Chapter 6 Applied Instructions Symbol S 1 : Hour for the setting time S 2 : Minute for the setting time 6_ S 3 : Second for the setting time S : Current time D : Comparison result Explanation 1. This instruction compares the value of the hour, the minute, and the second specified by S 1 – S 3 with the value of the hour, the minute, and the second in the devices starting from the device specified by S , and stores the comparison result in D . 2. The hour of the current time is in the device specified by S , and the value of the hour between 0 – 23. The minute of the current time is in the device specified by S +1, and the value of the minute must be between 0 – 59.
The second of the current time is in the device specified by S +2, and the value of the second must be between 0 – 59. 3. The operand D occupies three consecutive devices. The comparison result is stored in D , D +1, and D +2. 4. In general, use the TRD instruction (API 1600) to read the current time from the real-time clock first, and then use the TCMP instruction 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-487 API Instruction code Operand Function 1605 TCMP P S1, S2, S3, S, D Comparing the time Device X Y M S T C HC D FR SM SR E K 16# “$” F S1 S2 S3 S D BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1 S2 S3 S D Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 -