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

The text of a manual · part 25 of 60

C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 234 to 243

Pages 234 to 243 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 234

Section 5-18

Data Conversion

Any or all of the digits in S may be converted in sequence from the designated first digit. The first digit, the number of digits to be converted, and the half of D to receive the first 7-segment display code (rightmost or leftmost 8 bits) are designated in Di. If multiple digits are designated, they will be placed in order starting from the designated half of D, each requiring two digits. If more digits are designated than remain in S (counting from the designated first digit), further digits will be used starting back at the beginning of S. Digit Designator

The digits of Di are set as shown below.

Digit number:

3 2 1 0

Specifies the first digit to receive converted data (0 to 3). Number of digits to be converted (0 to 3) 0: 1 digit 1: 2 digits 2: 3 digits 3: 4 digits First half of D to be used. 0: Rightmost 8 bits (1st half) 1: Leftmost 8 bits (2nd half) Not used; set to 0.

Some example Di values and the 4-bit binary to 7-segment display conversions that they produce are shown below.

Di: 0011 S digits

Di: 0030 D

S digits

D

0

1st half

0

1st half

1

2nd half

1

2nd half

2

2

3

3

D+1 1st half 2nd half

Di: 0112 S digits

D

0

1st half

1

2nd half

2 3

D+1

Di: 0130 S digits 0 1 2 3

D 1st half 2nd half D+1

1st half

1st half

2nd half

2nd half D+2 1st half 2nd half

216

Page 235

Section 5-18

Data Conversion Example

The following example shows the data to produce an 8. The lower case letters show which bits correspond to which segments of the 7-segment display. The table underneath shows the original data and converted code for all hexadecimal digits.

Di

S a

D Bit 00 or bit 08 f 1 a

1

1 b

22

0

1 c

0

23

0

1 d

0

20

0

1 e

21

0

1 f

0

22

0

1 g

1

23

1

0

20

0

21

1

22

1

1

23

1

1

20

1

0

21

0

1

22

1

1

23

1

0

20

0

1

21

0 x100

0 x101

1 x102

1

Flags x103

1: Second digit 0

0: One digit

1

2

0 or 1: bits 00 through 07 or 08 through 15.

3

Not used.

8

Bit 07 or bit 15 e c d

0

Converted code (segments) g f e d c b

Display

Digit

Original data Bits

0

0

0

0

0

0

0

1

1

1

1

1

1

1

0

0

0

1

0

0

0

0

0

1

1

0

2

0

0

1

0

0

1

0

1

1

0

1

1

3

0

0

1

1

0

1

0

0

1

1

1

1

4

0

1

0

0

0

1

1

0

0

1

1

0

5

0

1

0

1

0

1

1

0

1

1

0

1

6

0

1

1

0

0

1

1

1

1

1

0

1

7

0

1

1

1

0

0

1

0

0

1

1

1

8

1

0

0

0

0

1

1

1

1

1

1

1

9

1

0

0

1

0

1

1

0

1

1

1

1

A

1

0

1

0

0

1

1

1

0

1

1

1

B

1

0

1

1

0

1

1

1

1

1

0

0

C

1

1

0

0

0

0

1

1

1

0

0

1

D

1

1

0

1

0

1

0

1

1

1

1

0

E

1

1

1

0

0

1

1

1

1

0

0

1

F

1

1

1

1

0

1

1

1

0

0

0

1

ER:

Incorrect digit designator, or data area for destination exceeded

– b g a

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

217

Page 236

Section 5-18

Data Conversion

5-18-10 ASCII CONVERT – ASC(86) Operand Data Areas S: Source word

Ladder Symbols

IR, SR, AR, DM, HR, TC, LR ASC(86)

@ASC(86)

S

S

Di

Di

D

D

Di: Digit designator IR, SR, AR, DM, HR, TC, LR, # D: First destination word IR, SR, AR, DM, HR, LR

Limitations

Di must be within the values given below All destination words must be in the same data area.

Description

When the execution condition is OFF, ASC(86) is not executed. When the execution condition is ON, ASC(86) converts the designated digit(s) of S into the equivalent 8-bit ASCII code and places it into the destination word(s) beginning with D. Any or all of the digits in S may be converted in order from the designated first digit. The first digit, the number of digits to be converted, and the half of D to receive the first ASCII code (rightmost or leftmost 8 bits) are designated in Di. If multiple digits are designated, they will be placed in order starting from the designated half of D, each requiring two digits. If more digits are designated than remain in S (counting from the designated first digit), further digits will be used starting back at the beginning of S. Refer to Appendix I for a table of extended ASCII characters.

Digit Designator

The digits of Di are set as shown below. Digit number:

3 2 1 0

Specifies the first digit to be converted (0 to 3). Number of digits to be converted (0 to 3) 0: 1 digit 1: 2 digits 2: 3 digits 3: 4 digits First half of D to be used. 0: Rightmost 8 bits (1st half) 1: Leftmost 8 bits (2nd half) Parity

218

0: none, 1: even, 2: odd

Page 237

Section 5-18

Data Conversion

Some examples of Di values and the 4-bit binary to 8-bit ASCII conversions that they produce are shown below. Di: 0011

Di: 0030

S

D

S

D

0

1st half

0

1st half

2nd half

1

2nd half

1 2

2

3

3

D+1 1st half 2nd half

Di: 0112

Di: 0130

S

D

0

1st half

1

2nd half

S 0 1

D 1st half 2nd half

2

2 D+1

3

3

D+1

1st half

1st half

2nd half

2nd half D+2 1st half 2nd half

Parity

The leftmost bit of each ASCII character (2 digits) can be automatically adjusted for either even or odd parity. If no parity is designated, the leftmost bit will always be zero. When even parity is designated, the leftmost bit will be adjusted so that the total number of ON bits is even, e.g., when adjusted for even parity, ASCII “31” (00110001) will be “B1” (10110001: parity bit turned ON to create an even number of ON bits); ASCII “36” (00110110) will be “36” (00110110: parity bit turned OFF because the number of ON bits is already even). The status of the parity bit does not affect the meaning of the ASCII code. When odd parity is designated, the leftmost bit of each ASCII character will be adjusted so that there is an odd number of ON bits.

Flags

ER:

Incorrect digit designator, or data area for destination exceeded. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

5-18-11 ASCII-TO-HEXADECIMAL – HEX(––) Operand Data Areas S: First source word

Ladder Symbols

IR, SR, AR, DM, HR, TC, LR HEX(––)

@HEX(––)

S

S

Di

Di

D

D

Di: Digit designator IR, SR, AR, DM, HR, TC, LR D: Destination word IR, SR, AR, DM, HR, LR

219

Page 238

Section 5-18

Data Conversion Limitations

Di must be within the values given below. All source words must be in the same data area. Bytes in the source words must contain the ASCII code equivalent of hexadecimal values, i.e., 30 to 39 (0 to 9), 41 to 46 (A to F), or 61 to 66 (a to f).

Description

When the execution condition is OFF, HEX(––) is not executed. When the execution condition is ON, HEX(––) converts the designated byte(s) of ASCII code from the source word(s) into the hexadecimal equivalent and places it into D. Up to 4 ASCII codes may be converted beginning with the designated first byte of S. The converted hexadecimal values are then placed in D in order from the designated digit. The first byte (rightmost or leftmost 8 bits), the number of bytes to be converted, and the digit of D to receive the first hexadecimal value are designated in Di. If multiple bytes are designated, they will be converted in order starting from the designated half of S and continuing to S+1 and S+2, if necessary. If more digits are designated than remain in D (counting from the designated first digit), further digits will be used starting back at the beginning of D. Digits in D that do not receive converted data will not be changed.

Digit Designator

The digits of Di are set as shown below. Digit number:

3 2 1 0

Specifies the first digit of D to be used (0 to 3). Number of bytes to be converted (0 to 3) 0: 1 byte (2-digit ASCII code) 1: 2 bytes 2: 3 bytes 3: 4 bytes First byte of S to be used. 0: Rightmost 8 bits (1st byte) 1: Leftmost 8 bits (2nd byte) Parity

220

0: none 1: even 2: odd

Page 239

Section 5-18

Data Conversion

Some examples of Di values and the 8-bit ASCII to 4-bit hexadecimal conversions that they produce are shown below. Di: 0011

Di: 0030

