REAL in Network Byte Order
medium
Sends a REAL to a device that reads 32-bit values highest byte first.
What it teaches
This controller stores a 32-bit value lowest byte first; many other controllers, HMIs and field devices read it highest byte first, as Modbus does. SWPB with REVERSE turns all four bytes round. SWPB takes an INT or a DINT, never a REAL, so COP the REAL into a DINT first: COP moves the 32 bits as they are, where MOVE would round the value to a whole number. Reverses REAL From Two Registers for the other direction.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| In_Value | Input | REAL | 24 | Value to send |
| Out_Word | Output | DINT | 0 | In_Value's 32 bits, bytes in the order the receiving device reads them |
Required behavior
- The receiving device, such as another controller, an HMI or a drive, reads 32-bit values highest byte first; this controller stores them lowest byte first.
- Every scan, Out_Word holds the 32 bits of In_Value with their four bytes in reverse order: a REAL whose bits are 16#41C00000 (24.0) is sent as 16#0000C041, which is 49217.
- The bits are moved, never the value: Out_Word is not In_Value rounded to a whole number.
- With the default In_Value of 24.0, Out_Word is 49217.