Serial Communication with the CP1L and CP1H PLCs : This tutorial is intended to explain serial communication configuration with the CP1L and CP1H PLCs.
The following serial communication option boards can be used on any available option board slot for the CP1 series PLCs.
CP1W-CIF01 (RS232C)
CP1W-CIF11 (RS422A/485, 50m)
CP1W-CIF12 (RS422A/485, 500m)
Note: The single option board slot on the CP1L-L14/20 and CP1L-EL is designated as serial port 1 in CX-Programmer, but uses the flags usually allocated to port 2 of other CP1L/H types. When using ladder instructions or function blocks, specify port 2. See the CP1L CPU Unit Operation Manual (Cat. No. W462) or CP1H CPU Unit Operation Manual (Cat. No. W450) for more information.
Related Auxiliary Flags | CP1L-L/EL | CP1L-M/EM and CP1H | |
Port 1 (left) | Port 2 (right) | ||
Serial Port Communications Error Flag | A392.04 | A392.12 | A392.04 |
Serial Port Restart Bit | A526.00 | A526.01 | A526.00 |
Serial Port Settings Change Bit | A619.02 | A619.01 | A619.02 |
Serial Port Error Flags | A528.00 to | A528.08 to | A528.00 to |
A528.07 | A528.15 | A528.07 | |
Serial Port Send Ready Flag (No-protocol mode) | A392.05 | A392.13 | A392.05 |
Serial Port Reception Completed Flag (No-protocol Mode) | A392.06 | A392.14 | A392.06 |
Serial Port Reception Overflow Flag (No-protocol mode) | A392.07 | A392.15 | A392.07 |
Serial Port PT Communications Flags | A393.00 to | A394.00 to | A393.00 to |
A393.07 | A394.07 | A393.07 | |
Serial Port PT Priority Registered Flags | A393.08 to | A394.08 to | A393.08 to |
A393.15 | A394.15 | A393.15 | |
Serial Port Reception Counter (No-protocol Mode) | A393.00 to | A394.00 to | A393.00 to |
A393.15 | A394.15 |
A393.15
|
Configuration of front switches
No. | Setting | Description | Application | Default | CPU TYPE |
SW4 | ON | Used for peripheral bus. | Used to enable a Serial Communications Option Board mounted in Option Board Slot 1 to be used by the peripheral bus. This SW should be always OFF for CPU Units with 10 I/O points, because there is no option slot in CPU Units with 10 I/O points. | OFF |
CP1L-L 14 and 20 I/O models. All CP1L-M/EL/EM models. All CP1H models.
|
OFF | According to PLC Setup. | ||||
SW5 | ON | Used for peripheral bus. | Used to enable a Serial Communications Option Board mounted in Option Board Slot 2 to be used by the peripheral bus. | OFF |
CP1L-M/EM models. CP1H models. |
OFF | According to PLC Setup. |
Supported protocols in user configuration
Protocols |
RS232C | RS422A | RS485 | ||
1:1 | 1:1 | 1:N | 1:1 | 1:N | |
Host Link | YES | YES | YES | NO | NO |
Serial PLC Link | YES | YES | YES | YES | YES |
Serial Gateway | YES | YES | YES | YES | YES |
No-protocol | YES | YES | YES | YES | YES |
1:N NT Link | YES | YES | YES | YES | YES |
1:1 NT Link | YES | YES | NO | YES | NO |
1:1 Link Master | YES | YES | NO | YES | NO |
1:1 Link Slave | YES | YES | NO | YES | NO |
Protocol overview
Host Link: Various control commands such as reading and writing I/O memory, changing the operating mode, and force setting/resetting bits can be executed by sending C-mode host link commands or FINS commands from the host computer to the CPU Unit. It is also possible to send FINS commands from the CPU Unit to the host computer to send data or information. Use Host Link communications to monitor data, such as operating status, error information, and quality data in the PLC or send data, such as production planning information to the PLC.
Serial PLC Link: Up to ten words per Unit can be shared by up to nine CPU Units, including one Polling Unit and eight Polled Units. An RS-422A/485 Option Boards (CP1W-CIF11/CIF12) are used to communicate via RS-422A/485, or RS-232C Option Boards (CP1W-CIF01) can be used to communicate between two CPU Units via an RS-232C connection. CJ1M CPU Units can also be included in Serial PLC Links, and the Serial PLC Links can also include PTs as Polled Units via 1:N NT Links. Serial PLC Links can be created on serial port 1 or serial port 2, but not on both ports at the same time.
Serial Gateway: Converts received FINS commands into CompoWay/F or Modbus-RTU commands and transfers them on the serial communications path.
No-Protocol: Communicates with standard devices with an RS-232C or RS-422A/485 port without a command–response format. Instead the TXD(236) and RXD(235) instructions are executed from the program to transmit data from the transmission port or read data in the reception port. The frame headers and end codes can be specified.
1:N NT Link: Data can be exchanged with PTs without using a communications program in the CPU Unit. 1:N NT Links are also used for 1:1 connections.
1:1 NT Link: Enables data exchange with a PT without communications programming in the CPU Unit. (The 1:N NT Link protocol is used for communications even for 1:1 connections.)
1:1 Link Master/Slave: Enables linking data in a 64-word Link Area between two PLCs.
Configuration of communication port via STUP instruction
The STUP instruction changes the communications parameters of a serial port on a Serial Communications Option Board. STUP(237) thus enables the protocol mode to be changed during PLC operation. This instruction is not allowed in interrupt tasks. A CX-Programmer project file (STUP Example.cxp) is attached as an example.
@STUP(237) | Description |
Control (C) | Port Number |
Source (S) | Source block containing the communication format |
Changing the communication format of the serial ports 1 and 2 is indicated by the system flags A619.01 and A619.02. After switching off and being switched back on, the controller incorporates the values in its communication parameters
Host Link Mode values
bit | Parameters | Values | Description | |
S | 00-03 | format | 0-E | 0 : 7, E, 2 5 : 7, O, 1 A : 8, N, 2 1 : 7, O,2 6 : 7, N, 1 C: 8, E, 1 2 : 7, N,2 8 : 8, E, 8 D: 8, O, 1 4 : 7, E, 1 9 : 8, O, 2 E: 8, N, 1 |
08-11 | mode | 0-8 | 0 : Host Link 5 : Host Link |
|
15 | format | 0-1 | 0 : standard 9600 E,7,2 1 : user defined (custom) | |
S + 1 | 00-07 | speed | 00 : 9600bps 04 : 2400bps 08 : 38400bps 01 : 300bps 05 : 4800bps 09 : 57600bps 02 : 600bps 06 : 9600bps 0A: 115200bps 03 : 1200bps 07 : 19200bps |
|
08-15 | reserved | always 0 | ||
S + 2 | reserved | always 0 | ||
S + 3 |
00-07 | slave number | 00-31 | 00 by default |
08-15 | reserved | always 0 | ||
S + 4 | reserved (always 0) | |||
S + 9 |
Additional Information
See the following manuals for additional information
- CP1L CPU Operation Manual (Cat. No. W342)
- CP1H CPU Operation Manual (Cat. No. W450)
- CP1L-EL/EM CPU Operation Manual (Cat. No. 516)
Additional STUP information can be found in the corresponding CPU Instruction Reference Manual. This article does not detail similar functionality for CJ-series communication units (CPU Bus Units) when mounted to the CP1H