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

The text of a manual · part 26 of 68

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

Pages 224 to 233 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 224

Section 5-17

Data Comparison Example

The following example shows the comparisons made and the results provided for BCMP(068). Here, the comparison is made during each cycle when 00000 is ON.

00000 BCMP(068)

Address

Instruction

00000 00001

LD BCMP(068)

001 HR 10

Operands 00000 001 HR 10 HR 05

HR 05

CD 001 001

Lower limits 0210

HR 10 HR 12 HR 14 HR 16 HR 18 HR 20 HR 22 HR 24 HR 26 HR 28 HR 30 HR 32 HR 34 HR 36 HR 38 HR 40

Compare data in IR 001 (which contains 0210) with the given ranges.

Upper limits

0000 0101 0201 0301 0401 0501 0601 0701 0801 0901 1001 1101 1201 1301 1401 1501

HR 11 HR 13 HR 15 HR 17 HR 19 HR 21 HR 23 HR 25 HR 27 HR 29 HR 31 HR 33 HR 35 HR 37 HR 39 HR 41

R: HR 05 0100 0200 0300 0400 0500 0600 0700 0800 0900 1000 1100 1200 1300 1400 1500 1600

HR 0500 HR 0501 HR 0502 HR 0503 HR 0504 HR 0505 HR 0506 HR 0507 HR 0508 HR 0509 HR 0510 HR 0511 HR 0512 HR 0513 HR 0514 HR 0515

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

5-17-5 TABLE COMPARE – TCMP(085) Operand Data Areas CD: Compare data

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # TCMP(085)

@TCMP(085)

CD

CD

TB

TB

R

R

TB: First comparison table word IR, AR, DM, EM, HR, TC, LR, SR R: Result word IR, SR, AR, DM, EM, HR, TC, LR

Limitations

TB and TB+15 must be in the same data area.

Description

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

Flags

ER:

EQ:

212

The comparison table (i.e., TB through TB+15) 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. ON if none of the words in the comparison table match CD, i.e., all of the bits in R are OFF.

Page 225

Section 5-17

Data Comparison Example

The following example shows the comparisons made and the results provided for TCMP(085). Here, the comparison is made during each cycle when 00000 is ON.

00000 TCMP(085) 001

Address

Instruction

00000 00001

LD TCMP(085)

Operands 00000

HR 10

001 HR 10 HR 05

HR 05

CD: 001 001

Upper limits 0210

Compare the data in IR 001 with the given ranges.

HR 10 HR 11 HR 12 HR 13 HR 14 HR 15 HR 16 HR 17 HR 18 HR 19 HR 20 HR 21 HR 22 HR 23 HR 24 HR 25

R: HR 05 0100 0200 0210 0400 0500 0600 0210 0800 0900 1000 0210 1200 1300 1400 0210 1600

HR 0500 HR 0501 HR 0502 HR 0503 HR 0504 HR 0505 HR 0506 HR 0507 HR 0508 HR 0509 HR 0510 HR 0511 HR 0512 HR 0513 HR 0514 HR 0515

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

5-17-6 AREA RANGE COMPARE – ZCP(088) Operand Data Areas CD: Compare data

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR, # ZCP(088) LL: Lower limit of range CD

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

LL

UL: Upper limit of range

UL

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

Limitations

LL must be less than or equal to UL. ZCP(088) is an expansion instruction. A Programming Device can be used to reassign function code 088 to another expansion instruction.

Description

When the execution condition is OFF, ZCP(088) is not executed. When the execution condition is ON, ZCP(088) compares CD to the range defined by lower limit LL and upper limit UL and outputs the result to the GR, EQ, and LE flags in the SR area. The resulting flag status is shown in the following table. Flag status

Comparison result CD < LL

GR (SR 25505) EQ (SR 25506) 0 0

LE (SR 25507) 1

LL ≤ CD ≤ UL

0

1

0

UL < CD

1

0

0

213

Page 226

Section 5-17

Data Comparison Precautions

Placing other instructions between ZCP(088) 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:

The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. LL is greater than UL.

Example: Saving ZCP(088) Results

EQ:

ON if LL ≤ CD ≤ UL

LE:

ON if CD < LL.

GR:

ON if CD > UL.

