The text of a manual · part 25 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 214 to 223
Pages 214 to 223 of 613, from Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual
The original document is the PDF (3.8 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Omron C200H-SP001 and Omron C200HW-PA204
Page 214
Section 5-16
Data Movement Description
When the execution condition is OFF, XFRB(062) is not executed. When the execution condition is ON, XFRB(062) copies the specified source bits to the specified destination bits. The two rightmost digits of C specify the starting bits in S and D and the leftmost two digits indicate the number of bits that will be copied. C MSB
LSB First bit of S (0 to F) First bit of D (0 to F) Number of bits (01 to FF)
Note Up to 255 (FF) bits can be copied at one time. Example
In the following example, XFRB(062) is used to transfer 5 bits from IR 020 to LR 21 when IR 00001 is ON. The starting bit in IR 020 is 0, and the starting bit in LR 21 is 4, so IR 02000 to IR 02004 are copied to LR 2104 to LR 2108. 00001 XFRB(062) #0540 IR 020
Address
Instruction
00000 00001
LD XFRB(062)
Operands
#0540 020 LR 21
LR 21
Bit 00
Bit 15
S (IR 020)
0 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1
Bit 00
Bit 15
D (LR 21) Flags
ER:
00001
0 1 0 0 0 1 0 1 0 1 1 1 0 0 0 1
The specified source bits are not all in the same data area. The specified destination bits are not all in the same data area. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.
5-16-11 EM BLOCK TRANSFER – XFR2(––) Operand Data Areas N: Number of words (BCD)
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR, # XFR2(––)
@XFR2(––)
N
N
S
S
D
D
S: Starting source word
Limitations
202
IR, SR, AR, DM, EM, HR, TC, LR, # D: Starting destination word IR, SR, AR, DM, EM, HR, TC, LR, #
S and S+N must be in the same data area, as must D and D+N. N must be BCD. XFR2(––) is an expansion instruction. A Programming Device must be used to assign a function code to XFR2(––) in order to use this instruction.
Page 215
Section 5-16
Data Movement Description
When the execution condition is OFF, XFR2(––) is not executed. When the execution condition is ON, XFR2(––) copies the contents of S, S+1, ..., S+N to D, D+1, ..., D+N. If a constant is used for S or D, the constant specifies an address in the current EM bank.
Flags
ER:
N is not BCD. S and S+N or D and D+N are not in the same data area. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.
Example
The following example copies the contents of the 300 words from DM 0000 through DM 0299 to EM 2000 through EM 2299 in the current EM bank. 00000 XFR2(––) #0300
Address
Instruction
00200 00201
LD XFR2(––)
Operands 00000 #0300 DM 0000 #2000
DM 0000 #2000
5-16-12 BLOCK TRANSFER TO OTHER EM BANK – BXF2(––) Operand Data Areas C: First control word
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR BXF2(––)
@BXF2(––)
C
C
S
S
D
D
S: Starting source word
Limitations
IR, SR, AR, DM, EM, HR, TC, LR, # D: Starting destination word IR, SR, AR, DM, EM, HR, TC, LR, #
The value in C+1 must be BCD from 1 to 6144. S and S+N must be in the same data area, as must D and D+N. BXF2(––) is an expansion instruction. A Programming Device must be used to assign a function code to BXF2(––) in order to use this instruction.
Description
When the execution condition is OFF, BXF2(––) is not executed. When the execution condition is ON, BXF2(––) copies the contents of S, S+1, ..., S+N to D, D+1, ..., D+N. The bank can be specified (in C) if an EM area address is used for S or D. If a constant is used for S or D, the constant specifies an address in the source or destination EM bank specified in C.
Control Words
C contains the source and destination bank numbers if data is being transferred to or from EM. The bank numbers are ignored unless an EM area address or a constant is used for S or D. C+1 contains the number of words to transfer and must be BCD (1 to 6144). Control word Bits C 0 to 7 8 to 15 C+1 0 to 15
Function Specifies the source bank number (00 to 0F). Specifies the destination bank number (00 to 0F). Specifies the number of words to transfer (1 to 6144).
203
Page 216
Section 5-16
Data Movement Flags
ER:
N is not BCD. S and S+N or D and D+N are not in the same data area. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The bank indicated by C does not exists when an EM area address is being used.
Example
The following example copies the contents of the 300 words from DM 0000 through DM 0299 to EM 2000 through EM 2299 in the EM bank 01. (The source bank number is ignored because an EM area address has not been used for it.) 00000 BXF2(––) DM 1000
Address
Instruction
00200 00201
LD BXF2(––)
Operands 00000 DM 1000 DM 0000 #2000
DM 0000 #2000
C: DM 1000 0
1
0
C+1: DM 1001 0
0
Source bank number (00)
3
0
0
Number of words (300)
Destination bank number (01)
5-16-13 EM BANK TRANSFER – BXFR(125) Operand Data Areas C: First control word
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR BXFR(125)
@BXFR(125)
C
C
S
S
D
D
S: Starting source word IR, SR, AR, DM, EM, HR, TC, LR D: Starting destination word IR, SR, AR, DM, EM, HR, TC, LR
Limitations
The value in C+1 must be BCD from 1 to 6144. S and S+N must be in the same data area, as must D and D+N.
Description
When the execution condition is OFF, BXFR(125) is not executed. When the execution condition is ON, BXFR(125) copies the contents of S, S+1, ..., S+N to D, D+1, ..., D+N. The bank can be specified (in C) if an EM area address is used for S or D.
Control Words
C contains the source and destination bank numbers if data is being transferred to or from EM. The bank numbers are ignored unless an EM area address or a constant is used for S or D. C+1 contains the number of words to transfer and must be BCD (1 to 6144). Control word Bits C 0 to 7 8 to 15 C+1 0 to 15
204
Function Specifies the source bank number (00 to 0F). Specifies the destination bank number (00 to 0F). Specifies the number of words to transfer (1 to 6144).
Page 217
Section 5-17
Data Comparison Flags
ER:
N is not BCD. S and S+N or D and D+N are not in the same data area. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The bank indicated by C does not exists when an EM area address is being used.
Example
The following example copies the contents of the 300 words from DM 0000 through DM 0299 to EM 2000 through EM 2299 in the EM bank 01. (The source bank number is ignored because an EM area address has not been used for it.) 00000 BXFR(125) DM 1000
Address
Instruction
00200 00201
LD BXFR(125)
Operands 00000 DM 1000 DM 0000 EM 2000
DM 0000 EM2000
C: DM 1000 0
1
0
C+1: DM 1001 0
0
Source bank number (00)
3
0
0
Number of words (300)
Destination bank number (01)
5-17 Data Comparison 5-17-1 MULTI-WORD COMPARE – MCMP(019) Operand Data Areas TB1: First word of table 1
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR MCMP(019)
@MCMP(019)
TB1
TB1
TB2
TB2
R
R
TB2: First word of table 2 IR, SR, AR, DM, EM, HR, TC, LR R: Result word IR, AR, DM, EM, HR, TC, LR, SR
Limitations
TB1 and TB1+15 must be in the same data area, as must TB2 and TB2+15. MCMP(019) is an expansion instruction. A Programming Device can be used to reassign function code 019 to another expansion instruction.
Description
When the execution condition is OFF, MCMP(019) is not executed. When the execution condition is ON, MCMP(019) compares the content of TB1 to TB2, TB1+1 to TB2+1, TB1+2 to TB2+2, ..., and TB1+15 to TB2+15. If the first pair is equal, the first bit in R is turned OFF, etc., i.e., if the content of TB1 equals the content of TB2, bit 00 is turned OFF, if the content of TB1+1 equals the content of TB2+1, bit 01 is turned OFF, etc. The rest of the bits in R will be turned ON.
Flags
ER:
One of the tables (i.e., TB1 through TB1+15, or TB2 through TB2+15) exceeds the data area.
205
Page 218
Section 5-17
Data Comparison
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. Example
The following example shows the comparisons made and the results provided for MCMP(019). Here, the comparison is made during each cycle when 00000 is ON.
00000 MCMP(019) 100 DM 0200
Address
Instruction
00000 00001
LD MCMP(019)
Operands 00000 100 DM 0200 DM 0300
DM 0300
TB1: IR 100 IR 100 IR 101 IR 102 IR 103 IR 104 IR 105 IR 106 IR 107 IR 108 IR 109 IR 110 IR 111 IR 112 IR 113 IR 114 IR 115
TB2: DM 0200
0100 0200 0210 ABCD ABCD ABCD ABCD 0800 0900 1000 ABCD ABCD ABCD 1400 0210 1212
DM 0200 DM 0201 DM 0202 DM 0203 DM 0204 DM 0205 DM 0206 DM 0207 DM 0208 DM 0209 DM 0210 DM 0211 DM 0212 DM 0213 DM 0214 DM 0215
0100 0200 0210 0400 0500 0600 0210 0800 0900 1000 0210 1200 1300 1400 0210 1600
R: DM 0300 DM 030000 DM 030001 DM 030002 DM 030003 DM 030004 DM 030005 DM 030006 DM 030007 DM 030008 DM 030009 DM 030010 DM 030011 DM 030012 DM 030013 DM 030014 DM 030015
0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 1
5-17-2 COMPARE – CMP(020) Ladder Symbols
Operand Data Areas Cp1: First compare word
CMP(020) IR, SR, AR, DM, EM, HR, TC, LR, # Cp1 Cp2: Second compare word Cp2
IR, SR, AR, DM, EM, HR, TC, LR, #
Limitations
When comparing a value to the PV of a timer or counter, the value must be in BCD.
Description
When the execution condition is OFF, CMP(020) is not executed. When the execution condition is ON, CMP(020) 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(020) 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. CMP(020) cannot be used to compare signed binary data. Use CPS(114) instead. Refer to 5-17-8 SIGNED BINARY COMPARE – CPS(114) for details.
206
Page 219
Section 5-17
Data Comparison Flags
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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. Flag
Example 1: Saving CMP(020) Results
00000
Address
C1 < C2
C1 = C2
C1 > C2
GR
25505
OFF
OFF
ON
EQ
25506
OFF
ON
OFF
LE
25507
ON
OFF
OFF
The following example shows how to save the comparison result immediately. If the content of HR 09 is greater than that of 010, 00200 is turned ON; if the two contents are equal, 00201 is turned ON; if content of HR 09 is less than that of 010, 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 CMP(020) is executed.
TR 0 CMP(020) HR 09 010
25505 00200
Greater Than
00201
Equal
00202
Less Than
25506
25507
Address
Instruction
00000 00001 00002
LD OUT CMP(020)
00003 00004
Example 2: Obtaining Indications during Timer Operation
LD AND
Operands 00000 TR 0 010 HR 09 TR 0 25505
Address
Instruction
00005 00006 00007 00008 00009 00010 00011
OUT LD AND OUT LD AND OUT
Operands 00200 TR 0 25506 00201 TR 0 25507 00202
The following example uses TIM, CMP(020), and the LE flag (25507) to produce outputs at particular times in the timer’s countdown. The timer is started by turning ON 00000. When 00000 is OFF, TIM 010 is reset and the second two CMP(020)s are not executed (i.e., executed with OFF execution conditions). Output 00200 is produced after 100 seconds; output 00201, after 200 seconds; output 00202, after 300 seconds; and output 00204, after 500 seconds.
207
Page 220
Section 5-17
Data Comparison
The branching structure of this diagram is important in order to ensure that 00200, 00201, and 00202 are controlled properly as the timer counts down. Because all of the comparisons here use to the timer’s PV as reference, the other operand for each CMP(020) must be in 4-digit BCD. 00000 TIM 010 #5000
500.0 s
CMP(020) TIM 010 #4000 25507 00200
Output at 100 s.
00200 CMP(020) TIM 010 #3000 25507 00201
Output at 200 s.
00201 CMP(020) TIM 010 #2000 25507 00202
Output at 300 s.
00204
Output at 500 s.
TIM 010
Address
Instruction
00000 00001
LD TIM
00002
CMP(020)
00003 00004 00005 00006
AND OUT LD CMP(020)
Operands 00000 010 #5000 TIM 010 #4000 25507 00200 00200 TIM 010 #3000
208
Address
Instruction
00007 00008 00009 00010
AND OUT LD CMP(020)
00011 00012 00013 00014
AND OUT LD OUT
Operands 25507 00201 00201 TIM 010 #2000 25507 00202 TIM 010 00204
Page 221
Section 5-17
Data Comparison
5-17-3 DOUBLE COMPARE – CMPL(060) Ladder Symbols
Operand Data Areas Cp1: First word of first compare word pair
CMPL(060) IR, SR, AR, DM, EM, HR, TC, LR Cp1 Cp2: First word of second compare word pair Cp2
IR, SR, AR, DM, EM, HR, TC, LR
___
Limitations
Cp1 and Cp1+1 must be in the same data area, as must Cp2 and Cp2+1. CMPL(060) is an expansion instruction. A Programming Device can be used to reassign function code 060 to another expansion instruction.
Description
When the execution condition is OFF, CMPL(060) is not executed. When the execution condition is ON, CMPL(060) 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.
Precautions
Placing other instructions between CMPL(060) 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. CMPL(060) cannot be used to compare signed binary data. Use CPSL(115) instead. Refer to 5-17-9 DOUBLE SIGNED BINARY COMPARE – CPSL(115) for details.
Flags
ER:
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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.
209
Page 222
Section 5-17
Data Comparison
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(060) is executed.
Example: Saving CMPL(060) Results
00000
TR 0 CMPL(060) HR 09 010 ––– 25505 00200
Greater Than
00201
Equal
00202
Less Than
25506
25507
Address
Instruction
00000 00001 00002
LD OUT CMPL(060)
Operands
Address
00000 TR 0
00004 00005 00006 00007 00008 00009 00010
HR 09 010 00003
AND
25505
Instruction OUT LD AND OUT LD AND OUT
Operands 00200 TR 0 25506 00201 TR 0 25507 00202
5-17-4 BLOCK COMPARE – BCMP(068) Operand Data Areas CD: Compare data
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR, # BCMP(068)
@BCMP(068)
CD
CD
CB
CB
R
R
CB: First comparison block word
Limitations
IR, DM, EM, HR, TC, LR, SR, AR R: Result word IR, SR, AR, DM, EM, HR, TC, LR
Each lower limit word in the comparison block must be less than or equal to the upper limit. BCMP(068) is an expansion instruction. A Programming Device can be used to reassign function code 068 to another expansion instruction.
210
Page 223
Section 5-17
Data Comparison Description
When the execution condition is OFF, BCMP(068) is not executed. When the execution condition is ON, BCMP(068) compares CD to the ranges defined by a block consisting of of CB, CB+1, CB+2, ..., CB+31. Each range is defined by two words, the first one providing the lower limit and the second word providing the upper limit. If CD is found to be within any of these ranges (inclusive of the upper and lower limits), the corresponding bit in R is set. The comparisons that are made and the corresponding bit in R that is set for each true comparison are shown below. The rest of the bits in R will be turned OFF. CB ≤ CD ≤ CB+1 Bit 00 CB+2 ≤ CD ≤ CB+3 Bit 01 CB+4 ≤ CD ≤ CB+5 Bit 02 CB+6 ≤ CD ≤ CB+7 Bit 03 CB+8 ≤ CD ≤ CB+9 Bit 04 CB+10 ≤ CD ≤ CB+11 Bit 05 CB+12 ≤ CD ≤ CB+13 Bit 06 CB+14 ≤ CD ≤ CB+15 Bit 07 CB+16 ≤ CD ≤ CB+17 Bit 08 CB+18 ≤ CD ≤ CB+19 Bit 09 CB+20 ≤ CD ≤ CB+21 Bit 10 CB+22 ≤ CD ≤ CB+23 Bit 11 CB+24 ≤ CD ≤ CB+25 Bit 12 CB+26 ≤ CD ≤ CB+27 Bit 13 CB+28 ≤ CD ≤ CB+29 Bit 14 CB+30 ≤ CD ≤ CB+31 Bit 15 Normally the first word in the range is less than the second, but if the first word in the range is greater than the second, the corresponding bit in R will be turned OFF when CD is outside of the range defined by the two words, as shown in the following diagram.
ÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉÉÉÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉ ÉÉÉÉÉÉ CB
CB + 1
0000
9999
CB+1
0000
Flags
ER:
CB
9999
The comparison block (i.e., CB through CB+31) exceeds the data area. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.
211