Installation manual
Publication 1747-RM001G-EN-P - November 2008
4-28 Math Instructions
Swap (SWP)
Use this instruction to swap the low and high bytes of a specified number of 
words in a bit, integer, ASCII, or string file. Use this instruction with SLC 5/03 
(OS302), SLC 5/04 (OS401), and SLC 5/05 processors. 
Entering Parameters
Enter the following parameters when programming this instruction.
• Source can only be an indexed word address
• Length refers to the number of words to be swapped, regardless of the 
file type. The address is limited to integer constants. For bit, integer, and 
ASCII file types, the length range is 1 to 128. For the string file type, the 
length range is 1 to 41. Note that this instruction is restricted to a single 
string element and cannot cross a string element boundary.
The following example shows how the SWP instruction works.
Before:
ST10:1 = abcdefghijklmnopqrstuvwxyz
After
ST10:1 = badcfehgjilknmporqtsvuxwzy
SWP
Swap
Source #ST10:1.DATA[0]
Length 5
SWP
Output Instruction
Fixed SLC 
5/01
SLC 
5/02
SLC 
5/03
SLC 
5/04
SLC 
5/05
•••
SWAP
Source #ST10:1.1
Length 13
SWP










