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

The text of a manual · part 37 of 60

C200HX/C200HG/C200HE Programmable Controllers Operation Manual, pages 354 to 363

Pages 354 to 363 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 354

Section 5-27

Serial Communications Instructions

Note Data is not output when the CTS and DSR signals are monitored. The specified number of bytes will be read from S through S+(N/2)–1, converted to ASCII, and transmitted through the specified port. The bytes of source data shown below will be transmitted in this order: 12345678... S S+1 S+2 S+3

MSB LSB 1 2 3 4 5 6 7 8

The following diagram shows the format for host link command (TXD) sent from the PC. Depending on their settings, the C200 HX/HG/HE and C200HS automatically attach the prefixes and suffixes, such as the node number, header, and FCS. @ X

X

Node number

X

X

X

X

.........

X

Header Data (122 ASCII characters max.) code (EX)

X

∗

X

FCS

CR

Terminator

RS-232C Mode

N must be BCD from #0000 to #0256. The value of the control word determines the port from which data will be output and the order in which data will be written to memory.

Control Word

The value of the control word determines the port from which data will be read and the order in which data will be written to memory.

Digit number:

3 2 1 0

Byte order

0: Most significant bytes first 1: Least significant bytes first

CTS and DSR signal monitoring (see note) 0: Don’t monitor CTS and DSR signals. 1: Monitor the CTS signal. (Output to bit 15 of D.) 2: Monitor the DSR signal. (Output to bit 15 of D.) 3: Monitor the CTS and DSR signals. (Output to bits 15 and 14 of D.) Auxiliary reception port 0: Internal RS-232C port 1: Communications port A 2: Communications port B Port

0: RS-232C port 1: Peripheral port

Note Data is not output when the CTS and DSR signals are monitored. The specified number of bytes will be read from S through S+(NP2)–1 and transmitted through the specified port. S S+1 S+2 S+3

336

MSB LSB 1 2 3 4 5 6 7 8

Page 355

Section 5-27

Serial Communications Instructions

When digit 0 of C is 0, the bytes of source data shown above will be transmitted in this order: 12345678... When digit 0 of C is 1, the bytes of source data shown above will be transmitted in this order: 21436587... Note When start and end codes are specified the total data length should be 256 bytes max., including the start and end codes. Flags

ER:

Another device is not connected to the peripheral port. There is an error in the communications settings (PC Setup) or the operand settings. Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) The source words (S to S+(N÷2)–1) exceed the data area.

26405: RS-232C Port Communications Enabled Flag 26413: Peripheral Port Communications Enabled Flag 26705: Host Link Unit #0 Communications Enabled Flag 26713: Host Link Unit #1 Communications Enabled Flag

5-27-3 CHANGE RS-232C SETUP – STUP(––) Operand Data Areas

Ladder Symbols

N: RS-232C port specifier STUP(––)

@STUP(––)

N

N

S

S

---

---

IR 000, IR 001, or IR 002 S: First source word IR, SR, AR, DM, HR, TC, LR, # The 3rd operand is ignored.

Limitations

