281
Comparison Instructions
Section 5-19
Description
When the execution condition is OFF, CMP(20) is not executed. When the
execution condition is ON, CMP(20) compares Cp1 and Cp2 and outputs the
result to the GR, EQ, and LE flags in the SR area.
Precautions
Placing other instructions between CMP(20) and the operation which
accesses the EQ, LE, and GR flags may change the status of these flags. Be
sure to access them before the desired status is changed.
Flags
ER:
Indirectly addressed EM/DM word is non-existent.
(Content of
*
EM/
*
DM word is not BCD, or the EM/DM area boundary
has been exceeded.)
EQ:
ON if Cp1 equals Cp2.
LE:
ON if Cp1 is less than Cp2.
GR:
ON if Cp1 is greater than Cp2.
Example:
Saving CMP(20) Results
The following example shows how to save the comparison result immediately.
If the content of HR 09 is greater than that of 010, 10200 is turned ON; if the
two contents are equal, 10201 is turned ON; if content of HR 09 is less than
that of 010, 10202 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, 10200, 10201, and 10202 are changed only when
CMP(20) is executed.
Flag
Address
C1 < C2
C1 = C2
C1 > C2
GR
25505
OFF
OFF
ON
EQ
25506
OFF
ON
OFF
LE
25507
ON
OFF
OFF
CMP(20)
010
HR 09
00000
25505
10200
25507
10202
TR
0
25506
10201
Greater Than
Equal
Less Than
Address
Instruction
Operands
Address Instruction
Operands
00000
LD
00000
00001
OUT
TR
0
00002
CMP(20)
HR
09
010
00003
AND
25505
00004
OUT
10200
00005
LD
TR
0
00006
AND
25506
00007
OUT
10201
00008
LD
TR
0
00009
AND
25507
00010
OUT
10202
Содержание SYSMAC CQM1H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 9: ......
Страница 11: ......
Страница 15: ...xvi...
Страница 87: ...62 Calculating with Signed Binary Data Section 1 7...
Страница 169: ...144 Serial Communications Board Section 2 6...
Страница 537: ......
Страница 565: ......
Страница 569: ......
Страница 573: ......
Страница 577: ......