Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 293

Table of Contents

Advertisement

Function
The time comparison instruction compares the unmasked values (corresponding bit of C set to 0) of the
present time data in S
execution 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.
Result
S
= S
ON
1
2
S
> S
OFF
1
2
S
< S
OFF
1
2
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,
minutes, 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
instructions are limited to comparing 8-bit time values.
The following table shows the structure of the CPU Unit's internal Calendar/Clock Area.
Addresses
A351.00 to A351.07
A351.08 to A351.15
A352.00 to A352.07
A352.08 to A352.15
A353.00 to A353.07
A353.08 to A353.15
• The Calendar/Clock Area can be set with a Programming Device (including a Programming
Console), DATE(735) instruction, or "CLOCK WRITE" FINS command (0702 hex).
CS/CJ/NSJ Series Instructions Reference Manual (W474)
to S
+2 with the comparison time data in S
1
1
Flag status
=
<>
<
OFF
OFF
ON
OFF
ON
ON
Comparison
S
1
Present time data
15
08
07
00
Minute (00 to
Second (00 to
S
1
59, BCD)
59, BCD)
Day of month
Hour (00 to
S
+1
1
(01 to 31, BCD)
23, BCD)
Year (00 to
Month (01 to
S
+2
1
99, BCD)
12, BCD)
Compares only hours and
minutes data.
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)
<=
>
ON
OFF
ON
OFF
ON
ON
ON
OFF
OFF
S
2
Conditions Flags
Result
(=, <>, <, <=, >, >=)
Comparison time data
15
08
07
00
Minute (00 to
Second (00 to
S
2
59, BCD)
59, BCD)
Day of month
Hour (00 to
S
+1
2
(01 to 31, BCD)
23, BCD)
Year (00 to
Month (01 to
S
+2
2
99, BCD)
12, BCD)
Year, month, day, and seconds
data is masked.
Contents
3. Instructions
to S
+2 and creates an ON
2
2
>=
3
257

Advertisement

Table of Contents
loading

Table of Contents