0% found this document useful (0 votes)
18 views82 pages

E5 D Series

manual

Uploaded by

fernando.mateus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views82 pages

E5 D Series

manual

Uploaded by

fernando.mateus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Programmable Controller CJ-series

General-purpose Serial
Connection Guide
(RS-485 CompoWay/F)
OMRON Corporation
Digital Temperature Controller
(E5□D/E5□C/E5□C-T)

P704-E1-01
About Intellectual Property Rights and Trademarks
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Windows is a registered trademark of Microsoft Corporation in the USA and other countries.
Company names and product names in this guide are the trademarks or registered trademarks
of their respective companies.
Table of Contents

1. Related Manuals ........................................................................................ 1


2. Terms and Definitions ............................................................................... 2
3. Precautions ................................................................................................ 3
4. Overview .................................................................................................... 4
5. Applicable Devices and Device Configuration ....................................... 5
5.1. Applicable Devices ............................................................................. 5
5.2. Device Configuration .......................................................................... 7
6. Serial Communications Settings ............................................................. 9
6.1. Parameters ........................................................................................ 9
6.2. Cable Wiring .................................................................................... 10
7. Serial Communications Connection Procedure .................................... 11
7.1. Work Flow ......................................................................................... 11
7.2. Digital Temperature Controller Setup ............................................... 13
7.3. PLC Setup........................................................................................ 17
7.4. Serial Communication Status Check ................................................ 38
8. Initialization Method ................................................................................ 44
8.1. Initializing a PLC .............................................................................. 44
8.2. Initializing a Digital Temperature Controller ...................................... 45
9. Program.................................................................................................... 46
9.1. Overview .......................................................................................... 46
9.2. Communications Sequence ............................................................. 51
9.3. Error Detection Processing .............................................................. 52
9.4. Memory Maps .................................................................................. 53
9.5. Ladder Program ............................................................................... 56
9.6. Protocol Data ................................................................................... 62
9.7. Timing Charts ................................................................................... 73
9.8. Error Processing .............................................................................. 74
10. Revision History .................................................................................. 77
1.Related Manuals

1. Related Manuals

To ensure system safety, make sure to always read and follow the information provided in all
Safety Precautions and Precautions for Safe Use in the manuals for each device which is
used in the system.
The table below lists the manuals pertaining to this guide.

Cat. No. Model Manual name


W472 CJ2M-CPU□□ CJ Series
CJ2H-CPU6□ CJ2 CPU Unit
CJ2H-CPU6□-EIP Hardware USER'S MANUAL
W473 CJ2M-CPU□□ CJ Series
CJ2H-CPU6□ CJ2 CPU Unit
CJ2H-CPU6□-EIP Software USER'S MANUAL
W336 CJ1W-SCU□1-V1 CJ Series
CJ1W-SCU□2 Serial Communications Units
OPERATION MANUAL
W474 CJ2□-CPU□□ CJ Series
Programmable Controllers
INSTRUCTIONS REFERENCE MANUAL
W446 CXONE-AL□□C-V4 CX-Programmer
/ AL□□D-V4 OPERATION MANUAL
W344 CXONE-AL□□C-V4 CX-Protocol
/ AL□□D-V4 OPERATION MANUAL
H225 E5□D Digital Temperature Controllers
Communications Manual
H224 E5□D Digital Temperature Controllers User’s Manual
H175 E5□C Digital Temperature Controllers
Communications Manual
H174 E5□C Digital Temperature Controllers User’s Manual
H186 E5□C-T Digital Temperature Controllers
Programmable Type
Communications Manual
H185 E5□C-T Digital Temperature Controllers
Programmable Type User’s Manual

1
2.Terms and Definitions

2. Terms and Definitions

Term Explanation and Definition


protocol macro A data transfer procedure (protocol) with a general-purpose external
device is created and stored in a Serial Communications Board or a Serial
Communications Unit. This functional protocol enables data to be
exchanged with general-purpose external devices by executing the
protocol macro instruction (hereinafter referred to as "PMCR instruction")
in a CPU Unit.
protocol A set of rules governing the data transfer procedures that gather
independent communication processing with a specific general-purpose
device. A protocol consists of more than one sequence.
sequence A unit of action to perform the independent communication processing that
can be started by executing the PMCR instruction in a program.
A sequence that is started by the instruction executes steps registered in
its own sequence.
step A unit to execute any one of the followings: message send processing,
message receive processing, message send/receive processing, receive
buffer clear, or step wait. Up to 15 steps can be set for per sequence.
send message A communications frame (command) sent to a general-purpose external
device. A send message is invoked by steps in a sequence and is sent to a
general-purpose external device.
receive message A communications frame (response) sent from a general-purpose external
device. A receive message is invoked by steps in the sequence and is
compared with data received from general-purpose external devices.
matrix A function to register and use some communications frames (responses)
when more than one communications frame is expected to be received
from a general-purpose external device.
The receive processing can be executed according to registered
communications frames by using this function.
case A unit to register multiple communications frames (response) to a matrix.
One communications frame is registered as one case.
Up to 15 types of cases can be registered per matrix.

2
3.Precautions

3. Precautions

(1) Understand the specifications of devices which are used in the system. Allow some
margin for ratings and performance. Provide safety measures, such as installing a safety
circuit, in order to ensure safety and minimize the risk of abnormal occurrence.
(2) To ensure system safety, make sure to always read and follow the information provided in
all Safety Precautions and Precautions for Safe Use in the manuals for each device
which is used in the system.
(3) The user is encouraged to confirm the standards and regulations that the system must
conform to.
(4) It is prohibited to copy, to reproduce, and to distribute a part or the whole of this guide
without the permission of OMRON Corporation.
(5) The information contained in this guide is current as of March 2018. It is subject to
change for improvement without notice.

The following notations are used in this guide.

Indicates a potentially hazardous situation which, if not avoided,


may result in minor or moderate injury or property damage.

Precautions for Safe Use


Precautions on what to do and what not to do to ensure safe usage of the product.

Precautions for Correct Use


Precautions on what to do and what not to do to ensure proper operation and performance.

Additional Information
Additional information to read as required.
This information is provided to increase understanding or make operation easier.

Symbol

The triangle symbol indicates precautions (including warnings).


The specific operation is shown in the triangle and explained in the text.
This example indicates a general precaution.

The filled circle symbol indicates operations that you must do.
The specific operation is shown in the circle and explained in the text.
This example shows a general precaution for something that you must do.

3
4.Overview

4. Overview

This guide describes procedures for connecting a Digital Temperature Controller (E5□D,
E5□C or E5□C-T) to a CJ-series Programmable Controller + Serial Communications Unit
(hereinafter referred to as the "PLC") via serial communications, both produced by OMRON
Corporation (hereinafter referred to as "OMRON"), and for checking their communication
status.
Refer to Section 6. Serial Communications Settings and Section 7. Serial Communications
Connection Procedure to understand setting methods and key points to send or receive a
message via serial communications.
The ladder program in the prepared CX-Programmer project file is used to check the serial
connection by sending or receiving a message of ''Properties Read'' to/from the Digital
Temperature Controller.

■The send/receive messages of "Properties Read''


Serial communications Digital Temperature
PLC
(RS-485) Controller

Sending command data Command data Executing the command

Receiving response data


Response data Returning response data
and storing in memory

Prepare the CX-Programmer project file and the CX-Protocol project file with latest versions
beforehand. To obtain the project files, contact your OMRON representative.

Name File name Version


CX-Programmer project file P704_CJ_CWF485_OMRON_E5CD_V100.cxp Ver.1.00
(extension: cxp)
CX-Protocol project file P704_CJ_CWF_OMRON_E5CDV100.psw Ver.1.00
(extension: psw)

This guide aims to explain wiring methods and communications settings


necessary to connect corresponding devices and provides the setting
procedures. The program used in this guide is not designed to be constantly
used at a site but is designed to check if the connection is properly established.
Both functionalities and performances are therefore not fully considered for the
program.
When you actually construct a system, please use the wiring methods,
communications settings and setting procedures described in this guide as a
reference, and design a program according to your application needs.

4
5.Applicable Devices and Device Configuration

5. Applicable Devices and Device Configuration

5.1. Applicable Devices


The applicable devices are as follows:

Manufacturer Name Model


OMRON CJ2 CPU Unit CJ2□-CPU□□
OMRON Serial Communications Unit CJ1W-SCU□1-V1
CJ1W-SCU□2
OMRON Digital Temperature Controller E5CD-□□2□□M-002
E5CD-□□2□□M-004
E5ED-□□4□□M-004
E5ED-□□4□□M-008
E5ED-□□4□□M-022
E5CC-□□□□□M-002
E5CC-□□□□□M-003
E5CC-□□□□□M-004
E5AC-□□□□SM-004
E5AC-□□□□SM-008
E5AC-□□□□SM-009
E5AC-□□□□SM-012
E5AC-□□□□SM-014
E5EC-□□□□□M-004
E5EC-□□□□□M-008
E5EC-□□□□□M-009
E5EC-□□□□□M-012
E5EC-□□□□□M-014
E5DC-□□□□□M-002
E5DC-□□□□□M-015
E5GC-□□□□□M-015
E5CC-T□□3□SM-002
E5CC-T□□3□SM-003
E5CC-T□□3□SM-004
E5AC-T□□4□SM-004
E5AC-T□□4□SM-008
E5AC-T□□4□SM-020
E5AC-T□□4□SM-022
E5EC-T□□4□SM-004
E5EC-T□□4□SM-008
E5EC-T□□4□SM-020
E5EC-T□□4□SM-022

