The text of a manual · part 38 of 60
C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 364 to 373
Pages 364 to 373 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 364
Section 5-28
Advanced I/O Instructions Using the Instruction
If the input word for connecting the digital switch is specified at for word A, and the output word is specified for word B, then operation will proceed as shown below when the program is executed.
IW Four digits: 00 to 03 100
101
102
Input data Leftmost 4 digits
103
Eight digits: 00 to 03, 04 to 07 Wd 0
D+1
Rightmost 4 digits D
00 When only 4 digits are read, only word D is used.
01
CS signal
02 03 04
RD (read) signal
05
1 Round Flag 0
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15 16
16 cycles to complete one round of execution
Application Example
This example shows a program for reading 8 digits in BCD from the digital switch. Assume that the digital switch is connected to IR 000 (input) and IR 100 (output). 00015
10005 05000
05000
05000 DSW 000 100 HR51 10005 @MOV(21) HR51 DM0000
When IR 00015 turns ON, the IR 05000 will hold itself ON until the One Round Flag (IR 10005) turns ON upon completion of one round of reading by DSW(––). The data set from the digital switch by DSW(––) is stored in HR 51. When the One Round Flag (10005) turns ON after reading has been completed, the number stored in HR 51 is transferred to DM 0000. Flags
ER:
Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) R and R+1 are not in the same data area.
25410: ON while DSW(––) is being executed.
346
Page 365
Section 5-28
Advanced I/O Instructions
5-28-3 HEXADECIMAL KEY INPUT – HKY(––)
Ladder Symbols
Operand Data Areas IW: Input word
HKY(––) IR, SR, AR, DM, HR, LR IW OW: Control signal output word OW D
IR, SR, AR, DM, HR, LR D: First register word IR, SR, AR, DM, HR, LR
Limitations
D and D+2 must be in the same data area.
Overview
When the execution condition is OFF, HKY(––) is not executed. When the execution condition is ON, HKY(––) inputs data from a hexadecimal keypad connected to the input indicated by IW. The data is input in two ways: 1, 2, 3...
1. An 8-digit shift register is created in D and D+1. When a key is pressed on the hexadecimal keypad, the corresponding hexadecimal digit is shifted into the least significant digit of D. The other digits of D, D+1 are shifted left and the most significant digit of D+1 is lost. 2. The bits of D+2 and bit 4 of OW indicate key input. When one of the keys on the keypad (0 to F) is being pressed, the corresponding bit in D+2 (00 to 15) and bit 4 of OW are turned ON.
Note
1. When one of the keypad keys is being pressed, input from the other keys is disabled. 2. Input and output bits not used here can be used as ordinary input and output bits. With this instruction, one key input is read in 4 to 13 cycles. More than one cycle is required because the ON keys can only be determined as the outputs are turned ON to test them. The hexadecimal key input device must be connectable in a 4 x 4 matrix.
Precautions
I/O refreshing must be performed for all I/O points used by HKY(––) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with HKY(––) whenever HKY(––) is used in a subroutine to ensure that the I/O points are refreshed each execution. Refer to page 354 for an example of this type of programming. HKY(––) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use HKY(––) more than twice in the program. HKY(––) cannot be used for I/O Units mounted to Slave Racks.
347
Page 366
Section 5-28
Advanced I/O Instructions Hardware
This instruction inputs 8 digits in hexadecimal from a hexadecimal keyboard. It utilizes 5 output bits and 4 input bits. Prepare the hexadecimal keyboard, and connect the 0 to F numeric key switches, as shown below, to input points 0 through 3 and output points 0 through 3. Output point 4 will be turned ON while any key is being pressed, but there is no need to connect it unless required by the application. OD212
C
D
E
F
8
9
A
B
0 1 2 3
4
5
6
7
4 5
0
1
2
3
6 7
ID212
8 9
0 1
10 11
2 3 4 5
12 13 14 15
6 7
COM COM
8 9 10 11
Output Unit 12
13 14 15 COM COM
Input Unit
The inputs connected to the input terminals must be on a DC Input Unit with 8 or more input points and the outputs connected to the output terminals must be from a Transistor Output Unit with 8 points or more.
348
Page 367
Section 5-28
Advanced I/O Instructions Using the Instruction
If the input word for connecting the hexadecimal keyboard is specified at word A, and the output word is specified at word B, then operation will proceed as shown below when the program is executed.
IW 00 01 02 03 16-key 0 to 9 to F
16-key selection control signals
Status of 16 keys
D+2 00 to 09 to 15 OW 04
Turn ON flags corresponding to input keys (The flags remain ON until the next input.) ON for a 12-cycle period if a key is pressed.
0 1 2 3 4 5 6 7 8 9 101112 Once per 12 cycles
Flags
0000
0000
0000
000F
0000
00F9
D+1
D
D+1
D
D+1
D
ER:
Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) D and D+2 are not in the same data area.
SR 25408: Example
ON while HKY(––) is being executed.
This example shows a program for inputting numbers from a hexadecimal keyboard. Assume that the hexadecimal keyboard is connected to IR 000 (input) and IR 100 (output).
25313 (Always ON) HKY(––) 000 100 DM1000 00015 @XFER(70) #0002 DM1000 DM0000
The hexadecimal key information that is input to IR 000 by HKY(––) is converted to hexadecimal and stored in words DM1000 and DM1001. IR 00015 is used as an “ENTER key,” and when IR 00015 turns ON, the numbers stored in DM 1000 and DM 1001 are transferred to DM 0000 and DM 0001.
349
Page 368
Section 5-28
Advanced I/O Instructions
5-28-4 TEN KEY INPUT – TKY(––) Ladder Symbols
Operand Data Areas IW: Input word
TKY(––) IR, SR, AR, DM, HR, LR IW D1: First register word D1
IR, SR, AR, DM, HR, LR
D2
D2: Key input word IR, SR, AR, DM, HR, LR
Limitations
D1 and D1+1 must be in the same data area.
Overview
When the execution condition is OFF, TKY(––) is not executed. When the execution condition is ON, TKY(––) inputs data from a ten-key keypad connected to the input indicated by IW. The data is input in two ways: TKY(––) can be used in several locations in the program by changing the input word, IW. 1, 2, 3...
1. An 8-digit shift register is created in D1 and D1+1. When a key is pressed on the ten-key keypad, the corresponding BCD digit is shifted into the least significant digit of D1. The other digits of D1, D1+1 are shifted left and the most significant digit of D1+1 is lost. 2. The first ten bits of D2 indicate key input. When one of the keys on the keypad (0 to 9) is being pressed, the corresponding bit of D2 (00 to 09) is turned ON.
Note
1. While one key is being pressed, input from other keys will not be accepted. 2. If more than eight digits are input, digits will be deleted beginning with the leftmost digit. 3. Input bits not used here can be used as ordinary input bits.
Hardware
This instruction inputs 8 digits in BCD from a 10-key keypad and uses 10 input points. Prepare a 10-key keypad, and connect it so that the switches for numeric keys 0 through 9 are input to points 0 through 9 as shown in the following diagram. The inputs on a DC Input Unit with 16 or more input points can be used. ID212
0
0 1 2 3 4 5 6 7 8 9 10
9
11 12 13
10-key
14 15 COM COM
DC Input Unit
350
0V
Page 369
Section 5-28
Advanced I/O Instructions Using the Instruction
If the input word for connecting the 10-key keypad is specified for IW, then operation will proceed as shown below when the program is executed.
IW D1+1
00 01 02
D1
Before execution
0
0
0
0
0
0
0
0
(1)
0
0
0
0
0
0
0
1
Input from 10-key to 09
“1” key input D2 (2) 00
0
0
0
0
0
01 Turn ON flags corresponding to 10-key inputs (The flags remain ON until the next input.)
02 to
1
0
“0” key input (3)
0
0
0
0
0
1
0
2
“2” key input
09 (4)
0
0
0
0
1
0
2
9
ON if a key is pressed.
10 (1)
Flags
0
(2)
(3)
“9” key input
(4)
ER:
Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) D1 and D1+1 are not in the same data area.
Example
In this example, a program for inputting numbers from the 10-key is shown. Assume that the 10-key is connected to IR 000.
25313 (Always ON) TKY(––) 000 DM1000 DM1002 00015 @XFER(70) #0002 DM1000 DM 0000
The 10-key information input to IR 000 using TKY(––) is converted to BCD and stored in DM 1000 and DM 1001. Key information is stored in DM 1002. IR 00015 is used as an “ENTER key,” and when IR 00015 turns ON, the data stored in DM 1000 and DM 1001 will be transferred to DM 0000 and DM 0001.
351
Page 370
Section 5-28
Advanced I/O Instructions
5-28-5 MATRIX INPUT – MTR(––) Ladder Symbols
Operand Data Areas IW: Input word
MTR(––) IR, SR, AR, DM, HR, LR IW OW: Output word OW
IR, SR, AR, DM, HR, LR
D
D: First destination word IR, SR, AR, DM, HR, LR
Limitations
D and D+3 must be in the same data area.
Overview
When the execution condition is OFF, MTR(––) is not executed. When the execution condition is ON, MTR(––) inputs data from an 8 × 8 matrix and records that data in D to D+3. Data for all 64 points in the matrix will be recorded even when fewer than 64 keys are connected.
00 01 OW bits 00 to 07 (for Output Unit outputs 00 to 07)
02 03 04 05 06 07
Bit 08 is turned ON to indicate that the entire matrix has been read.
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
08 00 01 02 03 04 05 06 07 IW bits 00 to 07 (for Input Unit inputs 00 to 07)
Key input data is written to D through D+3 (see table below).
A selection signal is output to OW bits 00 to 07 consecutively for 3 cycles. Only one output bit will be turned on at a time. Bit 08 of OW is turned ON for 3 cycles after 07 to indicate when each round of reading the matrix has been completed. When one of the 64 keys is pressed, an input will be received at one of the input bits. The key that was pressed is identified by comparing the output bit to which the signal was output and input bit at which it was received. When an key input is detected, the corresponding bit in D through D+3 is turned ON. The following table shows the correspondence between keys and bits in D through D+3. Word
352
Bits
Corresponding Keys
D
00 to 15
0 to 15
D+1
00 to15
16 to 31
D+2
00 to 15
32 to 47
D+3
00 to 15
48 to 63
Page 371
Section 5-28
Advanced I/O Instructions Hardware
This instruction inputs up to 64 signals from an 8 x 8 matrix using 8 input points and 8 output points. Any 8 x 8 matrix can be used. The inputs must be connected through a DC Input Unit with 8 or more points and the outputs must be connected through a Transistor Output Unit with 8 or more points. The basic wiring and timing diagrams for MTR(––) are shown below. Wiring 8th row
7th row A8 A7 A6 A5 A4 A3 A2 A1 A0 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0
1st row
A9 A8 A7 A6 A5 A4 A3 A2 A1 A0
ID 211 I/O Unit
Timing Diagram
00 01 02 03 04 05 06 07 00 32 64 00 32 64 06
Matrix select signal
Matrix status
Bits indicating input status One-round Flag (bit 08 of output word) Each round completed in 24 executions
Precautions
The 64 keys can be divided into 8 rows (including a row for OW bit 08) which are scanned consecutively. Since each row is scanned for 3 cycles, a delay of up to 25 cycles can occur before a given row of keys is scanned for inputs. I/O refreshing must be performed for all I/O points used by MTR(––) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with MTR(––) whenever MTR(––) is used in a subroutine to ensure that the I/O points are refreshed each execution. MTR(––) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. SR 25403, which is turned on while MTR(––) is being executed, is reset in an interlocked program section and MTR(––) is not executed in an interlocked program section. Do not use MTR(––) more than twice in the program. MTR(––) cannot be used for I/O Units mounted to Slave Racks.
353
Page 372
Section 5-29
Special I/O Unit Instructions Example
The following examples shows programming MTR(––) in a scheduled subroutine, where IORF(97) is programmed to ensure that the I/O words used by MTR(––) are refreshed each time MTR(––) is executed. INT(89) 001 004 # 0002 INT(89) 000 004 # 0002
SBN(92)
99
MTR(––) S D1 D2
IORF(97) D1 D2 RET(93) END(01)
Flags
Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.)
ER:
25403: SR 25403 is ON while MTR(––) is being executed.
5-29 Special I/O Unit Instructions The Special I/O Unit instructions are used to transfer data to and from the memory of the specified Special I/O Unit.
5-29-1 SPECIAL I/O UNIT READ – IORD(––) Operand Data Areas
Ladder Symbols
C: Control code IORD(––)
@IORD(––)
C
C
S
S
D
D
IR, SR, AR, DM, HR, TC, LR, # S: Source information IR, SR, AR, DM, HR, TC, LR, # D: First destination word IR, SR, AR, DM, HR, TC, LR
Limitations
Only Special I/O Units mounted to the PC’s CPU Rack or Expansion I/O Racks can be specified. The last three digits of S must be BCD (from 001 to 128).
354
Page 373
Section 5-29
Special I/O Unit Instructions Description
When the execution condition is OFF, IORD(––) is not executed. When the execution condition is ON, IORD(––) transfers data from the specified Special I/O Unit’s memory to words beginning at D. The source information provides the node number of the Special I/O Unit and the number of words to be read, as shown in the following diagram. S: Digits 2 to 4: Number of words to read (001 to 128) Digit 1: Node number of the Special I/O Unit (0 to F)
The control code (C) depends on the Special I/O Unit being specified. Refer to the Unit’s Operating Manual for details. Example
When IR 00000 goes from OFF to ON, the following instruction transfers 100 words from the memory area of Special I/O Unit number 3 to DM 0100 through DM 0199. 00000
Address
Instruction
00200 00201
LD @IORD(––)
Operands
IORD(––) C #3100
00000
DM 0100
DM
Flags
ER:
C #3100 0100
The last three digits of S (number of words specifier) isn’t BCD or isn’t within the range of 001 through 128. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) The source Unit’s unit number isn’t 0 to F or it is mounted on a Slave Rack. The received data overflows a data area boundary.
EQ:
ON when the data was read successfully, otherwise OFF.
5-29-2 SPECIAL I/O UNIT WRITE – IOWR(––) Operand Data Areas
Ladder Symbols
C: Control code IOWR(––)
@IOWR(––)
C
C
S
S
D
D
IR, SR, AR, DM, HR, TC, LR, # S: First source word IR, SR, AR, DM, HR, TC, LR D: Destination information IR, SR, AR, DM, HR, TC, LR, #
Limitations
Only Special I/O Units mounted to the PC’s CPU Rack or Expansion I/O Racks can be specified. The last three digits of D must be BCD (from 001 to 128).
355