AH500 Programming Manual 
6-31 
API 
Instruction code
Operand  Function 
0064 
 
CMPT※ 
P 
S
1
, S
2
, n, D 
Comparing the tables 
Device
X
Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#  “$”  DF 
1
2
Pulse instruction
16-bit instruction (9 steps)
32-bit instruction
AH500  AH500 
- 
Symbol: 
S
1
 
:
Source device 1  Word 
S
2
 
:
Source device 2  Word 
n 
:
Data length  Word 
D 
:
Comparison result  Bit 
Explanation: 
1.  The instruction is used to compare n pieces of data in devices starting from S
1
 with those in 
devices starting from S
2
. The values compared are signed decimal numbers, and the 
comparison results are stored in D. 
2.  The operand n should be within the range between 1 and 256. 
3.  The value which is written into the operand D is a one-bit value.   
4.  When the results gotten from the comparison by using the instruction CMPT# are that all 
devices are ON, SM620 is ON. Otherwise, SM620 is OFF. 
5.  If the operand S
1
 is a device, the comparison will be as shown below. 
S1
+1
+2
Comparison sign
+3
+(N-2)
S1
S1
S1
S1
+(N-1)
S1
~
n
S2
+1
+2
+3
+(N-2)
S2
S2
S2
S2
+(N-1)
S2
~
n
1234(BIN)
5678(BIN)
5000(
BIN)
1000(BIN)
10(BIN)
90(BIN)
1111(BIN)
2222(BIN)
3333(BIN)
4444(BIN)
8888(BIN)
9999(BIN)
D
+1
+2
+3
+(N-2)
D
D
D
D
+(N-1)
D
~
1
1
1
0
0
0
>
Comparison result
 
6.  If the operand S
1
 is a constant within the range between -32768 and 32767, the comparison 
will be as shown below. 
Compariosn sign
S2
+1
+2
+3
+(N-2)
S2
S2
S2
S2
+(N-1)
S2
~
n
3333(BIN)
1111
(BIN)
2222(BIN)
3333(BIN)
4444(BIN)
8888(BIN)
9999(BIN)
D
+1
+2
+3
+(N-2)
D
D
D
D
+(N-1)
D
~
0
0
1
0
0
0
=
Comparison result
S1
 
7.  The corresponding comparison operation results of the instructions are listed below.