Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 24 of 68

Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 204 to 213

Pages 204 to 213 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 204

Section 5-16

Data Movement word value of #6000 (bits 13 and 14 ON). The data changes that would occur for the given register and control word contents are also shown. 00000 ASFT(017) #6000 DM 0100

Address

Instruction

00100 00101

LD ASFT(017)

Operands 00000 #6000 DM 0100 DM 0110

DM 0110

Before execution

After 1 execution

After 7 executions

1234 0000 0000 2345 3456 0000 4567 5678 6789 0000 789A

1234 0000 2345 0000 3456 4567 0000 5678 6789 789A 0000

1234 2345 3456 4567 5678 6789 789A 0000 0000 0000 0000

DM 0100 DM 0101 DM 0102 DM 0103 DM 0104 DM 0105 DM 0106 DM 0107 DM 0108 DM 0109 DM 0110

5-16 Data Movement This section describes the instructions used for moving data between different addresses in data areas. These movements can be programmed to be within the same data area or between different data areas. Data movement is essential for utilizing all of the data areas of the PC. Effective communications in Link Systems also requires data movement. All of these instructions change only the content of the words to which data is being moved, i.e., the content of source words is the same before and after execution of any of the data movement instructions.

5-16-1 MOVE – MOV(021) Ladder Symbols

Operand Data Areas S: Source word

MOV(021)

@MOV(021)

S

S

D

D

IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word

Description

IR, SR, AR, DM, EM, HR, LR

When the execution condition is OFF, MOV(021) is not executed. When the execution condition is ON, MOV(021) copies the content of S to D. Source word

Destination word Bit status not changed.

Precautions

192

TC numbers cannot be designated as D to change the PV of the timer or counter. You can, however, easily change the PV of a timer or a counter by using BSET(071).

Page 205

Section 5-16

Data Movement 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 when all zeros are transferred to D.

N:

ON when bit 15 of D is set to 1.

5-16-2 MOVE NOT – MVN(022) Ladder Symbols

Operand Data Areas S: Source word

MVN(022)

@MVN(022)

S

S

D

D

IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word

Description

IR, SR, AR, DM, EM, HR, LR

When the execution condition is OFF, MVN(022) is not executed. When the execution condition is ON, MVN(022) transfers the inverted content of S (specified word or four-digit hexadecimal constant) to D, i.e., for each ON bit in S, the corresponding bit in D is turned OFF, and for each OFF bit in S, the corresponding bit in D is turned ON. Source word

Destination word Bit status inverted.

Precautions

TC numbers cannot be designated as D to change the PV of the timer or counter. However, these can be easily changed using BSET(071).

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 when all zeros are transferred to D.

N:

ON when bit 15 of D is set to 1.

5-16-3 BLOCK SET – BSET(071) Operand Data Areas S: Source data

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # BSET(071)

@BSET(071)

S

S

St

St

E

E

St: Starting word

Limitations

IR, SR, AR, DM, EM, HR, TC, LR E: End Word IR, SR, AR, DM, EM, HR, TC, LR

St must be less than or equal to E, and St and E must be in the same data area.

193

Page 206

Section 5-16

Data Movement Description

When the execution condition is OFF, BSET(071) is not executed. When the execution condition is ON, BSET(071) copies the content of S to all words from St through E.

S

St

3 4 5 2

3 4 5 2 St+1 3 4 5 2 St+2 3 4 5 2

E 3 4 5 2

BSET(071) can be used to change timer/counter PV. (This cannot be done with MOV(021) or MVN(022).) BSET(071) can also be used to clear sections of a data area, i.e., the DM area, to prepare for executing other instructions.

Flags

ER:

St and E are not in the same data area or St is greater than E. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.

Example

00003

The following example shows how to use BSET(071) to change the PV of a timer depending on the status of IR 00003 and IR 00004. When IR 00003 is ON, TIM 010 will operate as a 50-second timer; when IR 00004 is ON, TIM 010 will operate as a 30-second timer.

00004 @BSET(071) #0500 TIM 010

Address

Instruction

00000 00001 00002

LD AND NOT @BSET(071)

TIM 010 00004

00003 @BSET(071) #0300 TIM 010 TIM 010

00003 00004 00005

LD AND NOT @BSET(071)

00003 TIM 010 00004

194

#9999

