AH500 Programming Manual 
6-372 
API    Instruction code  Operand 
Function 
1605    TCMP  P 
S
1
, S
2
, S
3
, S, D 
Comparing the time 
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#  “$”  DF 
Pulse instruction
16-bit instruction (11 steps)
32-bit instruction
AH500  AH500  - 
Symbol: 
S
1
:
Hour of the setting time  Word 
S
2
:
Minute of the setting time  Word 
S
3
:
Second of the setting time  Word 
S 
:
Current time  Word 
D 
:
Comparison result  Bit 
Explanation: 
1.  The value of the hour, the value of the minute, and the value of the second specified by S
1
~S
3
 
are compared with the value of the hour, the value of the minute, and the value of the second 
in the devices starting from the device specified by S, and the comparison result is stored in D. 
2.  The hour of the current time is in the device specified by S, and the value of the hour should be 
within the range between 0 and 23. The minute of the current time is in the device specified by 
S+1, and the value of the minute should be within the range between 0 and 59. The second of 
the current time is in the device specified by S+2, and the value of the second should be within 
the range between 0 and 59. 
3.  The operand D occupies three consecutive devices. The comparison result is stored in D, D+1, 
and D+2. 
4.  Users generally use the instruction TRD to read the current time from the real-time clock first, 
and then they use the instruction TCMP to compare the time. 
5.  If the setting time in S
1
~S
3
 is larger than the current time in S, D is ON, D+1 is OFF, and D+2 is 
OFF. 
6.  If the setting time in S
1
~S
3
 is equal to the current time in S, D is OFF, D+1 is ON, and D+2 is 
OFF. 
7.  If the setting time in S
1
~S
3
 is less than the current time in S, D is OFF, D+1 is OFF, and D+2 is 
ON. 
Example: 
1.  When X0.0 is ON, the instruction is executed. The setting time 12 hour 20 minute 45 second is 
compared with the current time in D20~D22, and the comparison result is stored in M10~M12. 
When X0.0 is switched from ON to OFF, the instruction is not executed. Besides, the state of 
M10, the state of M11, and the state of M12 remain the same as those before X0.0’s being ON. 
2.  If users want to get the comparison result ≧, ≦, or ≠, they can connect M10~M12 is series or in 
parallel.