N must be IR 000, IR 001, or IR 002. S and S+4 must be in the same data area. (S can be set to #0000 to change the RS-232C settings to their defaults.) STUP(––) can’t be executed for the internal RS-232C port if pin 2 of the DIP switch is ON. STUP(––) can’t be executed within an interrupt subroutine.

Description

When the execution condition is OFF, STUP(––) is not executed. When the execution condition is ON, STUP(––) changes the PC Setup settings for the port specified by N. N determines which part of the RS-232C Setup is changed. N

Specified Port

IR 000

Built-in RS-232C port (PC Setup: DM 6645 to DM 6649)

IR 001

Communications Board port A (PC Setup: DM 6555 to DM 6559)

IR 002

Communications Board port B (PC Setup: DM 6550 to DM 6554)

If S is a word address, the contents of S through S+4 are copied to the 5 words in the PC Setup that contain the settings for the port specified by N. If S is input as the constant #0000, the settings for the specified port are returned to their default values.

337

Page 356

Section 5-27

Serial Communications Instructions

Application Example

S

Function

Word address Constant (#0000)

The contents of S through S+4 are copied to the part of the PC Setup that contains the settings for the port specified by N. The settings for the port specified by N are returned to their default values.

This example shows a program that transfers the contents of DM 0100 through DM 0104 to the PC Setup area for Communications Board port A (DM 6555 through DM 6569). 00000

Address

Instruction

00000 00001

LD @STUP(––)

Operands

@STUP(––) 001 DM 0100

00000

000

DM

001 0100 000

The settings are transferred as shown below. The Changing RS-232C Setup Flag (SR 27504) will be turned OFF when the transfer has been completed. DM 0100

1001

DM 6555

1001

DM 0101

0803

DM 6556

0803

DM 0102

0000

DM 6557

0000

DM 0103

2000

DM 6558

2000

DM 0104

0000

DM 6559

0000

(Refer to 3-6-4 PC Setup for details.)

The following table shows the function of the transferred setup data. Word DM 0100

Content (see note) 1001

Function

DM 0101

0803

DM 0102

0000

Enables the communications settings in DM 0101 and sets the communications mode to RS-232C. Sets the following communications settings: 9,600 bps, 1 start bit, 8-bit data, 1 stop bit, no parity No transmission delay (0 ms)

DM 0103

2000

Enables the end code CR, LF.

DM 0104

0000

---

Note For details on the contents of setup data, refer to 3-6-4 PC Setup.

Flags

ER:

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) The port specifier (N) isn’t IR 000, IR 001, or IR 002. Port A has been specified, but pin 2 of the DIP switch is ON. The PC Setup is write-protected. (Pin 1 of the DIP switch is ON.) The specified source words exceed the data area. The instruction was executed from an interrupt program.

338

Page 357

Section 5-27

Serial Communications Instructions

5-27-4 PROTOCOL MACRO – PMCR(––) Operand Data Areas

Ladder Symbols

C: Control word PMCR(––)

@PMCR(––)

C

C

S

S

D

D

IR, SR, AR, DM, HR, TC, LR, # S: First output word IR, SR, AR, DM, HR, TC, LR, # D: First input word IR, SR, AR, DM, HR, TC, LR

Limitations

C must be BCD from #1000 to #2999. DM 6144 through DM 6655 cannot be used for D.

Description

When the execution condition is OFF, PMCR(––) is not executed. When the execution condition is ON, PMCR(––) calls and executes the specified communications sequence (protocol data) that has been registered in the Communications Board installed in the PC. The send/receive message for the communications sequence registered in the Communications Board must be set to read or write word data when DM isn’t specified for S and D. Use a constant when it isn’t necessary to set a word for the first output word. When the communications sequence doesn’t require an input word, specify a word address anyway. Data won’t be stored in the specified word and the contents of the word will be retained. When the communications sequence does require input words, specify words that aren’t used for any other purpose in the program. The input and output words (S and D) can also be set in the communications sequence registered in the Communications Board. Note Refer to the Communications Board Operation Manual for details on the Communications Boards and the Protocol Software Operation Manual for details on communications sequences.

Control Word

The first digit of the control word (1 or 2) specifies the Communications Board port and the last three digits specify the communications sequence (000 to 999), as shown in the following diagram. C: Digits 2 to 4: Communications sequence number (000 to 999) Digit 1: Port specifier 1: Communications port A 2: Communications port B

Flags

ER:

Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) D is not BCD or DM 6144 through DM 6655 has been used for D. Another PMCR(––) instruction was already in progress when the instruction was executed. The port specifier was not 1 or 2.

339

Page 358

Section 5-28

Advanced I/O Instructions Example

When IR 00000 is ON and SR 28908 (the Communications Board Port A Instruction Execution Flag) is OFF, communications sequence 100 is called in the Communications Board and data is transferred through Communications Board port A. Send data is read from the range of words beginning at DM 0000 (the first output word) and reception data is stored in the range of words beginning at DM 0010 (the first input word). 00000

28908 PMCR #1100 DM0000

Address

Instruction

00200 00201 00202

LD AND NOT PMCR(––)

Operands 00000 28908 # DM DM

DM0010

1100 0000 0010

5-28 Advanced I/O Instructions Advanced I/O instructions enable control, with a single instruction, of previously complex operations involving external I/O devices (digital switches, 7-segment displays, etc.). There are five advanced I/O instructions, as shown in the following table. All of these are expansion instructions and must be assigned to function codes before they can be used. Name

Mnemonic

Function

7-SEGMENT DISPLAY OUTPUT

7SEG(––)

DIGITAL SWITCH INPUT

DSW(––)

BCD output to 7-segment display Data input from a digital switch

HEXADECIMAL KEY INPUT

HKY(––)

TEN-KEY INPUT

TKY(––)

Hexadecimal input from 16-key keypad BCD input from 10-key keypad

