Difference between revisions of "Protocol:Modbus:32-bit Types"

From Serious Documentation
Jump to: navigation, search
(Does SHIP Modbus Support include Read/Write Multiple?)
(Does SHIP Modbus Support include Read/Write Multiple?)
Line 29: Line 29:
 
However… if you are actually moving complex (larger) data types, we do use and require FC16.
 
However… if you are actually moving complex (larger) data types, we do use and require FC16.
 
   
 
   
linkvar   x1          type=”Integer” address=”0x0001”          -- moved with FC16 using  a 2 register read/write multiple
+
{| class="wikitable" style="margin: 1em 1em;"
linkvar  x2           type=”Float”      address=”0x0002”          -- moved with FC16 using  a 2 register read/write multiple
+
! scope="col" style="text-align:left" | linkvar name
+
! scope="col" style="text-align:left" | Datatype
 +
! scope="col" style="text-align:left" | Address
 +
! scope="col" style="text-align:left" | FC
 +
|-
 +
|<code>x1</code>|| {{DataType|Integer}}||<code>0x0001</code>||FC16 using  a 2 register read/write multiple
 +
|-
 +
|<code>x2</code>|| {{DataType|Float}}||<code>0x0002</code>||FC16 using  a 2 register read/write multiple
 +
|-
 +
|}
 +
 
 
Note that the addresses in SHIP are logical addresses.  There is no concept of a byte-wise array that these address map down into.  Therefore x1 and x2 above do not overlay in memory somehow like they might on a PLC which maps all addresses to bytewise memory, but rather x1 and x2 are completely independent entities each 32-bits in size.
 
Note that the addresses in SHIP are logical addresses.  There is no concept of a byte-wise array that these address map down into.  Therefore x1 and x2 above do not overlay in memory somehow like they might on a PLC which maps all addresses to bytewise memory, but rather x1 and x2 are completely independent entities each 32-bits in size.
 
   
 
   
 
The endianness of the 32-bit transaction as transported on the FC16 “2 register” transaction is fully controllable with all 8 options depending on your algorithms on your side of the communications.
 
The endianness of the 32-bit transaction as transported on the FC16 “2 register” transaction is fully controllable with all 8 options depending on your algorithms on your side of the communications.

Revision as of 13:01, 27 February 2015

See Also

Does SHIP Modbus Support include Read/Write Multiple?

This is a common question, and the answer to that question is “it depends”.

We support only the movement of one “logical variable” at a time. Each variable is moved with a single function (i.e. packet). If the variable is a short or Boolean type, this is FC06/FC05 respectively. If the variable is a longer type, i.e. 32-bits like an Integer or Float, we use FC16 to move the pieces of the variable as a single transaction.

So, if you have (for example) 4 independent link variables:

linkvar name Datatype Address
v1 Short 0x0001
v2 Short 0x0002
v3 Short 0x0003
v4 Short 0x0004

You cannot use FC16 to set them all in a single packet; you have to call the FC06 4 times.

However… if you are actually moving complex (larger) data types, we do use and require FC16.

linkvar name Datatype Address FC
x1 Integer 0x0001 FC16 using a 2 register read/write multiple
x2 Float 0x0002 FC16 using a 2 register read/write multiple

Note that the addresses in SHIP are logical addresses. There is no concept of a byte-wise array that these address map down into. Therefore x1 and x2 above do not overlay in memory somehow like they might on a PLC which maps all addresses to bytewise memory, but rather x1 and x2 are completely independent entities each 32-bits in size.

The endianness of the 32-bit transaction as transported on the FC16 “2 register” transaction is fully controllable with all 8 options depending on your algorithms on your side of the communications.