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