DL205 User Manual, 4th Edition, Rev. B
5–174
Chapter 5: Standard RLL Instructions - Table
1
2
3
4
5
6
7
8
9
10
11
12
13
14
A
B
C
D
Swap (SWAP)
The Swap instruction exchanges the data in two tables of equal
length.
The following description applies to both the Set Bit and Reset Bit table instructions.
Step 1: Load the length of the tables (number of V-memory locations) into the first level of the
accumulator stack. This parameter must be a HEX value, 0 to FF. Remember that the tables
must be of equal length.
Step 2: Load the starting V-memory location for the first table into the accumulator. This parameter
must be a HEX value. You can use the LDA instruction to convert an octal address to hex.
Step 3: Insert the Swap instruction. This specifies the starting address of the second table.
Helpful hint: — The data swap occurs within a single scan. If the instruction executes on
multiple consecutive scans, it will be difficult to know the actual contents of either table at
any particular time. So, remember to swap just on a single scan.
The example to the right shows a table of two words at
V3000. We will swap its contents with another table of
two words at V3100 by using the Swap instruction.
The example program below uses a PD contact (triggers for one scan for off-to-on transition).
First, we load the length of the tables (two words) into the accumulator. Then we load the
address of the first table (V3000) into the accumulator using the LDA instruction, converting
the octal address to hex. Note that it does not matter which table we declare “first”, because
the swap results will be the same.
DirectSOFT
LD
K2
X0
Load the constant value 2
(Hex.) into the lower 16 bits
of the accumulator.
LDA
O 3000
SWAP
V 3100
Swap the contents of the
table in the previous
instruction with the one at
V3100.
Convert octal 3000 to HEX
and load the value into the
accumulator. This is the
table beginning.
Handheld Programmer Keystrokes
STR
$
SHFT
ANDST
L
3
D
SHFT
RST
S
ANDN
W
0
A
PREV
CV
P
ENT
2
C
0
A
0
A
ENT
SHFT
ANDST
L
3
D
3
D
0
A
0
A
ENT
SHFT
CV
P
SHFT
3
D
0
A
0
A
3
D
1
B
0
A
ENT
1 2 3 4
5 6 7 8
A B C D
0 0 00
V 3000 V 31 0
0
S W A
P
Operand Data Type DL260 Range
aaa
V-memory V All (See page 3 - 56)
DS Used
HPP Used