Swaps the low and high bytes of a specified number of words in a bit, integer, ASCII, or string file.
Example
Swap (aBcDeF) = BaDcFe
Ladder Logic Solution
Before /After Swap
Example
The next 3 words of N7:140
Ladder Logic Solution
Before/After Swap
·
Note
- Values of N7:140 are in Hexadecimal
Example
Let's say N7:145 contain ABCD (hexadecimal) and we want to separate high byte and the low byte of this word and put them into 2 separate word.
Ladder Logic Solution
Execute an AND instruction on the N7: 145 with FF (Hex) this will result in getting the low byte from N7: 145, and put it in N7: 146.
Now that we got the low byte, we have to swap the word N7:145.
Now we can do another AND instruction with FF (Hex) to get the low byte of the swapped word, and put it in words N7: 147
- N7:145 = ABCD (Hex)
- N7:146 = AB
- N7:147 = CD
Note
- The source can only be an indexed word address.
- Bit length (1-128)
- Integer length (1-128)
- String length (1-41) (one string only)
- ASCII length (1-128)