MATRIX INPUT

MTR(––)

Data input from an 8 x 8 matrix

Although TKY(––) is used only to simplify programming, the other advanced I/O instructions can be used to shorten cycle time, reduce the need for Special I/O Units, and reduce system cost. With the exception of TKY(––), however, the advanced I/O instructions can only be used once each in the program and cannot be used for I/O Units mounted to Slave Racks, where Special I/O Units must be used.

5-28-1 7-SEGMENT DISPLAY OUTPUT – 7SEG(––) Ladder Symbols

Operand Data Areas S: First source word

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

C: Control data 000 to 007

Limitations

340

S and S+1 must be in the same data area. DM 0000 to DM6143 can be used for O.

Page 359

Section 5-28

Advanced I/O Instructions Do not set C to values other than 000 to 007. Overview

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

Display’s data input logic

Display’s latch input logic

4 digits (S)

Same as Output Unit

Same as Output Unit Different from Output Unit Same as Output Unit Different from Output Unit

000 001 002 003

Same as Output Unit Different from Output Unit Same as Output Unit Different from Output Unit

004 005 006 007

Different from Output Unit 8 digits (S, S+1)

Same as Output Unit Different from Output Unit

C

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(––) 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(––) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with 7SEG(––) whenever 7SEG(––) 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. 7SEG(––) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use 7SEG(––) more than twice in the program. 7SEG(––) 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-

341

Page 360

Section 5-28

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

342

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

Page 361

Section 5-28

Advanced I/O 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(––) 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(––). 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.) Indirectly addressed DM word is non-existent. (Content of word is not BCD, or the DM area boundary has been exceeded.) There is an error in operand settings.

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

5-28-2 DIGITAL SWITCH INPUT – DSW(––) Ladder Symbols

Operand Data Areas IW: Input word

DSW(––) IR, SR, AR, DM, HR, LR IW OW: Output word OW R

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

343

Page 362

Section 5-28

Advanced I/O Instructions Overview

DSW(––) is used to read the value set on a digital switch connected to I/O Units. When the execution condition is OFF, DSW(––) is not executed. When the execution condition is ON, DSW(––) reads the 8-digit value set on the digital switch from IW and places the result in R. The 8-digit value it is placed in R and R+1, with the most significant digits placed in R+1. DSW(––) reads the 8-digit value in 20 executions, and then starts over and continues reading the data. The digital switch must provide four data lines and one latch signal line and read signal line for each digit being input.

Precautions

I/O refreshing must be performed for all I/O points used by DSW(––) each time it is executed to ensure effective operation. The I/O REFRESH instruction must thus be used with DSW(––) whenever DSW(––) 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. DSW(––) will be executed from the first cycle whenever program execution is started, including restarts made after power interruptions. Do not use DSW(––) more than twice in the program. DSW(––) cannot be used for I/O Units mounted to Slave Racks. Note Input and output bits not used here can be used as ordinary input and output bits.

Hardware

With this instruction, 8-digit BCD set values are read from a digital switch. DSW(––) utilizes 5 output bits and 8 input bits. Connect the digital switch and the Input and Output Units as shown in the diagram below. Output point 5 will be turned ON when one round of data is read, but there is no need to connect output point 5 unless required for the application.

ID212 1 3 5 7 9 11 13 15 COM

0

Input Unit D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD

2 4 6 8 10 12 14

3 5 7 9 11 13 15 COM

344

D0 D1 D2 D3 D0 D1 D2 D3 CS0 CS1 CS2 CS3 RD

A7E data line rightmost digits A7E A7E data line leftmost digits

Leftmost digits

Rightmost digits

To A7E chip selection To A7E RD terminal

COM

Note An interface to convert signals from 5 V to 24 V is required to connect an A7E digital switch.

OD212 1

Interface

0 2 4 6 8 10 12 14 COM

Output Unit

Page 363

Section 5-28

Advanced I/O Instructions

The following example illustrates connections for an A7B Thumbwheel Switch. ID212

Input Unit

0 1 2 3 4 5 6 7 8 9

A7B Thumbwheel Switch

10 11 12

8 4 2 1

13 14

OD212

15 COM COM

Switch no. 8

7

6

5

4

3

2

1

C

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

Output Unit

15 DC COM

Note The data read signal is not required in the example.

The inputs must be connected to a DC Input Unit with 8 or more input points and the outputs must be connected from a Transistor Output Unit with 8 or more output points.

345