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

The text of a manual · part 21 of 60

C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 194 to 203

Pages 194 to 203 of 586

The original document is the PDF (3.4 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.

For the Omron C200HE-CPU42-E

Page 194

Section 5-15

Data Shifting

5-15-5 ROTATE LEFT – ROL(27) Ladder Symbols

Description

Operand Data Areas

ROL(27)

@ROL(27)

Wd

Wd

Wd: Rotate word IR, SR, AR, DM, HR, LR

When the execution condition is OFF, ROL(27) is not executed. When the execution condition is ON, ROL(27) shifts all Wd bits one bit to the left, shifting CY into bit 00 of Wd and shifting bit 15 of Wd into CY. CY

Bit 15

Bit 00

0

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

Precautions

Use STC(41) to set the status of CY or CLC(41) to clear the status of CY before doing a rotate operation to ensure that CY contains the proper status before execution ROL(27). The status of CY is cleared at the end of each cycle (when END(01) is executed).

Flags

ER:

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) Receives the data of bit 15. ON when the content of Wd is zero; otherwise OFF. ON when a 1 is shifted into bit 15 of Wd.

CY: EQ: N:

5-15-6 ROTATE RIGHT – ROR(28) Ladder Symbols

Description

Operand Data Areas

ROR(28)

@ROR(28)

Wd

Wd

Wd: Rotate word IR, SR, AR, DM, HR, LR

When the execution condition is OFF, ROR(28) is not executed. When the execution condition is ON, ROR(28) shifts all Wd bits one bit to the right, shifting CY into bit 15 of Wd and shifting bit 00 of Wd into CY. CY

Bit 15

0

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

Bit 00

Precautions

Use STC(41) to set the status of CY or CLC(41) to clear the status of CY before doing a rotate operation to ensure that CY contains the proper status before execution ROR(28). The status of CY is cleared at the end of each cycle (when END(01) is executed).

Flags

ER: CY: EQ: N:

176

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) ROR(28) receives the data of bit 00. ON when the content of Wd is zero; otherwise OFF. ON when a 1 is shifted into bit 15 of Wd.

Page 195

Section 5-15

Data Shifting

5-15-7 ONE DIGIT SHIFT LEFT – SLD(74) Ladder Symbols

Operand Data Areas St: Starting word

SLD(74)

@SLD(74)

St

St

E

E

IR, SR, AR, DM, HR, LR E: End word IR, SR, AR, DM, HR, LR

Limitations

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

Description

When the execution condition is OFF, SLD(74) is not executed. When the execution condition is ON, SLD(74) shifts data between St and E (inclusive) by one digit (four bits) to the left. 0 is written into the rightmost digit of the St, and the content of the leftmost digit of E is lost. E

... St

8 F C 5

D 7 9 1

Lost data

0

Precautions

If a power failure occurs during a shift operation across more than 50 words, the shift operation might not be completed.

Flags

ER:

The St and E words are in different areas, or St is greater than E. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

5-15-8 ONE DIGIT SHIFT RIGHT – SRD(75) Ladder Symbols

Operand Data Areas E: End word

SRD(75)

@SRD(75)

E

E

St

St

IR, SR, AR, DM, HR, LR St: Starting word IR, SR, AR, DM, HR, LR

Limitations

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

Description

When the execution condition is OFF, SRD(75) is not executed. When the execution condition is ON, SRD(75) shifts data between St and E (inclusive) by one digit (four bits) to the right. 0 is written into the leftmost digit of St and the rightmost digit of E is lost. St 3 4 5 2

0

... E

F 8 C 1

Lost data

177

Page 196

Section 5-15

Data Shifting Precautions

If a power failure occurs during a shift operation across more than 50 words, the shift operation might not be completed. Set the range between E and St to a maximum of 50 words.

Flags

ER:

The St and E words are in different areas, or St is less than E. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

5-15-9 WORD SHIFT – WSFT(16) Ladder Symbols

Operand Data Areas St: Starting word

WSFT(16)

@WSFT(16)

St

St

E

E

IR, SR, AR, DM, HR, LR E: End word IR, SR, AR, DM, HR, LR

Limitations

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

Description

When the execution condition is OFF, WSFT(16) is not executed. When the execution condition is ON, WSFT(16) shifts data between St and E in word units. Zeros are written into St and the content of E is lost. E F

0

St + 1 C

2

3

4

5

St 2

1

0

2

9

Lost 0000 E 3

Flags

ER:

4

St + 1 5

2

1

0

2

St 9

0

0

0

0

The St and E words are in different areas, or St is greater than E. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

5-15-10 ASYNCHRONOUS SHIFT REGISTER – ASFT(17) Operand Data Areas C: Control word

Ladder Symbols

IR, SR, AR, DM, HR, LR

Limitations

178

ASFT(17)

ASFT(17)

St: Starting word

C

C

IR, SR, AR, DM, HR, LR

St

St

E

E

E: End word IR, SR, AR, DM, HR, LR

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

Page 197

Section 5-15

Data Shifting Description

When the execution condition is OFF, ASFT(17) does nothing and the program moves to the next instruction. When the execution condition is ON, ASFT(17) is used to create and control a reversible asynchronous word shift register between St and E. This register only shifts words when the next word in the register is zero, e.g., if no words in the register contain zero, nothing is shifted. Also, only one word is shifted for each word in the register that contains zero. When the contents of a word are shifted to the next word, the original word’s contents are set to zero. In essence, when the register is shifted, each zero word in the register trades places with the next word. (See Example below.) The shift direction (i.e. whether the “next word” is the next higher or the next lower word) is designated in C. C is also used to reset the register. All of any portion of the register can be reset by designating the desired portion with St and E.

Control Word

