Protocol:Modbus:32-bit Types

From Serious Documentation
Jump to: navigation, search

Starting with SHIP v5.0.130, the Modbus subsystem supports 32-bit data types including Integer and Float.

Since transporting these longer-than-16-bit data types is non-standard, many systems have many different byte ordering associated with these transfers. SHIP also supports, on a per slave (linkset) basis, any of the 8 byte ordering options.

A common question we get is "Does SHIP Modbus Support include Read/Write Multiple?". The answer to that question is “it depends”. See the explanation below.

See Also

Transporting 32-bit Data Types on Modbus

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, this is FC06/FC05 respectively. If the variable is a longer type, i.e. 32-bits like an Integer or Float, we use FC04/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 FC04/FC16.

linkvar name Datatype Address FC
x1 Integer 0x0001 FC04/FC16 using a 2 register read/write multiple
x2 Float 0x0002 FC04/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.