The text of a manual · part 28 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 5 Instruction Set, pages 244 to 253
Pages 244 to 253 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 244
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
232
Page 245
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
The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.
233
Page 246
Section 5-18
Data Conversion
5-18-10 ASCII CONVERT – ASC(086) Operand Data Areas S: Source word
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR ASC(086)
@ASC(086)
S
S
Di
Di
D
D
Di: Digit designator IR, SR, AR, DM, EM, HR, TC, LR, # D: First destination word IR, SR, AR, DM, EM, 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(086) is not executed. When the execution condition is ON, ASC(086) 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
234
0: none, 1: even, 2: odd
Page 247
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
1
2nd half
1
2nd half
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. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded.
5-18-11 ASCII-TO-HEXADECIMAL – HEX(162) Operand Data Areas S: First source word
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR HEX(162)
@HEX(162)
S
S
Di
Di
D
D
Di: Digit designator IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, EM, HR, LR
235
Page 248
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(162) is not executed. When the execution condition is ON, HEX(162) 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
236
0: none 1: even 2: odd
Page 249
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
1st byte
0
1st byte
D
2nd byte
1
2nd byte
0
S
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.
237
Page 250
Section 5-18
Data Conversion Flags
ER:
Incorrect digit designator, or data area for destination exceeded. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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(162) LR 10 HR 10
Address
Instruction
00000 00001
LD @HEX(162)
Operands 00000 LR 10 HR 10 010
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(194) Ladder Symbols
Operand Data Areas S: Source word
SCL(194)
@SCL(194)
S
S
P1
P1
R
R
IR, SR, AR, DM, EM, HR, TC, LR, # P1: First parameter word IR, SR, AR, DM, EM, HR, TC, LR R: Result word IR, SR, AR, DM, EM, 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. SCL(194) is an expansion instruction. A Programming Device can be used to reassign function code 194 to another expansion instruction.
Description
SCL(194) is used to linearly convert a 4-digit hexadecimal value to a 4-digit BCD value. Unlike BCD(024), which converts a 4-digit hexadecimal value to its 4-digit BCD equivalent (Shex → SBCD), SCL(194) 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(194) is not executed. When the execution condition is ON, SCL(194) 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.
238
Page 251
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
BX
Value before conversion (Hexadecimal)
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. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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(194) DM 0100 DM 0150
Address
Instruction
00000 00001
LD @SCL(194)
00000 DM 0100 DM 0150 DM 0200
DM 0200
DM 0150 DM 0151 DM 0152 DM 0153
Operands
0010 0005 0050 0019
DM 0100
0100
DM 0200
0512
239
Page 252
Section 5-18
Data Conversion
5-18-13 COLUMN TO LINE – LINE(063) Operand Data Areas S: First word of 16 word source set
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR LINE(063)
@LINE(063)
S
S
C
C
D
D
C: Column bit designator (BCD)
Limitations
IR, SR, AR, DM, EM, HR, TC, LR, # D: Destination word IR, SR, AR, DM, EM, HR, TC, LR
S and S+15 must be in the same data area. C must be between #0000 and #0015. LINE(063) is an expansion instruction. A Programming Device can be used to reassign function code 063 to another expansion instruction.
Description
When the execution condition is OFF, LINE(063) is not executed. When the execution condition is ON, LINE(063) 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
. . .
. . .
. . . Bit 15
D
Flags
ER:
0
Bit 00
. . .
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). The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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(063) to move bit column 07 from the set (IR 100 to IR 115) to DM 0100.
00000 LINE(063) 100 #0007 DM 0100
240
Address
Instruction
00000 00001
LD LINE(063)
Operands 00000 100 #0007 DM 0100
Page 253
Section 5-18
Data Conversion
5-18-14 LINE TO COLUMN – COLM(064) Operand Data Areas S: Source word
Ladder Symbols
IR, SR, AR, DM, EM, HR, TC, LR COLM(064)
@COLM(064)
S
S
D
D
C
C
D: First word of the destination set
Limitations
IR, AR, DM, EM, HR, TC, LR, SR C: Column bit designator (BCD) IR, SR, AR, DM, EM, HR, TC, LR, #
D and D+15 must be in the same data area. C must be between #0000 and #0015. COLM(064) is an expansion instruction. A Programming Device can be used to reassign function code 064 to another expansion instruction.
Description
When the execution condition is OFF, COLM(064) is not executed. When the execution condition is ON, COLM(064) 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 15
S
Bit 00
.
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). The content of a word containing an indirect DM/EM address is not BCD or the DM/EM 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(064) 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(064) DM 0100 DM 0200 #0015
Address
Instruction
00000 00001
LD COLM(064)
Operands 00000 DM 0100 DM 0200 #0015
241