Omron SYSMAC C200HS Operation Manual page 183

Programmable controllers
Hide thumbs Also See for SYSMAC C200HS:
Table of Contents

Advertisement

Data Comparison
Limitations
Description
Precautions
Flags
Example:
Saving CMPL(60) Results
TR
0
00000
25505
25506
25507
Address
00000
00001
00002
00003
Cp1 and Cp1+1 must be in the same data area, as must Cp2 and Cp2+1.
When the execution condition is OFF, CMPL(60) is not executed. When the exe-
cution condition is ON, CMPL(60) joins the 4-digit hexadecimal content of
Cp1+1 with that of Cp1, and that of Cp2+1 with that of Cp2 to create two 8-digit
hexadecimal numbers, Cp+1,Cp1 and Cp2+1,Cp2. The two 8-digit numbers are
then compared and the result is output to the GR, EQ, and LE flags in the SR
area.
Placing other instructions between CMPL(60) and the operation which ac-
cesses the EQ, LE, and GR flags may change the status of these flags. Be sure
to access them before the desired status is changed.
CMPL(60) cannot be used to compare signed binary data. Use CPSL(––)
instead. Refer to 5-17-9 DOUBLE SIGNED BINARY COMPARE – CPSL(––) for
details.
Indirectly addressed DM word is non-existent. (Content of ∗DM word is
ER:
not BCD, or the DM area boundary has been exceeded.)
GR:
ON if Cp1+1,Cp1 is greater than Cp2+1,Cp2.
EQ:
ON if Cp1+1,Cp1 equals Cp2+1,Cp2.
LE:
ON if Cp1+1,Cp1 is less than Cp2+1,Cp2.
The following example shows how to save the comparison result immediately. If
the content of HR 10, HR 09 is greater than that of 011, 010, then 00200 is turned
ON; if the two contents are equal, 00201 is turned ON; if content of HR 10, HR 09
is less than that of 011, 010, then 00202 is turned ON. In some applications, only
one of the three OUTs would be necessary, making the use of TR 0 unnecessary.
With this type of programming, 00200, 00201, and 00202 are changed only
when CMPL(60) is executed.
Instruction
Operands
LD
00000
OUT
TR
CMPL(60)
HR
AND
25505
CMPL(60)
HR 09
010
–––
00200
00201
00202
Address
Instruction
00004
OUT
0
00005
LD
00006
AND
09
00007
OUT
010
00008
LD
00009
AND
00010
OUT
Section 5-17
Greater Than
Equal
Less Than
Operands
00200
TR
0
25506
00201
TR
0
25507
00202
173

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents