Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

CR6 Modbus Master Problem


kcopeland Jul 9, 2017 11:17 PM

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


JDavis Jul 10, 2017 05:20 PM

Did you remember to declare your variables as type Long?


kcopeland Jul 10, 2017 05:34 PM

So simple... Thanks Jacob.  Can you help me understand why the variable type affects the modbus master call?


JDavis Jul 10, 2017 06:53 PM

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.

Log in or register to post/reply in the forum.