00006 00007 00008

LD OR TIM

Operands 00003 00004 #0500 TIM 010 TIM 010 00004 00003 #0300 TIM 010 TIM 010 00003 00004 010 #9999

Page 207

Section 5-16

Data Movement

5-16-4 BLOCK TRANSFER – XFER(070) Operand Data Areas N: Number of words (BCD)

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # XFER(070)

@XFER(070)

N

N

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

Both S and D may be in the same data area, but their respective block areas must not overlap. S and S+N must be in the same data area, as must D and D+N. N must be BCD between 0000 and 6144.

Description

When the execution condition is OFF, XFER(070) is not executed. When the execution condition is ON, XFER(070) copies the contents of S, S+1, ..., S+N to D, D+1, ..., D+N.

Flags

ER:

S

D

3 4 5 2

3 4 5 2

S+1

D+1

3 4 5 1

3 4 5 1

S+2

D+2

3 4 2 2

3 4 2 2

S+N

D+N

6 4 5 2

6 4 5 2

N is not BCD between 0000 and 2000. 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.

5-16-5 DATA EXCHANGE – XCHG(073) Ladder Symbols

Operand Data Areas E1: Exchange word 1

XCHG(073)

@XCHG(073)

E1

E1

E2

E2

IR, SR, AR, DM, EM, HR, TC, LR E2: Exchange word 2

Description

IR, SR, AR, DM, EM, HR, TC, LR

When the execution condition is OFF, XCHG(073) is not executed. When the execution condition is ON, XCHG(073) exchanges the content of E1 and E2. E1

E2

195

Page 208

Section 5-16

Data Movement

If you want to exchange content of blocks whose size is greater than 1 word, use work words as an intermediate buffer to hold one of the blocks using XFER(070) three times. 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.

5-16-6 SINGLE WORD DISTRIBUTE – DIST(080) Operand Data Areas S: Source data

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # DIST(080)

@DIST(080)

S

S

DBs

DBs

C

C

DBs: Destination base word IR, SR, AR, DM, EM, HR, TC, LR C: Control word (BCD) IR, SR, AR, DM, EM, HR, TC, LR, #

Limitations

C must be a BCD. If C≤6655, DBs must be in the same data area as DBs+C. If C≥9000, DBs must be in the same data area as DBs+C–9000.

Description

Depending on the value of C, DIST(080) will operate as a data distribution instruction or stack instruction. If C is between 0000 and 6655, DIST(080) will operate as a data distribution instruction and copy the content of S to DBs+C. If the leftmost digit of C is 9, DIST(080) will operate as a stack instruction and create a stack with the number of words specified in the rightmost 3 digits of C.

Precautions

Stack operation will be unreliable if the specified stack length is different from the length specified in the last execution of DIST(080) or COLL(081).

Data Distribution Operation (C=0000 to 6655)

When the execution condition is OFF, DIST(080) is not executed. When the execution condition is ON, DIST(080) copies the content of S to DBs+C, i.e.,C is added to DBs to determine the destination word.

Stack Operation (C=9000 to 9999)

S

DBs + C

3 4 5 2

3 4 5 2

When the execution condition is OFF, DIST(080) is not executed. When the execution condition is ON, DIST(080) operates a stack from DBs to DBs+C–9000. DBs is the stack pointer, so S is copied to the word indicated by DBs and DBs is incremented by 1. The Negative Flag also changes. Digits of C:

3 2 1 0

Specifies the stack length (000 to 999). A value of 9 indicates stack operation.

Data can be added to the stack until it is full. DIST(080) is normally used together with COLL(081), which can be set to read from the stack on a FIFO or LIFO basis. Refer to 5-16-7 DATA COLLECT – COLL(081) for details. Example of Stack Operation

196

In the following example, the content of C (LR 10) is 9010, and DIST(080) is used to write the numerical data #00FF to the 10-word stack from HR 20 to HR 29. During the first cycle when IR 00001 is ON, the data is written to DBs+1 (HR 21)

Page 209

Section 5-16

Data Movement and the stack pointer is incremented by 1. In the second cycle the data is written to DBs+2 (HR 22) and the stack pointer is incremented, and so on. 00001 DIST(080) # 00FF HR 20

Address

Instruction

00000 00001

LD DIST(080)