Bits 00 through 12 of C are not used. Bit 13 is the shift direction: turn bit 13 ON to shift down (toward lower addressed words) and OFF to shift up (toward higher addressed words). Bit 14 is the Shift Enable Bit: turn bit 14 ON to enable shift register operation according to bit 13 and OFF to disable the register. Bit 15 is the Reset bit: the register will be reset (set to zero) between St and E when ASFT(17) is executed with bit 15 ON. Turn bit 15 OFF for normal operation. Control word value

Flags

Function

#4000

Shifts upward (towards higher addressed words).

#6000

Shifts downward (towards lower addressed words).

#8000

Clears the contents of St through E to #0000.

ER:

The St and E words are in different areas, or St is greater than E. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

Example

The following example shows instruction ASFT(17) used to shift words in an 11-word shift register created between DM 0100 and DM 0110 with a control 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(17) #6000 DM 0100

Address

Instruction

00100 00101

LD ASFT(17)

00000 # DM DM

DM 0110

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

Operands

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

6000 0100 0110

179

Page 198

Section 5-16

Data Movement

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(21) Ladder Symbols

Operand Data Areas S: Source word

MOV(21)

@MOV(21)

S

S

D

D

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

Description

IR, SR, AR, DM, HR, LR

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

Destination word Bit status not changed.

Precautions

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(71).

Flags

ER:

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) ON when all zeros are transferred to D. ON when bit 15 of D is set to 1.

EQ: N:

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

Operand Data Areas S: Source word

MVN(22)

@MVN(22)

S

S

D

D

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

Description

IR, SR, AR, DM, HR, LR

When the execution condition is OFF, MVN(22) is not executed. When the execution condition is ON, MVN(22) 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.

180

Page 199

Section 5-16

Data Movement 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(71).

Flags

ER:

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM 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(71) Operand Data Areas S: Source data

Ladder Symbols

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

@BSET(71)

S

S

St

St

E

E

St: Starting word IR, SR, AR, DM, HR, TC, LR E: End Word IR, SR, AR, DM, HR, TC, LR

Limitations

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

Description

When the execution condition is OFF, BSET(71) is not executed. When the execution condition is ON, BSET(71) 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(71) can be used to change timer/counter PV. (This cannot be done with MOV(21) or MVN(22).) BSET(71) 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. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

181

Page 200

Section 5-16

Data Movement Example

00003

The following example shows how to use BSET(71) 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(71) #0500 TIM 010

Address

Instruction

00000 00001 00002

LD AND NOT @BSET(71)

TIM 010 00004

00003 @BSET(71) #0300

00003 00004 00005

TIM 010 TIM 010

TIM 010 #9999

00006 00007 00008

00003 00004 # TIM TIM

0500 010 010 00004 00003

# TIM TIM

0300 010 010 00003 00004 010 9999

LD AND NOT @BSET(71)

00003

00004

Operands

LD OR TIM #

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

Ladder Symbols

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

@XFER(70)

N

N

S

S

D

D

S: Starting source word

Limitations

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

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

182

When the execution condition is OFF, XFER(70) is not executed. When the execution condition is ON, XFER(70) copies the contents of S, S+1, ..., S+N to D, D+1, ..., D+N. 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

Page 201

Section 5-16

Data Movement Flags

ER:

N is not BCD between 0000 and 2000. S and S+N or D and D+N are not in the same data area. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

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

Operand Data Areas E1: Exchange word 1

XCHG(73)

@XCHG(73)

E1

E1

E2

E2

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

Description

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

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

E2

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(70) three times. Flags

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

ER:

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

Ladder Symbols

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

@DIST(80)

S

S

DBs

DBs

C

C

DBs: Destination base word IR, SR, AR, DM, HR, TC, LR C: Control word (BCD) IR, SR, AR, DM, 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(80) will operate as a data distribution instruction or stack instruction. If C is between 0000 and 6655, DIST(80) 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(80) 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(80) or COLL(81).

Data Distribution Operation (C=0000 to 6655)

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

DBs + C

3 4 5 2

3 4 5 2

183

Page 202

Data Movement

Section 5-16

Stack Operation (C=9000 to 9999)

When the execution condition is OFF, DIST(80) is not executed. When the execution condition is ON, DIST(80) 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(80) is normally used together with COLL(81), which can be set to read from the stack on a FIFO or LIFO basis. Refer to 5-16-7 DATA COLLECT – COLL(81) for details. Example of Stack Operation

In the following example, the content of C (LR 10) is 9010, and DIST(80) 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) 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(80) # 00FF HR 20

Address

Instruction

00000 00001

LD DIST(80)

00001 # HR LR

LR 10

Stack pointer

Operands

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

00FF 20 10

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. Indirectly addressed DM word is non-existent. (Content of ∗DM word is not BCD, or the DM area boundary has been exceeded.)

EQ:

184

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

Page 203

Section 5-16

Data Movement

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

Ladder Symbols

IR, SR, AR, DM, HR, TC, LR COLL(81)

@COLL(81)

SBs

SBs

C

C

D

D

C: Offset data (BCD) IR, SR, AR, DM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, 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(81) will operate as a data collection instruction, FIFO stack instruction, or LIFO stack instruction. If C is between 0000 and 6655, COLL(81) 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(81) will operate as a FIFO stack instruction. If the leftmost digit of C is 8, COLL(81) will operate as a LIFO stack instruction. 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(80) or COLL(81).

Data Collection Operation (C=0000 to 6655)

When the execution condition is OFF, COLL(81) is not executed. When the execution condition is ON, COLL(81) 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(81) is not executed. When the execution condition is ON, COLL(81) 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(81) can be used together with DIST(80). Refer to 5-16-6 SINGLE WORD DISTRIBUTE – DIST(80) for details. Note FIFO stands for First-In-First-Out.

185