The text of a manual · part 53 of 68
Programmable Controllers C200HX-CPU-ZE, C200HG-CPU-ZE, C200HE-CPU-ZE Operation Manual: SECTION 8 Serial Communications, pages 477 to 485
Pages 477 to 485 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 477
Section
RS-232C Communications
8-3
The default values are assumed for all of the PC Setup (i.e., the RS-232C port is used in Host Link mode, the node number is 00, and the standard communications parameters are used.)
00100 SR 26405 @TXD DM 0000 #0000 #0010
8-3
If SR 26405 (the Transmit Ready Flag) is ON when IR 00100 turns ON, the ten bytes of data (DM 0000 to DM 0004) will be transmitted.
RS-232C Communications This section explains RS-232C communications. The TXD(236) and RXD(235) instructions can be used with RS-232C communications to output data to a printer, input data from a bar code reader or transmit Host Link commands to other devices equipped with an RS-232C port.
RS-232C Connection
The following diagram shows the RS-232C connection when the RS-232C port is used in RS-232C mode (no protocol).
Device equipped with RS-232C mode an RS-232C port
PC Setup Parameters
The following parameters in the PC Setup must be set in advance to enable RS-232C mode communications through the RS-232C or peripheral ports. Communications Mode Set the communications mode to RS-232C mode. RS-232C port: Set bits 12 through 15 of DM 6645 to 1. Peripheral port: Set bits 12 through 15 of DM 6650 to 1. Standard Port Settings Standard settings or custom settings can be used for the RS-232C and peripheral ports. Refer to page 462 for details on the standard communications settings. Custom Port Settings Standard settings or custom settings can be used for the RS-232C and peripheral ports. Refer to page 463 for details on custom communications settings. Enabling Start and End Codes DM 6648: RS-232C port DM 6653: Peripheral port
Bit
15
0
0
End code usage 0: Not set (Amount of reception data specified.) 1: Set (End code specified.) 2: CR/LF Start code usage 0: Not set 1: Set (Start code specified.) Defaults: No start code; data reception complete at 256 bytes.
468
0
Page 478
Section
RS-232C Communications
8-3
Specify whether or not a start code is to be set at the beginning of the data, and whether or not an end code is to be set at the end. Instead of setting the end code, it is possible to specify the number of bytes to be received before the reception operation is completed. Both the codes and the number of bytes of data to be received are set in DM 6649 or DM 6654. Setting the Start Code, End Code, and Amount of Reception Data Bit 15
0
DM 6649: RS-232C port DM 6654: Peripheral port
End code or number of bytes to be received For end code: (00 to FF) For amount of reception data: 2 digits hexadecimal, 00 to FF (00: 256 bytes) Start code 00 to FF Defaults: No start code; data reception complete at 256 bytes.
8-3-1 Communications Frame Structure Up to 259 bytes of data (including the start and end codes) can be transferred with the execution of one TXD(236) or RXD(235) instruction. When there are two or more start codes, the first start code will be used. Likewise, when there are two or more end codes, the first end code will be used. Avoid using commonly occurring characters for the end code. Use CR and LF for the end code if data transmissions are being cut short because the end code is occurring within the body of the transmission data. • No start code and end code Data (specified number of bytes)
• Start code only ST
Data (specified number of bytes)
• End code only Data (256 bytes or less)
ED
• Both start code and end code ST
Data (257 bytes or less)
ED
• CR, LF specified for the end code Data (258 bytes or less)
CR
LF
CR
LF
• Both start code (00 to FF) and end code (CR, LF) ST
Data (259 bytes or less)
8-3-2 Communications Procedure Brief descriptions of the TXD(236) and RXD(235) are provided below. Transmission (TXD(236))
1, 2, 3...
Refer to 5-28-2 TRANSMIT – TXD(236) for more details. Always include the specified port’s Transmit Ready Flag as an execution condition for TXD(236) to ensure that this Flag is ON before the transmission can be executed. 1. Check to see that SR 26405 (RS-232C Port Transmit Ready Flag), SR 26413 (Peripheral Port Transmit Ready Flag), SR 28305 (Communications Board Port A Transmit Ready Flag), or SR 28313 (Communications Board Port B Transmit Ready Flag) is ON.
469
Page 479
Section
RS-232C Communications
8-3
2. Use the TXD(236) instruction to transmit the data. (Bits 08 to 11 are valid only when bits 12 to 15 are set to 0.) (@)TXD
S: Address of first word of data to be transmitted S C N
C: Control data Bits 00 to 03 0: Leftmost bytes first 1: Rightmost bytes first Bits 04 to 07 0: Normal data transmission operation 1: Status of bit 15 for the leftmost word of the transmission data is reflected on the RTS of the corresponding port. 2: Status of bit 15 for the leftmost word of the transmission data is reflected on the DTR of the corresponding port. 3: Statuses of bits 14 and 15 for the leftmost word of the transmission data are reflected on the RTS and DTR of the corresponding port. Bits 08 to 11 0: Built-in RS-232C port 1: Communications Board port A 2: Communications Board port B Bits 12 to 15 0: RS-232C port 1: Peripheral port 2: Host Link Unit #1 3: Host Link Unit #2 N: Number of bytes to be transmitted (4 digits BCD), 0000 to 0256 (start and end bits)
3. From the time this instruction is executed until the data transmission is complete, the Transmit Ready Flag (SR 26405, SR 26413, SR 28305, or SR 28313) will remain OFF. It will turn ON again upon completion of the data transmission. Reception (RXD(235)) 1, 2, 3...
Refer to 5-28-1 RECEIVE – RXD(235) for more details. 1. Check to see that SR 26406 (RS-232C Port Reception Completed Flag) or SR 26414 (Peripheral Port Reception Completed Flag) is ON. 2. Use the RXD(235) instruction to receive the data. (Bits 08 to 11 are valid only when bits 12 to 15 are set to 0.) (@)RXD
D: Leading word no. for storing reception data D C N
C: Control data Bits 00 to 03 0: Leftmost bytes first 1: Rightmost bytes first Bits 04 to 07 0: Normal data reception operation 1: Reads the status of CTS of the corresponding port into bit 15 for the leftmost word of the reception data write. 2: Reads the status of DSR of the corresponding port into bit 15 for the leftmost word of the reception data write. 3: Reads the statuses of CTS and DSR of the corresponding port into bits 14 and 15 for the leftmost word of the reception data write. Bits 08 to 11 0: Built-in RS-232C port 1: Communications Board port A 2: Communications Board port B Bits 12 to 15 0: RS-232C port 1: Peripheral port N: Number of bytes stored (4 digits BCD), 0000 to 0256 (start and end bits)
470
Page 480
Section
RS-232C Communications
8-3
3. When RXD(235) is executed, the received data is transferred to the specified words (without the start and end codes) and the Reception Completed Flag is turned OFF. The start and end of reception are as follows: Start: Continuous reception status if the start code is not enabled. Reception starts when the start code is received if it is enabled. End: Reception ends when the end code is received or 259 bytes of data have been received. 4. The status resulting from reading the data received will be stored in the SR Area. Check to see that the operation was successfully completed. The contents of these bits will be reset each time RXD(235) is executed. RS-232C
Peripheral
Error
SR 26400 to SR 26403
SR 26408 to SR 26411
Communications port error code (1 digit BCD) 0: Normal completion 1: Parity error 2: Framing error 3: Overrun error
SR 26404
SR 26412
Communications Error Flag
SR 26407
SR 26415
Reception Overrun Flag (After reception was completed, the subsequent data was received before the data was read by means of the RXD instruction.)
SR 265
SR 266
Number of bytes received (not including start and end bits)
Note To reset the RS-232C port (i.e., to restore the initial status), turn ON SR 25209. To reset the Communications Board port A, turn ON SR 28900. To reset the Communications Board port B, turn ON SR 28901. These bits will turn OFF automatically after the reset.
8-3-3 Application Example This example shows a program for using the RS-232C port in the RS-232C mode to transmit 10 bytes of data (DM 0100 to DM 0104) to the computer, and to store the data received from the computer in the DM area beginning with DM 0200. Before executing the program, the following PC Setup settings must be made. DM 6645: 1000 (RS-232C port in RS-232C mode; standard settings) DM 6648: 2000 (No start code; end code CR/LF) The default values are assumed for all other PC Setup settings. The host computer must have the same communications settings and a program to receive the data transmitted from the PC. The data 3454 is stored in each word from DM 0100 to DM 0104. 00100 DIFU(013)
00101
00101 SR 26405 @TXD DM 0100 #0000
If SR 26405 (the Transmit Ready Flag) is ON when IR 00100 turns ON, the ten bytes of data (DM 0100 to DM 0104) will be transmitted, leftmost bytes first.
#0010 SR 26406 @RXD DM 0200 #0000 #0265
When SR 26406 (Reception Completed Flag) goes ON, the number of bytes of data specified in SR 265 will be read from the PC’s reception buffer and stored in memory starting at DM 0200, leftmost bytes first.
The data will be as follows: “34543454345434543454CR LF”
471
Page 481
Section
One-to-one PC Links
8-4
8-4
One-to-one PC Links If two PCs are linked one-to-one by connecting them together through their RS-232C ports, they can share common LR areas. When two PCs are linked one-to-one, one of them will serve as the master and the other as the slave. As shown in the diagram below, when data is written into a word the LR area of one of the linked Units, it will automatically be written identically into the same word of the other Unit. Each PC has specified words to which it can write and specified words that are written to by the other PC. Each can read, but cannot write, the words written by the other PC.
CPU
PS
CPU
C200HX/HG/HE
C200HX/HG/HE
Master Master area
PS
Slave 1
Write “1”
Master area
Written automatically. Slave area
Wiring
1
1
Write Slave area
Wire the cable as shown in the diagram below using the connector listed. Applicable Connectors The following connectors are applicable. One plug and one hood are included with the CPU Unit. The same connectors can be used for both ends of the cable. Plug: XM2A-0901 (OMRON) or equivalent Hood: XM2S-0911 (OMRON) or equivalent
C200HX/HG/HE
C200HX/HG/HE, C200HS, or CQM1
Signal Abbr.
Pin No.
Pin No.
Signal Abbr.
FG
1
1
FG
SD
2
2
SD
RD
3
3
RD
RS
4
4
RS
CS
5
5
CS
–
6
6
–
–
7
7
–
–
8
8
–
SG
9
9
SG
Note Ground the FG terminal of the PC to a resistance of 100 Ω or less.
472
Page 482
Section
One-to-one PC Links PC Setup
8-4
To use a 1:1 link, the only settings necessary are the communications mode and the link words. Set the communications mode for one of the PCs to one-to-one link master and the other PC to one-to-one link slave, and then set the link words in the PC designated as the master. Bits 08 to 11 are valid only for the master for link one-to-one. Bit 15
0
DM 6645: RS-232C port
Communications mode 2: One-to-one link slave 3: One-to-one link master Link words for one-to-one link 0: LR 00 to LR 63 1: LR 00 to LR 31 2: LR 00 to LR 15 Port settings 00: Standard communication parameters
The word used by each PC will be as shown in the following table, according to the settings for the master, slave, and link words. DM 6645 setting
LR 00 to LR 63
LR 00 to LR 31
LR 00 to LR 15
Master words
LR00 to LR31
LR00 to LR15
LR00 to LR07
Slave words
LR32 to LR63
LR16 to LR31
LR08 to LR15
Communications Procedure
If the settings for the master and the slave are made correctly, then the one-toone link will start up automatically when the PCs are turned ON.
Application Example
This example shows a program for verifying the conditions for executing a oneto-one link using the RS-232C ports. Before executing the program, set the following PC Setup parameters. Master: DM 6645: 3200 (one-to-one link master; link words: LR 00 to LR 15) Slave: DM 6645: 2000 (one-to-one link slave) When the following programs are executed in the master and the slave, the status of IR 001 of each Unit will be reflected in IR 100 of the other Unit. IR 001 is an input word and IR 100 is an output word. In the Master 25313 (Always ON) MOV(021) 001 LR00
MOV(021) LR08 100
In the Slave 25313 (Always ON) MOV(021) 001 LR08
MOV(021) LR00 100
473
Page 483
Section
NT Links
8-5
8-5
NT Links A one-to-one NT link that uses NT link commands can be established by connecting the RS-232C port of the PC to the RS-232C port of a Programmable Terminal (PT). A one-to-N NT link that uses NT link commands can be established by connecting the PC and Programmable Terminal (PT) with RS-422/485 cable.
One-to-one NT Links
The following diagram shows the connections for a one-to-one NT link.
One-to-N NT Links
The following diagram shows the connections for a one-to-N NT link. Up to 8 Programmable Terminals can be connected unless the PC is a With a up to 4 Programmable Terminals can be connected (including connections through a Communications Board). See note
Note:
1:N NT link RS-422/485
RS-232C ↔ RS-422/485 Adapter
The following table shows the maximum number of PTs that can be connected to each port. PC
474
RS-232C port
C200HE
4
Communications port A 4
C200HX/HG
8
8
Communications port B 4 8
Page 484
Section
The Protocol Macro Function PC Setup
8-6
Make the following settings when establishing an NT link. Link Port One-to-one Built-in RS-232C port Communications Board port B Communications Board port A One-to-N Built-in RS-232C port
Setting Set bits 12 to 15 of DM 6645 to 4. Set bits 12 to 15 of DM 6550 to 4. Set bits 12 to 15 of DM 6555 to 4. Set bits 12 to 15 of DM 6645 to 5. Set the max. node number (1 to 7) in bits 08 to 11 of DM 6545 (1 to 3 for the C200HE).
Communications Board port B
Set bits 12 to 15 of DM 6550 to 5. Set the max. node number (1 to 7) in bits 08 to 11 of DM 6550 (1 to 3 for the C200HE).
Communications Board port A
Set bits 12 to 15 of DM 6555 to 5. Set the max. node number (1 to 7) in bits 08 to 11 of DM 6555 (1 to 3 for the C200HE).
Restrictions on Use
If the C200H-OV001 Voice Unit is being used, the 1:N mode cannot be used with the RS-232 port. In that case, either use the NT Link in 1:1 mode or use the 1:N mode with the port on the communications board.
Applications
Refer to the documentation provided for the NT Link Interface Unit for details on actual NT link applications.
8-6
The Protocol Macro Function This section explains how to use the Protocol Macro function.
8-6-1 Introduction The Protocol Macro function is a communications protocol that controls half duplex (see below) data transfers with various communications devices and general-purpose components equipped with RS-232C or RS-422/485 ports. The user can easily modify the data transfer procedures (communications sequences) with OMRON’s Protocol Support Software and execute the communications sequences from the ladder program with PMCR(260). The Communications Boards come equipped with seven communications procedures. These standard sequences can be used as is or modified to meet the requirements of a particular application. Note Refer to the Communications Board Operation Manual for details on Communications Boards and the Protocol Support Software Operation Manual for details on the Protocol Support Software. Half Duplex Communications With half duplex communications, data is received and sent consecutively, i.e., not at the same time. (The C200HX/C200HG/C200HE Protocol Macro function supports half duplex communications only.) Send
Send Receive
Receive
Full Duplex Communications With full duplex communications, data can be received and sent simultaneously.
475
Page 485
Section
The Protocol Macro Function
8-6
(The C200HX/C200HG/C200HE Protocol Macro function does not support full duplex communications.)
Send
Send
Receive
RS-232C Connection (One-to-one)
Receive
Only one device can be connected with an RS-232C connection. The RS-232C cable can be up to 15 m long.
(RS-232C) Port B
Basic protocol
RS-232C
(RS-232C) Port A Basic protocol 15 m RS-232C
15 m
Device with an RS-232C interface
Device with an RS-232C interface
RS-422/485 Connection (One-to-N)
(RS-232C) Port B (RS-422/485) Port A
An RS-422/485 connection allows 2 or more devices to be connected (one-to-N connection) with a maximum cable length of 500 m. The RS-422/485 connection is also useful for distant one-to-one connections.
RS-232C ↔ RS-422/485 Adapter RS-232C 15 m
Conversion Adapter NT-AL001
Temperature Controller with RS-422/485 communications Temperature Controller with RS-422/485 communications Temperature Controller with RS-422/485 communications RS-422/485
Temperature Controller with RS-422/485 communications
RS-422/485
Temperature Controller with RS-422/485 communications Temperature Controller with RS-422/485 communications
Temperature Controller with RS-422/485 communications Temperature Controller with RS-422/485 communications 500 m max.
500 m max.
Connection Cable Wiring
476
The following diagrams show the cable wiring used with Protocol Macro function communications.