Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

The Modbus/TCP library can support structures. Any Endpoint object may be created as an array of floats equal in size to the number of elements in the structure. The Modbus/TCP library must do this as the storage of booleans (coils and discrete inputs) are in different address spaces than registers (input registers and holding registers), and there is no support in Modbus/TCP to combine the writing or reading of coils and registers via a single request. The Design Pad broadcast operator creates a Modbus/TCP endpoint which represents an array of floating point values. Boolean structure members will be 'upcast' to a floating point value when broadcast, and 'downcast' from float to boolean when received. Float structure member types are unaltered.  You should, as a rule, only transfer structures between Fairmount Automation devices.  For third party devices, individual Modbus/TCP boradcast and receive operators should be used.

.  For example, let say you compose a structure of:

BOOL1

BOOL2

BOOL3

FLOAT1

BOOL4

FLOAT2

 There is no standard that specifies how to deal with floating point or its word ordering, none for characters and none for packed Booleans.  This is controller specific whether it is supported and how.

When a structure is used, all members are floats, and each consumes 2 registers.  Based on the type of the structure, member data is upcast or downcast as it is removed from or placed into the structure.

The example above will consume 12 registers.

Floats are sent most significant word first (lowest register number), and, within a word, most significant byte first.  this is effectively a big-endian transmission.

The order for the example will be (because it is within a structure):

BOOL1: cast to a float using Register 1 and Register 2.  It will cast to a 1.0 or 0.0 value.

BOOL2: cast to a float using Register 3 and Register 4.  It will cast to a 1.0 or 0.0 value.

BOOL3: cast to a float using Register 5 and Register 6  It will cast to a 1.0 or 0.0 value.

FLOAT1: passed as a float using Register 7 and Register 8.

BOOL4: cast to a float using Register 9 and Register 10  It will cast to a 1.0 or 0.0 value.

FLOAT2: cast to a float using Register 11 and Register 12.

Because each BOOL is converted to 32 bit floats, Fairmount Automation recommends packing up to 23 BOOLs into one structure float, using up to three binary to decimal converters.

The Modbus/TCP library enforces as set of rules on clients to prevent corruption. A float value consists of two sequential 16 bit Modbus registers. The library will not permit any access that attempt to obtain or modify a single register within the pair of registers a float represents. The lack of a locking mechanism within Modbus/TCP precludes protection of an entire structure. For example, consider a structure containing three elements A, B and C. Unless A,B and C are accessed in a single Modbus/TCP request by a peer, no assurance can be made that B is isochronous to A and C. However, reading and writing individual floating point members, including those as elements of a structure are assured to be isochronous because they are always performed within the scope of a single Modbus/TCP request that effectively provides a lock around the two Modbus/TCP registers that are used to represent a floating point value.

The structure is not precluded from containing sub-structures. The only requirement is that the peers agree as to the total number of elements in the structure.

  • No labels