Omron SYSMAC CP Series Instruction & Reference Manual page 129

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
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
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.
Result
S
= S
1
2
S
> S
1
2
S
< S
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, 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.
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 Con-
sole), DATE(735) instruction, or "CLOCK WRITE" FINS command (0702 hex).
CP1E CPU Unit Instructions Reference Manual(W483)
to S
+2 with the comparison time data in S
1
1
=
<>
ON
OFF
OFF
ON
OFF
ON
Comparison
S
1
Result
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)
to S
2
2
Flag status
<
<=
OFF
ON
OFF
OFF
ON
ON
S
2
Conditions Flags
(=, <>, <, <=, >, >=)
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
2 Instructions
+2 and creates an ON execu-
>
>=
OFF
ON
ON
ON
OFF
OFF
2-93
2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents