Hi all,
As part of a project, I am trying to use a CR6 datalogger to read data from a Modbus RTU device (Kamstrup Multical 603 with a HC-003-67 Modbus RTU module).
Specs:
- Modbus slave address = 93
- Communication speed = 19200baud
- Parity/stop = Even parity/ One stop bit
- Default datagram (register addressing on the RTU)
Goal:
For now I am trying to read registers 1-82 (inclusive), which are made up of 32bit IEEE Float values (i.e. 2 registers make up one value - 1&2, 3&4... 81&82). The hex addresses for these are in the range 0000 to 0051. Alternatively I can use other registers from the datagram which are defined in UINT 16bit.
Connections:
I'm using a 2-wire shielded 24-awg cable and this is connected to the Data A- / B+ / GND ports on the Modbus RTU module (see link). On the CR6 I am using the COM1/2 pair as well as the corresponding GND.
Code:
Below are the relevant parts of the cr6 program I've been trying:
'Modbus communication with Kamstrup Multical603 with HC-003-67 RTU Public Modbus_data(81) 'Data from the default registers in the Logger Public Modbus_Result Public Modbus_Bool
The code below is executed in the main scan loop:
'Read information over Modbus from the Kamstrup Multical 603 reader SerialOpen (ComC1,19200,18,200,0,4) 'Set bit parity and baud rate to correct values () ModbusMaster (Modbus_Result, ComC1, 19200, 93, 3, Modbus_data(),1,40,3,200) SerialClose (ComC1)
Problem:
Unfortunately, there is no data read into the Modbus_data array (all remain zeros) and the Modbus_Result variable is incremented by 1 at each scan interval indicating a communication timeout.
Does anyone have an idea how to proceed from here?
Links with info:
Multical 603 energy meter here
Additional Modbus RTU module HC-003-67 and datagram here