![]() |
![]() |
|
![]() |
||
Ladder Logic Swap Function |
Sponsored by: KronoTour Travel
![]() |
SWP - SwapSwaps the low and high bytes of a specified number of words in a bit, integer, ASCII, or string file. ExampleSwap (aBcDeF) = BaDcFe Ladder Logic Solution![]() Before /After Swap ExampleThe next 3 words of N7:140 Ladder Logic Solution![]() Before/After Swap · Note
ExampleLet'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 SolutionExecute 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 ![]()
Note
|
Sponsored by: KronoTour Travel
![]()
|