Omron CPM1 - PROGRAMING MANUAL 02-2001 Programming Manual page 451

Hide thumbs Also See for CPM1 - PROGRAMING MANUAL 02-2001:
Table of Contents

Advertisement

Comparison Instructions
Example:
Saving CMP(20) Results
TR
0
00000
Address Instruction
00000
00001
00002
00003
00004
7-19-2 TABLE COMPARE – TCMP(85)
Limitations
Description
Flags
The following example shows how to save the comparison result immediately. If
the content of HR 09 is greater than that of DM 0000, 20000 is turned ON; if the
two contents are equal, 20001 is turned ON; if content of HR 09 is less than that
of DM 0000, 20002 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, 20000, 20001, and 20002 are changed only when CMP(20) is
executed.
25505
25506
25507
Operands
LD
00000
OUT
TR
CMP(20)
HR
DM
0000
AND
25505
OUT
20000
Ladder Symbols
TCMP(85)
CD
TB
R
DM 6144 to DM 6655 cannot be used for R.
When the execution condition is OFF, TCMP(85) is not executed. When the
execution condition is ON, TCMP(85) compares CD to the content of TB, TB+1,
TB+2, ..., and TB+15. If CD is equal to the content of any of these words, the
corresponding bit in R is set, e.g., if the CD equals the content of TB, bit 00 is
turned ON, if it equals that of TB+1, bit 01 is turned ON, etc. The rest of the bits in
R will be turned OFF.
ER:
The comparison table (i.e., TB through TB+15) exceeds the data area.
Indirectly addressed DM word is non-existent. (Content of *DM word is
not BCD, or the DM area boundary has been exceeded.)
CMP(20)
HR 09
DM 0000
Address Instruction
00005
LD
0
00006
AND
00007
OUT
09
00008
LD
00009
AND
00010
OUT
@TCMP(85)
CD
TB
R
Section
20000
Greater Than
20001
Equal
20002
Less Than
Operands
TR
0
25506
20001
TR
0
25507
20002
Operand Data Areas
CD: Compare data
IR, SR, DM, HR, TC, LR, #
TB: First comparison table word
IR, SR, DM, HR, TC, LR
R: Result word
IR, SR, DM, HR, TC, LR
7-19
433

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents