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

The text of a manual · part 43 of 68

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

Pages 394 to 403 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 394

Section 5-29

Advanced I/O Instructions

5-29-3 HEXADECIMAL KEY INPUT – HKY(212)

Ladder Symbols

Operand Data Areas IW: Input word

HKY(212) IR, SR, AR, DM, EM, HR, LR IW OW: Control signal output word OW

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

D

D: First register word IR, SR, AR, DM, EM, HR, LR

Limitations

D and D+2 must be in the same data area. HKY(212) is an expansion instruction. A Programming Device can be used to reassign function code 212 to another expansion instruction.

Overview

When the execution condition is OFF, HKY(212) is not executed. When the execution condition is ON, HKY(212) 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(212) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with HKY(212) whenever HKY(212) is used in a subroutine to ensure that the I/O points are refreshed each execution. Refer to page 387 for an example of this type of programming. HKY(212) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use HKY(212) more than twice in the program. HKY(212) cannot be used for I/O Units mounted to Slave Racks.

382

Page 395

Section 5-29

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.

383

Page 396

Section 5-29

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:

The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. D and D+2 are not in the same data area.

SR 25408: Example

ON while HKY(212) 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(212) 000 100 DM1000 00015 @XFER(070) #0002 DM1000 DM0000

The hexadecimal key information that is input to IR 000 by HKY(212) 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.

384

Page 397

Section 5-29

Advanced I/O Instructions

5-29-4 MATRIX INPUT – MTR(213) Ladder Symbols

Operand Data Areas IW: Input word

MTR(213) IR, SR, AR, DM, EM, HR, LR IW OW: Output word OW

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

D

D: First destination word IR, SR, AR, DM, EM, HR, LR

Limitations

D and D+3 must be in the same data area. MTR(213) is an expansion instruction. A Programming Device can be used to reassign function code 213 to another expansion instruction.

Overview

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

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

385

Page 398

Section 5-29

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(213) 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(213) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with MTR(213) whenever MTR(213) is used in a subroutine to ensure that the I/O points are refreshed each execution. MTR(213) 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(213) is being executed, is reset in an interlocked program section and MTR(213) is not executed in an interlocked program section. Do not use MTR(213) more than twice in the program. MTR(213) cannot be used for I/O Units mounted to Slave Racks.

386

Page 399

Section 5-29

Advanced I/O Instructions Example

The following examples shows programming MTR(213) in a scheduled subroutine, where IORF(097) is programmed to ensure that the I/O words used by MTR(213) are refreshed each time MTR(213) is executed. 25315 INT(089) 001 004 # 0002 INT(089) 000 004 # 0002

SBN(092)

99

25315 MTR(213) S D1 D2

IORF(097) D1 D2 RET(093) END(001)

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.

25403: SR 25403 is ON while MTR(213) is being executed.

5-29-5 7-SEGMENT DISPLAY OUTPUT – 7SEG(214) Ladder Symbols

Operand Data Areas S: First source word

7SEG(214) IR, SR, AR, DM, EM, HR, TC, LR S O: Output word O IR, SR, AR, DM, EM, HR, LR C

C: Control data 000 to 007

Limitations

S and S+1 must be in the same data area. DM 0000 to DM6143 can be used for O. Do not set C to values other than 000 to 007. 7SEG(214) is an expansion instruction. A Programming Device can be used to reassign function code 214 to another expansion instruction.

Overview

When the execution condition is OFF, 7SEG(214) is not executed. When the execution condition is ON, 7SEG(214) reads the source data (either 4 or 8-digit), converts it to 7-segment display data, and outputs that data to the 7-segment display connected to the output indicated by O.

387

Page 400

Section 5-29

Advanced I/O Instructions

The value of C indicates the number of digits of source data and the logic for the Input and Output Units, as shown in the following table. Source data 4 digits (S)

Display’s data input logic Same as Output Unit Different from Output Unit

8 digits (S, S+1)

Same as Output Unit Different from Output Unit

Display’s latch input logic Same as Output Unit Different from Output Unit Same as Output Unit Different from Output Unit Same as Output Unit Different from Output Unit Same as Output Unit Different from Output Unit

C 000 001 002 003 004 005 006 007

If there are 8 digits of source data, they are placed in S and S+1, with the most significant digits placed in S+1. If there are 4 digits of source data, they are placed in S. 7SEG(214) displays the 4 or 8-digit data in 12 cycles, and then starts over and continues displaying the data. The 7-segment display must provide four data lines and one latch signal line for each display digit. Note

1. Consider the cycle time and the characteristics of the 7-segment display when designing the system. 2. Output bits not used here can be used as ordinary output bits.

