Download Print this page

Omron NS Reference Manual page 55

Hide thumbs Also See for NS:

Advertisement

Section2 Functions
NS series Macro Reference
SWAP
Swaps high order and low order of the specified address
Applicable versions
Format
Function
Return Value
Example
System version 4 or higher
SWAP(S,n)
Swap high order (1 byte) and low order (1 byte) of the word data or the internal
holding word which was taken n word form S.
S: Top address ($W or $HW) to be swapped. (See note.)
n: The number of words to be taken from S.
Setting range is as follows:
When specifying "n" directly: 1 to 32767
When specifying "n" indirectly: $W0 to $W32767
Note: Index can be set when using address to specify for S. Setting range is for $W
is between 0 and 32767 and for $HW is between 0 to 8191.
None
SWAP($W100,3);
Swap high order and low order of the word data which was taken from 3 words from
$W100.
<Before performing SWAP>
Swap high order and low order
1
2
$W 100
5
6
$W 101
$W 102
9
0
.
.
.
$HW0 to $HW8191
3
4
7
8
1
2
35
<After performing SWAP>
3
4
$W 100
7
8
$W 101
$W 102
1
2
.
.
.
1
2
5
6
9
0

Advertisement

loading

This manual is also suitable for:

Ns-series