5
5.Applicable Devices and Device Configuration

Precautions for Correct Use


In this guide, the devices with models and versions listed in 5.2. Device Configuration are
used as examples of applicable devices to describe the procedures for connecting the
devices and checking their connection.
You cannot use devices with versions lower than the versions listed in 5.2.
To use the above devices with models not listed in 5.2. or versions higher than those listed in
5.2., check the differences in the specifications by referring to the manuals before operating
the devices.

Additional Information
This guide describes the procedures for establishing the network connection.
It does not provide information on operation, installation, wiring method, device functionality,
or device operation, which is not related to the connection procedures.
Refer to the manuals or contact your OMRON representative.

6
5.Applicable Devices and Device Configuration

5.2. Device Configuration


The hardware components to reproduce the connection procedures in this guide are as
follows:

Personal computer CJ2M-CPU12+


(CX-One installed, CJ1W-SCU42
OS: Windows 7) E5CD-RX2A6M-002

USB cable Serial cable (RS-485)

Manufacturer Name Model Version


OMRON Serial Communications Unit CJ1W-SCU42 Ver.2.0
OMRON CJ2 CPU Unit CJ2M-CPU12 Ver.2.0
OMRON Power Supply Unit CJ1W-PA202
OMRON CX-One CXONE-AL□□C-V4 Ver.4.□□
/AL□□D-V4
OMRON CX-Programmer (Included in CX-One) Ver.9.65
OMRON CX-Protocol (Included in CX-One) Ver.1.992
OMRON CX-Programmer project file P704_CJ_CWF485_ Ver.1.00
OMRON_E5CD_V100.cxp
OMRON CX-Protocol project file P704_CJ_CWF_OMRON_ Ver.1.00
E5CD_V100.psw
- Personal computer (OS: Windows 7) -
- USB cable -
(USB 2.0 type B connector)
- Serial cable (RS-485) -
OMRON Digital Temperature Controller E5CD-RX2A6M-002

Precautions for Correct Use


Prepare the CX-Programmer project file and the CX-Protocol project file with latest versions
beforehand. To obtain the project files, contact your OMRON representative.

Precautions for Correct Use


Update CX-Programmer and CX-Protocol to the versions specified in this Clause 5.2. or to
higher versions. If you use a version higher than the one specified, the procedures and
related screenshots described in Section 7. and the subsequent sections may not be
applicable. In that case, use the equivalent procedures described in this guide by referring to
the CX-Programmer OPERATION MANUAL (Cat. No. W446) and the CX-Protocol
OPERATION MANUAL (Cat. No. W344).

7
5.Applicable Devices and Device Configuration

Precautions for Correct Use


Turn ON the terminating resistance switch on Serial Communications Unit and connect
terminating resistance to the terminals of the Digital Temperature Controller at either end of
the RS-422A/485 transmission path.

Additional Information
For information on the serial cable (RS-485), refer to 3-4 RS-232C and RS-422A/485 Wiring
of the CJ Series Serial Communications Units OPERATION MANUAL (Cat. No. W336).

Additional Information
The system configuration in this guide uses USB for the connection between the personal
computer and the PLC. For information on how to install the USB driver, refer to A-5 Installing
the USB Driver of the CJ-series CJ2 CPU Unit Hardware USER'S MANUAL (Cat. No. W472).

8
6.Serial Communications Settings

6. Serial Communications Settings

This section describes the parameters and cable wiring, which are set up in this guide.

6.1. Parameters
The following parameters are required to connect the PLC and the Digital Temperature
Controller via serial communications.

PLC Digital Temperature


Setting item
(Serial Communications Unit) Controller
Unit No. 0 -
Communications Unit No. - 1 (default)
(slave address)
Serial communications port Port 1 (RS-422A/485) -
(connection)
Terminating resistance Terminating resistance ON -
(TERM: ON)
2-wire or 4-wire 2-wire (WIRE: 2) 2-wire (fixed)
Serial communications Protocol macro -
mode
Data length 7 bits (default) 7 bits (default)
(transmission character)
Stop bits 2 bits (default) 2 bits (default)
Parity (parity bit) Even (default) Even (default)
Baud rate 9,600 bps (default) 9,600 bps (default)
Protocol macro transmission Half-duplex (default) -
method
Communications method - CompoWay/F (default)
Send data wait time - 20 ms (default)

Precautions for Correct Use


The connection procedure described in this guide assumes that the following Serial
Communications Unit, port and unit number are used.
Model: CJ1W-SCU42
Serial communications port: Port 1
Unit No.: 0
If you connect devices under different conditions, refer to Section 9. Program and create a
program by changing both the CIO area and the control data of the PMCR instruction.

9
6.Serial Communications Settings

6.2. Cable Wiring


For details on cable wiring, refer to SECTION 3 Installation and Wiring of the CJ Series Serial
Communications Units OPERATION MANUAL (Cat. No. W336).
Check the connector configurations and pin assignments before wiring.

■Connector configuration and pin assignment


Serial Communications Unit (CJ1W-SCU42) applicable connector: Terminal block
Pin No. Symbol Signal name Input/Output
1 (See note 1.) RDA Receive data - Input
2 (See note 1.) RDB Receive data + Input
3 (See note 1.) SDA Send data - Output
4 (See note 1.) SDB Send data + Output
5 (See note 2.) FG Shield -
Note 1: For 2-wire connection, use either pins 1 and 2 or pins 3 and 4.
2: Pin 5 (Shield) is connected to the GR terminal on the Power Supply Unit though the
Serial Communications Unit. The cable shield can thus be grounded if you ground
the GR terminal of the Power Supply Unit.

Digital Temperature Controller (E5CD) applicable connector: Terminal block


Pin No. Signal name Input/Output
1-12
13 B(+) Input/Output
14 A(-) Input/Output
15-18

■Cable and pin assignment


Serial Communications Digital Temperature Controller
Unit (CJ1W-SCU42) (E5CD)
RS-422A/ Signal Pin No. Terminal Signal RS-485
485 name No. name interface
interface RDA- 1 13 B(+)
Terminating resistance
RDB+ 2 14 A(-)
SDA- 3
SDB+ 4
FG 5
Terminal block Terminal block
*Connect 120 Ω (1/2 W) terminating resistance
between B(+) and A(-) of the Digital Temperature
Controller that is connected at the end of the
network.

Additional Information
For information on the connector configurations and pin assignments of the other models,
refer to their respective manuals.

10
7.Serial Communications Connection Procedure

7. Serial Communications Connection Procedure

This section describes the procedures for connecting the PLC to the Digital Temperature
Controller via serial communications. The procedures for setting up the PLC and the Digital
Temperature Controller in this guide are based on the factory default settings.
For the initialization, refer to Section 8. Initialization Method.

7.1. Work Flow


Take the following steps to connect the PLC and the Digital Temperature Controller via serial
communications and to send or receive a message.

7.2. Digital Temperature Controller Set up the Digital Temperature Controller.


Setup

7.2.1. Parameter Settings Set parameters for the Digital Temperature
Controller.

7.3. PLC Setup Set up the PLC.

7.3.1. Hardware Settings Set the hardware switches on the Serial
Communications Unit and connect the cables.

7.3.2. Opening the Project File and Start CX-Programmer, open the project file, and go
online with the PLC.
Going Online with the PLC

7.3.3. Creating an I/O Table Create an I/O table for the PLC.

7.3.4. Parameter Settings Set parameters for the Serial Communications
Unit.

7.3.5. Transferring the Project Data Transfer the created project data to the PLC.

7.3.6. Starting CX-Protocol and Start CX-Protocol and open the project file.
Opening the Project File

7.3.7. Going Online and Transferring Go online with CX-Protocol and transfer the
protocol data to the Serial Communications Unit.
the Protocol Data

11
7.Serial Communications Connection Procedure

7.4. Serial Communication Status Start the send/receive processing and confirm that
Check serial communications performs normally.

7.4.1. Starting the Trace Start tracing with CX-Protocol.

7.4.2. Executing the Communications Execute the communications sequence with
Sequence CX-Programmer.

7.4.3. Checking the Trace Data Check that correct data is sent and received, using
the trace data in CX-Protocol.

7.4.4. Checking Received Data With CX-Programmer, check that correct data is
written to the I/O memory of the PLC.

12
7.Serial Communications Connection Procedure

7.2. Digital Temperature Controller Setup


Set up the Digital Temperature Controller.

7.2.1. Parameter Settings


Set parameters for the Digital Temperature Controller.

1 Connect the power supply and a


Serial cable
serial cable to the terminal block (RS-485)
located on the back of Digital
Temperature Controller.

*Only the parameters in


Communications Setting Level
are described in this guide.
If you use the parameters in
Adjustment Level that is
specific to each of the models,
refer to their respective
manuals.
2 Check the positions of each of
the keys, No.1 and No. 2
displays and Operation
indicators.