The following example shows how to save the comparison result immediately. If IR 100 > AB1F, IR 00200 is turned ON; if #0010 ≤ IR 100 ≤ AB1F, IR 00201 is turned ON; if IR 100 < 0010, IR 00202 is turned ON.

TR 0 00000 ZCP(088) IR 100 #0010 #AB1F

25505 00200

Greater Than (above range)

00201

Equal (within range)

00202

Less Than (below range)

25506

25507

Address

Instruction

00000 00001 00002

LD OUT ZCP(088)

00003 00004

LD AND

Operands 00000 TR 0 IR 100 #0010 #AB1F 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

5-17-7 DOUBLE AREA RANGE COMPARE – ZCPL(116) Operand Data Areas Ladder Symbols

CD: Compare data IR, SR, AR, DM, EM, HR, LR, TC

ZCPL(116) LL: Lower limit of range CD LL UL

Limitations

214

IR, SR, AR, DM, EM, HR, LR, TC UL: Upper limit of range IR, SR, AR, DM, EM, HR, LR, TC

The 8-digit value in LL+1,LL must be less than or equal to UL+1,UL. CD and CD+1 must be in the same data area, as must LL and LL+1, and UL and UL+1.

Page 227

Section 5-17

Data Comparison

ZCPL(116) is an expansion instruction. A Programming Device can be used to reassign function code 116 to another expansion instruction. Description

When the execution condition is OFF, ZCPL(116) is not executed. When the execution condition is ON, ZCPL(116) compares the 8-digit value in CD, CD+1 to the range defined by lower limit LL+1,LL and upper limit UL+1,UL and outputs the result to the GR, EQ, and LE flags in the SR area. The resulting flag status is shown in the following table. Flag status

Comparison result GR (SR 25505)

EQ (SR 25506)

LE (SR 25507)

CD , CD+1< LL+1,LL

0

0

1

LL+1,LL ≤ CD, CD+1 ≤ UL+1,UL

0

1

0

UL+1,UL < CD, CD+1

1

0

0

Precautions

Placing other instructions between ZCPL(116) 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:

The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. LL+1,LL is greater than UL+1,UL.

EQ: LE:

ON if LL+1,LL ≤ CD, CD+1 ≤ UL+1,UL ON if CD, CD+1 < LL+1,LL.

GR:

ON if CD, CD+1 > UL+1,UL.

Example

Refer to 5-17-6 AREA RANGE COMPARE – ZCP(088) for an example. The only difference between ZCP(088) and ZCPL(116) is the number of digits in the comparison data.

5-17-8 SIGNED BINARY COMPARE – CPS(114) Operand Data Areas Ladder Symbols

Cp1: First compare word IR, SR, AR, DM, EM, HR, TC, LR, #

CPS(114) Cp2: Second compare word Cp1 Cp2 000

IR, SR, AR, DM, EM, HR, TC, LR, # Third operand: Set to 000. –––

Limitations

CPS(114) is an expansion instruction. A Programming Device can be used to reassign function code 114 to another expansion instruction.

Description

When the execution condition is OFF, CPS(114) is not executed. When the execution condition is ON, CPS(114) compares the 16-bit (4-digit) signed binary contents in Cp1 and Cp2 and outputs the result to the GR, EQ, and LE flags in the SR area. Note

Precautions

1. Refer to page 30 for details on 16-bit signed binary data. 2. Refer to 5-17-2 Compare – CMP(020) for details on saving comparison results. Placing other instructions between CPS(114) 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.

215

Page 228

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 status

Comparison result Cp1 < Cp2

GR (SR 25505) EQ (SR 25506) 0 0

LE (SR 25507) 1

Cp1 = Cp2

0

1

0

Cp1 > Cp2

1

0

0

5-17-9 DOUBLE SIGNED BINARY COMPARE – CPSL(115) Operand Data Areas Cp1: First compare word

Ladder Symbols

IR, SR, AR, DM, EM, HR, TC, LR CPSL(115) Cp2: Second compare word Cp1

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

Cp2

Third operand: Set to 000.

000

Limitations

–––

Cp1 and Cp1+1 must be in the same data area, as must Cp2 and Cp2+1. CPSL(115) is an expansion instruction. A Programming Device can be used to reassign function code 115 to another expansion instruction.

Description

