Function, Hint, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual
Page 129: Masking time values, 2 with the comparison time data in s
2-93
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Co
mp
ari
s
on I
n
stru
ctio
ns
2
=DT
, <>DT
,
, <=DT
, >DT
, >=DT
Function
The time comparison instruction compares the unmasked values (corresponding bit of C set to 0) of the
present time data in S
1
to S
1
+2 with the comparison time data in S
2
to S
2
+2 and creates an ON execu-
tion condition when the comparison condition is true. At the same time, the result of a time comparison
instruction is reflected in the arithmetic flags (=, <>, <, <=, >, >=).
The time comparison instructions are treated just like the LD, AND, and OR instructions to control the
execution of subsequent instructions.
There are 18 possible combinations of time comparison instructions.
Any time values that are masked in the control word (C) are not included in the comparison.
The following table shows the ON/OFF status of each flag for each comparison result.
Masking Time Values
Time values can be masked individually and excluded from the comparison operation. To mask a time
value, set the corresponding bit in the control word (C) to 1. Bits 00 to 05 of C mask the seconds, min-
utes, hours, day, month, and year, respectively.
Example:
When C = 39 hex, the rightmost 6 bits are 111001 (year=1, month=1, day=1, hours=0, minutes=0, and
seconds=1) so only the hours and minutes are compared. This mask setting can be used to perform a
particular operation at a given time (hour and minute) each day.
Hint
• Previous data comparison instructions compared data in 16-bit units. The time comparison instruc-
tions are limited to comparing 8-bit time values.
The following table shows the structure of the CPU Unit’s internal Calendar/Clock Area.
• The Calendar/Clock Area can be set with a Programming Device (including a Programming Con-
sole), DATE(735) instruction, or “CLOCK WRITE” FINS command (0702 hex).
Result
Flag status
=
<>
<
<=
>
>=
S
1
= S
2
ON
OFF
OFF
ON
OFF
ON
S
1
> S
2
OFF
ON
OFF
OFF
ON
ON
S
1
< S
2
OFF
ON
ON
ON
OFF
OFF
Addresses
Contents
A351.00 to A351.07
Second (00 to 59, BCD)
A351.08 to A351.15
Minute (00 to 59, BCD)
A352.00 to A352.07
Hour (00 to 23, BCD)
A352.08 to A352.15
Day of month (01 to 31, BCD)
A353.00 to A353.07
Month (01 to 12, BCD)
A353.08 to A353.15
Year (00 to 99, BCD)
S
1
S
2
(=, <>, <, <=, >, >=)
Comparison
Result
Conditions Flags
00
07
08
15
S
1
S
1
+1
S
1
+2
00
07
08
15
Present time data
Comparison time data
Compares only hours and
minutes data.
Year, month, day, and seconds
data is masked.
Second (00 to
59, BCD)
Minute (00 to
59, BCD)
Hour (00 to
23, BCD)
Day of month
(01 to 31, BCD)
Month (01 to
12, BCD)
Year (00 to
99, BCD)
Second (00 to
59, BCD)
Minute (00 to
59, BCD)
Hour (00 to
23, BCD)
Day of month
(01 to 31, BCD)
Month (01 to
12, BCD)
Year (00 to
99, BCD)
S
2
S
2
+1
S
2
+2