In this guide, the keys are


described as follows:
L (Level) Key
M (Mode) Key
U (Up) Key
D (Down) Key

3 Turn ON Digital Temperature


Controller.

4 The current temperature is


displayed on No. 1 display once
Digital Temperature Controller is
turned ON. (Operation Level)

Press the L (Level) Key for at


least 3 seconds. L (Level) Key for at least 3 seconds

13
7.Serial Communications Connection Procedure

5 "in-t" (Initial Setting Level) is


displayed on No. 1 display.

Press the L (Level) Key again


for less than 1 second.
L (Level) Key

6 The display changes to


Communications Setting Level. < Setting value>
"psel" (Protocol Setting) and CWF / Mod
"cwf" (CompoWay/F) are (default: CWF)
displayed on No. 1 and No. 2 CWF: CompoWay/F
displays, respectively. Mod: Modbus-RTU

*If the setting value is different,


press the U (Up) or D (Down)
Key to change the parameter.
M (Mode) Key
Press the M (Mode) Key.

7 "u-no" (Communications Unit


No.) is displayed.
Check that Communications <Setting value>
Unit No. is 1. 0 to 99 (default: 1)

*If the setting value is different,


change it in the same way as
step 6.

Press the M (Mode) Key.


M (Mode) Key

8 "bps" (Communications Baud


Rate) is displayed. <Setting value>
Check that Communications 9.6, 19.2, 38.4 or
Baud Rate is 9.6 kbps. 57.6 kbps
(default: 9.6)
*If the setting value is different,
change it in the same way as
step 6.

Press the M (Mode) Key.


M (Mode) Key

14
7.Serial Communications Connection Procedure

9 "len" (Communications Data


Length) is displayed.
Check that Communications <Setting value>
Data Length is 7 bits. 7 or 8 bits (default: 7)

*If the setting value is different,


change it in the same way as
step 6.

Press the M (Mode) Key.


M (Mode) Key

10 "sbit" (Communications Stop


Bits) is displayed.
Check that Communications
Stop Bits is 2 bits. <Setting value>
1 or 2 bits (default: 2)
*If the setting value is different,
change it in the same way as
step 6.

Press the M (Mode) Key.


M (Mode) Key

11 "prty" (Communications Parity)


is displayed.
Check that Communications
Parity is EVEN. <Setting value>
NONE, EVEN or ODD
*If the setting value is different, (default: EVEN)
change it in the same way as
step 6.

Press the M (Mode) Key.


M (Mode) Key

12 "sdwt" (Send Data Wait Time) is


displayed.
Check that Send Data Wait Time <Setting value>
is 20. 0 to 99 ms (default: 20)

*If the setting value is different,


change it in the same way as
step 6.

Press the L (Level) Key for less


than 1 second. L (Level) Key

15
7.Serial Communications Connection Procedure

