← Bit Manipulation

Detect the Byte Order

hard

Works out which byte order a device uses from a value it is known to report.

What it teaches

There is no standard for how a 32-bit value is split across Modbus registers, so commissioning often means trying each order against a value you already know, such as a reference pressure. Try the value as it arrives, then SWPB with REVERSE, WORD and HIGH/LOW, and report the first that matches. Combines REAL From Two Registers and REAL in Network Byte Order.

Parameters

TagDirectionTypeDefaultDescription
In_RawInputDINT134219481332 bits as received from the device
In_ExpectedInputREAL1013.25The value the device is known to be reporting
Out_OrderOutputDINT00 as received, 1 REVERSE, 2 WORD, 3 HIGH/LOW, -1 none
Out_ValueOutputREAL0In_Raw read in the order found, or 0.0

Required behavior