When the execution condition is OFF, CPSL(115) is not executed. When the execution condition is ON, CPSL(115) compares the 32-bit (8-digit) signed binary contents in Cp1+1, Cp1 and Cp2+1, Cp2 and outputs the result to the GR, EQ, and LE flags in the SR area. Note

1. Refer to page 30 for details on 32-bit signed binary data. 2. Refer to 5-17-2 Compare – CMP(020) for details on saving comparison results.

Precautions

Placing other instructions between CPSL(115) 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:

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+1, Cp1 equals Cp2+1, Cp2.

LE:

ON if Cp1+1, Cp1 is less than Cp2+1, Cp2.

GR:

ON if Cp1+1, Cp1 is greater than Cp2+1, Cp2. Flag status

Comparison result

216

Cp1+1, Cp1 < Cp2+1, Cp2

GR (SR 25505) EQ (SR 25506) 0 0

LE (SR 25507) 1

Cp1+1, Cp1 = Cp2+1, Cp2

0

1

0

Cp1+1, Cp1 > Cp2+1, Cp2

1

0

0

Page 229

Section 5-17

Data Comparison

5-17-10 Input Comparison Instructions (300 to 328) Ladder Symbols

Operand Data Areas S1: Comparison data 1

Mnem(Code) IR, SR, AR, DM, EM, HR, TC, LR, # S1 S2: Comparison data 2 S2

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

---

Note “Mnem” in the ladder symbol above is replaced with the mnemonic of the specific instruction; “code” is replaced with the function code of the specific instruction. Description

When the execution condition is OFF, input comparison instructions are not executed and execution continues to the remainder of the instruction line. When the execution is ON, input comparison instructions compare constants and/or the contents of specified words for either signed or unsigned data and will create an ON execution condition when the comparison condition is met. If the comparison condition is not met, the remainder of the instruction line will be skipped and execution will move to the next instruction line. A total of 24 input comparison instructions are available. These can be input using various combinations of symbols and options. If no options are specified, the comparison will be for one-word unsigned data. Symbol =

(Equal)

<>

(Not equal)

<

(Less than)

<=

(Less than or equal)

>

(Greater than)

>=

(Greater than or equal)

Option (data format)

Option (data length)

S (signed data)

L (double length)

Unsigned input comparison instructions (i.e., instructions without the S option) can handle unsigned binary or BCD data. Signed input comparison instructions (i.e., instructions with the S option) handle signed binary data. When using input comparison instructions, follow each input comparison instruction in the program with another instruction on the same instruction line.

217

Page 230

Section 5-17

Data Comparison

The following table shows the function codes, mnemonics, names, and functions of the input comparison instructions. Code

Mnemonic

300 301 302 303

= =L =S =SL

EQUAL DOUBLE EQUAL SIGNED EQUAL DOUBLE SIGNED EQUAL

Name

TRUE WHEN S1 = S2

Function

305 306 307 308

<> <>L <>S <>SL

NOT EQUAL DOUBLE NOT EQUAL SIGNED NOT EQUAL DOUBLE SIGNED NOT EQUAL

TRUE WHEN S1 ≠ S2

310 311 312 313

< <L <S <SL

LESS THAN DOUBLE LESS THAN SIGNED LESS THAN DOUBLE SIGNED LESS THAN

TRUE WHEN S1 < S2

315 316 317 318

<= <=L <=S <=SL

LESS THAN OR EQUAL DOUBLE LESS THAN OR EQUAL SIGNED LESS THAN OR EQUAL DOUBLE SIGNED LESS THAN OR EQUAL

TRUE WHEN S1 S2

320 321 322 323

> >L >S >SL

GREATER THAN DOUBLE GREATER THAN SIGNED GREATER THAN DOUBLE SIGNED GREATER THAN

TRUE WHEN S1 > S2

325 326

>= >=L

TRUE WHEN S1 - S2

327

>=S

328

>=SL

GREATER THAN OR EQUAL DOUBLE GREATER THAN OR EQUAL SIGNED GREATER THAN OR EQUAL DOUBLE SIGNED GREATER THAN OR EQUAL

Precautions

Input comparison instructions cannot be used as right-hand instructions, i.e., another instruction must be used between them and the right bus bar.

Example