Operands 00001 #00FF HR 20 LR 10

LR 10

Stack pointer

After one execution

After two executions

HR 20

HR 20

0 0 0 1

0 0 0 2

HR 21 0 0 F F HR 22

Stack pointer incremented

HR 21 0 0 F F HR 22 0 0 F F

Stack area

HR 29

Flags

ER:

HR 29

The content of C is not BCD or 6655<C<9000. When C≤6655, DBs and DBs+C are not in the same data area. When C≥9000, DBs and DBs+C–9000 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.

EQ:

ON when the content of S is zero; otherwise OFF.

5-16-7 DATA COLLECT – COLL(081) Operand Data Areas SBs: Source base word

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR COLL(081)

@COLL(081)

SBs

SBs

C

C

D

D

C: Offset data (BCD) IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, EM, HR, TC, LR

Limitations

C must be a BCD. If C≤6655, SBs must be in the same data area as SBs+C. If the leftmost digit of C is 8 or 9, DBs must be in the same data area as SBs+N (N=the 3 rightmost digits of C).

Description

Depending on the value of C, COLL(081) will operate as a data collection instruction, FIFO stack instruction, or LIFO stack instruction. If C is between 0000 and 6655, COLL(081) will operate as a data collection instruction and copy the content of SBs+C to D. If the leftmost digit of C is 9 , COLL(081) will operate as a FIFO stack instruction. If the leftmost digit of C is 8, COLL(081) will operate as a LIFO stack instruction.

197

Page 210

Section 5-16

Data Movement

Both stack operations use a stack beginning at SBs with a length specified in the rightmost 3 digits of C. Precautions

Stack operation will be unreliable if the specified stack length is different from the length specified in the last execution of DIST(080) or COLL(081).

Data Collection Operation (C=0000 to 6655)

When the execution condition is OFF, COLL(081) is not executed. When the execution condition is ON, COLL(081) copies the content of SBs + C to D, i.e., C is added to SBs to determine the source word.

FIFO Stack Operation (C=9000 to 9999)

SBs + C

D

3 4 5 2

3 4 5 2

When the execution condition is OFF, COLL(081) is not executed. When the execution condition is ON, COLL(081) copies the data from the oldest word recorded in the stack to D. The stack pointer, SBs, is then decremented by 1. Digits of C:

3 2 1 0

Specifies the stack length (000 to 999). A value of 9 indicates FIFO stack operation.

COLL(081) can be used together with DIST(080). Refer to 5-16-6 SINGLE WORD DISTRIBUTE – DIST(080) for details. Note FIFO stands for First-In-First-Out. Example

In the following example, the content of C (HR 00) is 9010, and COLL(081) is used to copy the oldest entries from a10-word stack (IR 001 to IR 010) to LR 20. 00001 COLL (081) 001 HR 00

Address

Instruction

00000 00001

LD COLL(081)

IR 001 Stack pointer

Stack pointer decremented

00001 001 HR 00 LR 20

LR 20

Before execution

Operands

After one execution IR 001

Stack pointer decremented

After two executions IR 001

0 0 0 2

0 0 0 1

0 0 0 0

IR 002

IR 002

IR 002

1 2 3 4

A B C D

IR 003

IR 003

IR 003

IR 010

IR 010

A B C D Stack area

IR 010

Output

198

Output

LR 20

LR 20

1 2 3 4

A B C D

Page 211

Section 5-16

Data Movement LIFO Stack Operation (C=8000 to 8999)

When the execution condition is OFF, COLL(081) is not executed. When the execution condition is ON, COLL(081) copies the data most recently recorded in the stack to D. The stack pointer, SBs, is then decremented by 1. Digits of C:

3 2 1 0

Specifies the stack length (000 to 999). A value of 8 indicates LIFO stack operation.

Data can be added to the stack until it is full. DIST(080)’s stack operation can be used together with COLL(081)’s read stack operation. COLL(081) can be set to read on a FIFO or LIFO basis. Refer to 5-16-6 SINGLE WORD DISTRIBUTE (080) for details. Note LIFO stands for Last-In-First-Out. Example

In the following example, the content of C (HR 00) is 8010, and COLL(081) is used to copy the most recent entries from a 10-word stack (IR 001 to IR 010) to LR 20. 00001 COLL(081) 001 HR 00

Address