S

D

S

D

1st byte

0

1st byte

0

2nd byte

1

2nd byte

1

2

2 S+1

3

3

1st byte 2nd byte Di: 0023

Di: 0133

S

D

S

1st byte

0

1st byte

D

2nd byte

1

2nd byte

0

2 S+1

1 S+1

3

2

1st byte

1st byte

2nd byte

2nd byte

3

S+2 1st byte 2nd byte

ASCII Code Table

The following table shows the ASCII codes before conversion and the hexadecimal values after conversion. Refer to Appendix I for a table of ASCII characters. Original data ASCII Code

Converted data

Bit status (See note.)

Digit

Bits

30

*

0

1

1

0

0

0

0

0

0

0

0

0

31

*

0

1

1

0

0

0

1

1

0

0

0

1

32

*

0

1

1

0

0

1

0

2

0

0

1

0

33

*

0

1

1

0

0

1

1

3

0

0

1

1

34

*

0

1

1

0

1

0

0

4

0

1

0

0

35

*

0

1

1

0

1

0

1

5

0

1

0

1

36

*

0

1

1

0

1

1

0

6

0

1

1

0

37

*

0

1

1

0

1

1

1

7

0

1

1

1

38

*

0

1

1

1

0

0

0

8

1

0

0

0

39

*

0

1

1

1

0

0

1

9

1

0

0

1

41

*

1

0

1

0

0

0

1

A

1

0

1

0

42

*

1

0

1

0

0

1

0

B

1

0

1

1

43

*

1

0

1

0

0

1

1

C

1

1

0

0

44

*

1

0

1

0

1

0

0

D

1

1

0

1

45

*

1

0

1

0

1

0

1

E

1

1

1

0

46

*

1

0

1

0

1

1

0

F

1

1

1

1

Note The leftmost bit of each ASCII code is adjusted for parity. Parity

The leftmost bit of each ASCII character (2 digits) is automatically adjusted for either even or odd parity. With no parity, the leftmost bit should always be zero. With odd or even parity, the leftmost bit of each ASCII character should be adjusted so that there is an odd or even number of ON bits. If the parity of the ASCII code in S does not agree with the parity specified in Di, the ER Flag (SR 25503) will be turned ON and the instruction will not be executed.

221

Page 240

Section 5-18

Data Conversion Flags

ER:

Incorrect digit designator, or data area for destination exceeded. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

In the following example, the 2nd byte of LR 10 and the 1st byte of LR 11 are converted to hexadecimal values and those values are written to the first and second bytes of IR 010.

Example

00000 @HEX(––) LR 10 HR 10

Address

Instruction

00000 00001

LD @HEX(––)

Operands 00000 LR HR

010

10 10 010

HR 10 0 1 1 0

LR 12

3 5 3 4

LR 11

4 2 3 2

LR 10

3 1 3 0 Conversion to hexadecimal

010 0 0 2 1

5-18-12 SCALING – SCL(––) Ladder Symbols

Operand Data Areas S: Source word

SCL(––)

@SCL(––)

S

S

P1

P1

R

R

IR, SR, AR, DM, HR, TC, LR, # P1: First parameter word IR, SR, AR, DM, HR, TC, LR R: Result word IR, SR, AR, DM, HR, LR

Limitations

P1 and P1+2 must be BCD. P1 through P1+3 must be in the same data area. P1+1 and P1+3 must not be set to the same value.

Description

SCL(––) is used to linearly convert a 4-digit hexadecimal value to a 4-digit BCD value. Unlike BCD(24), which converts a 4-digit hexadecimal value to its 4-digit BCD equivalent (Shex → SBCD), SCL(––) can convert the hexadecimal value according to a specified linear relationship. The conversion line is defined by two points specified in the parameter words P1 to P1+3. When the execution condition is OFF, SCL(––) is not executed. When the execution condition is ON, SCL(––) converts the 4-digit hexadecimal value in S to the 4-digit BCD value on the line defined by points (P1, P1+1) and (P1+2, P1+3) and places the result in R. The result is rounded off to the nearest integer. If the result is less than 0000, then 0000 is written to R, and if the result is greater than 9999, then 9999 is written to R.

222

Page 241

Section 5-18