Precautions

I/O refreshing must be performed for all I/O points used by 7SEG(214) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with 7SEG(214) whenever 7SEG(214) is used in a subroutine to ensure that the I/O points are refreshed each execution. Refer to page 387 for an example of this type of programming. 7SEG(214) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use 7SEG(214) more than twice in the program. 7SEG(214) cannot be used for I/O Units mounted to Slave Racks.

Hardware

This instruction outputs word data to a 7-segment display. It utilizes either 8 output bits for 4 digits or 12 output bits for 8 digits. The 7-segment display is connected to an Output Unit as shown in the diagram below. For 4-digit display, the data outputs (D0 to D3) are connected to output points 0 through 3 (allocated word O), and latch outputs (CS0 to CS3) are connected to output points 4 through 7. Output point 12 (for 8-digit display) or output point 8 (for 4-digit dis-

388

Page 401

Section 5-29

Advanced I/O Instructions play) will be turned ON when one round of data is displayed, but there is no need to connect them unless required by the application. D0 D1 D2 D3 LE3

LE2

VDD (+) VSS (0) LE1 LE0

VDD (+) VSS (0) LE3

LE2

LE1

D0 D1 D2 D3 LE0 OD212 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 DC COM

The outputs must be connected from an Output Unit with 8 or more output points for four digits or 16 or more output points for eight digits. Basic Output, Special I/O, or High-density Output Units can be used. Note

Using the Instruction

1. Output Unit outputs normally employ negative logic. (Only the PNP output type employs positive logic.) 2. The 7-segment display may require either positive or negative logic, depending on the model. 3. The 7-segment display must have 4 data signal lines and 1 latch signal line for each digit. If the first word holding the data to be displayed is specified at S, and the output word is specified at O, and the SV taken from the table below is specified at C, then operation will proceed as shown below when the program is executed. If only four digits are displayed, then only word S will be used. Data Storage Format Leftmost 4 digits

Rightmost 4 digits

S+1

S

389

Page 402

Section 5-30

Special I/O Unit Instructions Timing

The timing of data output is shown in the following table. “O” is the first word holding display data and “C” is the output word. Bit(s) in O

Function

Output status (Data and latch logic depends on C)

(4 digits, 1 block)

(4 digits, 2 blocks)

00 to 03

00 to 03 04 to 07

Latch output 0

04

08

Latch output 1

05

09

Latch output 2

06

10

Latch output 3

07

11

One Round Flag

08

12

Data output

100

0

1

2

101

3

4

5

102

6

7

8

103

9

Note 0 to 3: Data output for word S 4 to 7: Data output for word S+1

10 11 12

12 cycles required to complete one round

Application Example

This example shows a program for displaying 8-digit BCD numbers at a 7-segment LED display. Assume that the 7-segment display is connected to output word IR 100. Also assume that the Output Unit is using negative logic, and that the 7-segment display logic is also negative for data signals and latch signals.

25313 (Always ON) 7SEG(214) DM0120 100 004

The 8-digit BCD data in DM 0120 (rightmost 4 digits) and DM 0121 (leftmost 4 digits) are always displayed by means of 7SEG(214). When the contents of DM 0120 and DM 0121 change, the display will also change.

Flags

ER:

S and S+1 are not in the same data area. (When set to display 8-digit data.) The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. There is an error in operand settings.

25409: SR 25409 will be ON while 7SEG(214) is being executed.

5-30 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.

390

Page 403

Section 5-30

Special I/O Unit Instructions

5-30-1 SPECIAL I/O UNIT READ – IORD(222) Operand Data Areas

Ladder Symbols

C: Control code IORD(222)

@IORD(222)

C

C

S

S

D

D

IR, SR, AR, DM, EM, HR, TC, LR, # S: Source information IR, SR, AR, DM, EM, HR, TC, LR, # D: First destination word IR, SR, AR, DM, EM, 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).

Description

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

Operands

IORD(222) C #3100 DM 0100

Flags

ER:

00000 C #3100 DM 0100

The last three digits of S (number of words specifier) isn’t BCD or isn’t within the range of 001 through 128. The content of a word containing an indirect DM/EM address is not BCD or the DM/EM area boundary has been exceeded. The source Unit’s unit number isn’t 0 to F or it is mounted on a Slave Rack. A Special I/O Unit that isn’t compatible with IORD(222) was specified. The instruction wasn’t completed normally. An error has occurred in the specified Unit or there was a verification error with the specified Unit. A handshake error occurred. The received data overflows a data area boundary.

EQ:

ON when the data was read successfully, otherwise OFF.

391