13 "in-t" ((Initial Setting Level) is


displayed.

Press the L (Level) Key for at


least 1 second.
L (Level) Key for at least 1 second

14 The display returns to Operation


Level as shown in step 4.

15 Turn OFF Digital Temperature


Controller.

16
7.Serial Communications Connection Procedure

7.3. PLC Setup


Set up the PLC.

7.3.1. Hardware Settings


Set the hardware switches on the Serial Communications Unit and connect the cables.

Precautions for Correct Use


Make sure that the power supply is OFF when you set up.
If it is ON, the settings described in the following steps and subsequent procedures may not
be applicable.

1 Make sure that PLC is powered


OFF.

2 Check the positions of the


hardware switches and Port 1
on the front panel of Serial
Communications Unit by
referring to the figure on the
right.

3 Set Unit number switch to 0.


The unit number is set to 0 as
the factory default setting.

4 Set Terminating resistance


・TERM
ON/OFF switch to ON. (Terminating resistance ON/OFF switch)
OFF: Terminating resistance OFF
(Terminating resistance ON). ON: Terminating resistance ON

5 Set 2-wire or 4-wire switch to 2


(2-wire).
・WIRE (:2-wire or 4-wire switch)
2: 2-wire, 4: 4-wire

17
7.Serial Communications Connection Procedure

6 Connect Serial Communications


Unit to PLC as shown on the Personal
right. computer Serial Communications Unit
PLC
End Cover
Connect Digital Temperature
USB cable Serial cable
Controller and Port 1 on Serial (RS-485)
Communications Unit with the
serial cable. Power Supply Unit CPU Unit

Connect Personal computer and


PLC with a USB cable.

18
7.Serial Communications Connection Procedure

7.3.2. Opening the Project File and Going Online with the PLC
Start CX-Programmer, open the project file, and go online with the PLC.
Install CX-Programmer and the USB driver on your personal computer beforehand.

1 Turn ON PLC and Digital


Temperature Controller.

2 Start CX-Programmer.

*If the User Account Control


Dialog Box is displayed at start,
make a selection to start
CX-Programmer.
3 CX-Programmer starts up.

4 Select Open from the File Menu.

5 The Open CX-Programmer


Project Dialog Box is displayed.
Select P704_CJ_CWF_OMRON
_E5CD_V100.cxp and click
Open.

*Obtain the project file from


OMRON.

6 After opening the project file,


select Programs in the project
workspace.

(Project workspace)

19
7.Serial Communications Connection Procedure

7 Select Change Model from the


PLC Menu.

8 The Change PLC Dialog Box is


displayed.
From the pull-down list of Device
Type, select the device type of
PLC to use.
Click Settings.

*CJ2M is selected in this guide.

9 The Device Type Settings


Dialog Box is displayed.
From the pull-down list of CPU
Type, select the CPU type to
use.
Click OK.

*CPU12 is selected in this guide.

20
7.Serial Communications Connection Procedure

10 Check that the network type is


set to USB in the Change PLC
Dialog Box. Click OK.

*If not, select USB from the


pull-down list.

*If you have changed the device


type in step 8 or the CPU type
in step 9, the dialog box on the
right will be displayed.
Confirm that there is no
problem, and click Yes.
Make sure that the program
has been converted normally.
("0 errors" must be shown.)
(Although the duplicated output
warnings are detected as
shown on the right, they are not
problems.)

11 Select Programs in the project


workspace.

Select Work Online from the


PLC Menu.

21
7.Serial Communications Connection Procedure

12 The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

13 Check that CX-Programmer and


PLC are online.

*The icon is pressed down


during online connection.

Additional Information
If the online connection to the PLC cannot be established, check the cable connection.
After checking the cable connection, return to step 7, check the settings described in steps 8
to 10, and try online again.
For details, refer to Connecting Directly to a CJ2 CPU Unit Using a USB Cable of the
CX-Programmer OPERATION MANUAL (Cat. No. W446).

Additional Information
Some dialog boxes described in this guide may not be displayed depending on the
environmental settings of CX-Programmer. For details on the environmental settings, refer to
Options and Preferences in CHAPTER 3 Project Reference of the CX-Programmer
OPERATION MANUAL (Cat. No. W446).
The procedures with CX-Programmer in this guide assume that the check box ''Confirm all
operations affecting the PLC'' has been selected on the PLCs Tab Page.

22
7.Serial Communications Connection Procedure

7.3.3. Creating an I/O Table


Create an I/O table for the PLC.

1 If the operating mode of PLC is


Run Mode or Monitor Mode,
change it to Program Mode by
following the steps below.

(1)Select Operating Mode -


Program from the PLC Menu
in CX-Programmer.

(2)The dialog box on the right is


displayed. Confirm that there
is no problem, and click Yes.

*Refer to Additional Information


on the previous page for the
settings concerning the dialog
display.

(3)Check that Stop/Program


Mode is displayed to the right
of the PLC model in the
project workspace of
CX-Programmer.

(Project workspace)
2 Select Edit - I/O Table and Unit
Setup from the PLC Menu in
CX-Programmer.

The PLC I/O table Window is


displayed.

Precautions for Correct Use


The PLC will be reset after creating and transferring an I/O table in step 3 and the
subsequent steps. Always confirm safety before creating and transferring an I/O table.

23
7.Serial Communications Connection Procedure

3 Select Create from the Options


Menu of the PLC IO Table
Window.

The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

4 The Transfer from PLC Dialog


Box is displayed.
Select IO Table and SIO Unit
Parameters.
Click Transfer.

When the transfer is completed,


the Transfer Results Dialog Box
is displayed.
Check that the transfer is
successfully completed by
referring to the message in the
dialog box.
When an I/O table is created
successfully, the dialog box
displays as follows:
Transfer Success: 1 Unit
Transfer Unsuccessful: 0 Unit

Click OK.

24
7.Serial Communications Connection Procedure

7.3.4. Parameter Settings


Set parameters for the Serial Communications Unit.

1 Double-click [0000] Main Rack


in the PLC IO Table Window to
expand the tree.

2 Right-click 00 [1500]
CJ1W-SCU42 and select Unit
Setup.

3 The View Parameters Dialog


Box is displayed.
Select Port1: Protocol macro
Settings from the pull-down list
of Displayed Parameter.

*This setting is required to use


Port 1 of Serial
Communications Unit.

25
7.Serial Communications Connection Procedure

4 The setting items of "Port1:


Protocol macro Settings" are
listed as shown in the figure on
the right.
(The figure on the right shows
the default values.)

5 Select User settings from the


pull-down list of Set Value for
"Port1: Port settings".

6 Set the following parameters in


the same way as step 5.
・Serial communications mode:
Protocol macro
・Data length: 7 bits
・Stop bits: 2 bits
・Parity: Even
・Baud rate: Default(9600bps)
・Protocol macro Transmission
method: Half-duplex

*Use the default values for other


parameters.

Click Transfer[PC to Unit].

26
7.Serial Communications Connection Procedure

7 The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

Check that the transfer is


completed as shown on the
right. Click Close.

8 The dialog box on the right is


displayed. Check the contents
and click Yes.

The Select Port Dialog Box is


displayed. Select All ports and
click OK.

9 The dialog box on the right is


displayed. Check the contents
and click OK.

27
7.Serial Communications Connection Procedure

10 Click Compare in the View


Parameters Dialog Box.

11 Check that a message stating


"Compare successful" is
displayed as shown on the right.
Click Close.

12 Click OK in the View


Parameters Dialog Box.

13 Select Exit from the File Menu


of the PLC IO Table Window to
close.

28
7.Serial Communications Connection Procedure

7.3.5. Transferring the Project Data


Transfer the created project data to the PLC.

1 Select Programs in the project


workspace of CX-programmer.

Select Transfer - To PLC from


the PLC Menu.

2 Select Program(s), Comments


and Program index. Click OK.

*The I/O table and Special Unit


Setup are unnecessary to
transfer here, because they are
already set in 7.3.3. Creating
an I/O Table and 7.3.4.
Parameter Settings.

*The Comments and the


Program index Check Boxes
may not be displayed
depending on the device type.
In that case, select Program(s)
only and transfer the project
data.

3 The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

29
7.Serial Communications Connection Procedure

4 The dialog box on the right is


displayed (stating "Download
successful") when the transfer is
completed. Click OK.

5 Select Programs in the project


workspace.
Select Transfer - Compare
with PLC from the PLC Menu.

6 Select Program(s) and click OK.

7 Check that a message is


displayed stating "Compare
successful". Click OK.

30
7.Serial Communications Connection Procedure

7.3.6. Starting CX-Protocol and Opening the Project File


Start CX-Protocol and open the project file.

1 Start CX-Protocol.

*If the User Account Control


Dialog Box is displayed at start,
make a selection to start
CX-Protocol.
2 Start CX-Protocol.

The following panes are


displayed in this window. Project
Top left: Project Workspace Workspace
Bottom left: Output Window Project
Window
Right: Project Window

Output
Window

3 Select Open from the File Menu.

4 The Open Dialog Box is


displayed.
Select P704_CJ_CWF_
OMRON_E5CD_V100.psw and
click Open.

*Obtain the project file from


OMRON.

5 The project data read are


displayed in both the Project
Workspace and the Project
Window.

31
7.Serial Communications Connection Procedure

7.3.7. Going Online and Transferring the Protocol Data


Go online with CX-Protocol and transfer the protocol data to the Serial Communications Unit.

1 Double-click P704_CJ_
CWF_OMRON_E5CD_V100 in
the Project Workspace to
display a tree.

2 Select Edit PC-PLC Comms


Settings from the PLC Menu.

3 The Change PLC Dialog Box is


displayed. From the pull-down
list of Device Type, select the
device type of PLC to use.
Click Settings.

*CJ2M is selected in this guide.

32
7.Serial Communications Connection Procedure

4 The Device Type Settings


Dialog Box is displayed.
From the pull-down list of CPU
Type, select the CPU type to
use. Click OK.

*CPU12 is selected in this guide.

5 Check that the network type is


set to USB in the Change PLC
Dialog Box.
Click OK.

*If not, select USB from the


pull-down list.

6 Select Connect to PLC from the


PLC Menu.

33
7.Serial Communications Connection Procedure

7 In the Project Workspace, the


PLC mode displayed next to the
PLC Icon changes from Offline
to Program. It means that PLC is
online and in operating mode.

*If the other operating mode


(Monitor or Run) is displayed,
change it to Program mode by
following step 8.
8 If the operating mode is Monitor
mode or Run mode in step 7,
select Operating Mode -
Program from the PLC Menu.

The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.
Check that the operating mode
changes to Program mode as
shown in step 7.

9 Double-click New Protocol List


in the Project Workspace to
display a tree.

10 The Project Window on the right


is displayed. Check that SCU [0]
is selected in the Target Column.

*If SCU [0] is not shown, select


SCU [0] as shown in the figure
on the right.

11 Click New Protocol List in the


Project Workspace and select
Download Protocols from the
Protocol Menu.

34
7.Serial Communications Connection Procedure

12 The dialog box on the right is


displayed. Select Include
Source Information and click
Compile.

13 The compiling is complete when


100% is displayed in the
Complied % Column.
Click Download after checking
that the compiling is completed.

14 The dialog box on the right is


displayed. Confirm that there is
no problem, and click OK.

35
7.Serial Communications Connection Procedure

15 Check that 100% is displayed in


the Downloaded % Column as
shown on the right.
Click Close.

16 Select Compare Protocols


from the Protocol Menu.

17 The dialog box on the right is


displayed. Select Include
Source Information and click
Compile.

36
7.Serial Communications Connection Procedure

18 The compiling is complete when


100% is displayed in the
Complied % Column.
Click Compare after checking
that the compiling is completed.

19 The dialog box on the right is


displayed. Check that
Successful is displayed in the
Result Column.
Click OK.

20 Check that 100% is displayed in


the Compared % Column as
shown on the right.
Click Close.

37
7.Serial Communications Connection Procedure

7.4. Serial Communication Status Check


Start the send/receive processing and confirm that serial communications performs normally.

If the PLC memory is changed by malfunction during the monitoring of power


flow and present value status in the Ladder Section Window or in the Watch
Window, the devices connected to Output Units may malfunction, regardless of
the operating mode of the CPU Unit.
Always ensure safety before monitoring power flow and present value status in
the Ladder Section Window or in the Watch Window.

Precautions for Correct Use


Check that the serial cable is connected before performing the following procedure.
If not, turn OFF both devices, and then connect the serial cable.

7.4.1. Starting the Trace


Start tracing with CX-Protocol.

1 Select Operating Mode -


Monitor from the PLC Menu in
CX-Protocol.

2 The dialog box on the right is


displayed. Confirm that there is
no problem, and click Yes.

3 Check that the operating mode


changes to Monitor mode.
Double-click NewPLC1.

4 The tree under NewPLC1


expands.
Select Serial Communications
Unit. (SCU [0] is selected as
shown on the right.)

38
7.Serial Communications Connection Procedure

5 Select the Trace 1 Icon ( ) in


the Project Window.
(Check that the Trace 1 is
highlighted as shown in the
figure on the right.)

*Trace 1 corresponds to Port 1


of Serial Communications Unit.
6 Select Start Trace - One Shot
Trace from the PLC Menu.

7 Check that the status of Trace 1


in the Project Window changes
to One-shot Trace Running.

39
7.Serial Communications Connection Procedure

7.4.2. Executing the Communications Sequence


Execute the communications sequence with CX-Programmer.

1 Expand the tree under Programs


in the project workspace of
CX-Programmer and
double-click Section1.
The Ladder Section Window
shows the Section1 ladder
program.
Ladder section window

2 In the Ladder Section Window,


right-click Input_Start and
select Set - On.

3 Check that the Input_Start


contact is turned ON as shown
in the figure on the right.

40
7.Serial Communications Connection Procedure

7.4.3. Checking the Trace Data


Check that correct data is sent and received, using the trace data in CX-Protocol.

1 Select Upload Trace from the


PLC Menu in CX-Protocol.

*Once the trace data is stored,


the menu item "Upload Trace"
will be selectable.

2 The dialog box on the right is


displayed. Check the contents
and click Yes.

3 Check the receive message in


the trace data file as shown in
the figure on the right.

(In the example on the right, "45


35 43 44 2D 52 58 32 41 36" in
hexadecimal and
"E5CD-RX2A6" in string are
received as properties of the
Digital Temperature Controller.)

*The example shows that the


received data (properties of
Digital Temperature Controller)
is "E5CD-RX2A6" in string;
however, the received data
varies depending on Digital
Temperature Controller used.

First row of receive message: in string


Second row of receive message: in hexadecimal

41
7.Serial Communications Connection Procedure

7.4.4. Checking Received Data


With CX-Programmer, check that correct data is written to the I/O memory of the PLC.

1 Select Edit - Memory from the


PLC Menu in CX-Programmer.

2 Double-click CIO in the Memory


Tab of the PLC Memory
Window.

3 Enter 5500 in the Start Address


Field of the CIO Area.
Check that the start address
changes to CIO5500.

42
7.Serial Communications Connection Procedure

4 Select Monitor from the Online


Menu.

5 The Monitor Memory Areas


Dialog Box is displayed.
Select CIO and click Monitor.

6 Check received data (properties


of Digital Temperature
Controller) in the CIO Area as
shown on the right.

*In the example on the right, the


stored data starting from
CIO5503 is in hexadecimal and
is described as follows:
4535 4344 2D52 5832 4136
These values can be
expressed as a string
“E5CD-RX2A6” which is the
same as the trace data
described in step 3 of 7.4.3.
Checking the Trace Data.

*The number of words being


used (0009 in hexadecimal) is
stored in CIO5500.
The properties of Digital
Temperature Controller are
stored in the addresses from
CIO5503 to CIO5507.

*For details, refer to 9.2.2.


PMCR Instruction Operand
Settings.

43
8.Initialization Method

8. Initialization Method

The setting procedures in this guide are based on the factory default settings.
Some settings may not be applicable unless you use the devices with the factory default
settings.

8.1. Initializing a PLC


To initialize the settings of a PLC, it is necessary to initialize a Serial Communications Unit and
a CPU Unit. Change the operating mode of the PLC to PROGRAM mode before the
initialization.

8.1.1. Serial Communications Unit


To initialize the settings of a Serial Communications Unit, select Edit - I/O Table and Unit
Setup from the PLC Menu in CX-Programmer and perform the following steps.

(1) Right-click Serial Communications Unit in the PLC IO Table Window and select Unit Setup
from the menu.

(2) In the CJ1W-SCU42 [View Parameters] Dialog Box, click Set Defaults first, then click
Transfer[PC to Unit].

44
8.Initialization Method

8.1.2. CPU Unit


To initialize the settings of a CPU Unit, select Clear All Memory Areas from the PLC Menu in
CX-Programmer. Select Initialize in the Confirm All Memory Area Clear Dialog Box and click
OK.

8.2. Initializing a Digital Temperature Controller


To initialize the settings of a Digital Temperature Controller, refer to Parameter Initialization in
6-8 Advanced Function Setting Level of the Digital Temperature Controllers User's Manual
(Cat. No. H224/H174/H185).

45
9.Program

9. Program

This section describes the details on the program used in this guide.

9.1. Overview
The following explains the specifications and functions of the program that are used to check
the connection between the Digital Temperature Controller (hereinafter referred to as the
"Destination Device") and the PLC (Serial Communications Unit (hereinafter referred to as the
"SCU")).

This program uses the protocol macro function of the SCU, to send/receive the "Properties
Read" command to/from the Destination Device and detect a normal end or an error end.
A normal end of the send/receive processing means a normal end of the communications
sequence.
An error end means an error end of the communications sequence and an error of the
Destination Device (identified in the response data from the Destination Device)

Here, the prefix "&" is added to decimal data and the prefix "#" is added to hexadecimal data
when it is necessary to distinguish between decimal and hexadecimal data. (e.g., "&1000" for
decimal data and "#03E8" for hexadecimal data)

Additional Information
OMRON has confirmed that normal communications can be performed using this program
under the conditions of 5.2. Device Configuration. However, we do not guarantee the normal
operation under disturbances such as electrical noise or device performance variation.

46
9.Program

9.1.1. Outline of Processing


The following figure shows the data flow from when the PLC (SCU) sends command data to
Destination Device via serial communications until the PLC receives response data from the
Destination Device.

(1)The ladder program executes the PMCR instruction for which the communications
sequence No. 618 is specified.
(2)The PLC reads the parameters (which are set in the send data setting area) according to
the send message defined by the communications sequence No. 618, and sends command
data to Digital Temperature Controller.
(3)The Digital Temperature Controller executes the command by receiving the command data
from the PLC, and returns response data to the PLC.
(4)The PLC receives the response data from Digital Temperature Controller according to the
receive message defined by the communications sequence No. 618, and stores the data in
the response data storage area.

PLC Digital Temperature


RS-485
CPU Unit SCU Controller
Ladder program Protocol data

PMCR
Sequence No. 1
Sequence No. 2


Sequence No. 618

(1) Executes the PMCR (2) Sends command data.


instruction. (Sequence No. 618)
(Specifying the sequence
No. 618)
Command data
CIO 5020 onwards
Send data
setting area (3) Executes the
Response data command and
returns
CIO 5501 onwards response data.
Response data
storage area (4) Receives the
response data and
stores it in the
specified memory.
(Sequence No. 618)

47
9.Program

9.1.2. PMCR Instruction and Send/Receive Messages


The following describes the PMCR instruction and the general operation of sending/receiving
a message.

Additional Information
For details, refer to Serial Communications Instructions (PMCR) in SECTION 3 Instructions
of the CJ Series Programmable Controllers INSTRUCTIONS REFERENCE MANUAL (Cat.
No. W474).

●PMCR Instruction Operands

48
9.Program

C1: Control word 1


The following three items are set for SCU.
・ Communications port No. (internal logical port): #0 to #7
・ Serial port No. (physical port): #1 or #2 (#1: PORT1, #2: PORT2)
・ Unit address of Destination Device: # unit number + #10
+0 word
Bits 15 0
* * * *
Control word: C1

Unit address of Destination Device


Communications port No.
(Internal logical port) Serial port No. (physical port)

C2: Control word 2


The communications sequence number is set, which is registered as protocol data.
For information on the communications sequence number registered in this protocol data,
refer to 9.2.1 Communications Sequence Number.
+0 word
Bits 15 0
Control word: C2 * * * *

Communications sequence No.


&0 to 999 (#0000 to 03E7)

[S: First send word (send area specification)]


The first word of the words required to send data is specified. S contains the number of
words (n) to be sent. (i.e., including the S word)
Between #0000 and #00FA (n=&0 and &250) words can be send.
The send data (variable data) is entered in the words from S+1 to S+(n-1).
If there is no operand specified in the execution sequence, such as a direct or linked word,
set constant #0000 for S.

+0 word +1 word +2 words +3 words …words (n-1) words


Bit 15 0 15 0 15 0 15 0 15 0 15 0
Send area: S * * * * * * * * * * * * * * * * * * * * * * * *

Data
No. of send area words

[R: First Receive Word (receive area specification)]


The number of receive words (m) is automatically stored in R (i.e., including the R word).
The received data is stored in the words from R+1 to R+(m-1). (m=&0 to &250 or #0000 to
#00FA)
+0 word +1 word +2 words +3 words …words (m-1) word
Bit 15 0 15 0 15 0 15 0 15 0 15 0
* * * * * * * * * * * * * * * * * * * * * * * *
Receive area: R

Data
No. of receive area words

49
9.Program

●Send/Receive Messages

[Frames of send/receive messages]

Send message * * * * * * CR LF Destination


Device
PLC
Data Terminator

Receive message * * * * * * CR LF

Data Terminator

[Relationship between send area S (PMCR instruction operand) and send message]

+0 word +1 word +2 words +(n-1) words


Bit 15 0 15 0 15 0 15 0
CPU→SCU * * * * * * * * * * * * * * * *
Send area:S
No. of send
area words

SCU → Destination Device * * * * * * CR LF


Send message
Data Terminator

[Relationship between receive area R (PMCR instruction operand) and receive message]

Destination Device →SCU * * * * * * CR LF


Receive message
Data Terminator

No. of receive
area words
Bit
15 0 15 0 15 0 15 0
SCU → CPU * * * * * * * * * * * * * * * *
Receive area: R
+0 word +1 word +2 words +(n-1) words

50
9.Program

9.2. Communications Sequence


The following describes the communications sequence that is used for the PMCR instruction
in this program.

9.2.1. Communications Sequence Number


A communications sequence that is registered in the SCU is identified by a communications
sequence number. The Destination Device executes the command corresponding to the
communications sequence number that is specified in the program for executing the PMCR
instruction.
The protocol data used in this guide includes the following communications sequence.

No. Command name Description


618 Properties Read Reads the properties of the Destination Device.

9.2.2. PMCR Instruction Operand Settings


The PMCR instruction operands for the communications sequence No. 618 (#026A)
"Properties Read" are shown below.

・Control word C1 setting (C1: CIO 5010)


Word Description (data type) Data (description)
Communications port No. (1-digit hex)
#7110 (communications port No. 7,
Serial port No. (1-digit hex)
C1 serial port No. 1 and
Unit address of Destination Device
#unit number + #10)
(2-digit hex)

・Control word C2 setting (C2: CIO 5011)


Word Description (data type) Data (description)
C2 Communications sequence No. &618 (Properties Read)

・First send word S setting (S: CIO 5020)


Word Description (data type) Data (description)
S Number of send words (4-digit hex) #0002 (send data: 2 words )
S+1 Node number #0001 (destination node No.)

・First receive word R setting (R: CIO 5500)


Word Description (data type) Data (description)
R Number of receive words (4-digit hex) Stores the number of words used,
including the R word
R+1 End code (CompoWay/F) (UINT) Stores the CompoWay/F end code.
R+2 MRES/SRES (FINS-mini) (UINT) Stores the end code of the command
execured on the Destination Device.
R+3 Model numbers 1 and 2 (WORD)
R+4 Model numbers 3 and 4 (WORD)
R+5 Model numbers 5 and 6 (WORD) Stores the read-out properties of the
R+6 Model numbers 7 and 8 (WORD) Destination Device.
R+7 Model numbers 9 and 10 (WORD)
R+8 Buffer size (WORD)

51
9.Program

9.3. Error Detection Processing


With this program, the error detection processing is performed according to the following
descriptions (1) to (3). For information on error codes, refer to 9.8. Error Processing.

CJ2M-CPU12
CJ1W-SCU42 Destination Device

Serial cable

(1) (2) (3)

(1)Errors at the execution of the PMCR instruction (PMCR instruction errors)


An incorrect communications sequence number and an incorrect memory address, both of
which prevent the execution of the PMCR instruction, are detected as PMCR instruction
errors. If an error occurs, the error code (1519.00 to 03) will be generated to identify the
error, which indicates the port operating status in the CIO area allocated to the SCU.

(2)Errors in communications with the Destination Device (Communications error)


Errors that occur in communications with the Destination Device, such as character
corruption and transmission errors caused by unmatched baud rate setting, are detected as
communications errors. If an error occurs, the Sequence Abort End Completion flag
(1519.10) in the CIO area allocated to the SCU will be turned ON to identify the error.

(3)Errors in the Destination Device (Destination Device errors)


Destination Device errors include a command error, a parameter error, a data error and an
execution failure in the Destination Device. An error is identified in the response data that is
returned from the Destination Device. With this program, an error can be detected by
comparing difference in frames between a receive message in normal (hereinafter referred
to as a "normal message") and a receive message in error (hereinafter referred to as an
"error message"). Refer to 9.6.6. Receive Message Settings for details.

Normal STX “01” “00” “00” “03” “05” “00” “00” *** ETX **
message Send Node Sub End MRC SRC MRES SRES Data Send BCC
Start No. Address code End

Error STX “01” “00” “**” “03” “05” “**” “**” ETX **
message Send Node Sub End MRC SRC MRES SRES Send BCC
start No. Address code end

Error STX “01” “00” “**” ETX **


message Send Node Sub End Send BCC
start No. address code end

Additional Information
For information on the CIO area allocated to the SCU, refer to 9.4.2 Lists of Allocations.

52
9.Program

9.4. Memory Maps


The memory maps of this program are shown below.

9.4.1. Lists of Addresses


The tables below list the addresses necessary to execute this program.
You can change the allocations below to any addresses.

Precautions for Correct Use


Make sure that there is no duplicated address when changing the addresses.

●Input memory
The below addresses are used to operate this program.
Address Data type Variable name Description
5000.00 BOOL Input_Start Starts the send/receive processing when this flag
changes from OFF to ON.
5021 UINT Input_DestinationNodeNo Sets the node number of the Destination Device
(send destination).

●Output memory
The execution results of the program are stored in these addresses.
Address Data type Variable name Description
5000.02 BOOL Output_NormalEnd Turns ON when the send/receive processing ends
normally.
5000.03 BOOL Output_ErrorEnd Turns ON when one or more of the following errors
occur.
(1) PMCR instruction error
(2) Communications error
(3) Destination Device error
5503 WORD Output_Model 1_2 Stores the model numbers 1 and 2 received from the
Destination Device.
5504 WORD Output_Model 3_4 Stores the model numbers 3 and 4 received from the
Destination Device.
5505 WORD Output_Model 5_6 Stores the model numbers 5 and 6 received from the
Destination Device.
5506 WORD Output_Model 7_8 Stores the model numbers 7 and 8 received from the
Destination Device.
5507 WORD Output_Model 9_10 Stores the model numbers 9 and 10 received from the
Destination Device.
5508 WORD Output_BufferSize Stores the buffer size received from the Destination
Device.
H400 UINT Output_PMCR_ErrorCode Stores the error code when a PMCR instruction error
or a communications error occurs.

53
9.Program

Address Data type Variable name Description


H402 UINT Output_DestinationDevice Stores the error code received from the Destination
ErrorCode[0] Device when an error occurs in the Destination
Device. (CompoWay/F)
H403 UINT Output_DestinationDevice Stores the error code received from the Destination
ErrorCode[1] Device when an error occurs in the Destination
Device. (FINS-mini)

●Internal memory
These addresses are used to operate this program only.
Address Data type Variable name Description
5000.01 BOOL Local_PMCRExecuting Indicates the PMCR instruction execution status.
Turns ON when the PMCR instruction is being
executed, and turns OFF when the PMCR instruction is
not executed.
5000.04 BOOL Local_PMCRNormalEnd Turns ON when the PMCR instruction ends normally.
5000.05 BOOL Local_PMCRErrorEnd Turns ON when a communications error (such as a
transmission error) occurs.
5000.06 BOOL Local_DestinationDevice Turns ON when a Destination Device error occurs.
Error
5000.07 BOOL Local_PMCRError Turns ON when a PMCR instruction error (any of the
following three errors) occurs.
(1) Sequence number error
(2) Data read/write range error
(3) Protocol data syntax error
5010 UINT Local_ControlWord1 Execution parameter of the PMCR instruction.
5011 UINT Local_ControlWord2 Execution parameter of the PMCR instruction.
5012 UINT Local_PMCR_ErrorCode Stores the error code when a PMCR instruction error
occurs.
5020 UINT Local_FirstSendWord Sets the number of send words of the PMCR
instruction.
5500 UINT Local_FirstReceiveWord Stores the number of words received from the
Destination Device.
5501 UINT Local_ResposeCode[0] Stores the error code of the Destination Device (end
code of CompoWay/F) when a Destination Device error
occurs.
5502 UINT Local_ResposeCode[1] Stores the error code of the Destination Device
(MRES/SRES of FINS-mini) when a Destination Device
error occurs.

54
9.Program

9.4.2. Lists of Allocations


The tables below list the addresses necessary to execute this program.

●CIO area
These addresses are allocated and fixed in the CIO area according to the unit number (unit
address) that is set for the SCU.
Unit number 0 is used in this program.

Address Data type Variable name


1509 UINT ProtocolMacroErrorCode_SCU_0_P1
1509.10 BOOL SequenceAbortEndCompletion_SCU_0_P1
1509.11 BOOL SequenceEndCompletion_SCU_0_P1
1509.15 BOOL ProtocolMacroExecuting_SCU_0_P1

Additional Information
For details on the CIO area allocated to the SCU, refer to 2-3-2. CIO Area of the CJ Series
Serial Communications Units OPERATION MANUAL (Cat. No. W336).

●Related auxiliary area


The following address is allocated and fixed in the related auxiliary area according to the
communications port number (logical port) that is specified in the program (PMCR
instruction operands).
The communications port No. 7 is used in this program.

Address Data type Variable name


A202.07 BOOL CommPortEnabledFlag_P7

Additional Information
For information on the related auxiliary area for the PMCR instruction, refer to Related
Auxiliary Area Words and Bits in Serial Communications Instructions (PMCR) in SECTION 3.
Instructions of the CJ Series Programmable Controllers INSTRUCTIONS REFERENCE
MANUAL (Cat. No. W474).

55
9.Program

9.5. Ladder Program

9.5.1. Functional Components of the Ladder Program


The functional components of this program are shown below.
Major Minor classification Description
classification
1.Initialization 1.1. Response code clear The area of use is cleared, and the
processing 1.2. Operand setting for initialization setting is performed as a
PMCR instruction preparation for communications.
1.3. Send/receive symbol
setting
2.PMCR 2.1. PMCR instruction The communications sequence registered
instruction executing in SCU is identified and executed.
execution 2.2. PMCR instruction A normal end or an error end is detected
management execution processing based on the related flags or receive data
2.3. Normal/error detection after the execution.
processing
3.Normal end 3.1. Normal end processing The normal completion flag is turned ON.
state 3.2. Response code setting The response code for a normal end is
management set.
4.Error end 4.1. Error end processing The error end flag is turned ON.
state 4.2. Response code setting The response code corresponding to the
management error cause is set.

56
9.Program

9.5.2. Detailed Description of Each Functional Component


The program used in this guide is shown below.

●1. Initialization processing

No. Name Description


1.1. Response code clear Clears the error code storage areas to zero.
1.2. Operand setting for Sets execution parameters (operands) of the PMCR
PMCR instruction instruction.
1.3. Send/receive symbol Initializes the receive data storage areas.
setting

57
9.Program

●2. PMCR instruction execution management

No. Name Description


2.1. PMCR instruction Enters the PMCR instruction executing status.
executing The executing state is reset at a normal end or an error end of
the send/receive processing.
2.2. PMCR instruction Executes the PMCR instruction under the following
execution conditions.
processing - Communications port No.7 can be used.
- Protocol macro is not being executed.

Precautions for Safe Use


Thoroughly check the overall program before specifying an area to store the data that is
received after the PMCR instruction. Otherwise, the data may be written to an unintended
memory area.

Precautions for Correct Use


The communications port No. 7 is used in this program.
Do not use the communications port No.7 for other purposes.
If you have no choice but to use the communications port No. 7, check that Communications
Port Enabled Flag (A202.07) is ON.

58
9.Program

No. Name Description


2.3. Normal/error Detects a normal end or an error end, based on the results of
detection processing send/receive processing.
It is considered as a normal end when all the following
conditions are met.
(1)Normal end of PMCR instruction
(No PMCR instruction error)
(2)Normal end of communications sequence
(No communications error)
(3)Normal message received from the Destination Device
(No Destination Device error)
If any of these conditions is not met and an error occurs, the
corresponding error flag will turn ON.

59
9.Program

●3. Normal end state management

No. Name Description


3.1. Normal end Turns ON the normal end flag if a normal end of the
processing send/receive processing is detected in 2.3. Normal/error
detection processing.
3.2. Response code Sets response code "#0000" for a normal end in the response
setting code storage areas.

60
9.Program

●4. Error end state management

No. Name Description


4.1. Error end processing Turns ON the error end flag if an error end of the send/receive
processing is detected in 2.3. Normal/error detection
processing.
4.2. Response code Sets the response code corresponding to the error in the
setting response code storage area when an error occurs.

Additional Information
Refer to 9.8 Error Processing for information on the response codes.

61
9.Program

9.6. Protocol Data


The protocol data consists of sequence, step, send/receive message and matrix.
The protocol data structure is described as follows:

●When there is only one receive message for a step (send/receive once)
・One each of receive and send messages is set for a step.
Sequence No. 618 Step No. 00 Send message 00 Receive message 00


・ Step No. yy Send message yy Receive message yy

Sequence No. xxx xxx: 999 max., yy: 15 max.

●When there is more than one receive message for a step (send/receive once)
・The send message and matrix are set for a step.
・More than one receive message is set in the case numbers 00 to 14 of matrix.
("Other" is automatically set in the case number 15.)
Sequence No. 900 Step No. 00 Send message 00 < Matrix >

Case No. 00 Receive message 00



・ Step No. yy

yy: 15 max. zz: 14 max. Case No. zz Receive message zz

Sequence No. xxx xxx: 999 max. Automatic setting in case No. 15 Case No.15 Other

9.6.1. Protocol Data Structure


The protocol data in this guide uses a modified standard system protocol.
There are three different receive messages (one normal message and two error messages) for
the send message (SD PRO_R), and those messages are set in the matrix (MX PRO_R).
The protocol data structure used in this guide is shown below.

(Standard system protocol before modification)


Sequence No. 618 Step No. 00 SD PRO_R RV PRO_R

(After modification)
Sequence No. 618 Step No. 00 SD PRO_R <MX PRO_R>

Case No. 00 RV PRO_R

Case No. 01 RV FINSERR

Case No. 02 RV COMFERR

Case No. 15 Other

RV PRO_R for receiving a normal message


RV FINSERR, RV COMFERR and Other for receiving an error message
(Refer to 9.6.6. Receive Message Settings for details.)

62
9.Program

9.6.2. Procedure of Protocol Data Processing


The procedure of protocol data processing is shown below.

1. [Step No. 00]


Sending the send message (SD PRO_R)

2. When step No.00 ends normally When step No.00 ends in error
↓ ↓
3. Next Process: Matrix Error Process: Abort
Executes the case No. 00, 01, 02 and Aborts the step and ends the
15, and terminates the communications sequence.
communications sequence as an
End.
↓ ↓
(End) (End)

63
9.Program

9.6.3. Sequence Settings


The Destination Device executes the "Properties Read" command corresponding to the
communications sequence No. 618 that is used in the protocol data in this guide.
The communications sequence settings include the time for monitoring the send and receive
processing (monitoring time).

Additional Information
For details on communications sequence settings, refer to 5-2 Creating Sequences and
Steps of the CX-Protocol OPERATION MANUAL (Cat. No. W344).

●Monitoring time
The monitoring time (Timer Tr, Tfr, and Tfs) that is set for the communications sequence is
described below.

[Screenshot of the communications sequence settings]

[Settings]
Item Name Description
Monitors the time from when the receive command of the step in
Receive wait
the sequence is recognized until the first byte (header) is
Timer Tr monitoring
received. This timer is set to 3 seconds in the protocol data used
time
in this guide.
Receive Monitors the time from reception of the first byte to reception of
finish the last byte of the data in the step in the sequence.
Timer Tfr
monitoring This timer is set to 3 seconds in the protocol data used in this
time guide.
Send finish Monitors the time from transmission of the header to
Timer Tfs monitoring transmission of the last byte of the data. This timer is set to 3
time seconds in the protocol data used in this guide.

Additional Information
For information on the calculation method of monitoring time, refer to 4-5 Calculation Method
of Monitoring Time of the CX-Protocol OPERATION MANUAL (Cat. No. W344).

64
9.Program

9.6.4. Step Settings


The step that is set for the communications sequence No. 618 is described below.
The step settings include retry count, send/receive messages (message names), next
process and error process.
The sequence of the protocol data used in this guide consists of the step No. 00 only.

Additional Information
For details on the step settings, refer to 3-3 Step Attributes of the CX-Protocol OPERATION
MANUAL (Cat. No. W344).

●Retry count
The retry count that is set for the step is shown below. The step is repeated the number of
designated times (0 to 9 times) when an error occurs. If the error still remains after the
designated number of retry repetitions, the system goes to the error process.
The retry count can be set only for steps in which the Send&Receive command is set.

[Screenshot of the step settings]

[Settings]
Step No. Retry count
00 3

●Send/Receive messages (message names)


The send/receive messages that are set for the step are shown below.
Here, the registered send message name and matrix name are selected.

[Screenshot of the step settings]

[Settings]
Step No. Send message Receive message
00 SD PRO_R <MX PRO_R>
The matrix is indicated with a pair of marks < > at the beginning and end of a receive
message. The matrix is used when more than one receive message exists.

65
9.Program

●Next process and error process


The next process and error process that are both set for the step are shown below.
The process set in the Next Column is executed when execution of the step ends normally.
If a communications error occurs, the process set in the Error Column is executed.

[Screenshot of the step settings]

[Settings]
Step No. Next process Error process
00 Matrix Abort

[Process list]
Process Description
End Ends the communications sequence.
Next Goes to the next step number.
Abort Aborts the step and ends the communications sequence.
Goto Goes to a designated step number.
Matrix Follows the next process that is set for each receive
message in the matrix.

66
9.Program

9.6.5. Send Message Settings


The send message that is set in this guide is described below.

Additional Information
For details on the send message settings, refer to 3-4 Communication Message Attributes of
the CX-Protocol OPERATION MANUAL (Cat. No. W344).

[Screenshot of the send message settings]

●[Send message (SD PRO_R)]


[Settings]
<h>+<a>+”00”+”0”+”0503”+<t>+<c>
(1) (2) (3) (4) (5)
No. Code Description
(1) <h > (Header) Type: Code, Data: 02 hex
(2) <a > (Address) (R(1),2): Converts 2-byte data and sends it from the word
(first send word specified with the PMCR instruction
$(R(1),2)
operand + 1).
$: Forward direction ASCII conversion
(Converts the send message from hexadecimal code to
ASCII code, and outputs the send data from the lower byte.)
(S+1 word Local_SendDataNodeNo)
(3) “00”, “0”, “0503” Constant ASCII
(4) <t > (Terminator) Type: Code, Data: 03 hex
(5) <c> (Check code) Type: LRC (horizontal parity) (0) (1-byte BIN)
Setting range: 2 to 6

67
9.Program

[Send message command frame]


This is the command frame of the message that is sent by the SCU to the Destination
Device according to the settings of the send message (SD PRO_R).

FINS-mini Command
STX Node No. Subaddress Text

Data

Byte

Command Number Remarks


of bytes
STX 1 Fixed: STX
(This code indicates the beginning of the communications
frame.)
Node No. 2 Variable: The value between 01 and 99 can be set.
(“XX” for a broadcast transmission)
01 is set in the protocol data used in this guide.
Subaddress 2 Fixed: 00
SID 1 Fixed: 0
MRC 2 05 is set in the protocol data used in this guide.
(Reads the properties of the Destination Device.)
SRC 2 03 is set in the protocol data used in this guide.
(Reads the properties of the Destination Device.)
*
Data From 0 This is not used for the "Properties Read" command.
onwards
ETX 1 Fixed: ETX (This code indicates the end of the text.)
BCC 1 Abbreviation of Block Check Character
Stores the result of the BCC calculation from Node No. up to
ETX.
* When Data is not used, it is removed from the frame, and ETX is shifted next to SRC.

68
9.Program

9.6.6. Receive Message Settings


The receive message that is set in this guide is described below, which corresponds to the
response frame of normal or error message.

Additional Information
For details on the receive message settings, refer to 3-4 Communication Message Attributes
of the CX-Protocol OPERATION MANUAL (Cat. No. W344).

[Screenshot of the receive message settings]

●Normal or error message detection


In this guide, the normal or error message can be detected by the end code of the receive
message in the protocol data.

●Receive message (RV PRO_R) (normal message)


[Settings]
<h>+<a>+”00”+&(W(1),2)+”0503”+&(W(2),4)+(W(3),10)+&(W(8),4)+<t>+<c>
(1) (2) (3) (4) (3) (5) (6) (7) (8) (9)

In the standard system protocol RV PRO_R, a CompoWay/F communications error is read


and discarded by the code "(*,2)"; however, in the protocol data used in this guide, the end
code from the Destination Device is converted and stored by the code "&(W(1),2)" as shown
in (4), to detect whether there is an error or not.

●Message name (RV FINSERR) (error message)


[Settings] (FINS-mini protocol error detection)
<h>+<a>+”00”+&(W(1),2)+”0503”+&(W(2),4)+<t>+<c>
(1) (2) (3) (4) (3) (5) (8) (9)

●Message name (RV COMFERR) (error message)


[Settings] (CompoWay/F protocol error detection)
<h>+<a>+”00”+&(W(1),2)+<t>+<c>
(1) (2) (3) (4) (8) (9)

69
9.Program

No. Code Description


(1) <h > (Header) Type: Code, Data: 02 hex
(2) <a > (Address) (R(1),2): Converts 2-byte data and compares the receive data
$(R(1),2) with the word (first send word specified with the PMCR
instruction operand + 1).
$: Forward direction ASCII conversion
(Converts the send message from hexadecimal code to ASCII
code, and outputs the send data from the lower byte.)
(3) “00”, “0503” Constant ASCII
(4) &(W(1),2) (W(1),2): Converts 2-byte data and stores it in the word (first
receive word specified with the PMCR instruction operand + 1).
&: Forward direction hexadecimal conversion
(Converts the receive message from ASCII code to
hexadecimal code, and stores the receive data from the lower
byte.)
(5) &(W(2),4) (W(2),4): Converts 4-byte data and stores it in the word (first
receive word specified with the PMCR instruction operand + 2).
&: Forward direction hexadecimal conversion
(Converts the receive message from ASCII code to
hexadecimal code, and stores the receive data from the
rightmost byte.)
(6) (W(3),10) (W(3),10): Converts 10-byte data and stores it in the word (first
receive word specified with the PMCR instruction operand +3).
(7) &(W(8),4) (W(8),4): Converts 4-byte data and stores it in the word (first
receive word specified with the PMCR instruction operand + 8).
&: Forward direction hexadecimal conversion
(Converts the receive message from ASCII code to
hexadecimal code, and stores the receive data from the
rightmost byte.)
(8) <t> (Terminator) Type: Code, Data: 03 hex
(9) <c> (Check code) Type: LRC (horizontal parity) (0) (1-byte BIN)
Setting range: RV PRO_R = 2 to 9
RV FINSERR=2 to 7
RV COMFERR=2 to 5

70
9.Program

[Response frame of receive message]


This is the response frame of the receive message that is received by the SCU from the
Destination Device.
FINS-mini Response
STX Node No.Subaddress End code Text

Data

Byte

Command Number Remarks


of bytes
STX 1 Fixed: STX (This code indicates the beginning of the
communications frame.)
Node number 2 Variable: Between 01 and 99
The unit number of the Destination Device that returns the
response.
01 is set in the protocol data used in this guide.
Subaddress 2 Fixed: 00
End code 2 Destination Device error code[0] (CompoWay/F)
(Refer to 9.8 Error Processing.)
*1
MRC 2 Returns the send command value.
05 is returned in the protocol data used in this guide.
(Reads the properties of the Destination Device.)
*1
SRC 2 Returns the send command value.
03 is returned in the protocol data used in this guide.
(Reads the properties of the Destination Device.)
*1
MRES 2 Destination Device error code [1] (FINS-mini)
(Refer to 9.8 Error Processing.)
*1
SRES 2 Destination device error code [1] (FINS-mini)
(Refer to 9.8 Error Processing.)
*1 *2
Data From 0 Reads the model (fixed to 10 bytes) and communications
onwards buffer size with the "Properties Read" command.
ETX 1 Fixed: ETX (This code indicates the end of the text.)
BCC 1 Abbreviation of Block Check Character
Stores the result of the BCC calculation from the node
number up to ETX.
*1 If the CompoWay/F command cannot be executed, these commands are removed from the
frame, and ETX is shifted next to End code. In this case, only the end code is returned.
*2 If the response does not use Data or if the specified FINS-mini command cannot be
executed, Data is removed from the frame, and ETX is shifted next to SRES.

71
9.Program

9.6.7. Matrix Settings


The matrix (MX PRO_R) that is set in this guide is described below.

Additional Information
For details on matrix settings, refer to 3-5 Creating Matrices of the CX-Protocol OPERATION
MANUAL (Cat. No. W344).

[Screenshot of the matrix setting]

*The above screenshot shows that four cases are set in the matrix (MX PRO_R).

●Receive matrix (MX PRO_R)


The following shows that four cases (case No. 00, 01, 02 and 15) are set in the matrix (MX
PRO_R).

[Screenshot of the case number setting]

[Settings]
The table below shows the receive message and next process for each case number.
Case No. Receive message Next process
00 RV PRO_R End
01 RV FINSERR End
02 RV COMFERR End
15 Other End
An actually received message is compared with each of the following expected receive
messages set in the matrix: "RV PRO_R" (normal message), "RV FINSERR" and "RV
COMFERR" (error messages) and "Other" (other receive message) in that order.
If the actually received message is matched with either the normal or error message,
control will be passed to the next process as required. If not matched, control will be
passed to the next process designated with "Other". The ladder program checks the
received result to detect an error in the Destination Device.

72
9.Program

9.7. Timing Charts


The timing charts are shown below.

Normal end
Input_Start
(5000.00)

Local_PMCRExecuting
(5000.01)

Receive data storage area


(5501 to 5506) Normal resoponse Normal resoponse

Output_NormalEnd
(5000.02)

Output_ErrorEnd
(5000.03)

Output_PMCR_ErrorCode
(H400) #0000

Output_DestinationDeviceErrorCode
(H402) #0000

Error end (1) Error end (2) Error end (3)


PMCR error Communications error Destination device error
Input_Start
(5000.00)

Local_PMCRExecuting
(5000.01)

Receive data storage area


Error response
(5501 to 5506)

Output_NormalEnd
(5000.02)

Output_ErrorEnd
(5000.03)

Output_PMCR_ErrorCode #0002 to 4 #000F #0000


(H400)

Output_DestinationDeviceErrorCode #0000 #0000 #0010


(H402)

73
9.Program

9.8. Error Processing


The errors that may occur during the program execution are described below.

9.8.1. Protocol Macro Error Codes


The SCU detects these errors by monitoring the macro operation.
The error codes include either (1) PMCR instruction error or (2) Communications error (e.g.,
transmission error), and are stored in H400 (Output_PMCR_ErrorCode).

[Error code list]


Error code Name Classification Description
The sequence number specified for
Sequence No. (1)PMCR
#0002 the PMCR instruction does not exist
error instruction error
in the Unit.
Data read/write When data is written or read to/from
(1)PMCR
#0003 area exceeded the CPU Unit, the specified area
instruction error
error range is exceeded.
A code that cannot be executed
Protocol data (1)PMCR occurs while the protocol macro is
#0004
syntax error instruction error executed. (Example: A header occurs
after a delimiter.)
Transmission (2)Communications Communications cannot perform due
#000F
error error to an error in the transmission path.

Additional Information
For details and troubleshooting on the protocol macro errors, refer to 12-3 Troubleshooting of
the CJ Series Serial Communications Units OPERATION MANUAL (Cat. No. W336).

74
9.Program

9.8.2. Destination Device Error Codes


A Destination Device error is detected by monitoring communications of the Destination
Device when the SCU sends a command. The error code of the CompoWay/F error is stored
in H402 (Output_DestinationDeviceErrorCode[0]), and the error code of the Fins-mini error in
the Destination Device is stored in H403 (Output_DestinationDeviceErrorCode[1]).

[Frame] ([H402])
Bit 15 8 7 0

#Always #00 “**" End code

[Error code list]


End code Name Description Priority
00 Normal completion The command ended normally without error. None
The specified FINS command could not be
FINS command executed.
0F 8
error The FINS response code should indicate why
the command could not be executed.
The sum total of bits whose received data is
10 Parity error "1" does not match the set value of the 2
"communications parity" bit.
11 Framing error Stop bit is "0". 1
An attempt was made to transfer new data
12 Overrun error when the reception data buffer was already 3
full.
The calculated BCC value is different from the
13 BCC error 5
received BCC value.
-The command text contains characters other
than 0 to 9, and A to F.
14 Format error -There was no SID and command text, or 7
there was no command text.
-"MRC/SRC" not included in command text.
-Illegal (unsupported) subaddress
-There was no subaddress, SID and
16 Subaddress error command text. 6
-Subaddress was less than two characters,
and there was no SID and command text
The received frame exceeds the specified
18 Frame length error 4
(supported) number of bytes.

75
9.Program

[Frame] ([H403])
Bit 15 8 7 0

#**** Response code

[Response code list]


Response code Error name Priority
0000 Normal completion None
0401 Unsupported command 1
1001 Command too long 2
1002 Command too short 3
1101 Area type error 4
Start address out-of-range
1103 5
error
End address out-of-range
1104 6
error
Number of elements/data
1003 7
mismatch
110B Response too long 8
1100 Parameter error 9
3003 Read-only error 10
2203 Operation error 11

Additional Information
For details on the Destination Device errors and troubleshooting, refer to the Digital
Temperature Controllers User's Manual (Cat. No. H224/H174/H185) and the Digital
Temperature Controllers Communications Manual (Cat. No. H225/H175/H186).

76
10.Revision History

10. Revision History

Revision Date of revision Description of revision


code
01 June 2018 First edition

77
2018

P704-E1-01 0618-(0618)

You might also like