Instruction

00000 00001

LD COLL(081)

Operands

001 HR 00 LR 20

LR 20

Before execution IR 001 Stack pointer

0 0 0 2

Stack pointer decremented

00001

After one execution IR 001

Stack pointer decremented

After two executions IR 001

0 0 0 1

0 0 0 0 IR 002

IR 002

IR 002

1 2 3 4

1 2 3 4

IR 003

IR 003

IR 003

IR 010

IR 010

A B C D Stack area

IR 010

Flags

ER:

Output

Output

LR 20

LR 20

A B C D

1 2 3 4

The content of C is not BCD or 6655<C<8000. When C≤6655, DBs and DBs+C are not in the same data area. When C≥8000, the beginning and end of the stack are not in the same data area or the value of the stack pointer exceeds the length of the stack. 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 when the transferred data is zero; otherwise OFF.

199

Page 212

Section 5-16

Data Movement

5-16-8 MOVE BIT – MOVB(082) Operand Data Areas S: Source word

Ladder Symbols

IR, SR, AR, DM, EM, HR, LR, # MOVB(082)

@MOVB(082)

S

S

Bi

Bi

D

D

Bi: Bit designator (BCD) IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, EM, HR, LR

Limitations

The rightmost two digits and the leftmost two digits of Bi must each be between 00 and 15.

Description

When the execution condition is OFF, MOVB(082) is not executed. When the execution condition is ON, MOVB(082) copies the specified bit of S to the specified bit in D. The bits in S and D are specified by Bi. The rightmost two digits of Bi designate the source bit; the leftmost two bits designate the destination bit. Bit 15

Bi

Bi MSB 1

2

0

1

0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 Bit 15

LSB

S

Bit 00

1

2

0

1

Bit 00

0 1 0 1 0 1 0 0 0 1 1 1 0 0 0 1

Source bit (00 to 15) Bit 15

Destination bit (00 to 15)

D Flags

ER:

Bit 00

0 1 0 0 0 1 0 0 0 1 1 1 0 0 0 1

C is not BCD, or it is specifying a non-existent bit (i.e., bit specification must be between 00 and 15). The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.

N:

ON if the leftmost bit of the content of word D is 1, otherwise OFF.

5-16-9 MOVE DIGIT – MOVD(083) Operand Data Areas S: Source word

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # MOVD(083)

@MOVD(083)

S

S

Di

Di

D

D

Di: Digit designator (BCD) IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, EM, HR, TC, LR

Limitations

The rightmost three digits of Di must each be between 0 and 3.

Description

When the execution condition is OFF, MOVD(083) is not executed. When the execution condition is ON, MOVD(083) copies the content of the specified

200

Page 213

Section 5-16

Data Movement digit(s) in S to the specified digit(s) in D. Up to four digits can be transferred at one time. The first digit to be copied, the number of digits to be copied, and the first digit to receive the copy are designated in Di as shown below. Digits from S will be copied to consecutive digits in D starting from the designated first digit and continued for the designated number of digits. If the last digit is reached in either S or D, further digits are used starting back at digit 0. Digit number:

3 2 1 0

First digit in S (0 to 3) Number of digits (0 to 3) 0: 1 digit 1: 2 digits 2: 3 digits 3: 4 digits First digit in D (0 to 3) Not used.

Digit Designator

The following show examples of the data movements for various values of Di. Di: 0010

Di: 0030

S

D

S

D

0

0

0

0

1

1

1

1

2

2

2

2

3

3

3

3

S

D

S

D

0

0

0

0

1

1

1

1

2

2

2

2

3

3

3

3

Di: 0031

Flags

ER:

Di: 0023

At least one of the rightmost three digits of Di is not between 0 and 3. 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-10 TRANSFER BITS – XFRB(062) Operand Data Areas C: Control word

Ladder Symbols

IR, SR, AR, DM, EM, TC, HR, LR, # XFRB(062)

@XFRB(062)

C

C

S

S

D

D

S: First source word

Limitations

IR, SR, AR, DM, EM, HR, TC, LR D: First destination word IR, SR, AR, DM, EM, HR, LR

The specified source bits must be in the same data area. The specified destination bits must be in the same data area. XFRB(062) is an expansion instruction. A Programming Device can be used to reassign function code 062 to another expansion instruction.

201