Hi All-
I'm using a CR6 to act as a master to a device. This device outputs 5 16-bit integers. If a request is made to an invalid register then the whole request fails. I am using Modbus Poll to validate that the device is working properly. It looks like the CR6 is requesting 10 values even though I'm only asking for 5 16-bit unsigned integers. Here is my modbus master parameter over TC/IP:
ModbusMaster (MBResult(),Socket,38400,10,4,Data(),401,5,2,50,3)
This outputs the following modbus hex statement:
T 00 0B 00 00 00 06 0A 04 01 90 00 0A
From the last "0A" parameter, it shows that it is still requesting 10 values instead of 5. The same request made using Modbus Poll shows a hex string of:
T 6A 00 00 00 06 0A 04 01 90 00 05
What am I missing here?
Thanks
Kyle
Did you remember to declare your variables as type Long?
So simple... Thanks Jacob. Can you help me understand why the variable type affects the modbus master call?
If your variable is of type float, it will always request two registers per value. Longs are handled differently depending on the ModbusOption parameter chosen.