Advanced Function Instruction
7-90
FUN106 D P
T-T_C
TABLE TO TABLE COMPARE
FUN106 D P
T-T_C
Ta : Starting register of Table a
Tb : Starting register of Table b
L : Lengths of Table
Pr : Pointer
Ta, Tb may combine with V, Z, P0~P9 to
serve indirect address application
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
2
∣
256
V、Z
P0~P9
Ta ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Tb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
L ○ ○* ○ ○
Pr ○ ○ ○ ○ ○ ○ ○ ○* ○* ○
z When comparison control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, then starting from the
first register in the tables Ta and Tb (when "FHD" = 1 or Pr value has reached L-1) or starting from the next
pair of registers (Tapr+1 and Tbpr+1) pointed by Pr ("FHD" = 0, while Pr is less than L-1), this instruction will
search for pairs of registers with different values (when "D/S" = 1) or the same value (when "D/S" = 0). When
search found (either different or the same), it will immediately stop the search and the pointer Pr will point to
the register pairs met the search criteria. The found flag "FND" will be set to 1. When it has searched to the last
register of the table, the instruction will stop executing. whether it found or not. The compare-to-end flag "END"
will be set to 1, and the pointer value will stop at L-1. When this instruction is executed next time, Pr will
automatically return to the head of the table to begin the search.
z The effective range of Pr is 0 to L-1. The Pr value should not changed by other programs during the operation.
As this will affect the result of the search. If the Pr value not in the effective range, the pointer error flag "ERR"
will be set to 1, and this instruction will not be carried out.
X0
EN
Ta :
106P.T-T_C
END
Tb :
R 11
L :
Pr :
FHD
D/S
ERR
10
R 10
FND
R 0
z The instruction at left starts from the register next to the register
pointed by the pointer (because "FHD" is 0) to search for register
pairs with different data (because "D/S" is 1) within the 2 tables.
At the very beginning, Pr points to Ta1 and Tb1. There are 3
different pairs of data at the position 1,3,6 of the table.
However, it does not compare from the beginning, and this
instruction will start searching from position 3 downwards. After
X0 has changed 3 times from 0 to 1, the results are shown in the
diagram below.
Pr
R10 1
Ta
Tb Pr
FE
R0 0000 R11 0000 R10 3 1 0
R1 1111 R12 0000
R2 2222
R13 2222 ←
R3 3333 R14 1234
cX0=
(First)
Pr
FE
R4 4444 R15 4444
Start
point
R10 6 1 0
R5 5555 R16 5555
R6 6666 R17 0000
R7 7777 R18 7777
dX0=
(Second)
Pr
FE
R8 8888 R19 8888 R10 9 0 1
R9 9999 R20 9999
eX0=
(Third)
Before execution
After execution