< (310) When IR 00000 is ON in the following example, the contents of DM 0100 and DM 0200 are compared in as binary data. If the contents of DM 0100 is less than that of DM 0200, IR 05000 is turned ON and execution proceeds to the next line. If the content of DM 0100 is not less than that of DM 0200, the remainder of the instruction line is skipped and execution moves to the next instruction line. When IR 00000 is OFF, IR 05000 is turned OFF. <S(312) When IR 00001 is ON in the following example, the contents of DM 0110 and DM 0210 are compared as binary data. If the content of DM 0110 is less than that of DM 0210, IR 05001 is turned ON and execution proceeds to the next line. If the content of DM 0110 is not less than that of DM 0210, the remainder of the instruction line is skipped and execution moves to the next instruction line.

218

Page 231

Section 5-17

Data Comparison When IR 00001 is OFF, IR 05001 is turned OFF. 00000 05000

<(310)

Address

Instruction

00000

LD

00001

<(310)

DM 0100 DM 0200

Operands 00000 DM 0100

00001 05001

<S(312)

DM 0200

DM 0110 DM 0210

OUT

05000

00002

LD

00001

00003

<S(312) DM 0110 DM 0210 OUT

Comparison without sign (<)

S1: DM 0100

05001

S2: DM 0200

8714

3A1C

Decimal: 34580

Decimal: 14876

34580 > 14876 (Will not proceed to next line.) Comparison with sign (<S)

S1: DM 0110

S2: DM 0210

8714

3A1C

Decimal: –30956

Decimal: 14876

–30956 < 14876 (Will proceed to next line.)

219

Page 232

Section 5-18

Data Conversion

5-18 Data Conversion The conversion instructions convert word data that is in one format into another format and output the converted data to specified result word(s). Conversions are available to convert between binary (hexadecimal) and BCD, to 7-segment display data, to ASCII, and between multiplexed and non-multiplexed data. All of these instructions change only the content of the words to which converted data is being moved, i.e., the content of source words is the same before and after execution of any of the conversion instructions.

5-18-1 BCD-TO-BINARY – BIN(023) Ladder Symbols

Operand Data Areas S: Source word (BCD)

BIN(023)

@BIN(023)

S

S

R

R

IR, SR, AR, DM, EM, HR, TC, LR R: Result word

Description

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

When the execution condition is OFF, BIN(023) is not executed. When the execution condition is ON, BIN(023) converts the BCD content of S into the numerically equivalent binary bits, and outputs the binary value to R. Only the content of R is changed; the content of S is left unchanged. BCD

S

Binary

R

BIN(023) can be used to convert BCD to binary so that displays on the Programming Console or any other programming device will appear in hexadecimal rather than decimal. It can also be used to convert to binary to perform binary arithmetic operations rather than BCD arithmetic operations, e.g., when BCD and binary values must be added. Flags

ER:

The content of S is not BCD. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.

220

EQ:

ON when the result is zero.

N:

25402 is always OFF.

Page 233

Section 5-18

Data Conversion

5-18-2 DOUBLE BCD-TO-DOUBLE BINARY – BINL(058) Ladder Symbols

Operand Data Areas S: First source word (BCD)

BINL(058)

@BINL(058)

S

S

R

R

IR, SR, AR, DM, EM, HR, TC, LR R: First result word

Description

Flags

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

When the execution condition is OFF, BINL(058) is not executed. When the execution condition is ON, BINL(058) converts an eight-digit number in S and S+1 into 32-bit binary data, and outputs the converted data to R and R+1.

ER:

BCD

S+1

S

Binary

R+1

R

The contents of S and/or S+1 words are not BCD. 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 result is zero.

N:

25402 is always OFF.

5-18-3 BINARY-TO-BCD – BCD(024) Ladder Symbols

Operand Data Areas S: Source word (binary)

BCD(024)

@BCD(024)

S

S

R

R

IR, SR, AR, DM, EM, HR, LR R: Result word

Description

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

BCD(024) converts the binary (hexadecimal) content of S into the numerically equivalent BCD bits, and outputs the BCD bits to R. Only the content of R is changed; the content of S is left unchanged. Binary

S

BCD

R

BCD(024) can be used to convert binary to BCD so that displays on the Programming Console or any other programming device will appear in decimal rather than hexadecimal. It can also be used to convert to BCD to perform BCD arithmetic operations rather than binary arithmetic operations, e.g., when BCD and binary values must be added.

221