312 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 7 Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT)
Structured Text
The operands are the same as those for the relay ladder SWPB instruction. If you select
the HIGH/LOW order mode, enter it as HIGHLOW or HIGH_LOW (without the
slash).
Description: The SWPB instruction rearranges the order of the bytes of the Source. It places the result
in the Destination.
When you read or write ASCII characters, you typically do not need to swap characters.
The ASCII read and write instructions (ARD, ARL, AWA, AWT) automatically swap
characters, as shown below.
Arithmetic Status Flags: Not affected
Fault Conditions: None
Execution:
SWPB(Source,OrderMode,Dest);
42969
42968
B A
Tag Name Value Style Type
bar_code[0] AB ASCII INT
A B
bar code reader
Condition Relay Ladder Action Structured Text Action
Prescan The rung-condition-out is set to false. No action taken
Rung-condition-in is false The rung-condition-out is set to false. N/A
Rung-condition-in is true The rung-condition-out is set to true. N/A
EnableIn is set N/A EnableIn is always set.
The instruction executes.
Instruction execution The instruction rearranges the specified bytes. The instruction rearranges the specified bytes.
Postscan The rung-condition-out is set to false. No action taken.