Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 311
Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT) Chapter 7
Swap Byte (SWPB)
The SWPB instruction rearranges the bytes of a value.
Operands:
Relay Ladder
Operand Type Format Enter
Source INT
DINT
REAL
Tag Tag that contains the bytes that you want to rearrange
Order Mode If the source is
an
And you want to change the bytes to this
pattern (each letter represents a
different byte)
Then select
INT N/A Any of the options
DINT
REAL
ABCD ? DCBA REVERSE (or enter 0)
ABCD ? CDAB WORD (or enter 1)
ABCD ? BADC HIGH/LOW (or enter 2)
Destination INT
DINT
REAL
Tag Tag to store the bytes in the new order
If the source is
an
Then the destination must be an
INT INT
DINT
DINT DINT
REAL REAL