Data Conversion

The following table shows the functions and ranges of the parameter words: Function

Range

P1

Parameter

BCD point #1 (AY)

0000 to 9999

---

Comments

P1+1

Hex. point #1 (AX)

0000 to FFFF

Do not set P1+1=P1+3.

P1+2

BCD point #2 (BY)

0000 to 9999

---

P1+3

Hex. point #2 (BX)

0000 to FFFF

Do not set P1+3=P1+1.

The following diagram shows the source word, S, converted to D according to the line defined by points (AY, AX) and (BY, BX). Value after conversion (BCD) BY

R AY

AX

S

Value before conversion (Hexadecimal)

BX

The results can be calculated by first converting all values to BCD and then using the following formula. Results = BY – [(BY – AY)/(BX – AX) X (BX – S)] Flags

ER:

The value in P1+1 equals that in P1+3. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) P1 and P1+3 are not in the same data area, or other setting error.

EQ: Example

ON when the result, R, is 0000.

When 00000 is turned ON in the following example, the BCD source data in DM 0100 (#0100) is converted to hexadecimal according to the parameters in DM 0150 to DM 0153. The result (#0512) is then written to DM 0200. 00000 @SCL(––) DM 0100 DM 0150

Instruction

00000 00001

LD @SCL(––)

Operands 00000 DM DM DM

DM 0200

DM 0150 DM 0151 DM 0152 DM 0153

Address

0010 0005 0050 0019

0100 0150 0200

DM 0100

0100

DM 0200

0512

223

Page 242

Section 5-18

Data Conversion

5-18-13 COLUMN TO LINE – LINE(63) Operand Data Areas S: First word of 16 word source set

Ladder Symbols

IR, SR, AR, DM, HR, TC, LR LINE(63)

@LINE(63)

S

S

C

C

D

D

C: Column bit designator (BCD)

Limitations

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

S and S+15 must be in the same data area. C must be between #0000 and #0015.

Description

When the execution condition is OFF, LINE(63) is not executed. When the execution condition is ON, LINE(63) copies bit column C from the 16-word set (S to S+15) to the 16 bits of word D (00 to 15). C

Bit 15

Bit 00

S S+1 S+2 S+3 . . .

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

S+15

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

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

. . .

. . .

. . .

D

Flags

ER:

Bit 00

Bit 15 0

. . .

0 1 1 1

The column bit designator C is not BCD, or it is specifying a non-existent bit (i.e., bit specification must be between 00 and 15). Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

EQ: Example

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

The following example shows how to use LINE(63) to move bit column 07 from the set (IR 100 to IR 115) to DM 0100.

00000 LINE(63) 100 #0007

Address

Instruction

00000 00001

LD LINE(63)

Operands 00000

DM 0100

# DM

224

100 0007 0100

Page 243

Section 5-18

Data Conversion

5-18-14 LINE TO COLUMN – COLM(64) Operand Data Areas S: Source word

Ladder Symbols

IR, SR, AR, DM, HR, TC, LR COLM(64)

@COLM(64)

S

S

D

D

C

C

D: First word of the destination set

Limitations

IR, AR, DM, HR, TC, LR C: Column bit designator (BCD) IR, SR, AR, DM, HR, TC, LR, #

D and D+15 must be in the same data area. C must be between #0000 and #0015.

Description

When the execution condition is OFF, COLM(64) is not executed. When the execution condition is ON, COLM(64) copies the 16 bits of word S (00 to 15) to the column of bits, C, of the 16-word set (D to D+15). Bit 00

Bit 15

S

.

0

.

.

.

.

.

0 1 1 1

C

Bit 15

D D+1 D+2 D+3 . . .

.

Bit 00

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

. . .

. . .

. . .

D+15 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0

Flags

ER:

The bit designator C is not BCD, or it is specifying a non-existent bit (i.e., bit specification must be between 00 and 15). Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)

EQ: Example

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

The following example shows how to use COLM(64) to move the contents of word DM 0100 (00 to 15) to bit column 15 of the set (DM 0200 to DM 0215).

00000 COLM(64) DM 0100 DM 0200 #0015

Address

Instruction

00000 00001

LD COLM(64)

Operands 00000 DM DM #

0100 0200 0015

225