1. Comparison of Clock Time CKCMP

1. Comparison of Clock Time CKCMP

1.1. Instruction description

The instruction will read the current time from the hardware clock, compare it with the given time of the week, and store the comparison results of each situation in the designated bit register group.

Only comparing hours/minutes/seconds, the calendar section will be ignored.

Assuming to output to Y000, Y001, Y002, Y000=1 when the current time has not reached the specified time, Y001=1 when it has just reached the specified time, and Y002=1 when it exceeds the specified time.

Taking the current time of Tuesday, June 26, 2018 at 09:50:30 as an example, the specified time of 09:50:30 is exactly the same, the specified time of 08:00:00 exceeds the specified time, and the specified time of 11:00:00 does not arrive at the specified time.

1.1.1. There are the following precautions:

  1. If BCD format is selected in [PLC Settings]=>[Other]=>[Real time Clock Format], all date and time values must be encoded in BCD format (for example, 8211 represents 2013). Please refer to the table below.

  2. The time format used is a complete 8-character time format, and the address of the year must be included in the parameter. Even if the year, month, and day will not participate in the execution.

  3. Note: our HMI+PLC all in one could not use the function

T (Dn-Dn+7) Description Data
0 Year (2000-2099) Current Year
1 Month (1-12) Current month
2 Date (1-31) Current Date
3 Hour (0-23) Current Hour
4 Minutes (0-59) Current minute
5 seconds (0-59) current second
6 00 Reserved
7 What day of the week (0-6) The current day of the week, 0=Sunday

1.2. The valid operands of instruction

Input/Output Data Type operand Description
T 16 bit integer D Time
OUT ON/OFF Y/M/S, word positioning (D/V/Z) Result

1.3. Example

Command table

NETWORK 000

LD X000

CKCMP D0 Y0 // Using the time data stored in D3~D7 as the specified time, output the comparison results to Y000, Y001, Y002

CKCMP

图1 CKCMP