3. Instruction Set
3-377
API Mnemonic Operands Function
160
TCMP P Time compare
Controllers
ES2/EX2 SS2 SA2
SE SX2
Bit Devices Word devices Program Steps Type
OP X Y M S K H KnX KnYKnM KnS T C D E F
S1 * * * * * * * * ***
S2 * * * * * * * * ***
S3 * * * * * * * * ***
S * * *
D ** *
TCMP, TCMPP: 11 steps
PULSE 16-bit 32-bit
ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2 ES2/EX2 SS2 SA2
SE SX2
Operands:
S1: “Hour” for comparison (K0~K23) S2: “Minute” for comparison (K0~K59) S3: “Second” for
comparison (K0~K59) S: Current time of RTC (occupies 3 consecutive devices) D:
Comparison result (occupies 3 consecutive devices)
Explanations:
1. TCMP instruction compares the time set in S1, S2, S3 with RTC current value in S and stores
the comparison result in D.
2. S: “Hour” of current time of RTC. Content: K0~K23. S +1: “Minute” of current time of RTC.
Content: K0~K59. S +2: “Second” of current time of RTC. Content: K0~K59.
3. Usually the time of RTC in S is read by TRD instruction first then compared by TCMP
instruction. If operand S exceeds the available range, operation error occurs and M1067 = ON,
M1068 = ON. D1067 stores the error code 0E1A (HEX).
Program Example:
1. When X0 = ON, the instruction executes and the RTC current time in D20~D22 is compared
with the set value 12:20:45. Comparison result is indicated by M10~M12. When X0 goes from
ONOFF, the instruction is disabled however the ON/OFF status of M10~M12 remains.
2. Connect M10 ~ M12 in series or in parallel to obtain the results of , , and .
X0
M10
TCMP K12 K20 K45 D20 M10
M11
M12
ON when 12:20:45
ON when 12:20:45
ON when 12:20:45
>
=
<