0% found this document useful (0 votes)
1K views

User'S Manual: CP2E CPU Unit Software

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)
1K views

User'S Manual: CP2E CPU Unit Software

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/ 578

Cat. No.

W614-E1-01

SYSMAC CP Series
CP2E-E……D…-…
CP2E-S……D…-…
CP2E-N……D…-…
CP2E CPU Unit Software

USER’S MANUAL
NOTE
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior
written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because
OMRON is constantly striving to improve its high-quality products, the information contained in this manual is
subject to change without notice. Every precaution has been taken in the preparation of this manual. Neverthe-
less, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages
resulting from the use of the information contained in this publication.

Trademarks
• Microsoft, Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States
and other countries.

Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.

Copyrights
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
SYSMAC CP Series
CP2E-E……D…-…
CP2E-S……D…-…
CP2E-N……D…-…
CP2E CPU Unit Software
User’s Manual
Produced September 2019
Introduction
Thank you for purchasing a SYSMAC CP-series CP2E Programmable Controller.
This manual contains information required to use the CP2E. Read this manual completely and be sure
you understand the contents before attempting to use the CP2E.

Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical sys-
tems (an electrical engineer or the equivalent).
• Personnel in charge of installing FA systems
• Personnel in charge of designing FA systems
• Personnel in charge of managing FA systems and facilities

Applicable Products

z CP-series CP2E CPU Units


• Essential Model CP2E-E……D…-…
A model of CPU Unit that supports connections to Programmable Terminals and basic control
applications using instructions such as basic, movement, arithmetic, and comparison instructions.
• Standard Model CP2E-S……D…-…
A model of CPU Unit that supports connections to inverters and servo drives.
• Network Model CP2E-N……D…-…
A model of CPU Unit that supports Ethernet connection and enhanced positioning functions such
as 4-axis linear interpolation and pulse.
The CP Series is centered around the CP1H, CP1L, CP1E and CP2E CPU Units and is designed
with the same basic architecture as the CS and CJ Series.
Always use CP-series Expansion Units and CP-series Expansion I/O Units when expanding I/O
capacity.

CP2E CPU Unit Software User’s Manual(W614) 1


CP2E CPU Unit Manuals
Information on the CP2E CPU Units is provided in the following manuals.
Refer to the appropriate manual for the information that is required.

This Manual
CP2E CPU Unit Hardware CP2E CPU Unit Software CP1E/CP2E CPU Unit Instructions
User’s Manual(Cat. No. W613) User’s Manual(Cat. No. W614) Reference Manual(Cat. No. W483)
Mounting and
1 Setting Hardware
· Names and specifications of the parts of all Units
· Basic system configuration for each CPU Unit
· Connection methods for Expansion I/O Units
and Expansion Units

2 Wiring

· Wiring methods for the power supply


· Wiring methods between external I/O devices
and Expansion I/O Units or Expansion Units

Connecting
3 Online to the PLC

Connecting Cables for CX-Programmer Procedures for connecting the


Support Software CX-Programmer Support Software

4 Software Setup
Software setting methods for the CPU
Units (PLC Setup)

5 Creating the Program


· Program types and basic information Detailed information on
· CPU Unit operation programming instructions
· Internal memory
· Built-in CPU functions
· Settings

Checking and
6 Debugging Operation
· Checking I/O wiring, setting the Auxiliary Area
settings, and performing trial operation
· Monitoring and debugging with the
CX-Programmer

Maintenance and
7 Troubleshooting

Error codes and remedies if a problem occurs

2 CP2E CPU Unit Software User's Manual(W614)


Manual Configuration
The CP2E CPU manuals are organized in the sections listed in the following tables. Refer to the appro-
priate section in the manuals as required.

CP2E CPU Unit Software User’s Manual (Cat. No. W614)


(This Manual)
Section Contents
Section 1 Overview This section gives an overview of the CP2E, describes its application
procedures.
Section 2 CPU Unit Memory This section describes the types of internal memory in a CP2E CPU
Unit and the data that is stored.
Section 3 CPU Unit Operation This section describes the operation of a CP2E CPU Unit.
Section 4 Programming Concepts This section provides basic information on designing ladder programs
for a CP2E CPU Unit.
Section 5 I/O Memory This section describes the types of I/O memory areas in a CP2E CPU
Unit and the details.
Section 6 I/O Allocation This section describes I/O allocation used to exchange data between
the CP2E CPU Unit and other units.
Section 7 PLC Setup This section describes the PLC Setup, which are used to perform basic
settings for a CP2E CPU Unit.
Section 8 Overview and Allocation This section lists the built-in functions and describes the overall applica-
of Built-in Functions tion flow and the allocation of the functions.
Section 9 Quick-response Inputs This section describes the quick-response inputs that can be used to
read signals that are shorter than the cycle time.
Section 10 Interrupts This section describes the interrupts that can be used with CP2E PLCs,
including input interrupts and scheduled interrupts.
Section 11 High-speed Counters This section describes the high-speed counter inputs, high-speed
counter interrupts, and the frequency measurement function.
Section 12 Pulse Outputs This section describes positioning functions such as trapezoidal control,
jogging, and origin searches.
Section 13 PWM Outputs This section describes the variable-duty-factor pulse (PWM) outputs.
Section 14 Serial Communications This section describes communications with Programmable Terminals
(PTs) without using communications programming, no-protocol commu-
nications with general components, and connections with a Modbus-
RTU Easy Master, Serial PLC Link, host computer and Modbus-RTU
Slave.
Section 15 Ethernet This section gives an outline of the built-in Ethernet function, explains its
specification and how to make the settings required for operation.
Section 16 Other Functions This section describes PID temperature control, clock functions, DM
backup functions, security functions.
Section 17 Analog Option Board This section describes an overview of the Analog Option Board,
describes its installation and setting methods, memory allocations, star-
tup operation, refresh time, troubleshooting and how to use the Analog
Option Board.
Section 18 Operating the Program- This section describes basic functions of the CX-Programmer, such as
ming Device using the CX-Programmer to write ladder programs to control the CP2E
CPU Unit, to transfer the programs to the CP2E CPU Unit, and to debug
the programs.
Appendices The appendices provide lists of programming instructions, the Auxiliary
Area, cycle time response performance, PLC performance at power
interruption, memory map and Ethernet functions.

CP2E CPU Unit Software User’s Manual(W614) 3


CP2E CPU Unit Hardware User’s Manual (Cat. No. W613)
Section Contents
Section 1 Overview and Specifica- This section gives an overview of the CP2E, describes its features, and
tions provides its specifications.
Section 2 Basic System Configura- This section describes the basic system configuration and unit models
tion and Devices of the CP2E.
Section 3 Part Names and Functions This section describes the part names and functions of the CPU Unit,
Expansion I/O Units, and Expansion Units in a CP2E PLC.
Section 4 Programming Device This section describes the features of the CX-Programmer used for pro-
gramming and debugging PLCs, as well as how to connect the PLC with
the Programming Device by USB, Ethernet and serial port.
Section 5 Installation and Wiring This section describes how to install and wire CP2E Units.
Section 6 Troubleshooting This section describes how to troubleshoot problems that may occur
with a CP2E PLC, including the error indications provided by the CP2E
Units.
Section 7 Maintenance and Inspec- This section describes periodic inspections, the service life of the Bat-
tion tery, and how to replace the Battery.
Section 8 Using Expansion Units This section describes application methods for Expansion Units.
and Expansion I/O Units
Appendices The appendices provide information on dimensions, wiring diagrams,
and wiring serial communications, network installation for the CP2E and
comparison between CP1E and CP2E.

CP1E/CP2E CPU Unit Instructions Reference Manual (Cat. No. W483)


Section Contents
Section 1 Summary of Instructions This section provides a summary of instructions used with a
CP1E/CP2E CPU Unit.
Section 2 Instruction This section describes the functions, operands and sample programs of
the instructions that are supported by a CP1E/CP2E CPU Unit.
Section 3 Instruction Execution This section provides the execution times for all instructions used with a
Times and Number of Steps CP1E/CP2E CPU Unit.
Section 4 Monitoring and Comput- This section describes how to monitor and calculate the cycle time of a
ing the Cycle Time CP1E/CP2E CPU Unit that can be used in the programs.
Appendices The appendices provide a list of instructions by Mnemonic and ASCII
code table for the CP1E/CP2E CPU Unit.

4 CP2E CPU Unit Software User's Manual(W614)


Manual Structure

Page Structure and Icons

The following page structure and icons are used in this manual.

5 Installation and wiring


Level 1 heading
Level 2 heading
Level 2 heading 5-2 Installation Level 3 heading
Gives the current
Level 3 heading 5-2-1 Installation Location
headings.

DIN Track Installation

Step in a procedure 1

5-2 Installation
Use a screwdriver to pull down the DIN Track mounting pins from the back of the Units to release
them, and mount the Units to the DIN Track.

Indicates a step in a
procedure.
DIN Track mounting pins
5 Page tab
Release Gives the number

5-2-1 Installation Location


2 Fit the back of the Units onto the DIN Track by catching the top of the Units on the Track and then of the section.
pressing in at the bottom of the Units, as shown below.

DIN Track

3 Press in all of the DIN Track mounting pins to securely lock the Units in place.

Special Information
(See below.)
Icons are used to indicate
precautions and
additional information. DIN Track mounting pins

Precautions for Correct Use


Tighten terminal block screws and cable screws to the following torques.
M4: 1.2 N·m
M3: 0.5 N·m

Manual name CP2E CPU Unit Hardware User’s Manual(W613) 5-3

This illustration is provided only as a sample and may not literally appear in this manual.

Special Information
Special information in this manual is classified as follows:
Precautions for Safe Use
Precautions on what to do and what not to do to ensure using the product safely.

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 increase understanding or make operation easier.

CP2E CPU Unit Software User’s Manual(W614) 5


Terminology and Notation
Term Description
E-type CPU Unit An essential model of CPU Unit that supports connections to Programmable Terminals
and basic control applications using instructions such as basic, movement, arithmetic,
and comparison instructions.
Essential models of CPU Units are called “E……-type CPU Units” or “E14/20 CPU Units”
in this manual.
The models of E……-type CPU Units are shown below.
CP2E-E……D…-…
S-type CPU Unit A standard model of CPU Unit that supports connections to inverters and servo drives.
Standard models of CPU Units are called “S……-type CPU Units” or “S30/40/60 CPU
Units” in this manual.
The models of S……-type CPU Units are shown below.
CP2E-S……D…-…
N-type CPU Unit A network model of CPU Unit that supports Ethernet connection and enhanced position-
ing functions such as 4-axis linear interpolation and pulse.
Network models of CPU Units are called “N……-type CPU Units” or “N30/40/60 CPU
Units” in this manual.
The models of N……-type CPU Units are shown below.
CP2E-N……D…-…
CX-One A programming device that applies for programming and debugging PLCs.
CX-Programmer CP2E CPU Units are supported by CX-One version 4.51 or higher and CX-Programmer
version 9.72 or higher.

6 CP2E CPU Unit Software User's Manual(W614)


Sections in this Manual

1 11

2 12
1 Overview 11 High-speed Counters

3 13
Internal Memory
2 in the CPU Unit 12 Pulse Outputs
4 14

3 CPU Unit Operation 13 PWM Outputs


5 15

Understanding Serial
4 Programming 14 Communications 6 16

7 17
5 I/O Memory 15 Ethernet

8 18
6 I/O Allocation 16 Other Functions

APP
9
Analog
7 PLC Setup 17 Option Board
10
Overview of Built-in
Programming
8 Functions and
Allocations
18 Device Operations

Quick-response
9 Inputs A Appendices

10 Interrupts

CP2E CPU Unit Software User’s Manual(W614) 7


CONTENTS
Introduction ............................................................................................................... 1

CP2E CPU Unit Manuals ........................................................................................... 2

Manual Structure ....................................................................................................... 5

Terms and Conditions Agreement......................................................................... 15

Safety Precautions .................................................................................................. 17

Precautions for Safe Use........................................................................................ 19

Regulations and Standards.................................................................................... 21

Software Licenses and Copyrights ....................................................................... 22

Related Manuals ...................................................................................................... 23

Section 1 Overview
1-1 CP2E Overview ........................................................................................................................ 1-2
1-1-1 Overview of Features .................................................................................................................. 1-2
1-2 Basic Operating Procedure .................................................................................................... 1-3

Section 2 Internal Memory in the CPU Unit


2-1 Internal Memory in the CPU Unit............................................................................................ 2-2
2-1-1 CPU Unit Memory Backup Structure .......................................................................................... 2-2
2-1-2 Memory Areas and Stored Data ................................................................................................. 2-3
2-1-3 Transferring Data from a Programming Device ........................................................................... 2-4
2-1-4 Backup ........................................................................................................................................ 2-4

Section 3 CPU Unit Operation


3-1 CPU Unit Operation ................................................................................................................. 3-2
3-1-1 Overview of CPU Unit Operation ................................................................................................ 3-2
3-1-2 CPU Unit Operating Modes......................................................................................................... 3-3
3-2 Backing Up Memory ................................................................................................................ 3-5
3-2-1 CPU Unit Memory Configuration................................................................................................. 3-5
3-2-2 Backing Up Ladder Programs and Parameter Area.................................................................... 3-6
3-2-3 I/O Memory Backup .................................................................................................................... 3-6
3-2-4 Initializing I/O Memory at Startup................................................................................................ 3-7

Section 4 Understanding Programming


4-1 Programming ........................................................................................................................... 4-2
4-1-1 User Programs ............................................................................................................................ 4-2
4-1-2 Program Capacity ....................................................................................................................... 4-3
4-1-3 Basics of Programming ............................................................................................................... 4-3
4-2 Tasks, Sections, and Symbols ............................................................................................... 4-6
4-2-1 Overview of Tasks ....................................................................................................................... 4-6
4-2-2 Overview of Sections .................................................................................................................. 4-6
4-2-3 Overview of Symbols .................................................................................................................. 4-6

8 CP2E CPU Unit Software User’s Manual(W614)


4-3 Function Blocks....................................................................................................................... 4-8
4-3-1 Overview of Function Blocks....................................................................................................... 4-8
4-3-2 Advantages of Function Blocks ................................................................................................... 4-8
4-3-3 Function Block Specifications ................................................................................................... 4-10
4-3-4 ST Language............................................................................................................................. 4-12
4-4 Programming Instructions.................................................................................................... 4-14
4-4-1 Basic Understanding of Instructions ......................................................................................... 4-14
4-4-2 Operands .................................................................................................................................. 4-15
4-4-3 Instruction Variations................................................................................................................. 4-16
4-4-4 Execution Conditions ................................................................................................................ 4-16
4-4-5 Specifying Data in Operands .................................................................................................... 4-18
4-4-6 Data Formats ............................................................................................................................ 4-20
4-4-7 I/O Refresh Timing .................................................................................................................... 4-22
4-5 Constants ............................................................................................................................... 4-23
4-6 Index Registers ...................................................................................................................... 4-26
4-6-1 What are Index Registers?........................................................................................................ 4-26
4-6-2 Using Index Registers ............................................................................................................... 4-26
4-6-3 Monitoring Index Registers ....................................................................................................... 4-30
4-7 Specifying Offsets for Addresses ........................................................................................ 4-32
4-7-1 Overview ................................................................................................................................... 4-32
4-7-2 Application Examples for Address Offsets ................................................................................ 4-34
4-8 Ladder Programming Precautions...................................................................................... 4-35
4-8-1 Special Program Sections......................................................................................................... 4-35

Section 5 I/O Memory


5-1 Overview of I/O Memory Areas............................................................................................... 5-2
5-1-1 I/O Memory Areas....................................................................................................................... 5-2
5-1-2 I/O Memory Area Address Notation ............................................................................................ 5-5
5-1-3 I/O Memory Areas....................................................................................................................... 5-6
5-2 I/O Bits ...................................................................................................................................... 5-7
5-3 Work Area (W) .......................................................................................................................... 5-8
5-4 Holding Area (H) ...................................................................................................................... 5-9
5-5 Data Memory Area (D) ........................................................................................................... 5-11
5-6 Timer Area (T) ........................................................................................................................ 5-13
5-7 Counter Area (C) .................................................................................................................... 5-15
5-8 Index Registers (IR) ............................................................................................................... 5-17
5-9 Data Registers (DR) ............................................................................................................... 5-21
5-10 Auxiliary Area (A)................................................................................................................... 5-23
5-11 Condition Flags...................................................................................................................... 5-25
5-12 Clock Pulses .......................................................................................................................... 5-27

Section 6 I/O Allocation


6-1 Allocation of Input Bits and Output Bits ............................................................................... 6-2
6-1-1 I/O Allocation............................................................................................................................... 6-2
6-1-2 I/O Allocation Concepts............................................................................................................... 6-3
6-1-3 Allocations on the CPU Unit........................................................................................................ 6-3
6-1-4 Allocations to Expansion Units and Expansion I/O Units ............................................................ 6-4

Section 7 PLC Setup


7-1 Overview of the PLC Setup..................................................................................................... 7-2
7-2 PLC Setup Settings ................................................................................................................. 7-3
7-2-1 Startup and CPU Unit Settings ................................................................................................... 7-3
7-2-2 Timing and Interrupt Settings...................................................................................................... 7-4

CP2E CPU Unit Software User’s Manual(W614) 9


7-2-3 Input Constants Settings ............................................................................................................. 7-4
7-2-4 Serial Option Port 1/Built-in RS-232C Port ................................................................................. 7-5
7-2-5 Serial Option Port 2/Built-in RS-485 Port .................................................................................... 7-9
7-2-6 Serial Option Port 1 (EX) .......................................................................................................... 7-13
7-2-7 Built-in Inputs ............................................................................................................................ 7-16
7-2-8 Pulse Output 0 Settings ............................................................................................................ 7-18
7-2-9 Pulse Output 1 Settings ............................................................................................................ 7-19
7-2-10 Pulse Output 2 Settings ............................................................................................................ 7-21
7-2-11 Pulse Output 3 Settings ............................................................................................................ 7-22
7-2-12 Built-in Ethernet Settings .......................................................................................................... 7-24

Section 8 Overview of Built-in Functions and Allocations


8-1 Built-in Functions .................................................................................................................... 8-2
8-2 Overall Procedure for Using CP2E Built-in Functions ......................................................... 8-3
8-3 Terminal Allocations for Built-in Functions .......................................................................... 8-4
8-3-1 Specifying the Functions to Use.................................................................................................. 8-4
8-3-2 Selecting Functions in the PLC Setup......................................................................................... 8-4
8-3-3 Allocating Built-in Input Terminals ............................................................................................... 8-6
8-3-4 Allocating Built-in Output Temrinals ............................................................................................ 8-8

Section 9 Quick-response Inputs


9-1 Quick-response Inputs............................................................................................................ 9-2
9-1-1 Overview ..................................................................................................................................... 9-2
9-1-2 Flow of Operation........................................................................................................................ 9-3

Section 10 Interrupts
10-1 Interrupts ................................................................................................................................ 10-2
10-1-1 Overview ................................................................................................................................... 10-2
10-2 Input Interrupts ...................................................................................................................... 10-3
10-2-1 Overview ................................................................................................................................... 10-3
10-2-2 Flow of Operation...................................................................................................................... 10-4
10-2-3 Application Example.................................................................................................................. 10-8
10-3 Scheduled Interrupts........................................................................................................... 10-10
10-3-1 Overview ................................................................................................................................. 10-10
10-3-2 Flow of Operation.................................................................................................................... 10-11
10-4 Precautions for Using Interrupts........................................................................................ 10-13
10-4-1 Interrupt Task Priority and Order of Execution ........................................................................ 10-13
10-4-2 Related Auxiliary Area Words and Bits ................................................................................... 10-13
10-4-3 Duplicate Processing in each Task ......................................................................................... 10-13

Section 11 High-speed Counters


11-1 Overview................................................................................................................................. 11-2
11-1-1 Overview ................................................................................................................................... 11-2
11-1-2 Flow of Operation...................................................................................................................... 11-3
11-1-3 Specifications ............................................................................................................................ 11-7
11-2 High-speed Counter Inputs................................................................................................... 11-8
11-2-1 Pulse Input Methods Settings ................................................................................................... 11-8
11-2-2 Counting Ranges Settings ...................................................................................................... 11-10
11-2-3 Reset Methods ........................................................................................................................ 11-11
11-2-4 Reading the Present Value ..................................................................................................... 11-12
11-2-5 Frequency Measurement ........................................................................................................ 11-13
11-3 High-speed Counter Interrupts........................................................................................... 11-14
11-3-1 Overview ................................................................................................................................. 11-14
11-3-2 Present Value Comparison ..................................................................................................... 11-17
11-3-3 High-speed Counter Interrupt Instruction................................................................................ 11-20
11-4 Related Auxiliary Area Bits and Words ............................................................................. 11-25

10 CP2E CPU Unit Software User’s Manual(W614)


11-5 Application Example .......................................................................................................... 11-26

Section 12 Pulse Outputs


12-1 Overview................................................................................................................................. 12-3
12-1-1 Overview................................................................................................................................... 12-3
12-1-2 Flow of Operation ..................................................................................................................... 12-4
12-1-3 Specifications.......................................................................................................................... 12-15
12-2 Positioning Control ............................................................................................................. 12-16
12-2-1 Positioning Control Configuration ........................................................................................... 12-16
12-2-2 Relative Positioning and Absolute Positioning ........................................................................ 12-16
12-2-3 Application Example ............................................................................................................... 12-18
12-3 Jogging................................................................................................................................. 12-20
12-3-1 High-speed Jogging................................................................................................................ 12-20
12-3-2 Low-speed Jogging................................................................................................................. 12-20
12-3-3 Application Example ............................................................................................................... 12-20
12-4 Implementing Interrupt Feeding......................................................................................... 12-23
12-4-1 Interrupt Feeding .................................................................................................................... 12-23
12-4-2 Flow of Operation ................................................................................................................... 12-23
12-4-3 Application Example ............................................................................................................... 12-24
12-5 Positioning Linear Interpolation......................................................................................... 12-26
12-5-1 Positioning Linear Interpolation .............................................................................................. 12-26
12-5-2 Positioning Linear Interpolation Configuration ........................................................................ 12-27
12-5-3 Application Example ............................................................................................................... 12-28
12-6 Defining Origin Position...................................................................................................... 12-30
12-6-1 Origin Searches ...................................................................................................................... 12-30
12-6-2 Flow of Operation ................................................................................................................... 12-31
12-6-3 Settings in PLC Setup............................................................................................................. 12-31
12-6-4 Origin Search Instructions ...................................................................................................... 12-34
12-6-5 Origin Search Operations ....................................................................................................... 12-35
12-6-6 Origin Return .......................................................................................................................... 12-42
12-6-7 Changing the Present Value of the Pulse Output ................................................................... 12-43
12-7 Reading the Pulse Output Present Value .......................................................................... 12-44
12-8 Related Auxiliary Area Flags .............................................................................................. 12-45
12-9 Application Examples ......................................................................................................... 12-46
12-9-1 Vertically Conveying PCBs (Multiple Progressive Positioning) ............................................... 12-46
12-9-2 Feeding Wrapping Material: Interrupt Feeding ....................................................................... 12-51
12-9-3 Palletize: Two-axis Multipoint Positioning................................................................................ 12-53
12-10Precautions when Using Pulse Outputs ........................................................................... 12-59
12-11Pulse Output Pattern ........................................................................................................... 12-64
12-11-1 Speed Control (Continuous Mode) ......................................................................................... 12-64
12-11-2 Positioning Control (Independent Mode) ................................................................................ 12-66

Section 13 PWM Outputs


13-1 PWM Outputs (Variable-duty-factor Pulse Outputs)........................................................... 13-2
13-1-1 Flow of Operation ..................................................................................................................... 13-4
13-1-2 Ladder Program Example......................................................................................................... 13-4

Section 14 Serial Communications


14-1 Serial Communications......................................................................................................... 14-3
14-1-1 Types of CPU Units and Serial Ports ........................................................................................ 14-3
14-1-2 Overview of Serial Communications......................................................................................... 14-5
14-2 Program-free Communications with Programmable Terminals ........................................ 14-7
14-2-1 Overview................................................................................................................................... 14-7
14-2-2 Flow of Connection ................................................................................................................... 14-8
14-2-3 PLC Setup and PT System Settings......................................................................................... 14-8

CP2E CPU Unit Software User’s Manual(W614) 11


14-3 No-protocol Communications with General Components............................................... 14-10
14-3-1 Overview ................................................................................................................................. 14-10
14-3-2 Flow of Operation.................................................................................................................... 14-11
14-3-3 PLC Setup............................................................................................................................... 14-11
14-3-4 Related Auxiliary Area Bits and Words ................................................................................... 14-12
14-4 Modbus-RTU Easy Master Function .................................................................................. 14-14
14-4-1 Overview ................................................................................................................................. 14-14
14-4-2 Flow of Operation.................................................................................................................... 14-14
14-4-3 Setting and Word Allocation.................................................................................................... 14-15
14-4-4 Programming Examples.......................................................................................................... 14-18
14-5 Serial PLC Links .................................................................................................................. 14-27
14-5-1 Overview ................................................................................................................................. 14-27
14-5-2 Flow of Operation.................................................................................................................... 14-28
14-5-3 PLC Setup............................................................................................................................... 14-28
14-5-4 Operating Specifications ......................................................................................................... 14-30
14-5-5 Example Application................................................................................................................ 14-37
14-6 Connecting the Host Computer ......................................................................................... 14-39
14-6-1 Overview ................................................................................................................................. 14-39
14-6-2 Flow of Operation.................................................................................................................... 14-39
14-6-3 Command/response Format and List of Commands .............................................................. 14-40
14-6-4 Restrictions on the Usage of Host Link ................................................................................... 14-41
14-7 Modbus-RTU Slave Function .............................................................................................. 14-42
14-7-1 Overview ................................................................................................................................. 14-42
14-7-2 Flow of Operation.................................................................................................................... 14-43
14-7-3 PLC Setup............................................................................................................................... 14-43
14-7-4 Operation Specifications ......................................................................................................... 14-44
14-7-5 Command and Response Details ........................................................................................... 14-45
14-7-6 Related special auxiliary relay................................................................................................. 14-51
14-8 Precautions on the usage of RS-485 ................................................................................. 14-52

Section 15 Ethernet
15-1 System Configuration and Features .................................................................................... 15-3
15-1-1 Connecting the CX-Programmer to PLCs Online via Ethernet ................................................. 15-4
15-1-2 Exchanging Data between OMRON PLCs using Ethernet ....................................................... 15-5
15-1-3 Creating an Original Communications Procedure Using TCP/IP(UDP/IP) for the Host
Application or Communicating with PLCs from Another Manufacturer ..................................... 15-6
15-1-4 Automatically Adjusting the PLC’s Internal Clock at Regular Intervals ..................................... 15-6
15-2 Specifications ........................................................................................................................ 15-7
15-2-1 General Specifications (Ethernet) ............................................................................................. 15-7
15-2-2 Comparison with Previous Models (Ethernet Related) ............................................................. 15-8
15-3 Basic Setting for Ethernet................................................................................................... 15-10
15-3-1 Overview of Startup Procedure............................................................................................... 15-10
15-3-2 PLC Setup Procedure ............................................................................................................. 15-11
15-3-3 Basic Settings ......................................................................................................................... 15-13
15-3-4 Communications Test.............................................................................................................. 15-15
15-4 FINS Communications ........................................................................................................ 15-16
15-4-1 FINS Communications Service Specifications ........................................................................ 15-16
15-4-2 FINS Communications Service ............................................................................................... 15-17
15-4-3 Procedure for Using FINS/UDP, FINS/TCP............................................................................. 15-17
15-4-4 PLC Setup for FINS/UDP and FINS/TCP Applications .......................................................... 15-18
15-4-5 Auxiliary Area Allocations........................................................................................................ 15-22
15-4-6 New FINS Commands ............................................................................................................ 15-22
15-4-7 CMND/SEND/RECV Instructions ............................................................................................ 15-34
15-4-8 Restrictions When Using FINS Communication Services....................................................... 15-35
15-5 Socket Services ................................................................................................................... 15-36
15-5-1 Overview of Socket Service .................................................................................................... 15-36
15-5-2 Procedure for Using Socket Service Functions....................................................................... 15-36
15-5-3 Socket Services and Socket Status ........................................................................................ 15-37
15-5-4 PLC Setup for Socket Services .............................................................................................. 15-38
15-5-5 Auxiliary Area Allocations........................................................................................................ 15-39
15-5-6 Data Memory Area Allocations ............................................................................................... 15-42
15-5-7 Socket/TCP Programming Example........................................................................................ 15-50

12 CP2E CPU Unit Software User’s Manual(W614)


15-6 Automatic Clock Adjustment and Specifying Servers by Host Name ............................ 15-54
15-6-1 Automatic Clock Adjustment Function .................................................................................... 15-54
15-6-2 Specifying Servers by Host Name .......................................................................................... 15-54
15-6-3 Procedure for Using the Automatic Clock Adjustment Function ............................................. 15-55
15-6-4 PLC Setup for DNS and Automatic clock Adjustment............................................................. 15-55
15-6-5 Auxiliary Area Allocations ....................................................................................................... 15-58
15-7 Status Allocations of Bulit-in Ethernet Port...................................................................... 15-59

Section 16 Other Functions


16-1 PID Temperature Control ...................................................................................................... 16-2
16-1-1 Overview................................................................................................................................... 16-2
16-1-2 Flow of Operation ..................................................................................................................... 16-3
16-1-3 Application Example ................................................................................................................. 16-4
16-2 Clock ....................................................................................................................................... 16-7
16-3 DM Backup Function ............................................................................................................. 16-9
16-3-1 Backing Up and Restoring DM Area Data ................................................................................ 16-9
16-3-2 Procedure ............................................................................................................................... 16-11
16-4 Security Functions .............................................................................................................. 16-13
16-4-1 Ladder Program Read Protection ........................................................................................... 16-13
16-4-2 Protecting Program Execution Using the Lot Number ............................................................ 16-15

Section 17 Analog Input/Output Option Board


17-1 General Specifications.......................................................................................................... 17-2
17-2 Part Names ............................................................................................................................. 17-3
17-3 Installation and Setting ......................................................................................................... 17-4
17-3-1 Installation................................................................................................................................. 17-4
17-3-2 Setting ...................................................................................................................................... 17-5
17-3-3 Removing.................................................................................................................................. 17-5
17-4 Memory Allocation ................................................................................................................ 17-6
17-4-1 CIO Area Allocation .................................................................................................................. 17-6
17-4-2 Auxiliary Area Allocation ........................................................................................................... 17-6
17-5 Analog Input Option Board................................................................................................... 17-8
17-5-1 Main Specifications................................................................................................................... 17-8
17-5-2 Analog Input Signal Ranges ..................................................................................................... 17-8
17-5-3 Wiring ....................................................................................................................................... 17-9
17-6 Analog Output Option Board.............................................................................................. 17-12
17-6-1 Main Specifications................................................................................................................. 17-12
17-6-2 Analog Output Signal Ranges ................................................................................................ 17-12
17-6-3 Wiring ..................................................................................................................................... 17-13
17-7 Analog I/O Option Board..................................................................................................... 17-16
17-7-1 Main Specifications................................................................................................................. 17-16
17-7-2 Analog I/O Signal Ranges ...................................................................................................... 17-17
17-7-3 Wiring ..................................................................................................................................... 17-19
17-8 Startup Operation ................................................................................................................ 17-22
17-9 Analog Option Board Refresh Time................................................................................... 17-23
17-10Trouble Shooting ................................................................................................................. 17-24
17-11The Use of Analog Option Board ....................................................................................... 17-25
17-11-1 Procedure ............................................................................................................................... 17-25
17-11-2 Program Example ................................................................................................................... 17-26

Section 18 Programming Device Operations


18-1 Programming Devices Usable with the CP2E ..................................................................... 18-2
18-2 Overview of CX-Programmer................................................................................................ 18-3
18-2-1 CX-Programmer........................................................................................................................ 18-3
18-2-2 CX-Programmer Flow from Startup to Operation ..................................................................... 18-3

CP2E CPU Unit Software User’s Manual(W614) 13


18-2-3 Help........................................................................................................................................... 18-6
18-3 Creating a Ladder Program .................................................................................................. 18-7
18-3-1 Inputting a Ladder Program ...................................................................................................... 18-7
18-3-2 Saving and Reading Ladder Programs ................................................................................... 18-14
18-3-3 Editing Ladder Programs ........................................................................................................ 18-16
18-4 Connecting Online to the CP2E and Transferring the Program ...................................... 18-18
18-4-1 Connecting Online................................................................................................................... 18-18
18-4-2 Changing Operating Modes .................................................................................................... 18-19
18-4-3 Transferring a Ladder Program and the PLC Setup ................................................................ 18-20
18-4-4 Starting Operation................................................................................................................... 18-21
18-5 Online Monitoring and Debugging..................................................................................... 18-23
18-5-1 Monitoring Status .................................................................................................................... 18-23
18-5-2 Force-set/Reset Bits................................................................................................................ 18-25
18-5-3 Online Editing.......................................................................................................................... 18-26

Section A Appendices
A-1 Instruction Functions ..............................................................................................................A-2
A-1-1 Sequence Input Instructions .......................................................................................................A-2
A-1-2 Sequence Output Instructions.....................................................................................................A-3
A-1-3 Sequence Control Instructions ....................................................................................................A-5
A-1-4 Timer and Counter Instructions...................................................................................................A-7
A-1-5 Comparison Instructions ...........................................................................................................A-10
A-1-6 Data Movement Instructions .....................................................................................................A-12
A-1-7 Data Shift Instructions...............................................................................................................A-15
A-1-8 Increment/Decrement Instructions ............................................................................................A-18
A-1-9 Symbol Math Instructions..........................................................................................................A-19
A-1-10 Conversion Instructions.............................................................................................................A-24
A-1-11 Logic Instructions ......................................................................................................................A-28
A-1-12 Special Math Instructions..........................................................................................................A-29
A-1-13 Floating-point Math Instructions ................................................................................................A-29
A-1-14 Table Data Processing Instructions...........................................................................................A-32
A-1-15 Data Control Instructions ..........................................................................................................A-33
A-1-16 Subroutine Instructions .............................................................................................................A-37
A-1-17 Interrupt Control Instructions.....................................................................................................A-38
A-1-18 High-speed Counter/Pulse Output Instructions.........................................................................A-39
A-1-19 Step Instructions .......................................................................................................................A-50
A-1-20 Basic I/O Unit Instructions.........................................................................................................A-50
A-1-21 Serial Communications Instructions..........................................................................................A-54
A-1-22 Network Instructions .................................................................................................................A-55
A-1-23 Clock Instructions......................................................................................................................A-56
A-1-24 Failure Diagnosis Instructions ...................................................................................................A-57
A-1-25 Other Instructions......................................................................................................................A-57
A-2 Auxiliary Area Allocations by Address................................................................................A-58
A-2-1 Read-only Words ......................................................................................................................A-58
A-2-2 Read/Write Words.....................................................................................................................A-82
A-3 Response Performance.........................................................................................................A-99
A-3-1 I/O Response Time ...................................................................................................................A-99
A-3-2 Interrupt Response Time ........................................................................................................A-101
A-3-3 Serial PLC Link Response Performance.................................................................................A-102
A-3-4 Pulse Output Start Time..........................................................................................................A-103
A-3-5 Pulse Output Change Response Time....................................................................................A-103
A-4 PLC Operation for Power Interruptions .............................................................................A-104
A-5 Memory Map ........................................................................................................................A-107
A-6 Ethernet Functions ..............................................................................................................A-109
A-6-1 TCP Status Transitions............................................................................................................A-109
A-6-2 Ethernet Network Parameters.................................................................................................A-110
A-6-3 Buffer Configuration ................................................................................................................A-110
Index ......................................................................................................................................... 1-1
Revision History ......................................................................................................... Revision-1

14 CP2E CPU Unit Software User’s Manual(W614)


Terms and Conditions Agreement

Warranty, Limitations of Liability

Warranties
z Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workman-
ship for a period of twelve months from the date of sale by Omron (or such other period expressed in
writing by Omron). Omron disclaims all other warranties, express or implied.

z Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.

z Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-com-
plying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omron’s analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combi-
nation with any electrical or electronic components, circuits, system assemblies or any other materi-
als or substances or environments. Any advice, recommendations or information given orally or in
writing, are not to be construed as an amendment or addition to the above warranty.

See http://www.omron.com/global/ or contact your Omron representative for published information.

Limitation on Liability; Etc


OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR CON-
SEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY
WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT,
WARRANTY, NEGLIGENCE OR STRICT LIABILITY.
Further, in no event shall liability of Omron Companies exceed the individual price of the Product on
which liability is asserted.

CP2E CPU Unit Software User’s Manual(W614) 15


Application Considerations

Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyer’s application or use of the Product. At
Buyer’s request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a com-
plete determination of the suitability of the Product in combination with the end product, machine, sys-
tem, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyer’s application, product or system. Buyer shall take applica-
tion responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY OR IN LARGE QUANTITIES WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE
HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS
PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIP-
MENT OR SYSTEM.

Programmable Products
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or
any consequence thereof.

Disclaimers

Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omron’s test conditions, and the user must correlate it to actual application requirements. Actual perfor-
mance is subject to the Omron’s Warranty and Limitations of Liability.

Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omron’s representative at any time to
confirm actual specifications of purchased Product.

Errors and Omissions


Information presented by Omron Companies has been checked and is believed to be accurate; how-
ever, no responsibility is assumed for clerical, typographical or proofreading errors or omissions.

16 CP2E CPU Unit Software User’s Manual(W614)


Safety Precautions

Definition of Precautionary Information

The following notation is used in this manual to provide precautions required to ensure safe usage of a
CP-series PLC. The safety precautions that are provided are extremely important to safety. Always read
and heed the information provided in all safety precautions.

Indicates an imminently hazardous situation which,


WARNING if not avoided, will result in death or serious injury.
Additionally, there may be severe property damage.

Indicates a potentially hazardous situation which,


Caution if not avoided, may result in minor or moderate
injury, or property damage.

Precautions for Safe Use


Indicates precautions on what to do and what not to do to ensure using the product safely.

Precautions for Correct Use


Indicates precautions on what to do and what not to do to ensure proper operation
and performance.

Symbols
The triangle symbol indicates precautions (including
warnings). The specific operation is shown in the triangle
and explained in text. This example indicates a precau-
tion for electric shock.

The circle and slash symbol indicates operations that you


must not do. The specific operation is shown in the circle
and explained in text.

The filled circle symbol indicates operations that you


must do. The specific operation is shown in the circle and
explained in text. This example shows a general precau-
tion for something that you must do.

The triangle symbol indicates precautions (including


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

The triangle symbol indicates precautions (including


warnings). The specific operation is shown in the triangle
and explained in text. This example indicates a precau-
tion for hot surfaces.

CP2E CPU Unit Software User’s Manual(W614) 17


Caution

Be sure to sufficiently confirm the safety at the destination when you transfer
the program or I/O memory or perform procedures to change the I/O memory.
Devices connected to PLC outputs may incorrectly operate regardless of the operat-
ing mode of the CPU Unit.

Execute online edit only after confirming that no adverse effects will be caused
by extending the cycle time.
Otherwise, the input signals may not be readable.

Sufficiently check safety if I/O bit status or present values are monitored in the
Ladder Section Pane or present values are monitored in the Watch Pane.
If bits are set, reset, force-set, or force-reset by inadvertently pressing a shortcut key,
devices connected to PLC outputs may operate incorrectly regardless of the operat-
ing mode.

Program so that the memory area of the start address is not exceeded when
using a word address or symbol for the offset.
For example, write the program so that processing is executed only when the indirect
specification does not cause the final address to exceed the memory area by using
an input comparison instruction or other instruction.
If an indirect specification causes the address to exceed the area of the start address,
the system will access data in other area, and unexpected operation may occur.

Set the temperature range according to the type of temperature sensor con-
nected to the Unit.
Temperature data will not be converted correctly if the temperature range does not
match the sensor.

Do not set the temperature range to any values other than those for which tem-
perature ranges are given in the following table.
An incorrect setting may cause operating errors.

18 CP2E CPU Unit Software User’s Manual(W614)


Precautions for Safe Use
Observe the following precautions when using a CP-series PLC.

z Handling
• Set the Unit properly as specified in the operation manual. Improper setting of the Unit may result
in malfunction.
• Check that the DIP switches and data memory (DM) are properly set before starting operation.
• To initialize the DM Area, back up the initial contents for the DM Area to the built-in Flash Memory
using one of the following methods.
• Set the number of words of the DM Area to be backed up starting with D0 in the Number of CH
of DM for backup Box in the Startup Data Read Area.
• Include programming to back up specified words in the DM Area to the built-in Flash Memory
by turning ON A751.15 (DM Backup Save Start Bit).
• Check the ladder program for proper execution before actually running it on the Unit. Not checking
the program may result in an unexpected operation.
• Transfer a routing table to the CPU Unit only after confirming that no adverse effects will be
caused by restarting CPU Bus Units, which is automatically done to make the new tables effec-
tive.
• The ladder program and parameter area data in the CP2E CPU Units are backed up in the built-in
Flash Memory. The BKUP indicator will light on the front of the CPU Unit when the backup opera-
tion is in progress. Do not turn OFF the power supply to the CPU Unit when the BKUP indicator is
lit. The data will not be backed up if power is turned OFF and a memory error will occur the next
time the power supply is turned ON.
• With a CP2E CPU Unit, data memory can be backed up to the built-in Flash Memory. The BKUP
indicator will light on the front of the CPU Unit when backup is in progress. Do not turn OFF the
power supply to the CPU Unit when the BKUP indicator is lit. If the power is turned OFF during a
backup, the data will not be backed up and will not be transferred to the DM Area in RAM the next
time the power supply is turned ON.
• Install a battery (sold separately), if you are using clock data for the program. If the battery is not
installed, the clock data will be initialized when the power is turned off, and the program may
cause malfunction.
• When using a battery, set it to “Detect Low Battery” in PLC settings. If the setting is not changed,
a program that uses clock data may cause malfunction, when the battery is exhausted.
• Before replacing the battery, supply power to the CPU Unit for at least 30 minutes and then com-
plete battery replacement within 5 minutes. Memory data may be corrupted if this precaution is
not observed.
• The equipment may operate unexpectedly if inappropriate parameters are set. Even if the appro-
priate parameters are set, confirm that equipment will not be adversely affected before transfer-
ring the parameters to the CPU Unit.
• Before starting operation, confirm that the contents of the DM Area is correct.
• After replacing the CPU Unit, make sure that the required data for the DM Area, Holding Area, and
other memory areas has been transferred to the new CPU Unit before restarting operation.
• Do not attempt to disassemble, repair, or modify any Units. Any attempt to do so may result in mal-
function, fire, or electric shock.
• Confirm that no adverse effect will occur in the system before attempting any of the following. Not
doing so may result in an unexpected operation.
• Changing the operating mode of the PLC (including the setting of the startup operating mode).
• Force-setting/force-resetting any bit in memory.
• Changing the present value of any word or any set value in memory.

CP2E CPU Unit Software User’s Manual(W614) 19


z External Circuits
• Always configure the external circuits to turn ON power to the PLC before turning ON power to the
control system. If the PLC power supply is turned ON after the control power supply, temporary
errors may result in control system signals because the output terminals on DC Output Units and
other Units will momentarily turn ON when power is turned ON to the PLC.
• Fail-safe measures must be taken by the customer to ensure safety in the event that outputs from
output terminals remain ON as a result of internal circuit failures, which can occur in relays, tran-
sistors, and other elements.
• If the I/O Hold Bit is turned ON, the outputs from the PLC will not be turned OFF and will maintain
their previous status when the PLC is switched from RUN or MONITOR mode to PROGRAM
mode. Make sure that the external loads will not produce dangerous conditions when this occurs.
(When operation stops for a fatal error, including those produced with the FALS instruction, all out-
puts from PLC will be turned OFF and only the internal output status in the CPU Unit will be main-
tained.)

20 CP2E CPU Unit Software User’s Manual(W614)


Regulations and Standards
Trademarks
SYSMAC is a registered trademark for Programmable Controllers made by OMRON Corporation.
CX-One is a registered trademark for Programming Software made by OMRON Corporation.
Windows is a registered trademark of Microsoft Corporation.
Other system names and product names in this document are the trademarks or registered trademarks
of their respective companies.

CP2E CPU Unit Software User’s Manual(W614) 21


Software Licenses and Copyrights
This product incorporates certain third party software. The license and copyright information associated
with this software is shown at the following.

Copyright (c) 2001-2004 Swedish Institute of Computer Science.


All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and / or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIEDWAR-
RANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABIL-
ITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTI-
TUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUP-
TION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAM-
AGE.

22 CP2E CPU Unit Software User’s Manual(W614)


Related Manuals
The following manuals are related to the CP2E. Use them together with this manual.
Manual name Cat. No. Model numbers Application Contents
SYSMAC CP Series W614 CP2E-E……D…-… To learn the software Describes the following information for CP2E
CP2E CPU Unit Soft- CP2E-S……D…-… specifications of the PLCs.
ware User’s Manual CP2E PLCs • CPU Unit operation
(this manual) CP2E-N……D…-…
• Internal memory
• Programming
• Settings
• CPU Unit built-in functions
• Interrupts
• High-speed counter inputs
• Pulse outputs
• Serial communications
• Ethernet
• Other functions
Use this manual together with the CP2E CPU Unit Hardware User’s
Manual (Cat. No. W613) and Instructions Reference Manual (Cat. No.
W483).
SYSMAC CP Series W613 CP2E-E……D…-… To learn the hard- Describes the following information for CP2E
CP2E CPU Unit Hard- CP2E-S……D…-… ware specifications PLCs.
ware User’s Manual of the CP2E PLCs • Overview and features
CP2E-N……D…-…
• Basic system configuration
• Part names and functions
• Installation and settings
• Troubleshooting
Use this manual together with the CP2E CPU Unit Software User’s
Manual (Cat. No. W614) and Instructions Reference Manual (Cat. No.
W483).
SYSMAC CP Series W483 CP1E-E……D…-… To learn program- Describes each programming instruction in
CP1E/CP2E CPU Unit CP1E-N……D…-… ming instructions in detail.
Instructions Reference detail When programming, use this manual together
Manual CP1E-NA……D…-…
with the CP2E CPU Unit Software User’s Man-
CP2E-E……D…-… ual (Cat. No. W614).
CP2E-S……D…-…
CP2E-N……D…-…
CS/CJ/CP/NSJ Series W342 CS1G/H-CPU……H To learn communica- Describes
Communications Com- CS1G/H-CPU……-V1 tions commands for 1) C-mode commands and
mands Reference Man- CS/CJ/CP/NSJ- 2) FINS commands in detail.
ual CS1D-CPU……H series Controllers in
CS1D-CPU……S detail Read this manual for details on C-mode and
FINS commands addressed to CPU Units.
CS1W-SCU……-V1
CS1W-SCB……-V1 Note This manual describes commands addressed to CPU Units. It
CJ1G/H-CPU……H does not cover commands addressed to other Units or ports (e.g.,
serial communications ports on CPU Units, communications ports
CJ1G-CPU……P
on Serial Communications Units/Boards, and other Communica-
CJ1M-CPU…… tions Units).
CJ1G-CPU……
CJ1W-SCU……-V1

CP2E CPU Unit Software User’s Manual(W614) 23


Manual name Cat. No. Model numbers Application Contents

CX-One FA Integrated W463 CXONE-AL……D-V4 To install the soft- Describes the overview of the CX-One FA Inte-
Tool Package Setup ware provided in the grated Tool Package, and how to install and
CX-One uninstall the CX-One.
Manual

CX-Programmer W446 To learn the opera- Describes the operation procedures for the CX-
Operation Manual tion procedures for Programmer.
the CX-Program-
CX-Programmer W447 mer, the Program-
Operation Manual ming Device for
(Function Blocks/ Windows computers
Structured Text)

CX-Simulator Operation W366 To learn the opera- Describes the operation procedures for the CX-
Manual tion procedures for Simulator.
the CX-Simulator,
the Simulation
Device for Windows
computers

CX-Integrator Operation W464 To set up and moni- Describes the operation procedures for the CX-
Manual tor networks Integrator.

24 CP2E CPU Unit Software User’s Manual(W614)


1
\

Overview
This section gives an overview of the CP2E and describes its specifications.

1-1 CP2E Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2


1-1-1 Overview of Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1-2 Basic Operating Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

CP2E CPU Unit Software User's Manual(W614) 1-1


1 Overview

1-1 CP2E Overview

1-1-1 Overview of Features

The SYSMAC CP2E Programmable Controller is a package-type PLC made by OMRON that is designed
for easy application. The CP2E includes E……-type CPU Units (essential models) that support connec-
tions to Programmable Terminals and basic control applications using basic, movement, arithmetic, and
comparison instructions, S……-type CPU Units (standard models) that support connections to Inverters
and Servo Drives and N……-type CPU Units (network models) that support Ethernet connection and
enhanced positioning functions such as 4-axis linear interpolation and pulse.
Essential Models Standard Models Network Models
E……-type CPU Units S……-type CPU Units N……-type CPU Units
CPU Unit with CPU Unit with 30, CPU Unit with 30, CPU Unit with CPU Unit with 30,
14, 20 I/O Points 40 or 60 I/O Points 40 or 60 I/O Points 14, 20 I/O Points 40 or 60 I/O Points
Appearance

I/O points 14/20 30/40/60 30/40/60 14/20 30/40/60


Program capacity 4K steps 8K steps 10K steps
FB capacity 4K steps 8K steps 10K steps
DM Area capacity 4K words 8K words 16K words
Of these 1,500 words can be written Of these 7,000 Of these 15,000 words can be written
to the built-in Flash Memory. words can be to the built-in Flash Memory.
written to the
built-in Flash
Memory.
Mounting Expansion Not supported. 3 Units maximum 3 Units maximum Not supported. 3 Units maximum
I/O Units and Expan-
sion Units
Model with transis- Not supported. Available
tor outputs
Pulse outputs Not supported. 2 axes supported. 2 axes supported. 4 axes supported.
(Models with transis- (Linear interpola- (Linear interpola-
tor outputs only) tion supported) tion supported)
Built-in serial com- RS-232C port provided. RS-232C/RS-485 Not provided. Not provided.
munications port port provided. Expand to up to Expand to up to
two ports by a three ports by
Option Board. Option Boards.
Option Board Not supported. 1 slot 2 slots
Built-in Ethernet port Not supported. 1 port 2 ports
(Switch function)
Connection port for USB port Ethernet port
Programming Device
Clock Not supported. Supported
Using a Battery Not supported. Supported (CP2W-BAT02 sold separately)
Battery-free opera- Always battery-free operation.
tion Data in I/O Memory is retained even if no battery is attached.

1-2 CP2E CPU Unit Software User's Manual(W614)


1 Overview

1-2 Basic Operating Procedure


1-2 Basic Operating Procedure
In general, use the following procedure.

1
1. Setting Devices and Hardware
Connect the CPU Unit, Expansion I/O Units, and Expansion Units.

1-1-1 Overview of Features


Set the DIP switches on the Option Board and Expansion Units as required.
Refer to Section 3 Part Names and Functions and Section 5 Installation and Wiring in the CP2E CPU Unit
Hardware User’s Manual (Cat. No. W613).

2. Wiring
Wire the power supply, I/O, and communications.
Refer to Section 5 Installation and Wiring in the CP2E CPU Unit Hardware User’s Manual (Cat. No. W613).

3. Connecting Online to the PLC


Connect the personal computer online to the PLC.
Refer to Section 4 Programming Device in the CP2E CPU Unit Hardware User’s Manual (Cat. No. W613).

4. I/O Allocations
Allocations for built-in I/O on the CPU Unit are predetermined and memory is allocated automatically
to Expansion I/O Units and Expansion Units, so the user does not have to do anything.
Refer to Section 6 I/O Allocation in the CP2E CPU Unit Software User’s Manual (Cat. No. W614).

5. Software Setup
Make the PLC software settings.
With a CP2E CPU Unit, all you have to do is set the PLC Setup.
Refer to Section 7 PLC Setup in the CP2E CPU Unit Software User’s Manual (Cat. No. W614).

6. Writing the Programs


Write the programs using the CX-Programmer.
Refer to Section 4 Programming Concepts in the CP2E CPU Unit Software User’s Manual (Cat. No. W614).

7. Checking Operation
Check the I/O wiring and the Auxiliary Area settings, and perform trial operation.
The CX-Programmer can be used for monitoring and debugging.
Refer to Section 8 Overview and Allocation of Built-in Functions in the CP2E CPU Unit Software User’s
Manual (Cat. No. W614).

8. Basic Program Operation


Set the operating mode to RUN mode to start operation.

CP2E CPU Unit Software User's Manual(W614) 1-3


1 Overview

1-4 CP2E CPU Unit Software User's Manual(W614)


2
Internal Memory in the CPU Unit
This section describes the types of internal memory in a CP2E CPU Unit and the data
that is stored.

2-1 Internal Memory in the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2


2-1-1 CPU Unit Memory Backup Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2-1-2 Memory Areas and Stored Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2-1-3 Transferring Data from a Programming Device. . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2-1-4 Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4

CP2E CPU Unit Software User’s Manual(W614) 2-1


2 Internal Memory in the CPU Unit

2-1 Internal Memory in the CPU Unit

2-1-1 CPU Unit Memory Backup Structure

The internal memory in the CPU Unit consists of built-in RAM, built-in non-volatile RAM and built-in
Flash Memory. The built-in RAM and built-in non-volatile RAM are used as execution memory and the
built-in Flash Memory is used as backup memory.
CPU Unit

Built-in Flash Memory Built-in RAM


(Retained when the power (Not retained when the power
supply is interrupted) supply is interrupted)

Backup Memory Execution Memory

User Program Area


Automatic backup User Program Area
FB Program Area
FB Program Area
(Backup) Restore at startup

Parameter Automatic backup


PLC Setup Parameter
Routing Table Restore at startup
IP Router Table
IP Address Table
(Backup)
Built-in Non-volatile RAM
(Retained when the power
supply is interrupted)

Source and Comment Areas


Execution Memory

I/O Memory Areas

Backup using bit in Auxiliary Area


DM Area
DM Area
(Backup)
DM Area data restore at startup

Built-in RAM
The built-in RAM is the execution memory for the CPU Unit.
The user program and parameters are stored in the built-in RAM.
Data is unstable when the power supply is interrupted.

Build-in Non-volatile RAM


The built-in non-volatile RAM is the execution memory for the CPU Unit. It is used to retain the data
when the power supply is interrupted.
I/O memory is stored in the built-in non-volatile RAM.
Data Memory Area (D), Holding Area (H) and Counter Area (C) are retained even if the power supply is
interrupted with no battery installed.

2-2 CP2E CPU Unit Software User’s Manual(W614)


2 Internal Memory in the CPU Unit

2-1 Internal Memory in the CPU Unit


Built-in Flash Memory
The built-in Flash Memory is the backup memory for user program, parameters, program source, com-
ment and Data Memory backed up using control bits in the Auxiliary Area.
Data is retained even if the power supply is interrupted.

2-1-2 Memory Areas and Stored Data


The following table lists the CPU Unit memory areas and the data stored in each area.
Built-in Built-in
2
Memory area and Built-in
Details non-vola- Flash
stored data RAM
tile RAM Memory

2-1-2 Memory Areas and Stored Data


User Program Area The User Program Area stores the object code for executing Stored Not stored Stored
the user program that was created using the CX-Programmer.
FB Program Area The FB Program Area stores the function block that was cre- Stored Not stored Stored
ated using the CX-Programmer.
Parameter Area Stored Not stored Stored
PLC Setup Various initial settings are made in the PLC Setup using soft-
ware switches.
Refer to Section 7 PLC Setup.
Routing Table Routing tables are network parameters for FINS communica-
tions. They are specified using the CX-Integrator.
Refer to the CX-Integrator Operation Manual (Cat. No. W464)
IP Router Table IP router table is used to store the IP address of the relay IP
router when the device communicates through the IP router.
IP Address Table Definition table of the relationship between FINS node
address and IP address.
Source and Comment Areas Not stored Not stored Stored
Program Source The source code of the program (ladder language, in
task/function block)
Symbol Table The symbol table contains symbols created using the CX-Pro-
grammer (symbol names, addresses, and I/O comments).
Comments Comments are created using the CX-Programmer and include
annotations and row comments.
Program Index The program index provides information on program sections
created using the CX-Programmer, as well as program com-
ments.
I/O Memory Areas The I/O Memory Areas are used for reading and writing from Not stored Stored Not stored
the user programs.It is partitioned into the following regions
according to purpose.
• Regions where data is cleared when the power supply to
the CPU Unit is reset, and regions where data is automati-
cally retained without battery even if the power supply is
turned OFF.
• Regions where data are exchanged with other Units, and
regions that are used internally.
DM Area words backed up to backup memory (built-in Flash Not stored Stored Stored
Memory) using control bits in the Auxiliary Area.

CP2E CPU Unit Software User’s Manual(W614) 2-3


2 Internal Memory in the CPU Unit

2-1-3 Transferring Data from a Programming Device


Data that has been created using the CX-Programmer or CX-Integrator is transferred to the internal
memory in the CPU Unit as shown in the following diagram.
CX-Programmer CPU Unit

User-created Programs
User Program Area

User Program User Program

Function Block FB Program Area

Function Block
Symbol Table

Source and Comment Areas


Comments and
Program Index Program Source

Symbol Table
PLC Setup

Comments and
IP Router Table Program Index

IP Address Table Parameter Area

PLC Setup
I/OMemory

IP Router Table

IP Address Table

CX-Integrator
Routing Table

Routing Table I/O Memory Areas

The CX-Programmer can be used to


set I/O memory status and write data
to I/O Memory areas.

2-1-4 Backup
The CPU Unit will access the backup memory in the following process.
• The program, parameters, comments, program index or symbol table are transferred from the CX-
Programmer and CX-Integrator.
• The program is changed during online editing.
• DM backup is operated by the Auxiliary Area.
During these processes, BKUP LED will light, indicating that the CPU Unit is being backed up.

There are the following limitations during backup.


• The operation mode cannot be switched from PROGRAM mode to MONITOR/RUN mode.
• If the power supply is interrupted when the program or parameters are being transferred or backed
up, memory error may occur when the power supply is turned ON next time.
• If the power supply is interrupted when the DM area is being backed up, the reading of backed up DM
area will fail when the power supply is turned ON next time.

2-4 CP2E CPU Unit Software User’s Manual(W614)


.

CPU Unit Operation


3
This section describes the operation of the CP2E CPU Unit. Make sure that you under-
stand the contents of this section completely before writing ladder programs.

3-1 CPU Unit Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2


3-1-1 Overview of CPU Unit Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3-1-2 CPU Unit Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3-2 Backing Up Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3-2-1 CPU Unit Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3-2-2 Backing Up Ladder Programs and Parameter Area . . . . . . . . . . . . . . . . . . . . . 3-6
3-2-3 I/O Memory Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3-2-4 Initializing I/O Memory at Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7

CP2E CPU Unit Software User’s Manual(W614) 3-1


3 CPU Unit Operation

3-1 CPU Unit Operation


This section gives an overview of the CPU Unit operation, describes the operating modes, and explains
how the Unit operates when there is a power interruption.

3-1-1 Overview of CPU Unit Operation


The CPU Unit reads and writes data to the internal I/O memory areas while executing user ladder pro-
grams by executing the instructions in order one at a time from the start to the end.

CPU Unit Internal Memory

Overhead processing
(self-diagnosis)
Change in status
after all instructions
I/O memory have been executed Inputs
Program execution
Access 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 Exchange
0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0
CPU Unit 1 1 0 1 1 0 0 0 1 1 0 0 1 0 1 0
processing 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1
cycle 1 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1
Outputs

I/O refreshing
Refreshes external devices at this timing

Peripheral servicing

Overhead Processing (Self-diagnosis)


Self-diagnosis, such as an I/O bus check, is performed.

Ladder Program Execution


Instructions are executed from the beginning of the program and I/O memory is refreshed.

I/O Refresh
Data to and from external devices, such as sensors and switches, directly connected to the built-in I/O
terminals and expansion I/O terminals, is exchanged with data in the I/O memory of the PLC. This pro-
cess of data exchange is called the I/O refresh.

Peripheral Servicing
Peripheral servicing is used to communicate with devices connected to the communications port or for
exchanging data with the CX-Programmer.

Cycle Time
The cycle time is the time between one I/O refresh and the next.

3-2 CP2E CPU Unit Software User’s Manual(W614)


3 CPU Unit Operation

Additional Information

The average cycle time during operation will be displayed in the status bar on the bottom right of
the Ladder Program Window on the CX-Programmer.

3-1 CPU Unit Operation


I/O Memory
These are the PLC memory areas that are accessed by the ladder programs. SYSMAC PLCs refer to
these areas as the I/O memory. It can be accessed by specifying instruction operands. There are words
in the I/O memory area where data is cleared and words where data is retained when recovering from a
power interruption. There are also words that can be set to be cleared or retained. Refer to Section 5
I/O Memory.

3
3-1-2 CPU Unit Operating Modes

3-1-2 CPU Unit Operating Modes


Overview of Operating Modes
CPU Units have the following three operating modes.

PROGRAM mode: The programs are not executed in PROGRAM mode.This mode is used for the initial
settings in PLC Setup, transferring ladder programs, checking ladder programs, and
making prepartions for executing ladder programs such as force-setting/resetting bits.

MONITOR mode: In this mode, it is possible to perform online editing, force-set/reset bits, and change
I/O memory present values while the ladder programs are being executed. Adjust-
ments during trial operation are also made in this mode.

RUN mode: This is the mode in which the ladder program is executed. Some operations are dis-
abled during this mode. It is the startup mode at initial value when the CPU Unit is
turned ON.

Changing the Operating Mode


The operating mode can be changed from the CX-Programmer.

z Changing the Startup Mode


The default operating mode when the CPU Unit is turned ON is RUN mode.
To change the startup mode to PROGRAM or MONITOR mode, set the desired mode in Startup
Setting in PLC Setup from the CX-Programmer.

CP2E CPU Unit Software User’s Manual(W614) 3-3


3 CPU Unit Operation

z Changing the Operating Mode after Startup


Use one of the following procedures.
• Select PROGRAM, MONITOR, or RUN from the Startup Mode Menu.
• Right-click the PLC in the project tree, and then select PROGRAM, MONITOR, or RUN from the
Startup Mode Menu.

Operating Modes and Operation


The following table lists status and operations for each mode.
Operating mode PROGRAM MONITOR RUN
Ladder program execution Stopped Executed Executed
I/O refresh Executed Executed Executed
External I/O status OFF after changing to Controlled by Controlled by
PROGRAM mode but the ladder pro- the ladder pro-
can be turned ON from grams. grams.
the CX-Programmer
afterward.
I/O memory Non-retained memory Cleared Controlled by Controlled by
Retained memory Retained the ladder pro- the ladder pro-
grams. grams.
CX-Program- I/O memory monitoring Yes Yes Yes
mer opera- Ladder program monitoring Yes Yes Yes
tions
Ladder pro- From CPU Unit Yes Yes Yes
gram transfer To CPU Unit Yes No No
Checking programs Yes No No
Setting the PLC Setup Yes No No
Changing ladder programs Yes Yes No
Forced-set/reset operations Yes Yes No
Changing timer/counter PV Yes Yes No
Change I/O memory PV Yes Yes No

The Retaining of I/O Memory When Changing the Operating Mode


Non-retained areas Retained areas
• I/O bits • Holding Area
• Serial PLC Link Words • DM Area
• Work bits • Counter PV and Completion Flags
Mode changes • Timer PV/Completion Flags (Auxiliary Area bits/words are
• Index Registers retained or not retained depending
on the address.)
• Data Registers
(Auxiliary Area bits/words are retained or
not retained depending on the address.)
RUN or MONITOR to Cleared* Retained
PROGRAM
PROGRAM to RUN or Cleared* Retained
MONITOR
RUN to MONITOR or Retained Retained
MONITOR to RUN
* The data is cleared when the IOM Hold Bit is OFF. The outputs of the Output Units will be turned OFF when a
fatal error is occurred, regardless of the status of the IOM Hold Bit, and the status of the output bits in CPU Unit’s
I/O memory is retained.
Refer to Section 5 I/O Memory for details on the I/O memory.

3-4 CP2E CPU Unit Software User’s Manual(W614)


3 CPU Unit Operation

3-2 Backing Up Memory


This section describes backing up the CP2E CPU Unit memory areas.

3-2-1 CPU Unit Memory Configuration

3-2 Backing Up Memory


Data backup to the CP2E CPU Unit’s built-in memory describes as below.

z Ladder Programs and Parameter Area


Automatically backed up to the built-in Flash Memory whenever changed.

z DM Area in the I/O Memory


Data in specified words of the DM Area can be backed up to the built-in Flash Memory by using bits
in the Auxiliary Area. Other words are not backed up to the built-in Flash Memory.
3

z Other Areas in the I/O Memory (Including Holding Area Data, Counter PVs,

3-2-1 CPU Unit Memory Configuration


and Counter Completion Flags)
Automatically backed up to the built-in non-volatile RAM with no battery installed.

CP2E CPU Unit


Built-in Flash Memory Built-in RAM
Ladder programs Ladder programs

Changing program

PLC power turned ON Parameter Area

PLC Setup
PLC Setup changed
Parameter Area Routing Table

PLC Setup IP Router Table

Routing Table IP Address Table

IP Router Table
Built-in Non-volatile RAM
IP Address Table I/O Memory Areas
PLC power turned ON

· I/O Area
· Work Area
Operation using control
· Holding Area
bits in Auxiliary Area
· Auxiliary Area
· Timer Area
Part of DM Area · Counter Area

· DM Area

Hold Area, Counter Area, DM Area and part


PLC power turned ON of Auxiliary Area are backed up to the built-
in non-volatile RAM.

Clock
Clock data is backed up with battery.
(CP2W-BAT02 sold separately)

CP2E CPU Unit Software User’s Manual(W614) 3-5


3 CPU Unit Operation

3-2-2 Backing Up Ladder Programs and Parameter Area


Ladder programs and the parameter area are automatically backed up to and restored from the built-in
Flash Memory.

z Backing Up Memory
Ladder programs and parameter area are backed up to the built-in Flash Memory by transferring
them from the CX-Programmer or writing them using online editing.

z Restoring Memory
Ladder programs and parameter area are automatically transferred from the built-in Flash Memory
to the RAM memory when power is turned ON again or at startup.

Precautions for Safe Use


The BKUP indicator on the front of the CPU Unit turns ON when data is being written to the built-
in Flash Memory. Never turn OFF the power supply to the CPU Unit when the BKUP indicator is
lit.

3-2-3 I/O Memory Backup


Hold Area, Counter Area, DM Area and part of Auxiliary Area are automatically backed up to the built-in
non-volatile RAM. DM Area can be backed up to the built-in Flash Memory by using bits in the Auxiliary
Area.
Backup to built-in
Area Status at startup
Flash Memory
CIO Area Not backed up. Cleared to all zeros.
Work Area (W)
Timer Area (T)
Index Register Area (IR)
Data Register Area (DR)
Holding Area (H) The values are retained immediately
before power interruption.*
Counter Area (C)
Auxiliary Area (A) Retained or not retained depending on
the address. The values of the retained
area are retained immediately before
power interruption.
DM Area Number of words start- The specified number of words starting The specified number of words starting
(D) ing from D0 set in the from D0 is backed up by turning ON from D0 is restored from the built-in
Number of CH of DM for A751.15 (DM Backup Save Start Bit). Flash Memory if the Restore D0- from
backup Box in the Star- backup memory Check Box is selected in
tup Data Read Area in the Startup Data Read Area in the PLC
the PLC Settings. Settings.
Ranges not given Not backed up. The values are retained immediately
above. before power interruption.*

* These areas will be cleared when the power supply is turned ON if the Clear retained memory area (HR/DM/CNT)
Check Box is selected in the PLC Settings.

3-6 CP2E CPU Unit Software User’s Manual(W614)


3 CPU Unit Operation

3-2-4 Initializing I/O Memory at Startup


For CP2E CPU Units, the held areas in I/O memory (Holding Area, Counter PVs, Counter Completion
Flags and DM Area) are automatically retained in the built-in non-volatile RAM with no battery installed.
Use the following way to clear these areas when the power supply is turned ON.

3-2 Backing Up Memory


z Clearing All Held Areas to Zero at Startup
Select the Clear retained memory area (HR/DM/CNT) Check Box in the PLC Settings.

3-2-4 Initializing I/O Memory at Startup


Note If the Restore D0- from backup memory Check Box is selected, only the specified words in the DM Area will
be restored from the built-in Flash Memory when the power supply is turned ON.

CP2E CPU Unit Software User’s Manual(W614) 3-7


3 CPU Unit Operation

3-8 CP2E CPU Unit Software User’s Manual(W614)


Understanding Programming
This section provides basic information on ladder programming for CP2E CPU Units.

4-1 Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2


4-1-1 User Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4-1-2 Program Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4-1-3 Basics of Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
4-2 Tasks, Sections, and Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4-2-1 Overview of Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4-2-2 Overview of Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4-2-3 Overview of Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4-3 Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
4-3-1 Overview of Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
4-3-2 Advantages of Function Blocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
4-3-3 Function Block Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
4-3-4 ST Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
4-4 Programming Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
4-4-1 Basic Understanding of Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
4-4-2 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
4-4-3 Instruction Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
4-4-4 Execution Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-16
4-4-5 Specifying Data in Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18
4-4-6 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
4-4-7 I/O Refresh Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-22
4-5 Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
4-7 Specifying Offsets for Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
4-7-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
4-7-2 Application Examples for Address Offsets . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-34
4-8 Ladder Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
4-8-1 Special Program Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-35

CP2E CPU Unit Software User’s Manual(W614) 4-1


4 Understanding Programming

4-1 Programming

4-1-1 User Programs

Structure of User Programs

User programs are created by using the CX-Programmer.


The user programs consist of the following parts.
• Programs
A program consists of more than one instruction and ends with an END instruction.
• Tasks (Smallest Executable Unit)
A program is assigned to an interrupt task to execute it. (In the CX-Programmer, the interrupt task
number is specified in the program properties.)
Tasks include cyclic tasks (executed with normal cyclic processing), interrupt tasks (executed when
interrupt conditions have been completed) and scheduled interrupt tasks (executed at specified inter-
vals).
The CP2E can use only one cyclic task.
• Sections
When creating and displaying programs with the CX-Programmer, the one program can be divided
into any number of parts.
Each part is called a section.
Sections are created mainly to make programs easier to understand.
• Subroutines and Function Blocks
You can create subroutines and function blocks within a program.

User Program Data


The user programs are saved in a project file (.CXP) for the CX-Programmer along with other parame-
ters, such as the symbol table, PLC Setup data, and I/O memory data.

Programming Languages
Programs can be written using only ladder programs.

4-2 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

4-1-2 Program Capacity


The maximum program capacities of the CP2E CPU Units for all ladder programs (including symbol
table and comments) are given in the following table.
The total number of steps must not exceed the maximum program capacity.
Unit type Model numbers Program capacity
E……-type CPU Unit CP2E-E††D†-† 4K steps
S……-type CPU Unit CP2E-S††D†-† 8K steps
N……-type CPU Unit CP2E-N††D†-† 10K steps

4-1 Programming
It is possible to check the program size by selecting Program - Memory View in the CX-Programmer.
The size of a ladder instruction depends on the specific instruction and operands that are used.

4-1-3 Basics of Programming


This section describes the basics of programming for the CP2E.
4

Basic Concepts of Ladder Programming

4-1-2 Program Capacity


Instructions are executed in the order that they are stored in memory (i.e., in the order of the mnemonic
code). Be sure you understand the concepts of ladder programming, and write the programs in the
proper order.

z Basic Points in Creating Ladder Programs

Order of Ladder Program Execution


When the ladder diagram is executed by the CPU Unit, the execution condition (i.e., power flow)
flows from left to right and top to bottom.
The flow is different from that for circuits that consist of hard-wired control relays.
For example, when the diagram in figure A is executed by the CPU Unit, power flows as though the
diodes in brackets were inserted so that output R2 is not controlled by input condition D.
The actual order of execution is indicated on the right with mnemonics.
To achieve operation without these imaginary diodes, the diagram must be rewritten. Also, the power
flow in figure B cannot be programmed directly and must be rewritten.

Figure A (Good example)


A (1) Signal flow (6) Order of execution (mnemonics)
((5)) B (7)
R1 (1) LD A (6) AND B
(2) ((3)) (4) (2) LD C (7) OUT R1
C D
(3) OUT TR0 (8) LD TR0
((8)) (4) AND D (9) AND E
E (9) (10) (5) OR LD (10) OUT R2
R2

Figure B (Bad example)


A B
R1

E
C E
R2

CP2E CPU Unit Software User’s Manual(W614) 4-3


4 Understanding Programming

z Number of Times Bits Can be Used and Connection Method


• There is no limit to the number of I/O bits, work bits, timers, and other input bits that can be used.
Program structure should be kept as clear and simple as possible to make the programs easier to
understand and maintain even if it means using more input bits.

• There is no limit to the number of input conditions that can be connected in series or in parallel on
the rungs.

• Two or more OUT instructions can be connected in parallel.

0.00 0.05
TIM
0000
#100

102.00

• Output bits can also be used in input conditions.

102.00

102.00

z Ladder Programming Restrictions


• A rung error will occur if a ladder program is not connected to both bus bars.
The ladder program must be connected to both bus bars so that the execution condition will flow
from the left bus bar to the right bus bar.
If the rungs are not connected to both bus bars, a rung error will occur during the program check
on the CX-Programmer and program transfer will be impossible.

• A rung error will occur if the instruction shown below is made to directly connect to the bus bar
without an input condition.
OUT instructions, timers, counters, and other output instructions cannot be connected directly to
the left bus bar.
If one of these instructions is connected directly to the left bus bar, a rung error will occur and pro-
gram transfer will be impossible.

MOV

4-4 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

• A location error will occur if an instruction is not connected directly to the right bus bar.
An input condition cannot be inserted after an OUT instruction or other output instruction. The
input condition must be inserted before an OUT instruction or other output instruction. If it is
inserted after an output instruction, then a location error will occur during the program check in the
CX-Programmer.

0.00 0.03 102.01 0.04

0.01 102.01

4-1 Programming
• A warning will occur if the same output bit is used more than once in an OUT instruction.
One output bit can be used in one instruction only. Instructions in a ladder program are executed
in order from the top rung in each cycle. The result of an OUT instruction in a lower rung will be
eventually saved in the output bit. The results of any previous instructions controlling the same bit
will be overwritten and not output.
Output bit CIO 100.00

4
Output bit CIO 100.00

4-1-3 Basics of Programming

CP2E CPU Unit Software User’s Manual(W614) 4-5


4 Understanding Programming

4-2 Tasks, Sections, and Symbols

4-2-1 Overview of Tasks

There are basically two types of tasks.


Task settings must be made to use interrupt tasks with a CP2E CPU Unit.
Applicable
Task type Description programming Execution condition
language
Cyclic task Executed once per cycle Ladder diagram Only one for the CP2E.
(Normally, the user does not have to con-
sider this.)
Interrupt tasks Executed when a specific Ladder diagram An interrupt task is placed into READY
condition occurs. The process status when the interrupt condition
being executed is interrupted. occurs. A condition can be set for the fol-
lowing interrupt tasks.
• Scheduled interrupt tasks
• I/O interrupt tasks

4-2-2 Overview of Sections


With the CX-Programmer, programs can be created and displayed in functional units called sections.
Any program in a task can be divided into sections.
Sections improve program legibility and simplifies editing.

4-2-3 Overview of Symbols

Symbols
I/O memory area addresses or constants can be specified by using character strings registered as symbols.
The symbols are registered in the symbol table of the CX-Programmer.
Programming with symbols enables programming with names without being aware of the addresses.
The symbol table is saved in the CX-Programmer project file (.CXP) along with other parameters, such
as the user programs.

Symbol Types
There are two types of symbols that can be used in programs.

z Global Symbols
Global symbols can be accessed from all ladder programs in the PLC.

z Local Symbols
Local symbols can be accessed from only one task. They are assigned to individual tasks.

4-6 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Addresses are allocated to symbols using one of the following methods.


• User Specified allocation
• Automatic allocation using the CX-Programmer
The area of memory used for automatic allocations is set by selecting Memory Allocation - Auto-
matic Address Allocation from the PLC Menu in the CX-Programmer.
Scope
Address and
Access using

4-2 Tasks, Sections, and Symbols


Types of Project tree in the I/O comment
symbols CX-Programmer symbols Access from Access from (without a
from a net- other tasks the local task symbol name)
work
Global PLC tree Not Possible. Possible. Supported
symbols possible.

Local Program tree Not Possible. Not supported


symbols possible.

4
Note “Global” and “local” indicate only the applicable scope of the symbol.

4-2-3 Overview of Symbols


They have nothing to do with the applicable scope of memory addresses.
Therefore, a warning but not an error will occur in the following cases, and it will be possible to
transfer the user program.
• The same addresses is used for two different local symbols.
• The same addresses is used for a global symbol and a local symbol.

Additional Information

In programs in the CX-Programmer, global symbols and local symbols can be identified by the
following character colors and symbol icons.
Classification Display color Example (default color)
Global symbols Black (default) Start

3.00

Local symbols Blue (default) Error

W0.00

Select Tools - Options, and select Local Symbols or Global Symbols in Appearance to change
the color.

CP2E CPU Unit Software User’s Manual(W614) 4-7


4 Understanding Programming

4-3 Function Blocks


Function blocks can be used in programming SYSMAC CP-series PLCs.

4-3-1 Overview of Function Blocks


A function block is a basic program element containing a standard processing function that has been
defined in advance. Once the function block has been defined, the user just has to insert the function
block in the program and set the I/O in order to use the function.
As a standard processing function, a function block is not created with actual physical addresses, but
local variables. The user sets parameters (addresses or values) in those variables to use the function
block. The addresses used for the variables themselves are automatically assigned by the system (CX-
Programmer) each time they are placed in the program.
In particular, each function block is saved by the CX-Programmer as an individual file that can be
reused with programs for other PLCs. This makes it possible to create a library of standard processing
functions.

Program 2
Copy of function block A
Standard program
section written
with variables
Function block A Program 1
aa cc Variable Output
Copy of function block A
bb
MOV
#0000
Input Variable Variable Output
dd
Define in advance.
Insert in program. Setting Setting

Copy of function block A


Save function
block as file.

Library Input Variable Variable Output

Function
block A
To another PLC program
Reuse

4-3-2 Advantages of Function Blocks


Function blocks allow complex programming units to be reused easily. Once standard program sections
have been created as function blocks and saved in files, they can be reused just by placing a function
block in a program and setting the parameters for the function block’s I/O. Reusing standardized func-
tion blocks reduces the time required for programming/debugging, reduces coding errors, and makes
programs easier to understand.

4-8 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Structured Programming
Structured programs created with function blocks have better design quality and required less devel-
opment time.

z Easy-to-read “Block Box” Design


The I/O operands are displayed as local variable names in the program, so the program is like a
“black box” when entering or reading the program and no extra time is wasted trying to understand
the internal algorithm.

z Different Processes Easily Created from a Single Function Block

4-3 Function Blocks


Many different processes can be created easily from a single function block by using input variables
for the parameters (such as timer SVs, control constants, speed settings, and travel distances) in the
standard process.

z Reduced Coding Errors


Coding mistakes can be reduced, because blocks that have already been debugged can be reused.
4
z Data Protection
The local variables in the function block cannot be accessed directly from the outside, so the data

4-3-2 Advantages of Function Blocks


can be protected. (Data cannot be changed unintentionally.)

z Improved Reusability through Programming with Variables


The function block’s I/O is entered as local variables, so the data addresses in the function block do
not have to be changed as they do when copying and reusing a program section.

Creating Libraries
Processes that are independent and reusable (such as processes for individual steps, machinery,
equipment, or control systems) can be saved as function block definitions and converted to library
functions.
The function blocks are created with local variable names that are not tied to physical addresses, so
new programs can be developed easily just by reading the definitions from the file and placing them
in a new program.

Nesting Multiple Languages


Mathematical expressions can be entered in structured text (ST) language.
Nesting function blocks is supported. For example, it is possible to express only special operations
in ST language within a function block in a ladder diagram.
Function block (ladder language)

Call (Nesting)
Function block (ST language)

For details on using function blocks, refer to the CX-Programmer Ver. 7.0 Operation Manual: Func-
tion Blocks (Cat. No. W447).

CP2E CPU Unit Software User’s Manual(W614) 4-9


4 Understanding Programming

4-3-3 Function Block Specifications


Item Specifications
Defining and creat- Number of function 64 max.
ing function blocks block definitions
Function block 32 characters max.
names
Variables Variable names 15,000 characters max.
Variable types Input variables (Inputs), output
variables (Outputs), internal vari-
ables (Internals), and external
variables (Externals)
Number of variables used in a Maximum number of variables
function block (not including per function block definition
internal variables, external vari- • Input-output variables: 16
ables, EN, and EN0) max.
• Input variables + input-output
variables: 64 max.
• Output variables + input-out-
put variables: 64 max.
Allocation of addresses used by Automatic allocation (The alloca-
variables tion range can be set by the
user.)
Actual address specification Supported
Array specifications Supported (one-dimensional
arrays only and only for internal
variables)
Language Function blocks can be created in ladder programming language or
structured text.
Creating instances Number of 128 max.
instances
Instance names 15,000 characters max.
FB Program Area E……-type: 4K steps, S……-type: 8K steps, N……-type: 10K steps
Storing function Project files The project file (.cxp/cxt) Includes function block definitions and
blocks as files instances.
Program symbol The file memory program file (*.obj) includes function block defini-
files tions and instances.
Function block Each function block definition can be stored as a single file (.cxf) for
library files reuse in other projects.

4-10 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Data Types that Can be Used in Function Blocks


Availability in CP2E
Data type Content Size
Inputs Outputs In Out Internals Externals
BOOL Bit data 1 Yes Yes No Yes Yes
INT Integer 16 Yes Yes No Yes Yes
DINT Double integer 32 Yes Yes No Yes Yes
LINT Long (4-word) integer 64 Yes Yes No Yes Yes
UINT Unsigned integer 16 Yes Yes No Yes Yes
Unsigned double
UDINT 32 Yes Yes No Yes Yes
integer

4-3 Function Blocks


Unsigned long (4-word)
ULINT 64 Yes Yes No Yes Yes
integer
REAL Real number 32 Yes Yes No Yes Yes
LREAL Long real number 64 No No No No No
WORD 16-bit data 16 Yes Yes No Yes Yes
DWORD 32-bit data 32 Yes Yes No Yes Yes
LWORD 64-bit data 64 Yes Yes No Yes Yes
STRING Text string data Variable No No No No No
Flag: 1
4
TIMER Timer No No No Yes Yes
PV: 16
Flag: 1

4-3-3 Function Block Specifications


COUNTER Counter No No No Yes Yes
PV: 16
Array - - No No No No No
Structure - - No No No No No

Number of Steps Used by Function Blocks


When function blocks are used, memory is required for the following two items:
1. Function block definitions
2. Instance generation processing when function blocks are pasted into the user program as function
block instances
Therefore, the number of steps used in memory will increase with the number of instances of function
blocks created in the program (item 2).
Creating instances of function blocks (i.e., calling function block definitions and transferring parameters)
uses user program memory.
Function block definitions use memory in the FB Program Area, a special area for function blocks. If the
capacity of the FB Program Area is exceeded, the user program area is used.

Checking Function Block Memory Usage


Select View − Memory View from CX-Programmer.
The following Memory View Dialog Box will be displayed.

CP2E CPU Unit Software User’s Manual(W614) 4-11


4 Understanding Programming

4-3-4 ST Language
CP2E can use the ST (Structured Text) language within function blocks.
The standard control statements, operators, and functions make the ST language ideal for mathemati-
cal processing that is difficult to write in ladder programming.

Additional Information

For details on ST programming specifications, notation, and input procedures, refer to the CX-
Programmer Operation Manual: Function Blocks and Structured Text (Cat. No. W447).

z Features of ST Programming
• There are many control statements available, such as loop statements and IF-THEN-ELSE state-
ments, many operators such as arithmetic operators, comparison operators, and AND/OR opera-
tors, as well as many mathematical functions, string extract and merge functions, Memory Card
processing functions, string transfer functions, and trigonometric functions.
• Programs can be written like high-level languages such as C, and comments can be included to
make the program easy to read.
• ST programs can be uploaded and downloaded just like ordinary programs, but ST program can
only be used in function blocks.
• One-dimensional array variables are supported for easier data handling in applications.

Control Statements, Operators and Functions that Can be Used in


ST Programs
The control statements, operators and functions that can be used in CP2E are shown as follows. A part
of operators and functions are not available in CP2E.
The data types used in ST programs are the same as that can be used in function blocks.

z Control Statements
Control statements Availability in CP2E
IF, THEN, ELSEIF, ELSE, END_IF Yes
CASE, ELSE, END_CASE Yes
FOR, TO, BY, DO, END_FOR Yes
WHILE, DO, END_WHILE Yes
REPEAT, UNTIL, END_REPEAT Yes
EXIT Yes
RETURN Yes

4-12 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

z Operators
Operators Symbol Availability in CP2E
Parentheses and brackets (expression), array[index] Yes
Function evaluation identifier Yes
Exponential ** No
Complement NOT Yes
Multiplication * Yes
Division / Yes
Addition + Yes

4-3 Function Blocks


Subtraction - Yes
Comparisons <, >, <=, >= Yes
Equality = Yes
Non-equality <> Yes
Boolean AND % Yes
Boolean AND AND Yes
Boolean exclusive OR XOR Yes
Boolean OR OR Yes 4

z Standard Functions

4-3-4 ST Language
Function type Availability in CP2E
Numerical Functions No*
Arithmetic Functions No
Data Type Conversion Functions Yes
Number-String Conversion Functions No
Data Shift Functions Yes
Data Control Functions Yes
Data Selection Functions Yes

* Only MOD Function is available.

z OMRON Expansion Functions


Function type Availability in CP2E
Memory Card Functions No
Communications Functions No
Angle Conversion Functions No
Timer/Counter Functions No

CP2E CPU Unit Software User’s Manual(W614) 4-13


4 Understanding Programming

4-4 Programming Instructions

4-4-1 Basic Understanding of Instructions

Structure of Instructions
Programs consist of instructions. The conceptual structure of the inputs to and outputs from an instruc-
tion is shown in the following diagram.

Power flow (P.F., execution condition) Power flow (P.F., execution condition)*1
Instruction condition Instruction Instruction condition*2

Flags Flag
*1: Input instructions only.
*2: Not output for all instructions.
Operands Operands
(sources) (destinations)

I/O memory

z Power Flow
The power flow is the execution condition that is used to control the execution and instructions when
programs are executing normally. In a ladder program, power flow represents the status of the exe-
cution condition.

Input Instructions
• Load instructions indicate a logical start and outputs the execution condition.
Outputs the execution
condition.

• Intermediate instructions input the power flow as an execution condition and output the power flow
to an intermediate or output instruction.
Outputs the execution
condition.

=
D0
#1215

Output Instructions
Output instructions execute all functions, using the power flow as an execution condition.
LD power flow
Power flow for
output instruction

Input block Output block

4-14 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

4-4-2 Operands
Operands specify preset instruction parameters that are used to specify I/O memory area contents or
constants. Operands are given in boxes in the ladder programs.
Addresses and constants are entered for the operands to enable executing the instructions.
Operands are classified as source, destination, or number operands.

4-4 Programming Instructions


Example:

MOV SBS

&0 S (source) 2 N (number)


D0 D (destination)

Operand
Operand type Description
symbol
Source oper- Specifies the address of S Source oper- Source operand other than control
and the data to be read or a and data (C) 4
constant. C Control data Compound data in a source operand
that has different meanings depend-

4-4-2 Operands
ing on bit status.
Destination Specifies the address D −
operand where data will be writ-
(results) ten.
Number Specifies a particular N With numbers, it is not possible to specify an address
number used in the for indirect specification (except for jump instruction
instruction, such as a numbers).
subroutine number.

Operands are also called the first operand, second operand, and so on, starting from the top of the
instruction.

MOV
#0 First operand
D0 Second operand

CP2E CPU Unit Software User’s Manual(W614) 4-15


4 Understanding Programming

4-4-3 Instruction Variations


The following variations are available for instructions to differentiate executing conditions and to refresh
data when the instruction is executed (immediate refreshing).
Variation Symbol Description
No variation used. − These instructions are executed once every cycle while
the execution condition is satisfied.
Differentiation ON @ These instructions are executed only once when the exe-
variations cution condition turns ON.
OFF % These instructions are executed only once when the exe-
cution condition turns OFF.
Immediate refreshing ! Data in the built-in I/O area specified by the operands is
refreshed when the instruction is executed.

Example:

! @ MOV

Instruction (mnemonic)

Differentiation variation

Immediate refresh variation

4-4-4 Execution Conditions


The following two types of basic and special instructions can be used.
• Non-differentiated instructions: Executed every cycle
• Differentiated instructions: Executed only once

Non-differentiated Instructions

z Output Instructions (Instructions That Require Input Conditions)


These instructions are executed once every cycle while the execution condition is satisfied (ON or
OFF).

Non-differentiated Example:
Output instructions MOV
executed every cycle

z Input Instructions (Logical Starts and Intermediate Instructions)


These instructions read bit status, make comparisons, test bits, or perform other types of processing
every cycle. If the results are ON, the input condition is output (i.e., the execution condition is turned
ON).

Input instruction executed every cycle Example:

4-16 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Input-differentiated Instructions

z Upwardly Differentiated Instructions (Instructions Preceded by @)


• Output Instructions
The instruction is executed only during the cycle in which the execution condition changes from
OFF to ON.

4-4 Programming Instructions


The instruction is not executed in the following cycle.

Example: 1.02
@ Upwardly
differentiated @MOV
instruction

Executes the MOV instruction once


when CIO 1.02 turns ON.

• Input Instructions (Logical Starts and Intermediate Instructions)


The instruction reads bit status, makes comparisons, tests bits, or performs other types of pro-
cessing every cycle and will output an ON execution condition (power flow) when the result
changes from OFF to ON. 4
The execution condition will turn OFF the next cycle.

Upwardly differentiated instruction Example: 1.03


 

ON execution condition created for one


cycle when CIO 1.03 turns ON.

z Downwardly Differentiated Instructions (Instruction Preceded by %)


• Output Instructions
The instruction is executed only during the cycle in which the execution condition changes from
ON to OFF.
The instruction is not executed in the following cycle.

Example: 1.02
% Downwardly
differentiated %SET
instruction

Executes the SET instruction once


when CIO 1.02 turns OFF.

• Input Instructions (Logical Starts and Intermediate Instructions)


The instruction reads bit status, makes comparisons, tests bits, or performs other types of pro-
cessing every cycle and will output an ON execution condition (power flow) when the result
changes from ON to OFF.
The execution condition will turn OFF the next cycle.

Downwardly differentiated instruction Example: 1.03


 

ON execution condition created for one cycle


when CIO 1.03 turns ON.

CP2E CPU Unit Software User’s Manual(W614) 4 - 17


4 Understanding Programming

4-4-5 Specifying Data in Operands

Specifying Addresses
Application
Operand Description Example
examples
Specifying The word address and bit number are speci- 1 . 02 1.02
bit fied directly to specify a bit.
addresses Bit number 02
.
Bit number Word address CIO 1
(00 to 15)

Word address

Specifying The word address is specified directly to MOV 3 D200


3
word specify a 16-bit word.
Word address CIO 3
addresses
D200
Word address Word address D200

Specifying In brackets, specify the number of bits to off- 10.00[2] 10.00[2]


offsets for bit set the specified starting bit address. Number of bits to offset the address
addresses →Specify 10.02
. Starting bit address
Offset Constant
10.00 [W0]
0 to 15 or word
address in I/O memory Number of bits to offset the address
When W0 = &2→Specify 10.02
Starting bit address Starting bit address

A symbol can also be specified for the start-


ing bit address. Only Holding, Work, and DM
Area addresses can be used regardless of
whether a physical address or symbol is
used.
A constant or word address in I/O memory
can be used for the offset. If a word address
is specified, the contents of the word is used
as the offset.
Specifying In brackets, specify the number of words to D0[2] MOV 3 D0[200]
offsets for offset the specified starting bit address. Number of words to offset the address
word →Specify D2
[ ] Starting word address
addresses
Offset Constant of 0 or
higher or word address in D0 [W0]
I/O memory Number of bits to offset the address
Starting word address When W0 = &2→Specify D2
Starting word address
A symbol can also be specified for the start-
ing word address. Only Holding, Work, and
DM Area addresses can be used regardless
of whether a physical address or symbol is
used.
A constant or word address in I/O memory
can be used for the offset. If a word address
is specified, the contents of the word is used
as the offset.

4-18 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Application
Operand Description Example
examples
Specifying An offset from the beginning of the DM Area @D300
MOV #0001 @D300
indirect DM is specified. The contents of the address will
addresses in be treated as binary data (E……-type CPU
&256 decimal Contents
Binary Mode Unit 0000 to 4095, S……-type CPU Unit
0000 to 8191, N……-type CPU Unit 0000 to (#0100 hexadecimal)
16383) to specify the word address in DM
Area.
Specify D00256

4-4 Programming Instructions


Add the @ symbol at the front to specify an
indirect address in Binary Mode.
Add @

Specifying An offset from the beginning of the DM Area * D200 MOV #0001 *D200
indirect DM is specified. The contents of the address will
Addresses be treated as BCD data (E……-type CPU Contents
#0100
in BCD Unit 0000 to 4095, S……-type CPU Unit
Mode 0000 to 8191, N……-type CPU Unit 0000 to
16383) to specify the word address in the Specify D100
DM Area.
Add an asterisk (*) at the front to specify an
indirect address in BCD Mode. Add *
4
Note For Timer Completion Flags and Counter Completion Flags, there is no distinction between word addresses and bit

4-4-5 Specifying Data in Operands


addresses.

Operand Description Notation Application examples


Specifying a An index register (IR) or a data register (DR) is IR0 MOVR 1.02 IR0
register specified directly by specifying IR… (…: 0 to 15) Stores the PLC memory address for CIO
directly or DR… (…: 0 to 15). 0010 in IR0.
(See note.) IR1 MOVR 10 IR1
Stores the PLC memory address for CIO
0010 in IR1.
Specifying Indirect The bit or word with the PLC mem- ,IR0 LD ,IR0
an indirect address ory address contained in IR… will be Loads the bit with the PLC memory
address (No off- specified. Specify ,IR… to specify address in IR0.
using a reg- set) bits and words for instruction oper-
ister ands. ,IR1 MOV #0001 ,IR1

(See note.) Stores #0001 in the word with the PLC


memory in IR1.
Constant The bit or word with the PLC mem- +5,IR0 LD +5,IR0
offset ory address in IR… + or - the con- Loads the bit with the PLC memory
stant is specified. Specify +/- address in IR0 + 5.
constant ,IR…. Constant offsets
range from -2048 to +2047 (deci- +31,IR1 MOV #0001 +31,IR1
mal). Stores #0001 in the word with the PLC
The offset is converted to binary memory address in IR1 + 31.
data when the instruction is exe-
cuted.
DR offset The bit or word with the PLC mem- DR0 ,IR0 LD DR0 ,IR0
ory address in IR… + the contents of Loads the bit with the PLC memory
DR… is specified. Specify DR… address in IR0 + the value in DR0.
,IR…. DR (data register) contents
are treated as signed-binary data. DR0 ,IR1 MOV #0001 DR0 ,IR1
The contents of IR… will be given a Stores #0001 in the word with the PLC
negative offset if the signed binary memory address in IR1 + the value in DR0.
value is negative.

CP2E CPU Unit Software User’s Manual(W614) 4-19


4 Understanding Programming

Operand Description Notation Application examples


Auto- The contents of IR… is incremented ,IR0++ LD ,IR0 ++
increment by +1 or +2 after referencing the Increments the contents of IR0 by 2 after
value as an PLC memory address. the bit with the PLC memory address in IR0
+1: Specify ,IR…+ is loaded.
+2: Specify ,IR…+ + ,IR1+ MOV #0001 ,IR1 +
Increments the contents of IR1 by 1 after
#0001 is stored in the word with the PLC
memory address in IR1.
Auto-dec- The contents of IR… is decremented ,--IR0 LD ,--IR0
rement by -1 or -2 after referencing the After decrementing the contents of IR0 by
value as an PLC memory address. 2, the bit with the PLC memory address in
-1: Specify ,-IR… IR0 is loaded.
-2: Specify ,--IR… ,-IR1 MOV #0001 ,-IR1
After decrementing the contents of IR1 by
1, #0001 is stored in the word with the PLC
memory address in IR1.

Note For specific application methods, refer to 4-6 Index Registers.

4-4-6 Data Formats


The following table shows the data formats that the CP2E CPU Units can handle.
4-digit
Decimal
Type Data format hexadeci-
equivalent
mal
Unsigned &0 to #0000 to
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
binary &65535 #FFFF
Binary→ 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
Hexadecimal→ 23 22 21 20 23 22 21 20 23 22 21 20 23 22 21 20
Decimal→ 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1

Signed 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Negative: Negative:
binary -1 to #8000 to
Binary: → 215 214 213 212 211 210 29 28 27 26 25 24 23 22 21 20
- 32768 #FFFF
Hexadecimal: → 23 22 21 20 23 22 21 20 23 22 21 20 23 22 21 20
Decimal: → -32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 Positive: Positive:
0 to 32767 #0000 to
Sign bit: #7FFF
1:Negative, 0:Non-negative

The data is treated as 16-bit signed binary data using the leftmost bit as the
sign bit. The value is expressed in 4-digit hexadecimal.
Positive numbers: If the leftmost bit is OFF, it indicates a non-negative value.
For 4-digit hexadecimal, the value will be 0000 to 7FFF hex.
Negative numbers: If the leftmost bit is ON, it indicates a negative value. For 4-
digit hexadecimal, the value be 8000 to FFFF hex. It will be expressed as the
2’s complement of the absolute value of the negative value (decimal).

4-20 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

4-digit
Decimal
Type Data format hexadeci-
equivalent
mal
BCD (binary 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
#0 to #9999 #0000 to
coded deci- #9999
mal) BCD → 23 22 21 20 23 22 21 20 23 22 21 20 23 22 21 20

Decimal → 0 to 9 0 to 9 0 to 9 0 to 9

4-4 Programming Instructions


Single-preci- 31 30 29 23 22 21 20 19 2 1 0
* −
sion floating-
point decimal

Sign of Exponent Mantissa


mantissa Binary

sign Exponent
Value = (-1) ×1.[Mantissa] × 2
· Sign bit (bit 31): 1: Negative, 0: Positive
· Mantissa: The 23 bits from bit 00 to bit 22 contain the mantissa, i.e., the portion
below the decimal point in 1. .....,in binary.
4
Indicates this value.
· The 8 bits from bit 23 to bit 30 contain the exponent. The exponent
n n-127

4-4-6 Data Formats


is expressed in binary as the n in 2 . The actual value is 2 .

This format conforms to the IEEE 754 standard for single-precision floating-
point data. It is used only with instructions that convert or calculate floating-
point data.
• Input using operands in the CX-Programmer as signed decimal or 32-bit
hexadecimal with the # symbol.
• When inputting operands in the I/O Memory Edit/Monitor Window of the CX-
Programmer as signed decimal values with seven digits or less, the value will
be automatically converted to scientific notation (mantissa× 10Exponent) for
setting and monitoring. Inputs must be made using scientific notation for val-
ues with eight or more digits.
Example: When -1234.00 is input, it will become -1.234000e+003 in scientific
notation. For the mantissa×10Exponent, the value before the e is the man-
tissa and the value after the e is the signed exponent.

* Data range for single-precision floating-point decimal: -3.402823 × 1038 ≤ Value ≤ -1.175494 × 10-38, 0, +1.175494 ×
10-38 ≤ Value ≤ 3.402823 × 1038

CP2E CPU Unit Software User’s Manual(W614) 4-21


4 Understanding Programming

4-4-7 I/O Refresh Timing


The following methods are used to refresh external I/O.
• Cyclic refreshing
• Immediate refreshing (instructions with the ! variation and IORF)

Cyclic Refreshing
I/O is all refreshed after ladder programs are executed.

Start
15 0
LD1.01 CIO 0001
16-bit increments
15 0
OUT2.09 CIO 0002

END
All actual I/O data



Cyclic refreshing
(batch)
I/O refresh

Execute an instruction with the immediate refresh variation or an IORF instruction to perform I/O
refreshing while ladder programming is being executed.

Immediate Refresh
The method of specifying immediate refreshing depends on whether the object to be refreshed is built-
in I/O or an Expansion Unit.
• To specify immediate refreshing for the CPU Unit’s built-in I/O, specify the immediate refresh variation
(!) of the instruction.
• To specify immediate refreshing for Expansion I/O or an Expansion Unit, use the IORF instruction.
z Instructions with Refresh Variation (!)
Add an exclamation mark (!) in front of the instruction to specify immediate refreshing.
I/O will be refreshed as shown below when an instruction is executing if a real I/O bit in the CPU
Unit’s built-in I/O is specified as an operand.
• Bit Operands: I/O refreshing for the bit will be performed.
• Word Operands: I/O refreshing for the 16 specified bits will be performed.
• Input or Source Operands: Inputs are refreshed immediately before the instruction is executed.
• Output or Destination Operands: Outputs are refreshed immediately after the instruction is executed.
z IORF(097) Instruction
An I/O refresh (IORF) instruction is supported as a special instruction to refresh actual I/O data in
the specified word range. By using this instruction, it is possible to refresh all data or data in a spec-
ified range of actual I/O in CP-series Expansion I/O and Expansion Unit during the cycle.

Precautions for Correct Use


It is not possible to use the immediate refresh variation (!) for the actual I/O of Expansion I/O or
an Expansion Unit. Use the IORF instruction.

4-22 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

4-5 Constants

Overview

Constants are numeric values expressed in 16 or 32 bits and can be specified as instruction operands.
The following types of constants are supported.
• Bit Strings or Numeric Values (Integers)
Decimal values (with & symbol), hexadecimal values (with # symbol), BCD values (with # symbol), or
signed decimal values (with + or - symbol)
• Operands Specifying Numbers

4-5 Constants
Decimal Notation (No Symbol)
• Floating Point (Real Number) Notation
Signed decimal notation (with + or - symbol and decimal point)

Notation and Ranges


4
z Using Operands for Bit Strings or Numeric Values (Integers)

Unsigned Binary

4-4-7 I/O Refresh Timing


Data type Decimal values Hexadecimal values
Notation With & symbol With # symbol
& 10 # 000A

Decimal value Hexadecimal value


(integer) using 0 to F

Decimal symbol Hexadecimal symbol

Application MOV &10 D0 MOV #000A D0


example Stores 10 decimal (#000A hex) in D0. Stores #000A hex (&10 decimal) in D0.
Precautions for • An error will occur and the left bus bar • An error will occur and the left bus bar will be
correct use will be displayed in red if a hexadecimal displayed in red if a hexadecimal value
value including A to F is input with & including A to F is input without # from the
from the CX-Programmer. CX-Programmer.
• The input will be treated as an address • The input will be treated as an address in the
in the CIO Area and the contents of that CIO Area and the contents of that address
address will be specified if a decimal will be specified if a decimal value without #
value without & is input from the CX- is input from the CX-Programmer.
Programmer.
Range 16 bits &0 to 65535 #0000 to #FFFF
32 bits &0 to 4294967295 #00000000 to #FFFFFFFF

CP2E CPU Unit Software User’s Manual(W614) 4-23


4 Understanding Programming

Signed Binary
Data type Decimal values Hexadecimal values
Notation Signed + or - With # symbol
- 10 # FFF6

Decimal value Hexadecimal value


(integer) using 0 to F

+ or - sign Hexadecimal symbol

Application MOV -10 D0 MOV # FFF6 D0


example Stores 10 decimal (#FFF6 hex) in D0. Stores #FFF6 hex (10 decimal) in D0.
Precautions for The input will be treated as an address in • An error will occur and the left bus bar will be
correct use the CIO Area and the contents of that displayed in red if a hexadecimal value
address will be specified if a decimal including A to F is input without # from the
value without + or - is input from the CX- CX-Programmer.
Programmer. • The input will be treated as an address in the
CIO Area and the contents of that address
will be specified if a decimal value without #
is input from the CX-Programmer.
Range 16 bits Negative: -32768 to -1 Negative: #8000 to #FFFF
Positive: 0 to +32767 Positive: #0000 to #7FFF
32 bits Negative: -2147483648 to -1 Negative: #80000000 to #FFFFFFFF
Positive: 0 to +2147483647 Positive: #00000000 to #7FFFFFFF

Unsigned BCD
Data type Decimal values BCD values
Notation None # 0010
Decimal value using
0 to 9

BCD symbol

Application +B #0010 D0 D1
example Adds #0010 and the contents of D0 as BCD data
and stores the result in D1.
Precautions for The input will be treated as an address in the CIO
correct use Area and the contents of that address will be
specified if a decimal value without # is input from
the CX-Programmer.
Range 16 bits None #0000 to #9999
32 bits #0000 0000 to #99999999

4-24 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

z Using Operands to Specify Numbers


Data type Decimal values Hexadecimal values or BCD values
Notation No symbol (value only) Not possible.
10
Number only

Application SBS 0
example Jumps to subroutine 0.
Precautions for An error will occur and the left bus bar
correct use will be displayed in red if a decimal
value is input with & from the CX-Pro-
grammer.

4-5 Constants
z Using Floating-point (Real Number) Notation for Operands
Data type Decimal values Hexadecimal values
Notation With + or - With # symbol
(for single-precision data)
+ 0.10
Decimal value # 3DCCCCCD 4
(real number) Hexadecimal value
+ or - sign using 0 to F

4-4-7 I/O Refresh Timing


Hexadecimal symbol

Application FIX +0.10 D0 FIX #3DCCCCCD D0


example Converts floating point +0.10 into 16- Converts floating point #3DCCCCCD (+0.10 deci-
bit signed binary data and stores the mal) into 16-bit signed binary data and stores the
integer portion in D0. integer portion in D0.
Precautions for The input will be treated as an address The input will be treated as an address in the CIO
correct use in the CIO Area, an error will occur, Area, an error will occur, and the left bus bar will be
and the left bus bar will be displayed in displayed in red if a hexadecimal value including A
red if a decimal value with a decimal to F is input without # from the CX-Programmer.
point is input without + from the CX-
Programmer.

Additional Information

• Zero suppression can be used when inputting any data type.


For example, “&2” and “&02”, “#000F” and “#F” are treated as the same.
• “BIN” indicates binary data.
• BCD data is binary coded decimal.

CP2E CPU Unit Software User’s Manual(W614) 4-25


4 Understanding Programming

4-6 Index Registers

4-6-1 What are Index Registers?


Index Registers function as pointers to specify PLC memory addresses, which are absolute memory
addresses in I/O memory. After storing a PLC memory address in an Index Register with MOVR or
MOVRW, input the Index Register as an operand in other instructions to indirectly address the stored
PLC memory address.
The advantage of Index Registers is that they can specify any bit or word in I/O memory, including timer
and counter PVs.

Pointer All areas of


I/O Memory

MOVR(560)

IR
Index Register

4-6-2 Using Index Registers


Index Registers can be a powerful tool when combined with loops such as FOR-NEXT loops. The con-
tents of Index Registers can be incremented, decremented, and offset very easily, so a few instructions
in a loop can process tables of consecutive data very efficiently.
Increment IR0 and repeat
instruction execution Table data

Instruction Indirect
addressing
,IR0

IR0
Basically, Index Registers are used with the following steps:

1 Use MOVR to store the PLC memory address of the desired bit or word in an Index Register.

2 Specify the Index Register as the operand in almost any instruction to indirectly address the
desired bit or word.

3 Offset or increment the original PLC memory address (see below) to redirect the pointer to
another address.

4 Continue steps 2 and 3 to execute the instruction on any number of addresses.

Note Use any of the following methods to offset or increment an Index Register.
• Indirect Addressing of Index Registers:
Indirect addressing with auto-incrementing (,IR@+ or ,IR@++), indirect addressing with
auto-decrementing (,−IR@ or ,−−IR@), indirect referencing with a constant offset (con-
stant,IR@), indirect addressing with a DR offset (DR@,IR@)

4-26 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

• Instructions for Direct Addressing of Index Registers:


BINARY ADD (+L), BINARY SUBTRACT (−L), DOUBLE INCREMENT BINARY (++L),
DOUBLE DECREMENT BINARY (−−L)
Example:

Stores the PLC memory


Instruction A m MOVR(560) m IR0
address of m in IR0.

Instruction A m+1
Repeats the process
Instruction A ,IR0+ in a loop such as
FOR-NEXT.
Instruction A m+n

4-6 Index Registers


The example given above shows how an Index Register in a program loop can replace a long series of
instructions. In this case, instruction A is repeated n+1 times to perform some operation such as read-
ing and comparing a table of values.

Precautions for Correct Use


The following instructions are executed even when the input conditions are OFF. Therefore,
when indirect memory addresses are specified using auto-incrementing or auto-decrementing 4
(,IR+ or ,IR-) in an operand of any of these instructions, the value in the Index Register (IR) is
refreshed each cycle regardless of the input condition (increases or decreases one every cycle).

4-6-2 Using Index Registers


This must be considered when writing a program.
Classification Instructions
Sequence input instructions LD, LD NOT, AND, AND NOT, OR, OR NOT, LD TST, LD TSTN, AND
TST, AND TSTN, OR TST, OR TSTN
Sequence output instructions OUT, OUT NOT, DIFU, DIFD
Sequence control instructions JMP, FOR
Timer and counter instructions TIM/TIMX(550), TIMH(015)/TIMHX(551), TMHH(540)/TMHHX(552),
TTIM(087)/TTIMX(555), TIML(542)/TIMLX(553),
MTIM(533)/MTIMX(554), CNT/CNTX(546),
CNTR(012)/CNTRX(548)
Comparison instructions Symbol comparison instructions (LD, AND, OR =, etc.)
Single-precision floating-point Single-precision floating-point data comparison (LD, AND, OR = F,
math instructions etc.)

The following ladder programming examples show how the index registers are treated.

Example 1
Ladder Program:
LD P_Off
OUT, IR0+
Operation: When the PLC memory address CIO 0.13 is stored in IR0.
The input condition is OFF (P_Off is the Always OFF Flag), so the OUT instruction sets CIO 0.13,
which is indirectly addressed by IR0, to OFF. The OUT instruction is executed, so IR0 is incre-
mented. As a result, the PLC memory address CIO 0.14, which was incremented by +1 in the
IR0, is stored. Therefore, in the following cycle the OUT instruction turns OFF CIO 0.14.

Example 2
Ladder Program:
LD P_Off
SET, IR0+
Operation: When the PLC memory address CIO 0.13 is stored in IR0.

CP2E CPU Unit Software User’s Manual(W614) 4-27


4 Understanding Programming

The input condition is OFF (P_Off is the Always OFF Flag), so the SET instruction is not exe-
cuted. Therefore, IR0 is not incremented and the value stored in IR0 remains PLC memory
address CIO 0.13.
• The following instructions are executed even when the interlock is active. Therefore, when indi-
rect memory addresses are specified using auto-incrementing or auto-decrementing (,IR+ or
,IR-) in an operand of any of these instructions, the value in the Index Register (IR) is
refreshed each cycle regardless of the input condition (increases or decreases one every
cycle). This must be considered when writing a program.
Instruction group Instructions
Sequence output instructions OUT, OUT NOT
Timer and counter instructions TIM/TIMX, TIMH/TIMHX, TMHH/TMHHX, and
TIML/TIMLX

Precautions for Correct Use


• When Index Registers IR0 to IR15 are used within function blocks, using the same Index Reg-
ister within other function blocks or in the program outside of function blocks will create compe-
tition between the two instances and the program will not execute properly. Therefore, when
using Index Registers (IR0 to IR15), always save the value of the Index Register at the point
when the function block starts (or before the Index Register is used), and when the function
block is completed (or after the Index Register has been used), incorporate processing in the
program to return the Index Register to the saved value.
Example: Starting function block (or before using Index Register):

1. Save the value of IR (e.g., A).


Value A
P_On
Value A
[MOVL IR0 Symbol for saving]
IR0

Within function block:

2. Use IR.

Value B

IR0

At start of function block (or before Index Register is used):

3. Return IR to saved value (e.g., A).


Value A
P_On
Value A
[MOVL Symbol for saving IR0]
IR0

• Always set the value before using Index Registers. Operation will not be stable if Index Regis-
ters are used without the values being set.

Precautions for Correct Use


Precaution for Indirect Register Addressing with Index Registers
Do not use indirect register addressing to access areas outside of the I/O memory or areas
reserved by the system. An Illegal Access Error will occur if access is attempted.
Refer to A-4 Memory Map of PLC Memory Addresses for details on the limits of PLC memory
addresses.

4-28 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Application Example for Index Registers


The data in D0 to D99 (augend data) is added to the data in D100 to D199 (addend data) and the addi-
tion results are output to D200 to D299. The operands of a single addition instruction are specified by
index registers and the addition operations are performed by incrementing the index registers and
repeatedly executing the addition instruction.

MOVR(560) sets the PLC memory addresses of D0, D100, and D200 in
index registers IR0, IR1, and IR2.

The augend data (indirectly addressed by IR0+) is added to the addend

4-6 Index Registers


data (indirectly addressed by IR1+) with the SIGNED BINARY ADD
WITHOUT CARRY instruction (+(400)) and the result is output to the word
indirectly addressed by IR2+. Repeated 100 times.
Index registers IR0+, IR1+, and IR2+ are automatically incremented after
being referenced in the +(400) instruction.

Execution condition 4
a
MOVR When execution condition “a” goes ON
(upwardly differentiated condition), the

4-6-2 Using Index Registers


D0 PLC memory addresses of D0, D100,
IR0 and D200 are set in index registers IR0,
IR1, and IR2.
The following FOR-NEXT loop is not
MOVR executed unless execution condition “a”
is upwardly differentiated (OFF→ON).
D100
IR1

MOVR
D200
IR2

JMP
&50

FOR Start loop.


&100
Execution condition
a
+ If execution condition “a” is ON, the
word indirectly addressed by IR0
,IR0+ (auto-incremented) and the word
,IR1+ indirectly addressed by IR1
,IR2+ (auto-incremented) are added as 4-digit
signed hexadecimal values and the
result is output to the word indirectly
addressed by IR2 (auto-incremented).

NEXT Return to FOR and repeat loop.

JME Jump destination when execution


&50 condition “a” is not upwardly
differentiated (OFF→ON).

Additional Information

Index Registers can be directly addressed only in the instructions shown in the following table.

CP2E CPU Unit Software User’s Manual(W614) 4-29


4 Understanding Programming

z Direct Addressing of Index Registers


The size of an index registers is two words per register for Index Registers IR0 to IR15, so use a
double-word instruction (with an “L” in the mnemonic).
Instruction group Instruction name Mnemonic Primary function
Data Movement Instructions MOVE TO REGISTER MOVR(560) Stores the PLC memory
MOVE TIMER/COUNTER PV MOVRW(561) address of a bit or word in an
TO REGISTER Index Register.

DOUBLE MOVE MOVL(498) Transfers between Index


DOUBLE EQUAL =L(301) Registers. Used for
Comparison Instructions
exchanges and comparisons.
DOUBLE NOT EQUAL < >L(306)
DOUBLE LESS THAN < L(311)
DOUBLE LESS THAN OR < =L(316)
EQUAL
DOUBLE GREATER THAN >L(321)
DOUBLE GREATER THAN OR >=L(326)
EQUAL
DOUBLE COMPARE CMPL(060)
Increment/Decrement DOUBLE INCREMENT BINARY ++L(591) Changes the PLC memory
Instructions DOUBLE DECREMENT −−L(593) address in the Index Register
BINARY by incrementing, decrement-
ing, or offsetting its content.
Symbol Math Instructions DOUBLE SIGNED BINARY +L(401)
ADD WITHOUT CARRY
DOUBLE SIGNED BINARY −L(411)
SUBTRACT WITHOUT CARRY

4-6-3 Monitoring Index Registers


It is possible to monitor Index Registers as follows:
• To use the CX-Programmer to monitor the final Index Register values for each task.
• To monitor the Index Register values using Host Link commands or FINS commands, write a pro-
gram to store Index Register values from each task to another area (e.g., DM area) at the end of each
task, and to read Index Register values from the storage words (e.g., DM area) at the beginning of
each task. The values stored for each task in other areas (e.g., DM area) can then be edited using
the CX-Programmer, Host Link commands, or FINS commands.

4-30 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

z Example
Note Be sure to use PLC memory addresses in Index Registers.
IR storage words
for task 1

D1000
Task 1
D1001
IR0
a
MOVL
D1001 and D1000 stored
or
D1000 in IR0
0000C000Hex
IR0
IR0
a or

4-6 Index Registers


MOVR
Actual memory address of CIO
0000 0000 (0000C000 Hex) stored in D1000 C 0 0 0
IR0 D1001 0 0 0 0
IR0
IR0

MOVL
Contents of IR0 stored in
IR0 D1001 and D1000
D1000

4
IR storage words
for task 2

4-6-3 Monitoring Index Registers


D2000
Task 2
D2001
IR0
a
MOVL
D2001 and D2000 or
D2000 stored in IR0
0000C005Hex
IR0
IR0
a or
MOVR
Actual memory address CIO D2000
0005 C 0 0 5
0005 (0000C005 Hex) stored in
IR0 IR0 D2001 0 0 0 0
IR0

MOVL
IR0 Contents of IR0 stored in
D2001 and D2000
D2000

Peripheral servicing Read D1001 Read D2001


and D1000 and D2000

CP2E CPU Unit Software User’s Manual(W614) 4-31


4 Understanding Programming

4-7 Specifying Offsets for Addresses

4-7-1 Overview

When an address is specified for an instruction operand, it is possible to change the specified address
by specifying in brackets an offset for the specified address.

0.00[W0]
MOV

When the start address


is CIO 0.00 and W0 is Examples of When the start
&2, 2 is added, Specifying Bit address is D100 and
resulting in CIO 0.02. Address Offsets W1 is &3, 3 is added,
resulting in D103.
10.00[4]
Examples of
MOV Specifying Word
Address Offsets
An offset of 4 is added An offset of 12 is
to the start address of added to the start
CIO 10.00, resulting in address of D100,
CIO 10.04. resulting in D112.

z Bit Addresses
The bit address is offset by the amount specified by n (number of bits) from A (start bit address).

A [n]
Offset

Starting bit address

Number of bits to offset: +n

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Word
Starting bit address A

Start Bit Address


It is possible to specify the start bit address with a bit address or with a symbol (except the NUMBER
data type cannot be used).
Offsetting is possible for all addresses except the DM Areas.
When specifying symbols, make the symbol table setting as the array variation. The number of
arrays will be the maximum number of offset + 1 bit at least.
The I/O comment for the start bit address is displayed.

Offset
The offset can be specified as a decimal constant, word address (but CIO Area addresses cannot
be specified), or a one-word symbol (i.e., symbols with the following data types: INT, UINT, WORD,
CHANNEL).
Words in the Auxiliary Area (A) can only be specified as a decimal constant.
If a word address is specified, the contents of the specified word is used as the offset.
If the offset exceeds bit 15 in the specified word, offsetting will continue from bit 00 in the next word.
If the offset is specified indirectly, make sure that the final bit address does not exceed the upper
limit of the memory area by using input comparison or other instruction.

4-32 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

Examples:

10.0 [2]  10.02 a [2]  10.02

Offset (decimal value) Offset (decimal value)


Start bit address; symbol a = 10.0
Start bit address (bit symbol named a)
(bit address in I/O memory)
10.00 [W0]  10.02

4-7 Specifying Offsets for Addresses


a [b]  10.02
Offset when W0 = &2
(word address in I/O memory) Offset; symbol b = &2
Start bit address Start bit address; symbol a = 10.0
(bit address in I/O memory)

z Word Addresses
The word address is offset by the amount specified by n (number of offset words) from A (start word
address).

Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
A [n] Word 
Start word address A
Offset +n
4

Start Word Address

4-7-1 Overview
It is possible to specify the start word address with a word address or with a symbol (except the
NUMBER data type cannot be used).
Offsetting is possible only for addresses in the Holding, Word, and DM Areas.
The I/O comment for the start bit address is displayed.
When specifying symbols, make the symbol table setting as the array variation. The number of
arrays will be the maximum number of offset + 1 word at least.

Offset
The offset can be specified as a decimal constant, word address (but CIO Area addresses cannot
be specified), or one-word symbol (i.e., symbols with the following data types: INT, UINT, WORD,
CHANNEL).
If a word address or symbol is specified, the contents of the specified word is used as the offset.
If the offset exceeds bit 15 in the specified word, offsetting will continue from bit 00 in the next word.
If the offset is specified indirectly, make sure that the final bit address does not exceed the upper
limit of the memory area by using input comparison or other instruction.

Examples:

D0[2]  D2 a [2]  D2

Offset (decimal value) Offset (decimal value)


Start word address;
Start word address symbol a (one-word symbol) = D0
(word address in I/O memory)
D0 [W0]  D2
a [b]  D2
Offset; W0 = &2
(word address in I/O memory) Offset;
Start bit address symbol b(one-word symbol) = &2
(bit address in I/O memory) Start word address;
symbol a (one-word symbol) = D0

CP2E CPU Unit Software User’s Manual(W614) 4-33


4 Understanding Programming

Caution
Program so that the memory area of the start address is not exceeded when using a
word address or symbol for the offset.
For example, write the program so that processing is executed only when the indirect
specification does not cause the final address to exceed the memory area by using
an input comparison instruction or other instruction.
If an indirect specification causes the address to exceed the area of the start address,
the system will access data in other area, and unexpected operation may occur.

4-7-2 Application Examples for Address Offsets


It is possible to dynamically specify the offset by specifying a word address in I/O memory for the offset
in the brackets. The contents of the specified word address will be used as the offset.
For example, execution can be performed by increasing the address by incrementing the value in the
brackets and using only one instruction.

z Ladder Program Example


In this example, two areas of consecutive data are used: D0 to D99 and D100 to D199.
The contents of corresponding words are added starting from the specified starting point, W0, to the
end of the areas and the sums are output to D200 to D299 starting from the specified offset from
D200.
For example, if W0 is 30, the corresponding words from D30 to D99 and D130 to D199 are added,
and the sums are output to D230 to D299.

Set the value of W0 to the offset word (W1) using the MOV instruction.

 Use the operand of the addition instruction to specify and execute D0[W1] +
D100[W1] = D200[W1]. Repeat this process
 Increment W1 to increase the offset. 100 times.

Each process is performed with an input comparison instruction (<) as the execution condition so
that W1 does not exceed &100 to make sure that the upper limit of the indirect addressing range is
not exceeded.

Execution condition
a

MOV When execution condition a (upwardly


W0 differentiated) turns ON, the value of W0 is
set to W1.
W1

FOR Starts FOR loop


Execution condition &100
a
< If execution condition a is ON and the
+
value of W1 is less than &100, the data
W1 D0[W1] from the start position until D99 and
&100 D100[W1] the data until D199 are added, and the
D200[W1] sum for each is output until D299.

++ While execution condition a is ON, W0 is


incremented.
W1

NEXT Returns to FOR

4-34 CP2E CPU Unit Software User’s Manual(W614)


4 Understanding Programming

4-8 Ladder Programming Precautions

4-8-1 Special Program Sections

4-8 Ladder Programming Precautions


For CP2E CPU Units, programs have special program sections that will control instruction conditions.
The following special program sections are available.
Instruction
Program sections Instructions Status
conditions
Subroutine sections SBS, SBN, and RET instruc- Subroutine program The subroutine program
tions is executed. section between SBN and
RET instructions is exe-
cuted.
IL-ILC sections IL and ILC instructions During IL The output bits are turned
Step ladder sections STEP instructions OFF and timers are reset.
Other instructions will not be
executed and previous sta-
tus will be maintained. 4
FOR-NEXT sections FOR and NEXT instructions Break in progress. Looping

4-8-1 Special Program Sections


Instruction Combinations
The following table shows which of the special instructions can be used inside other program sections.
MILH and
Subroutine IL-ILC Step ladder FOR-NEXT
MILR-MILC
sections sections sections sections
sections
Subroutine sections No No No No No
IL-ILC sections Yes No No No Yes
MILH and MILR-MILC sections Yes No Yes No Yes
Step ladder sections No Yes Yes No No
FOR-NEXT sections Yes Yes Yes No Yes

Subroutines
Place all the subroutines together just after all of the main program and before the END instruction.
A subroutine cannot be placed in a step ladder, block program, or FOR-NEXT section.
If instructions other than those in a subroutine are placed after a subroutine (SBN to RET), those
instructions will not be executed.
Program

Subroutines

CP2E CPU Unit Software User’s Manual(W614) 4-35


4 Understanding Programming

Instructions not Supported in Subroutines


The following instructions cannot be used in a subroutine.
Classification
Mnemonic Instruction
by function
Step Ladder STEP STEP DEFINE
Instructions SNXT STEP NEXT

Instructions not Supported in Step Ladder Program Sections


The following instructions cannot be used in step ladder program sections.
Classification
Mnemonic Instruction
by function
Sequence Con- FOR, NEXT, and BREAK FOR, NEXT, and BREAK LOOP
trol Instructions END END
IL and ILC INTERLOCK and INTERLOCK CLEAR
JMP and JME JUMP and JUMP END
CJP CONDITIONAL JUMP and CONDITIONAL JUMP NOT
Subroutines SBN and RET SUBROUTINE ENTRY and SUBROUTINE RETURN

Note A step ladder program section can be used in an interlock section (between IL and ILC).
The step ladder section will be completely reset when the interlock condition is ON.

4-36 CP2E CPU Unit Software User’s Manual(W614)


I/O Memory
This section describes the types of I/O memory areas in a CP2E CPU Unit and the
details.
Be sure you understand the information in the section before attempting to write ladder
diagrams.
Refer to the CP1E/CP2E CPU Unit Instructions Reference Manual (Cat. No. W483) for
detailed information on programming instructions.
5

5-1 Overview of I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2


5-1-1 I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
5-1-2 I/O Memory Area Address Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
5-1-3 I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
5-2 I/O Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
5-3 Work Area (W) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
5-4 Holding Area (H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
5-5 Data Memory Area (D). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11
5-6 Timer Area (T) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13
5-7 Counter Area (C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15
5-8 Index Registers (IR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-17
5-9 Data Registers (DR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21
5-10 Auxiliary Area (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23
5-11 Condition Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25
5-12 Clock Pulses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-27

CP2E CPU Unit Software User’s Manual(W614) 5-1


5 I/O Memory

5-1 Overview of I/O Memory Areas


This section describes the I/O memory areas in a CP2E CPU Unit.

5-1-1 I/O Memory Areas


Data can be read and written to I/O memory from the ladder programs. I/O memory consists of an area
for I/O with external devices, user areas, and system areas.

System Areas

Input bits (starting from CIO 0)

User Areas Auxiliary Area


(A)

Timer Area (T)


Work Area (W)
Counter Area (C)
DM Area (D)
Index Registers (IR)
Condition Flags
Holding Area (H)
Data Registers (DR)

Clock Pulses

Output bits (starting from CIO 100)

CIO Area (CIO 0 to CIO 289)


In the CIO Area, input bit addresses range from CIO 0 to CIO 99, output bit addresses range from CIO
100 to CIO 199 and addresses for serial PLC links range from CIO 200 to CIO 289.
The bits and words in the CIO Area are allocated to built-in I/O terminals on the CP2E CPU Unit and to
the Expansion Units and Expansion I/O Units.
Input words and output bits that are not allocated may be used as work bits in programming.
Refer to 5-2 I/O Bits

5-2 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

User Areas
These areas can be used freely by the user.

z Work Area (W)


The Word Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike the
input bits and output bits in the CIO Area, I/O to and from external devices is not refreshed for this
area.
Use this area for work words and bits before using any words in the CIO Area. These words should

5-1 Overview of I/O Memory Areas


be used first in programming because they will not be assigned to new functions in future versions of
CP2E CPU Units.
Refer to 5-3 Work Area (W)

z Holding Area (H)


The Holding Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike
the input bits and output bits in the CIO Area, I/O to and from external devices is not refreshed for
this area.
These words retain their content when the PLC is turned ON or the operating mode is switched
between PROGRAM mode and RUN or MONITOR mode.
Automatically retained in the built-in non-volatile RAM even if the power supply is interrupted. 5
Refer to 5-4 Holding Area (H)

5-1-1 I/O Memory Areas


z Data Memory Area (D)
This data area is used for general data storage and manipulation and is accessible only by word (16
bits).
These words retain their content when the PLC is turned ON or the operating mode is switched
between PROGRAM mode and RUN or MONITOR mode.
Specified words can be retained in the built-in Flash Memory using Auxiliary Area bits.
Automatically retained in the built-in non-volatile RAM even if the power supply is interrupted.
Refer to 5-5 Data Memory Area (D)

z Timer Area (T)


There are two parts to the Timer Area: the Timer Completion Flags and the timer Present Values
(PVs).
Up to 256 timers with timer numbers T0 to T255 can be used.
• Timer Completion Flags
Each Timer Completion Flag is accessed as one bit using the timer number.
A Completion Flag is turned ON when the set time of the timer elapses.
• Timer PVs
Each timer PV is accessed as one word (16 bits) using the timer number.
The PV increases or decreases as the timer operates.
Refer to 5-6 Timer Area (T)

CP2E CPU Unit Software User’s Manual(W614) 5-3


5 I/O Memory

z Counter Area (C)


There are two parts to the Counter Area: the Counter Completion Flags and the Counter Present
Values (PVs).
Up to 256 counters with counter numbers C0 to C255 can be used.
These words retain their content when the PLC is turned ON or the operating mode is switched
between PROGRAM mode and RUN or MONITOR mode.
Automatically retained in the built-in non-volatile RAM even if the power supply is interrupted.
• Counter Completion Flags
Each Counter Completion Flag is accessed as one bit using the counter number.
A Completion Flag is turned ON when the set value of the counter is reached.
• Counter PVs
Each counter PV is accessed as one word (16 bits) using the timer number.
The PVs count up or down as the counter operates.
Refer to 5-7 Counter Area (C)

z Index Registers (IR)


Index registers (IR0 to IR15) are used to store PLC memory addresses (i.e., absolute memory
addresses in RAM) to indirectly address words in I/O memory.
Refer to 5-8 Index Registers (IR)

z Data Registers (DR)


Data registers (DR0 to DR15) are used together with Index Registers. When a Data Register is input
just before an Index Register, the content of the Data Register is added to the PLC memory address
in the Index Register to offset that address.
Refer to 5-9 Data Registers (DR)

System Areas
System Areas contain bits and words with preassigned functions.

z Auxiliary Area (A)


The words and bits in this area have preassigned functions.
Refer to A-2 Auxiliary Area Allocations by Address

z Condition Flags
The Condition Flags include the flags that indicate the results of instruction execution, as well as the
Always ON and Always OFF Flags.
The Condition Flags are specified with global symbols rather than with addresses. For example: P_on

z Clock Pulses
The Clock Pulses are turned ON and OFF by the CPU Unit’s internal timer.
The Clock Pulses are specified with global symbols rather than with addresses. For example: P_0_02

5-4 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-1-2 I/O Memory Area Address Notation


An I/O memory can be addressed using word addresses or bit addresses. The word addresses and bit
addresses are given in decimal format.

z Word Addresses
Specifies a16-bit word.

W 1 0 0

5-1 Overview of I/O Memory Areas


I/O memory area The word number within
designator the area given in decimal
Examples: D, A, W

z Bit Addresses
A bit addresses specifies one of the 16 bits in a word.
The word number and bit number are separated with a period.

W 1 0 0 . 0 2 5
I/O memory Word number Period Bit number
area designator (00 to 15)

5-1-2 I/O Memory Area Address Notation


On the CX-Programmer, addresses in the CIO Area (including addresses for Serial PLC Links) are
given with no I/O memory area designator. “CIO” is used as the I/O memory area designator in this
manual for clarity.

0 . 0 3
IN C 1 3 5 7 9 11
CIO 0 0 2 4 6 8 10
Inputs begin from CIO 0 Period Bit number
Outputs begin from CIO 100 (00 to 15)

CP2E CPU Unit Software User’s Manual(W614) 5-5


5 I/O Memory

5-1-3 I/O Memory Areas


Name No. of bits Word addresses Remarks Reference
CIO Area Input Bits 1,600 bits CIO 0 to CIO 99 − Refer to 5-2 I/O Bits.
(100 words)
Output Bits 1,600 bits CIO 100 to CIO 199 −
(100 words)
Serial PLC 1,440 bits CIO 200 to CIO 289 − Refer to Section 14 Serial
Link Words (90 words) Communications.
Work Area (W) 2,048 bits W0 to W127 − Refer to 5-3 Work Area
(128 words) (W).
Holding Area (H) 2,048 bits H0 to H127 Automatically retained Refer to 5-4 Holding Area
(128 words) even if the power supply is (H).
interrupted.
Data Memory E……-type 64K bits D0 to D4095 Automatically retained Refer to 5-5 Data Memory
Area (D) CPU Unit (4K words) even if the power supply is Area (D).
interrupted.
Data in specified words of
the DM Area can be
retained in the built-in
Flash Memory by using a
bit in the Auxiliary Area.
Applicable words: D0 to
D1499
S……-type 128K bits D0 to D8191 Automatically retained
CPU Unit (8K words) even if the power supply is
interrupted.
Data in specified words of
the DM Area can be
retained in the built-in
Flash Memory by using a
bit in the Auxiliary Area.
Applicable words: D0 to
D6999
N……-type 256K bits D0 to D16383 Automatically retained
CPU Unit (16K words) even if the power supply is
interrupted.
Data in specified words of
the DM Area can be
retained in the built-in
Flash Memory by using a
bit in the Auxiliary Area.
Applicable words: D0 to
D14999
Timer Area (T) Present values 256 T0 to T255 − Refer to 5-6 Timer Area
Timer Comple- 256 (T).
tion Flags
Counter Area (C) Present values 256 C0 to C255 Automatically retained Refer to 5-7 Counter Area
Counter Com- 256 even if the power supply is (C).
pletion Flags interrupted.
Index Register Index registers 16 IR0 to IR15 − Refer to 5-8 Index Regis-
(IR) ter (IR)
Data Register (DR) Data registers 16 DR0 to DR15 − Refer to 5-9 Data Register
(DR)
Auxiliary Area Read only 7,168 bits A0 to A447 Specific addresses at star- Refer to A-2 Auxiliary Area
(A) (448 words) tup are automatically Allocations by Address.
Read-write 8,192 bits A448 to A959 retained even if the power
(512 words) supply is interrupted.

5-6 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-2 I/O Bits

Overview

These words are allocated to built-in I/O terminals of CP2E CPU Units, CP-series Expansion Units and
Expansion I/O Units.

Notation
0 . 02

Bit number: 02

Word number: 0

5-2 I/O Bits


I/O memory area designator:
None on CX-Programmer,
“CIO” in documentation

Range
Input bits: CIO 0.00 to CIO 99.15 (100 words) 5
Output bits: CIO 100.00 to CIO 199.15 (100 words)

Applications
Built-in inputs can be used as basic inputs, interrupt inputs, quick-response inputs or high-speed
counters.
Built-in outputs can only be used as basic outputs.
Refer to Section 8 Overview of Built-in Functions and Allocations for details.

Details
• Bits in the CIO Area can be force-set and force-reset.
• The contents of the CIO Area will be cleared in the following cases:
• When the operating mode is changed between PROGRAM or MONITOR mode and RUN mode
• When the PLC power is reset
• When the CIO Area is cleared from the CX-Programmer
• When PLC operation is stopped due to a fatal error other than an FALS error occurs. (The con-
tents of the CIO Area will be retained when FALS is executed.)

Additional Information

Words that are not allocated to the built-in I/O terminals of the CPU Units, the Expansion Units
and Expansion I/O Units can only be used in programming. It is the same as the Work Area.

CP2E CPU Unit Software User’s Manual(W614) 5-7


5 I/O Memory

5-3 Work Area (W)


Overview
The Work Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike the
input bits and output bits in the CIO Area, I/O to and from external devices is not refreshed for this area.

Notation
W 20 . 02

Bit number: 02

Word number: 20

I/O memory area designator: W

Range
The Work Area contains 128 words with addresses ranging from W0 to W127.

Applications
It is sometimes necessary to use the same set of input conditions many times in the same program. In
this case a work bit can be used to store the final condition to simplify programming work and program
design.

W10.0

W10.0
NO bit
W10.0
NC bit

Storing a Condition in a Work Bit

Details
• Bits in the Work Area can be force-set and force-reset.
• The contents of the Work Area will be cleared in the following cases:
• When the operating mode is changed between PROGRAM or MONITOR mode and RUN mode
• When the PLC power is reset
• When the Work Area is cleared from the CX-Programmer
• When PLC operation is stopped due to a fatal error other than an FALS error occurs. (The con-
tents of the Work Area will be retained when FALS is executed.)

5-8 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-4 Holding Area (H)


Overview
The Holding Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike the
input bits and output bits in the CIO Area, I/O to and from external devices is not refreshed for this area.
These words retain their content when the PLC is turned ON or the operating mode is switched
between PROGRAM mode and RUN or MONITOR mode.
The Holding Area is automatically retained in the built-in non-volatile RAM even if the power supply is
interrupted.

Notation

5-4 Holding Area (H)


H 20 . 02

Bit number: 02

Word number: 20

I/O memory area designator: H


5

Range
The Holding area contains 128 words with addresses ranging from H0 to H127.
The Holding Area words from H512 to H1535 can be set for use with function blocks. These words can-
not be specified as instruction operands in the user program.

Applications
The Holding Area is used when you want to resume operation after a power interruption using the same
status as before the power interruption.

CP2E CPU Unit Software User’s Manual(W614) 5-9


5 I/O Memory

Details
• Bits in the Holding Area can be force-set and force-reset.
• When a self-maintaining bit is programmed with a Holding Area bit, the self-maintaining bit will not be
cleared even when the power is reset.
• If a Holding Area bit is not used for the self-maintaining bit, the bit will be turned OFF and the self-
maintaining bit will be cleared when the power is reset.
H0.00

H0.00

• If a Holding Area bit is used but not programmed as a self-maintaining bit, the bit will be turned OFF
by execution condition A when the power is reset.
A H0.00

Precautions for Correct Use


• When a Holding Area bit is used in a KEEP instruction, never use a normally closed condition
for the reset input.
When the power supply goes OFF or is temporarily interrupted, the input will go OFF before
the PLCs internal power supply and the Holding Area bit will be reset.

A B
Set
KEEP
Input Unit

H1.00
Bad ~ A
Reset

A B
Set
KEEP
H1.00
Input Unit

OK ~ A
Reset

5-10 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-5 Data Memory Area (D)

Overview

The DM area is used for general data storage and manipulation and is accessible only by word (16
bits).
These words retain their contents when the PLC is turned ON or the operating mode is switched
between PROGRAM mode and RUN or MONITOR mode.
Some words in the DM Area can be saved to the built-in Flash Memory using Auxiliary Area bits. These
words are specifically referred to as the backed up words in the DM Area.

5-5 Data Memory Area (D)


The DM Area is automatically retained in the built-in non-volatile RAM even if the power supply is inter-
rupted.

Notation
D 200

Word number: 200

5
I/O memory area designator: D

Range
• E……-type CPU Units have DM Area addresses ranging from D0 to D4095.
Of these, D0 to D1499 can be backed up in backup memory (built-in Flash Memory).
• S……-type CPU Units have DM Area addresses ranging from D0 to D8191.
Of these, D0 to D6999 can be backed up in backup memory (built-in Flash Memory).
• N……-type CPU Units have DM Area addresses ranging from D0 to D16383.
Of these, D0 to D14999 can be backed up in backup memory (built-in Flash Memory).

……-type CPU Unit ]


[ E…… ……-type CPU Unit ]
[ S…… ……-type CPU Unit]
[N……
D0 D0 D0
to Words that can be backed to Words that can be backed
to Words that can be backed
up to backup memory up to backup memory
up to backup memory
D1199 D1199 D1199
D1200 DM Fixed Allocation Words D1200 DM Fixed Allocation Words D1200 DM Fixed Allocation Words
for the Modbus-RTU Easy for the Modbus-RTU Easy for the Modbus-RTU Easy
to to to
Master (for Built-in Master (for Built-in Master (for Serial Port 1)
D1299 RS-232C Port) D1299 RS-232C Port) D1299
D1300 D1300 DM Fixed Allocation Words D1300 DM Fixed Allocation Words
to to for the Modbus-RTU Easy to for the Modbus-RTU Easy
Master (for Built-in RS-485 Master (for Serial Port 2)
D1499 D1399 Port) D1399
D1500 D1400 D1400
DM Fixed Allocation Words
to to for the Modbus-RTU Easy
D4095 D6999 to
Master (for Serial Port
D7000 D1499 1(EX))
to D1500
D8191 to
D14999
D15000
to
D15999
D16000
DM Fixed Allocation Words
to
for Ethernet Socket Services
D16047
D16048
to
D16383

CP2E CPU Unit Software User’s Manual(W614) 5-11


5 I/O Memory

Applications
The DM Area is for storing numeric data. It can be used for data exchange with Programmable Termi-
nals, serial communications devices, such as Inverters, and Analog I/O Units or Temperature I/O Units.

Details
Bits in the DM Area cannot be addressed individually.
z Backing Up to the Built-in Flash Memory
• The number of words set in the PLC Setup can be saved to the built-in Flash Memory during oper-
ation by turning ON the DM Backup Start bit (A751.15).
• Specify in the PLC Setup whether to read the data in the DM Area words to the RAM as the initial
values when the power supply is turned ON.
Refer to 16-3 DM Backup Function for how to use DM Area words and bits.

z DM Fixed Allocation Words for the Modbus-RTU Easy Master


D1200 to D1499 are used as command and response storage areas with the Modbus-RTU Easy
Master function. These words are used for other applications if the Modbus-RTU Easy Master func-
tion is not served.
Refer to 14-4 Modbus-RTU Easy Master Function for how to use the DM Area words and bits.

z DM Fixed Allocation Words for Ethernet Socket Services


D16000 to D16047 are used as setting, status and parameter areas with the Socket Service func-
tion. These words are used for other applications if the Ethernet Socket Service function is not
served.
Refer to 15-6-6 Data Memory Area Allocations for how to use the DM Area words and bits.

z Indirect Addressing of the DM Area


Indirect addressing can be used in the DM Area.
There are two modes that can be used.

Binary-mode Addressing (@D)


If a “@” symbol is input before a DM Area address, the contents of that DM Area word is treated as
a hexadecimal (binary) address and the instruction will operate on the DM Area word at that
address.
The entire DM Area can be indirectly addressed with hexadecimal values 0000 to 3FFF.

Example: @D0 0100 D256


Address actually used.

BCD-mode Addressing (*D)


If a * symbol is input before a DM Area address, the content of that DM Area word is treated as a
BCD address and the instruction will operate on the DM Area word at that address.
Only part of the DM Area (D0 to D9999) can be indirectly addressed with BCD values 0 to 9999.

Example: *D0 0100 D100


Address actually used.

5-12 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-6 Timer Area (T)

Overview

The Timer Area contains Timer Completion Flags (1 bit each) and timer PVs (16 bits each). The Com-
pletion Flag is turned ON when a decrementing timer PV reaches 0 (counting out) or an increment-
ing/decrementing timer PV reaches the set value or 0.

Notation
T 002

5-6 Timer Area (T)


Time number: 002

I/O memory area designator: T

Range
Timer numbers range from T0 to T255.
5
Details

z Types of Timers
The following table shows which instructions are used to refresh timer PVs in BCD and binary mode.
Timer instruction BCD mode Binary mode
HUNDRED-MS TIMER TIM TIMX
TEN-MS TIMER TIMH TIMHX
ONE-MS TIMER TMHH TMHHX
ACCUMULATIVE TIMER TTIM TTIMX

Timer numbers 0 to 255 are used by all timers listed above.


Note Only timer numbers 0 to 15 can be used in 1ms TIMER (TMHH/TMHHX).

z Timer Example: Timer Number 0 and a Timer Set Value of 1 s


· BCD mode
Timer Completion Flag
TIM
T000
000

#10

· Binary mode

Timer Completion Flag


TIMX
T000
000

#A or &10

CP2E CPU Unit Software User’s Manual(W614) 5-13


5 I/O Memory

z Timer PV Refresh Method


Timer num-
Timer PV refresh method
bers
T0 to T255 The timer PV is refreshed when the instruction is executed. This can cause a delay depending
on the cycle time.
• When the cycle time is longer than 100 ms, delay is generated by the TIM/TIMX instruction.
• When the cycle time is longer than 10 ms, delay is generated by the TIMH/TIMHX instruction.
• When the cycle time is longer than 1 ms, delay is generated by the TMHH/TMHHX instruction.

Precautions for Correct Use


It is not recommended to use the same timers number in two timer instructions because the tim-
ers will not operate correctly if they are operating simultaneously.
Do not use the same timer number for more than one instruction.
If two or more timer instructions use the same timer number, an error will be generated during
the program check.

z Resetting or Maintaining Timers


• Timer Completion Flags can be force-set and force-reset.
• Timer PVs cannot be force-set or force-reset, although the PVs can be refreshed indirectly by
force-setting/resetting the Completion Flag.
• There are no restrictions in the order of using timer numbers or in the number of N.C. or N.O. con-
ditions that can be programmed.
• Timer PVs can be read as word data and used in programming.
• The following table shows when timers will be reset or maintained.
TMHH/ TTIM/
TIM/TIMX TIMH/TIMHX
TMHHX TTIMX
Instruction
HUNDRED-MS ACCUMULA
TEN-MS TIMER ONE-MS TIMER
TIMER TIVE TIMER
When the operating mode is PV=0
changed between PROGRAM or Flag=OFF
MONITOR mode and RUN mode*1
When the PLC power is reset PV=0
Flag=OFF
CNR/CNRX instructions PV= 9999/FFFF
(timer/counter reset)*2 Flag=OFF
Jumps (JMP-JME) Retained
Interlocks (IL-ILC) with OFF inter- Reset (PV = SV, Timer Completion Flag = OFF) Retained
lock conditions

*1 If the IOM Hold Bit (A500.12) is ON, the PV and Completion Flag will be retained when a fatal error occurs
(including execution of FALS instructions) or the operating mode is changed from PROGRAM mode to
RUN or MONITOR mode or vice-versa. (The PV and Completion Flag will be cleared when power is
cycled.)
*2 Since the TIML/TIMLX instructions do not use timer numbers, they are reset under different conditions.
The PV for a TIML/TIMLX instruction is reset to the SV.
Refer to the descriptions of these instructions for details.

5-14 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-7 Counter Area (C)

Overview

The Counter Area contains Completion Flags (1 bit each) and counter PVs (16 bits each). A Comple-
tion Flag is turned ON when the counter PV reaches the set value (counting out).
Completion Flags and counter PVs are automatically retained in the built-in non-volatile RAM even if
the power supply is interrupted.

Notation

5-7 Counter Area (C)


C 002

Counter number: 002

I/O memory area designator: C

Range
5
Counter numbers range from C0 to C255.
.

Details

z Types of Counters
The following table shows which instructions are used to refresh counter PVs in BCD and binary
mode.
Counter instruction BCD mode Binary mode
COUNTER CNT CNTX
REVERSIBLE COUNTER CNTR CNTRX

Counter numbers 0 to 255 are used by all counters given above.


Built-in high-speed counters 0 to 5 do not use counter numbers.

CP2E CPU Unit Software User’s Manual(W614) 5-15


5 I/O Memory

Precautions for Correct Use


It is not recommended to use the same counter number in two counter instructions because the
counters will not operate correctly if they are counting simultaneously.
If two or more counter instructions use the same counter number, an error will be generated dur-
ing the program check.

z Counter Example: Counter Number 0 with a Counter Set Value of 10


· BCD mode

Counter Completion Flag


CNT C000
000
#10

· Binary mode

Counter Completion Flag


CNTX
C000
000
&10 or #A

z Resetting or Maintaining Counter PVs


• Counter Completion Flags can be force-set and force-reset.
• Counter PVs cannot be force-set or force-reset, although the PVs can be refreshed indirectly by
force-setting/resetting the Counter Completion Flag.
• There are no restrictions in the order of using counter numbers or in the number of N.C. or N.O.
conditions that can be programmed.
• Counter PVs can be read as word data and used in programming.
• The following table shows when counters PVs are reset or maintained.
CNT/CNTX CNTR/CNTRX
Instruction
COUNTER REVERSIBLE COUNTER
PV and Counter Completion Flag when counter PV=0
is reset Counter Completion Flag = OFF
When the operating mode is changed between Retained
PROGRAM or MONITOR mode and RUN mode
When the PLC power is reset Retained
Reset Input Reset
CNR/CNRX instructions Reset
Interlocks (IL-ILC) with OFF interlock conditions Retained

5-16 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-8 Index Registers (IR)

Overview

The sixteen Index Registers (IR0 to IR15) are used for indirect addressing. Each Index Register can
hold a single PLC memory address, which is the absolute memory address of a word in I/O memory.
These are different from the I/O memory area addresses in the CIO Area, DM Area, etc. They are the
continuous RAM addresses.
The user cannot directly input PLC memory addresses in the Index Registers. Use MOVR to convert a
regular data area address to its equivalent PLC memory address and write that value to the specified
Index Register. (Use MOVRW to set the PLC memory address of a timer/counter PV in an Index Regis-

5-8 Index Registers (IR)


ter.)

Notation
IR 13

Index register number: 13

Index register designator: IR


5

Range
Index register numbers range from IR0 to IR15.

Details
z Indirect Addressing
When an Index Register is used as an operand with a “,” prefix, the instruction will operate on the
word indicated by the PLC memory address in the Index Register, not the Index Register itself. Basi-
cally, the Index Registers are I/O memory pointers.
• All addresses in I/O memory (except Index Registers, Data Registers, and Condition Flags) can
be specified seamlessly with PLC memory addresses. It isn’t necessary to specify the data area.
I/O memory addresses for IR, DR, and Condition Flags, however, cannot be held.
• In addition to basic indirect addressing, the PLC memory address in an Index Register can be off-
set with a constant or Data Register, auto-incremented, or auto-decremented. These functions
can be used in loops to read or write data while incrementing or decrementing the address by one
each time that the instruction is executed.
With the offset and increment/decrement variations, the Index Registers can be set to base values
with MOVR or MOVRW and then modified as pointers in each instruction.
For pointer operation, either special instructions that can directly specify Index Registers (MOVR,
MOVRW, increment instructions, decrement instructions, or math instructions) are used, or indirect
offsets, auto-incrementing, or auto-decremented is used.

CP2E CPU Unit Software User’s Manual(W614) 5-17


5 I/O Memory

I/O Memory

Set to a base value Pointer


with MOVR(560) or
MOVRW(561).

z Index Register Initialization


The Index Registers will be cleared in the following cases:
• The operating mode is changed from PROGRAM mode to RUN/MONITOR mode or vice-versa
and the IOM Hold Bit is OFF.
• The PLC’s power supply is cycled and the IOM Hold Bit is OFF or not set to be held in the PLC
Setup.
• A fatal error occurs (except for one created with FALS).
Note If the IOM Hold Bit (A500.12) is ON, the Index Registers will not be cleared when a FALS
error occurs or the operating mode is changed from PROGRAM mode to RUN/MONITOR
mode or vice-versa.

Precautions for Correct Use


Precaution for Indirect Register Addressing with Index Registers
Do not use indirect register addressing to access areas outside of the I/O memory or areas
reserved by the system.
An Illegal Access Error will occur if access is attempted. Refer to A-5 Memory Map for details on
the limits of PLC memory addresses.

z Indirect Addressing Variations


The following table shows the variations available when indirectly addressing I/O memory with Index
Registers. (IR@ represents an Index Register from IR0 to IR15.)
Variation Function Syntax Example
Indirect addressing The content of IR@ is treated as ,IR@ LD ,IR0 Loads the bit at the PLC
the PLC memory address of a bit memory address contained
or word. in IR0.
Indirect addressing The constant prefix is added to the Constant ,IR@ LD +5,IR0 Adds 5 to the contents of IR0
with constant offset content of IR@ and the result is (Include a + or – in and loads the bit at that PLC
treated as the PLC memory the constant.) memory address.
address of a bit or word.
The constant may be any integer
from –2,048 to 2,047.
Indirect addressing The content of the Data Register is DR@,IR@ LD Adds the contents of DR0 to
with DR offset added to the content of IR@ and DR0,IR0 the contents of IR0 and loads
the result is treated as the PLC the bit at that PLC memory
memory address of a bit or word. address.
Indirect addressing After referencing the content of Increment by 1: LD , IR0++ Loads the bit at the PLC
with auto-increment IR@ as the PLC memory address ,IR@+ memory address contained
of a bit or word, the content is Increment by 2: in IR0 and then increments
incremented by 1 or 2. ,IR@++ the content of IR0 by 2.
Indirect addressing The content of IR@ is decremented Decrement by 1: LD , – –IR0 Decrements the content of
with auto-decrement by 1 or 2 and the result is treated ,–IR@ IR0 by 2 and then loads the
as the PLC memory address of a Decrement by 2: bit at that PLC memory
bit or word. ,– –IR@ address.

5-18 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

Example
This example shows how to store the PLC memory address of a word (CIO 2) in an Index Register
(IR0), use the Index Register in an instruction, and use the auto-increment variation.
MOVR 2 IR0 Stores the PLC memory address of CIO 2 in IR0.
MOV #0001 ,IR0 Writes #0001 to the PLC memory address contained in IR0.
MOV #0020 +1,IR0 Reads the content of IR0, adds 1, and writes #0020 to that PLC
memory address.
MOV #0001 ,IR0
Regular PLC memory
data area address MOVE TO REGISTER
address I/O memory instruction MOVR(560) 0002 IR0
0000 01B80Hex
0001 01B81Hex Pointer IR0

5-8 Index Registers (IR)


0002 #0001 01B82Hex 01B82Hex
0003 #0020 01B83Hex

0289 01CA1Hex
H000 01CC0Hex

H127 01D3FHex

W000 W000
022C0Hex

W127 0233FHex
5

Note The PLC memory addresses are listed in the diagram above, but it isn’t necessary to know the
PLC memory addresses when using Index Registers.
Since some operands are treated as word data and others are treated as bit data, the meaning of the
data in an Index Register will differ depending on the operand in which it is used.
• Word Operand:
MOVR 0000 IR2
MOV D0 ,IR2
When the operand is treated as a word, the contents of the Index Register are used “as is” as the
PLC memory address of a word.
In this example MOVR sets the PLC memory address of CIO 2 in IR2 and the MOV instruction copies
the contents of D0 to CIO 2.
• Bit Operand:
MOVR 000013 ,IR2
SET +5 , IR2
When the operand is treated as a bit, the leftmost 7 digits of the Index Register specify the word
address and the rightmost digit specifies the bit number. In this example, MOVR sets the PLC mem-
ory address of CIO 13 (0C00D hex) in IR2. The SET instruction adds +5 from bit 13 (D hex) to this
PLC memory address, so it turns ON bit CIO 1.02.

Additional Information

When MOVR is used to set a word address in an index register, the address is stored as follows:
31 0
Index register PLC memory address
When MOVR is used to set a bit address in an index register, the address is stored as follows:
31 4 3 0
Index register PLC memory address Bit number

CP2E CPU Unit Software User’s Manual(W614) 5-19


5 I/O Memory

Precautions for Correct Use


• Always set the value of an index register (IR) before using the index register. Operation will not
be dependable if an index register is used without first setting its value.
• The value of an index register will not be dependable after an interrupt task is started. When
using an index register in an interrupt task, set the value using MOVR or MOVRW before using
the index register. (MOVRW is used for timer/counter PVs and MOVR is used for other values.)

Additional Information
• When an Index Register is used as an operand without a “,” prefix, the instruction will operate
on the contents of the Index Register itself (a two-word or “double” value). Index Registers can
be directly addressed only in the instructions shown in the following table. Use these instruc-
tions to operate on the Index Registers as pointers.
• The Index Registers cannot be directly addressed in any other instructions, although they can
usually be used for indirect addressing.

z Direct Addressing
Instruction group Instruction name Mnemonic
Data Movement MOVE TO REGISTER MOVR(560)
Instructions MOVE TIMER/COUNTER PV TO REGISTER MOVRW(561)
DOUBLE MOVE MOVL(498)
Increment/Decrement DOUBLE INCREMENT BINARY ++L(591)
Instructions DOUBLE DECREMENT BINARY – –L(593)
Comparison Instructions DOUBLE EQUAL =L(301)
DOUBLE NOT EQUAL < >L(306)
DOUBLE LESS THAN < L(311)
DOUBLE LESS THAN OR EQUAL < =L(316)
DOUBLE GREATER THAN > L(321)
DOUBLE GREATER THAN OR EQUAL > =L(326)
DOUBLE COMPARE CMPL(060)
Symbol Math Instructions DOUBLE SIGNED BINARY ADD WITHOUT CARRY +L(401)
DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY –L(411)

z Precautions
It is possible to read the Index Register for only the last task executed within the cycle from the CX-
Programmer. If using Index Registers with the same number to perform multiple tasks, it is only pos-
sible with the CX-Programmer to read the Index Register value for the last task performed within the
cycle from the multiple tasks. Nor is it possible to write the Index Register value from the CX-Pro-
grammer.

Additional Information

The contents of an index register used inside a function block may be corrupted when the func-
tion block is called. Always save the contents of the index register before calling the function
block and then restore the contents after leaving the function block. Set the required contents in
the index register inside the function block.
P_On Save
Instructions using the index [MOVL IR0 Temporary internal address]
register

Set the required contents in the


Function index register inside the function
block block definition.

P_On Restore
Instructions using the index [MOVL Temporary internal address IR0]
register

5-20 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-9 Data Registers (DR)

Overview

The sixteen Data Registers (DR0 to DR15) are used to offset the PLC memory addresses in Index Reg-
isters when addressing words indirectly. The Data Registers can be used to specify an offset to add to
an Index Register when addressing words indirectly.
The content of Data Registers cannot be accessed (read or written) from the CX-Programmer.

Notation

5-9 Data Registers (DR)


DR 13

Index register number: 13

Index register designator: DR

Range
5
Index register numbers range from DR0 to DR15.

Details

z Forcing Bit Status


The value in a Data Register can be added to the PLC memory address in an Index Register to
specify the absolute memory address of a bit or word in I/O memory. Data Registers contain signed
binary data, so the content of an Index Register can be offset to a lower or higher address.
Normal instructions can be use to store data in Data Registers.
Data Registers cannot be force-set or force-reset.
I/O Memory
Set to a base value
with MOVR(560) or
MOVRW(561). Pointer

Set with a regular


instruction.

Example
The following examples show how Data Registers are used to offset the PLC memory addresses in
Index Registers.
LD DR0 ,IR0 Adds the contents of DR0 to the contents of IR0 and
loads the bit at that PLC memory address.
MOV #0001 DR0 ,IR1 Adds the contents of DR0 to the contents of IR1 and
writes #0001 to that PLC memory address.

CP2E CPU Unit Software User’s Manual(W614) 5-21


5 I/O Memory

z Range of Values
The contents of Data Registers are treated as signed binary data and thus have a range of –32,768
to 32,767.
Hexadecimal content Decimal equivalent
8000 to FFFF –32,768 to –1
0000 to 7FFF 0 to 32,767

The content of Data Registers cannot be accessed (read or written) from the CX-Programmer.

z Data Register Initialization


The Data Registers will be cleared in the following cases:
• The operating mode is changed from PROGRAM mode to RUN/MONITOR mode or vice-versa
and the IOM Hold Bit is OFF.
• The PLC’s power supply is cycled and the IOM Hold Bit is OFF or not set to be held in the PLC
Setup.
• A fatal error occurs (except for one created with FALS).
Note If the IOM Hold Bit (A500.12) is ON, the Data Registers will not be cleared when a FALS error
occurs or the operating mode is changed from PROGRAM mode to RUN/MONITOR mode or
vice-versa.

Precautions for Correct Use


• Do not use Data Registers until a value has been set in the register. The register's operation
will be unreliable if they are used without setting their values.
• The values in Data Registers are unpredictable at the start of an interrupt task. When a Data
Register will be used in an interrupt task, always set a value in the Data Register before using
the register in that task.

5-22 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-10 Auxiliary Area (A)

Overview

The words and bits in this area have preassigned functions.


Specific addresses (error log, clock area) at startup are automatically retained in the built-in non-volatile
RAM even if the power supply is interrupted.
Refer to A-2 Auxiliary Area Allocations by Address for details.

Precautions for Correct Use

5-10 Auxiliary Area (A)


For an S/N……-type CPU Unit without a Battery, the clock may be stop when the power supply is
turned ON. When the clock stops, the data in the Auxiliary Area (A) related to clock will be reset
to 01-01-01 01:01:01 Sunday. For an E……-type CPU Unit, the data is always 01-01-01 01:01:01
Sunday.
Data retained when the clock of an
Word/Bit Name
S/N……-type stops or in an E……-type
A100~A199 CH Error Log Area
A351~A354 CH Calendar/Clock Area
A510~A511 CH Startup Time 5
A512~A513 CH Power Interruption Time 01-01-01 01:01:01 Sunday
A515~A517 CH Operation Start Time

5-1-3 I/O Memory Areas


A518~A520 CH Operation End Time
A720~A749 CH Power ON Clock Data 1 to 10

Notation
A 20. 02

Bit number: 02

Word number: 20

I/O memory area designator: A

Range
The Auxiliary Area contains 960 words with addresses ranging from A0 to A959.

CP2E CPU Unit Software User’s Manual(W614) 5-23


5 I/O Memory

Applications
Applications of the bits and words in the Auxiliary Area are predefined. Ladder programs can be simpli-
fied and controllability can be improved by effectively using the bits and words in this area.

Details
• Some words or bits are set automatically by the system and others are set and manipulated by the
user.
The Auxiliary Area includes error flags set by self-diagnosis, initial settings, control bits, and status
data.
• Words and bits in this area can be read and written from the program or the CX-Programmer.
• The Auxiliary Area contains words that are read-only (A0 to A447) and words that can be read and
written (A448 to A959).
• Even the read/write bits in the Auxiliary Area cannot be force-set and force-reset continuously.

z Auxiliary Area Words and Bits in the CX-Programmer’s System-defined


Symbols
The following table gives the Auxiliary Area bits and words pre-registered in the CX-Programmer’s
global symbol table as system-defined symbols.
Refer to A-2 Auxiliary Area Allocations by Address for details.
Word/Bit Name Name in CX-Programmer
A200.11 First Cycle Flag P_First_Cycle
A200.12 Step Flag P_Step
A200.15 First Cycle Task Flag P_First_Cycle_Task
A262 Maximum Cycle Time P_Max_Cycle_Time
A264 Present Cycle Time P_Cycle_Time_Value
A401.08 Cycle Time Too Long Flag P_Cycle_Time_Error
A402.04 Battery Error Flag P_Low_Battery
A500.15 Output OFF Bit P_Output_Off_Bit

5-24 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-11 Condition Flags

Overview

These flags include the flags that indicate the results of instruction execution, as well as the Always ON
and Always OFF Flags. These bits are specified with symbols rather than addresses.
The CX-Programmer treats condition flags as system-defined symbols (global symbols) beginning with P_.

Notation

5-11 Condition Flags


P_ ER

Condition flag name: ER

I/O memory area designator:


P_ (indicates a system symbol name)

Details
The Condition Flags are read-only; they cannot be written from instructions or from the CX-Program-
mer. 5
The Condition Flags cannot be force-set and force-reset.

5-1-3 I/O Memory Areas


z Types of Condition Flags
Refer to 4-6 Ladder Programming Precautions for details.
Name in CX-
Name Function
Programmer
Always ON Flag P_On Always ON.
Always OFF Flag P_Off Always OFF.
Error Flag P_ER Turned ON when the operand data in an instruction is incorrect (an
instruction processing error) to indicate that an instruction ended
because of an error.
When the PLC Setup is set to stop operation for an instruction error
(Instruction Error Operation), program execution will be stopped and
the Instruction Processing Error Flag (A295.08) will be turned ON
when the Error Flag is turned ON.
Access Error Flag P_AER Turned ON when an Illegal Access Error occurs. The Illegal Access
Error indicates that an instruction attempted to access an area of
memory that should not be accessed.
When the PLC Setup is set to stop operation for an instruction error
(Instruction Error Operation), program execution will be stopped and
the Instruction Processing Error Flag (A4295.10) will be turned ON
when the Access Error Flag is turned ON.
Carry Flag P_CY Turned ON when there is a carry in the result of an arithmetic opera-
tion or a 1 is shifted to the Carry Flag by a Data Shift instruction.
The Carry Flag is part of the result of some Data Shift and Symbol
Math instructions.
Greater Than Flag P_GT Turned ON when the first operand of a Comparison Instruction is
greater than the second or a value exceeds a specified range.
Equals Flag P_EQ Turned ON when the two operands of a Comparison Instruction are
equal or the result of a calculation is 0.

CP2E CPU Unit Software User’s Manual(W614) 5-25


5 I/O Memory

Name in CX-
Name Function
Programmer
Less Than Flag P_LT Turned ON when the first operand of a Comparison Instruction is less
than the second or a value is below a specified range.
Negative Flag P_N Turned ON when the most significant bit of a result is ON.
Overflow Flag P_OF Turned ON when the result of calculation overflows the capacity of the
result word(s).
Underflow Flag P_UF Turned ON when the result of calculation underflows the capacity of
the result word(s).
Greater Than or P_GE Turned ON when the first operand of a Comparison Instruction is
Equals Flag greater than or equal to the second.
Not Equal Flag P_NE Turned ON when the two operands of a Comparison Instruction are
not equal.
Less than or Equals P_LE Turned ON when the first operand of a Comparison Instruction is less
Flag than or equal to the second.

z Using the Condition Flags


The Condition Flags are shared by all of the instructions. Their status may change after each
instruction execution in a single cycle.
Therefore, be sure to use Condition Flags on a branched output with the same execution condition
immediately after an instruction to reflect the results of instruction execution.

Example: Using Instruction A Execution Results

Instruction A Instruction Operand


LD
Instruction A
The result from instruction A
is reflected in the Equals Flag AND =
Condition Flag
Example: = Instruction B

Instruction B

Precautions for Correct Use


The Condition Flags are shared by all of the instructions. This means that program operation can
be changed from its expected course by interruption of a single task. Be sure to consider the
effects of interrupts when writing ladder programs to prevent unexpected operation.

5-26 CP2E CPU Unit Software User’s Manual(W614)


5 I/O Memory

5-12 Clock Pulses

Overview

The Clock Pulses are turned ON and OFF by the CPU Unit’s internal timer. These bits are specified
with symbols rather than addresses.
The CX-Programmer treats condition flags as system-defined symbols (global symbols) beginning with P_.

Notation
P_ 0_02s

5-12 Clock Pulses


Clock pulse name: 0_02s

I/O memory area designator:


P_ (indicates a system symbol name)

Details
The Clock Pulses are read-only; they cannot be written from instructions or from the CX-Programmer. 5
z Clock Pulses

5-1-3 I/O Memory Areas


Name in CX-
Name Description
Programmer
0.02-s Clock Pulse P_0_02s 0.01s ON for 0.01 s
OFF for 0.01 s

0.01s

0.1-s clock pulse P_0_1s 0.05s ON for 0.05 s


OFF for 0.05 s

0.05s

0.2-s clock pulse P_0_2s 0.1s ON for 0.1 s


OFF for 0.1 s

0.1s

1-s clock pulse P_1s 0.5s


ON for 0.5 s
OFF for 0.5 s

0.5s

1-min clock pulse P_1min 30s ON for 30 s


OFF for 30 s

30s

CP2E CPU Unit Software User’s Manual(W614) 5-27


5 I/O Memory

z Using the Clock Pulses


The following example turns a bit ON and OFF at 0.5-s intervals.

P_1s 100.00 Instruction Operand


LD P_1s 100.00
OUT 100.00 0.5s 0.5s

5-28 CP2E CPU Unit Software User’s Manual(W614)


I/O Allocation
This section describes I/O allocation used to exchange data between the CP2E CPU
Unit and other units.
Be sure you understand the information in the section before attempting to write ladder
diagrams.

6-1 Allocation of Input Bits and Output Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2


6-1-1 I/O Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
6-1-2 I/O Allocation Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 6
6-1-3 Allocations on the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
6-1-4 Allocations to Expansion Units and Expansion I/O Units . . . . . . . . . . . . . . . . . 6-4

CP2E CPU Unit Software User’s Manual(W614) 6-1


6 I/O Allocation

6-1 Allocation of Input Bits and Output


Bits
This section describes the allocation of input bits and output bits.

6-1-1 I/O Allocation


OMRON calls allocating I/O bits in memory “I/O allocation.”
The I/O on Expansion I/O Units are allocated I/O bits in the words following the allocated words to the
built-in I/O on the CPU Units.

Allocated 12 bits
Allocated 12 bits in the next word
00 to 11 00 to 11

Inputs 0CH (CIO 0) 1CH (CIO 1)

CPU Unit Expansion I/O Unit

Outputs 100CH (CIO 100) 101CH (CIO 101)

00 to 07 00 to 07

Allocated 8 bits Allocated 8 bits in


the next word

Bit 03 in CIO 0 Bit 05 in CIO 1

0CH (CIO 0) 1CH (CIO 1)

C 1 3 5 7 9 11 C 1 3 5 7 9 11
Inputs
0 2 4 6 8 10 0 2 4 6 8 10

CPU Unit Expansion I/O Unit

0 1 2 4 5 7 0 1 2 4 5 7
Outputs
C C C 3 c 6 C C C 3 c 6
Bit 02 in CIO 101
100CH (CIO 100) Bit 03 in CIO 100 101CH
(CIO 101)

6-2 CP2E CPU Unit Software User’s Manual(W614)


6 I/O Allocation

6-1-2 I/O Allocation Concepts


The CPU Unit automatically allocates I/O bits to the Expansion I/O Units and Expansion Units, if con-
nected when the power supply is turned ON.
It is not necessary to specify I/O bits allocation.

6-1-3 Allocations on the CPU Unit


z Input bits are allocated from CIO 0 and output bits are allocated from CIO 100

6-1 Allocation of Input Bits and Output Bits


The first word from which input bits are allocated is CIO 0. The first word from which output bits are allo-
cated is CIO 100. These cannot be changed.
z Words Allocated by the System and the Number of Connected Units
The starting words for inputs and outputs are predetermined for a CP2E CPU Unit. Input bits in CIO 0,
or CIO 0 and CIO 1, and output bits in CIO 100, or CIO 100 and CIO 101, are automatically allocated to
the built-in I/O on the CPU Unit.
The words from which bits are allocated by the system and the number of Expansion I/O Units and
Expansion Units that can be connected are given in the following table.
Allocated words Number of Expansion
CPU Unit Units and Expansion I/O
Input Bits Output Bits Units connected
14 or 20 I/O Point CIO 0 CIO 100 0 Unit
CPU Unit
30 or 40 I/O Point CIO 0 and CIO 1 CIO 100 and CIO 101 3 Units 6
CPU Unit
60 I/O Point CPU CIO 0, CIO 1 and CIO 2 CIO 100, CIO 101 and CIO 102 3 Units

6-1-2 I/O Allocation Concepts


Unit

z Application Example: CPU Unit with 40 I/O Points


CPU Unit with 40 I/O Points
CIO 0 (CIO 0.00 to CIO 0.11)
Input Bits CIO 1 (CIO 1.00 to CIO 1.11)
24 inputs
16 outputs
Output Bits CIO 100 (CIO 100.00 to CIO 100.07)
CIO 101 (CIO 101.00 to CIO 101.07)

15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Input Bits CIO 0 Input bits: 24
Cannot be used
CIO 1

CIO 100
Output Bits Cannot be used Output bits: 16
CIO 101

For a CPU Unit with 40 I/O points, a total of 24 input bits are allocated to the input terminal block. The
bits that are allocated are input bits CIO 0.00 to CIO 0.11 (i.e., bits 00 to 11 in CIO 0) and input bits CIO
1.00 to CIO 1.11 (i.e., bits 00 to 11 in CIO 1).
In addition, a total of 16 output bits are allocated to the output terminal block. The bits that are allocated
are output bits CIO 100.00 to CIO 100.07 (i.e., bits 00 to 07 in CIO 0) and output bits CIO 101.00 to CIO
101.07 (i.e., bits 00 to 07 in CIO 1).

CP2E CPU Unit Software User’s Manual(W614) 6-3


6 I/O Allocation

6-1-4 Allocations to Expansion Units and Expansion I/O Units


Expansion Units and Expansion I/O Units connected to the CPU Unit are automatically allocated input
bits and output bits in words following those allocated to the CPU Unit.
For example, if a CPU Unit with 40 I/O points is used, CIO 0 and CIO 1 are allocated for inputs and CIO
100 and CIO 101 are allocated for outputs. Thus, words from CIO 2 onward for inputs and words from
CIO 102 onward for outputs are automatically allocated to the Expansion I/O Units and Expansion Units
in the order that the Units are connected.

Allocations to Expansion I/O Units


There are Expansion I/O Units for expanding inputs, for expanding outputs, and for expanding both
input and outputs.
I/O bits starting from bit 00 in the next word after the word allocated to the previous Expansion Unit,
Expansion I/O Unit, or CPU Unit are automatically allocated. This word is indicated as “CIO m” for input
words and as “CIO n” for output words.
Input bits Output bits
Model No. of No. of No. of No. of
Addresses Addresses
bits words bits words
8-point Input Unit CP1W-8ED 8 1 CIO m, bits 00 to 07 − None None
8-point Relay outputs CP1W-8ER − None None 8 1 CIO n, bits 00
Output Unit Sinking transistor CP1W-8ET to 07
outputs
Sourcing transis- CP1W-8ET1
tor outputs
16-point Relay outputs CP1W-16ER − None None 16 2 CIO n, bits 00
Output Unit Sinking transistor CP1W-16ET to 07
outputs CIO n+1, bits
00 to 07
Sourcing transis- CP1W-16ET1
tor outputs
20-point Relay outputs CP1W-20EDR1 12 1 CIO m, bits 00 to 11 8 1 CIO n, bits 00
I/O Units Sinking transistor CP1W-20EDT to 07
outputs
Sourcing transis- CP1W-20EDT1
tor outputs
32-point Relay outputs CP1W-32ER − None None 32 4 CIO n, bits 00
Output Unit Sinking transistor CP1W-32ET to 07
outputs CIO n+1, bits
00 to 07
CIO n+2, bits
Sourcing transis- CP1W-32ET1 00 to 07
tor outputs
CIO n+3, bits
00 to 07
40-point Relay outputs CP1W-40EDR 24 2 CIO m, bits 00 to 11 16 2 CIO n, bits 00
I/O Unit Sinking transistor CP1W-40EDT CIO m+1, bits 00 to to 07
outputs 11 CIO n+1, bits
00 to 07
Sourcing transis- CP1W-40EDT1
tor outputs

6-4 CP2E CPU Unit Software User’s Manual(W614)


6 I/O Allocation

z I/O Bits Allocation with Expansion I/O Units Connected

Allocation Example: Expansion I/O Unit with 40 I/O Points (CP1W-40ED…)


Twenty-four input bits in two words are allocated (bits 00 to 11 in CIO m and bits 00 to 11 CIO m+1).
Sixteen output bits in two words are allocated in two words (bits 00 to 07 in CIO n and bits 00 to 07
in CIO n+1).

bit 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Input bits CIO m
Cannot be used
CIO m+1

CIO n

6-1 Allocation of Input Bits and Output Bits


Output bits Cannot be used
CIO n+1

Two input words (24 bits) and two output words (16 bits) are allocated to a 40-point I/O Unit.

Allocation Example: Expansion Input Units and Expansion Output Units


If Expansion Input Units or Expansion Output Units are connected, the input or output word not used
by an Expansion I/O Unit is allocated to the next Unit that requires it.
1st Unit: 2nd Unit: 3rd Unit:
8-point Expansion 16-point Expansion 20-point Expansion
CPU Unit with 30 I/O Points Input Unit Output Unit I/O Unit
Input bits CIO 0.00 to CIO 0.11
CIO 2.00 to CIO 2.07 CIO 3.00 to CIO 3.11
CIO 1.00 to CIO 1.05
No inputs
18 inputs 12 inputs
8 inputs 16 outputs
12 outputs 8 outputs
No outputs
Output bits CIO 100.00 to CIO 100.07 CIO 102.00 to CIO 102.07
CIO 104.00 to CIO 104.07
CIO 101.00 to CIO 101.03 CIO 103.00 to CIO 103.07 6

6-1-4 Allocations to Expansion Units and Expansion I/O Units


bit 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
CIO 0
CPU Unit with 30 I/O Points
CIO 1
Input bits Cannot be used
CIO 2 8-point Expansion Input Unit
CIO 3 20-point Expansion I/O Unit

CIO 100 CPU Unit with


CIO 101 30 I/O Points
Output bits CIO 102 Cannot be used
16-point Expansion Output Unit
CIO 103
CIO 104 20-point Expansion I/O Unit

CP2E CPU Unit Software User’s Manual(W614) 6-5


6 I/O Allocation

Allocations for Expansion Units

z I/O Word Allocations to Expansion Units


m: Indicates the next input word after the input word allocated to the Expansion Unit, Expansion I/O
Unit, or CPU Unit connected to the left of the current Unit.
n: Indicates the next output word after the output word allocated to the Expansion Unit, Expansion
I/O Unit, or CPU Unit connected to the left of the current Unit.
Model Input words Output words
Name
number No. of words Addresses No. of words Addresses
Analog I/O Unit CP1W-MAD11 2 words CIO m to m+1 1 word CIO n
CP1W-MAD42 4 words CIO m to m+3 2 word CIO n to CIO n+1
CP1W-MAD44 4 words CIO m to m+3 4 word CIO n to CIO n+3
Analog Input Unit CP1W-AD041 4 words CIO m to m+3 2 words CIO n to CIO n+1
CP1W-AD042 4 words CIO m to m+3 2 words CIO n to CIO n+1
Analog Output Unit CP1W-DA021 None − 2 words CIO n to CIO n+1
CP1W-DA041 None − 4 words CIO n to CIO n+3
CP1W-DA042 None − 4 words CIO n to CIO n+3
Temperature Sensor Units CP1W-TS001 2 words CIO m to m+1 None −
CP1W-TS002 4 words CIO m to m+3 None −
CP1W-TS003 4 words CIO m to m+3 None −
CP1W-TS004 2 words CIO m to m+1 1 word CIO n
CP1W-TS101 2 words CIO m to m+1 None −
CP1W-TS102 4 words CIO m to m+3 None −

6-6 CP2E CPU Unit Software User’s Manual(W614)


6 I/O Allocation

z I/O Word Allocations to Expansion Units

Allocation Example: CPU Unit with 40 I/O Points + Temperature Senser Unit
(TS002) + Analog Output Unit (DA041) + Expansion I/O Unit with 40 I/O points
1st Unit: 2nd Unit: 3rd Unit:
CPU Unit with 40 I/O Points CP1W-TS002 CP1W-DA041 Expansion I/O Unit with 40
Temperature Sensor Unit Analog Output Unit I/O Points
Input bits CIO 0.00 to CIO 0.11 CIO 6.00 to CIO 6.11
CIO 2 to CIO 5 None
CIO 1.00 to CIO 1.11 CIO 7.00 to CIO 7.11
24 inputs 24 inputs
TS002 DA041
16 outputs 16 outputs
Output bits CIO 100.00 to CIO 100.07 CIO 106.00 to CIO 106.07
None CIO 102 to CIO 105
CIO 101.00 to CIO 101.07 CIO 107.00 to CIO 107.07

6-1 Allocation of Input Bits and Output Bits


bit 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
CIO 0
Cannot be used CPU Unit with 40 I/O Points
CIO 1
CIO 2
CIO 3 Temperature Sensor Unit
Input bits
CIO 4
CIO 5
CIO 6 Cannot be used Expansion I/O Unit with 40 I/O Points
CIO 7

CIO 100
Cannot be used CPU Unit with 40 I/O Points
CIO 101
CIO 102
Output bits CIO 103
Analog Output Unit
CIO 104
CIO 105 6
CIO 106
Cannot be used Expansion I/O Unit with 40 I/O Points
CIO 107

6-1-4 Allocations to Expansion Units and Expansion I/O Units

CP2E CPU Unit Software User’s Manual(W614) 6-7


6 I/O Allocation

6-8 CP2E CPU Unit Software User’s Manual(W614)


PLC Setup
This section describes the parameters in the PLC Setup, which are used to make basic
settings for the CP2E CPU Unit.

7-1 Overview of the PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2


7-2 PLC Setup Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
7-2-1 Startup and CPU Unit Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3
7-2-2 Timing and Interrupt Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
7-2-3 Input Constants Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
7-2-4 Serial Option Port 1/Built-in RS-232C Port . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
7-2-5 Serial Option Port 2/Built-in RS-485 Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9
7-2-6 Serial Option Port 1 (EX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 7
7-2-7 Built-in Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16
7-2-8 Pulse Output 0 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18
7-2-9 Pulse Output 1 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-19
7-2-10 Pulse Output 2 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21
7-2-11 Pulse Output 3 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22
7-2-12 Built-in Ethernet Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24

CP2E CPU Unit Software User’s Manual(W614) 7-1


7 PLC Setup

7-1 Overview of the PLC Setup


The PLC Setup contains basic CPU Unit software parameter settings that the user can change to cus-
tomize PLC operation.
These settings can be changed from a CX-Programmer. Change the PLC Setup in the following case.
There is no need to reset, if the default (initial) settings are correct.
The setting from the CX-Programmer are saved to the built-in Flash Memory.
Application Parameter
Reading the DM area words saved to the backup memory when Startup Data Read
power is turned ON.
Changing the Startup Mode to PROGRAM or MONITOR mode Startup Mode
when debugging.
Detection of low-battery errors is not required when using bat- Detect Low Battery
tery-free operation.
Finding instruction errors when debugging. Stop CPU on Instruction Error
A minimum cycle time setting to create a consistent I/O refresh Minimum Cycle Time
cycle.
Setting a watch cycle time. Watch Cycle Time
Recording user-defined errors for FAL in the error log is not FAL Error Log Registration
required.

z Related Auxiliary Area Flags


Name Word Description Read/write
PLC Setup Error A402.10 ON when there is a setting error in the PLC Setup. Read only
Flag (Non-fatal error)

z Setting Methods for the PLC Setup


Set using the CX-Programmer
CX-Programmer

CP2E CPU Unit

PLC Setup

7-2 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

7-2 PLC Setup Settings

7-2-1 Startup and CPU Unit Settings

Startup Data Read Setting


When setting is read by
Name Default Possible settings
CPU Unit
1 Clear retained memory area (HR/DM/CNT) Do not clear. Do not clear. When power is turned ON
Clear.
2 Read D0- from backup memory Do not read. Do not read. When power is turned ON
Read.
3 Number of CH of DM for backup 0 E……-type CPU Unit: 0 to 1,499 When power is turned ON
S……-type CPU Unit: 0 to 6,999
N……-type CPU Unit: 0 to 14,999

Startup Mode Setting

7-2 PLC Setup Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Startup Mode Setting Run: RUN mode Program: PROGRAM mode When power is turned ON
Monitor: MONITOR mode
Run: RUN mode

Execute Process Settings


When setting is read by
Name Default Possible settings
CPU Unit 7
1 Stop CPU on Instruction Error Do not stop. Do not stop. At start of operation
Stop.

7-2-1 Startup and CPU Unit Settings


2 Do not register FAL to error log Register. Register. When power is turned ON
Do not register.
3 Do not detect Low Battery Do not detect. Do not detect. Every cycle
(N/S……-type CPU Unit only) Detect.

Comms Instructions Settings in FB:


Settings for Communications Instructions in Function Blocks
When setting is read by
Name Default Possible settings
CPU Unit
1 Retry Counts 0 0 At start of operation
:
15
2 Response Timeout 2s 0: 2 s At start of operation
1: 1 × 0.1 s
:
65535: 65,535 × 0.1 s

CP2E CPU Unit Software User’s Manual(W614) 7-3


7 PLC Setup

7-2-2 Timing and Interrupt Settings

Timing and Interrupt Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Watch Cycle Time No setting (1s) Setting At start of operation
1: 1 × 10 ms
:
100: 100 × 10 ms
2 Constant Cycle Time No setting (variable) Setting At start of operation
1ms
:
1,000 ms

7-2-3 Input Constants Settings

Input Constants
When setting is read by
Name Default Possible settings
CPU Unit
1 0CH: CIO 0 8 ms No filter (0 ms) When power is turned ON
1 ms
2 ms
4 ms
8 ms
16 ms
32 ms
2 1CH: CIO 1 Same as above. Same as above. Same as above.
3 2CH: CIO 2
4 3CH: CIO 3
5 4CH: CIO 4
6 5CH: CIO 5
7 6CH: CIO 6
8 7CH: CIO 7
9 8CH: CIO 8
10 9CH: CIO 9
11 10CH: CIO 10
12 11CH: CIO 11
13 12CH: CIO 12
14 13CH: CIO 13
15 14CH: CIO 14
16 15CH: CIO 15
17 16CH: CIO 16
18 17CH: CIO 17

Note The input constants of CP1W-40EDR/EDT/EDT1 are always 16ms regardless of the settings.

7-4 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

7-2-4 Serial Option Port 1/Built-in RS-232C Port


The settings are applicable to the N……-type CPU Units with Serial Option port 1, and the E/S……-type
CPU units with built-in RS-232C port.
Since this setting is reflected by power OFF and ON, the PLC Setup and the actual operation settings
may be different. The actual operation settings can be confirmed in words A617.

Communications Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Communications Settings Standard (9,600; Standard When power is turned ON
1, 7, 2, E) Baud rate: 9,600 bps
(Default settings) Start bits: 1 bit
Data length: 7 bits
Parity: Even
Stop bits: 2 bits
Custom
2 Mode Host Link Host Link When power is turned ON
(When custom settings have been selected.)
NT Link (1:N)
RS-232C (No-protocol)
PC Link (Slave)

7-2 PLC Setup Settings


PC Link (Master)
Modbus-RTU Easy Master
Modbus-RTU Slave
2-1 Host Link Settings
2-1-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps 7
38,400 bps
57,600 bps

7-2-4 Serial Option Port 1/Built-in RS-232C


115,200 bps
2-1-2 Format (data length, stop 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON

Port
bits, parity)
7 bits, 2 bits, odd
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-1-3 Unit Number 0 0 When power is turned ON
:
31
2-2 NT Link (1:N) Settings
2-2-1 Baud 115,200 bps 38,400 bps (standard) When power is turned ON
115,200 bps (high speed)
2-2-2 No.NT/PC Link Max. 1 0 When power is turned ON
(Highest unit number of PT
:
that can be connected to
the PLC) 7

CP2E CPU Unit Software User’s Manual(W614) 7-5


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-3 RS-232C (No-protocol) Settings
2-3-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-3-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits, par-
7 bits, 2 bits, odd
ity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-3-3 Start Code Disable. Disable. When power is turned ON
Set.
2-3-4 Start Code (setting) 00 Hex 00 Hex When power is turned ON
:
FF hex
2-3-5 End Code None Received Bytes (no end code) When power is turned ON
(Received Bytes)
CR, LF
Set End Code
2-3-6 Received Bytes 256 bytes 256 bytes When power is turned ON
(setting)
1 byte
:
255 bytes
2-3-7 Set End Code 00 Hex 00 Hex When power is turned ON
(setting)
:
FF Hex
2-3-8 Delay 0 ms 0 (×10 ms) When power is turned ON
:
9999 (×10 ms)
2-5 Modbus-RTU Easy Master Settings
2-5-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps

7-6 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-5 2-5-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits, par-
7 bits, 2 bits, odd
ity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-5-3 Response Timeout 5s 0 (5 s) When power is turned ON
1 (×100 ms)
:
255 (×100 ms)
2-6 PC Link (Slave) Settings
2-6-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps

7-2 PLC Setup Settings


4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-6-2 PLC Link Unit No. 0 0 When power is turned ON
:
7 7
2-7 PC Link (Master) Settings
2-7-1 Baud 9,600 bps 1,200 bps When power is turned ON

7-2-4 Serial Option Port 1/Built-in RS-232C


2,400 bps
4,800 bps

Port
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-7-2 Link Words 10 Words 1 word When power is turned ON
:
10 words
2-7-3 PC Link Mode ALL ALL When power is turned ON
Masters
2-7-4 No.NT/PC Link Max. 0 0 When power is turned ON
(Highest unit number of PT
:
that can be connected to
the PLC) 7

CP2E CPU Unit Software User’s Manual(W614) 7-7


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit

2 2-8 Modbus RTU Slave Settings

2-8-1 Baud 9,600 bps 1,200 bps When power is turned ON


2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps

2-8-2 Format 8 bits, 1 bit, even 8 bits, 1 bit, even When power is turned ON
(data length, stop bits, 8 bits, 2 bits, no parity
parity) 8 bits, 1 bit, odd

2-8-3 Modbus Slave Address 1 0 (Slave Address 1) When power is turned ON


1
:
247

7-8 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

7-2-5 Serial Option Port 2/Built-in RS-485 Port


The settings are applicable to the N30/40/60 CPU Units with Serial Option port 2, and the S30/40/60
CPU units with built-in RS-485 port.
Since this setting is reflected by power OFF and ON, the PLC Setup and the actual operation settings
may be different. The actual operation settings can be confirmed in words A618.

Communications Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Communications Settings Standard (9600; Standard When power is turned ON
1, 7, 2, E) Baud rate: 9,600 bps
(Default settings) Start bits: 1 bit
Data length: 7 bits
Parity: Even
Stop bits: 2 bits
Custom
2 Mode Host Link Host Link When power is turned ON
NT Link (1:N)
RS-232C (No-protocol)
PC Link (Slave)

7-2 PLC Setup Settings


PC Link (Master)
Modbus-RTU Easy Master
Modbus-RTU Slave
2-1 Host Link Settings
2-1-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
7
38,400 bps
57,600 bps

7-2-5 Serial Option Port 2/Built-in RS-485 Port


115,200 bps
2-1-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits, par-
7 bits, 2 bits, odd
ity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-1-3 Unit Number 0 0 When power is turned ON
:
31
2-2 NT Link (1:N) Settings
2-2-1 Baud 115,200 bps 38,400 bps (standard) When power is turned ON
115,200 bps (high speed)
2-2-2 No. NT/PC Link Max. 1 0 When power is turned ON
(Highest unit number of PT
:
that can be connected to
the PLC) 7

CP2E CPU Unit Software User’s Manual(W614) 7-9


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-3 RS-232C (No-protocol) Settings
2-3-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-3-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits, par- 7 bits, 2 bits, odd
ity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-3-3 Start Code Disable. Disable. When power is turned ON
Set.
2-3-4 Start Code 00 hex 00 hex When power is turned ON
(setting) :
FF hex
2-3-5 End Code None Received Bytes (no end code) When power is turned ON
(Received Bytes) CR, LF
Set End Code
2-3-6 Received Bytes (setting) 256 bytes 256 bytes When power is turned ON
1 byte
:
255 bytes
2-3-7 Set End Code (setting) 00 hex 00 hex When power is turned ON
:
FF hex
2-3-8 Delay 0 ms 0 (×10 ms) When power is turned ON
:
9999 (×10 ms)

2-5 Modbus-RTU Easy Master Settings

2-5-1 Baud 9,600 bps 1,200 bps When power is turned ON


2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps

7-10 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-5 2-5-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits, par- 7 bits, 2 bits, odd
ity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-5-3 Response Timeout 5s 0 (5 s) When power is turned ON
1 (×100 ms)
:
255 (×100 ms)
2-6 PC Link (Slave) Settings
2-6-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps

7-2 PLC Setup Settings


9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-6-2 PLC Link Unit No. 0 0 When power is turned ON
:
7
2-7 PC Link (Master) Settings
2-7-1 Baud 9,600 bps 1,200 bps When power is turned ON 7
2,400 bps
4,800 bps

7-2-5 Serial Option Port 2/Built-in RS-485 Port


9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-7-2 Link Words 10 words 1 word When power is turned ON
:
10 words
2-7-3 PC Link Mode ALL ALL When power is turned ON
Masters
2-7-4 No. NT/PC Link Max. 0 0 When power is turned ON
(Highest unit number of PT :
that can be connected to
the PLC) 7

CP2E CPU Unit Software User’s Manual(W614) 7-11


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit

2 2-8 Modbus RTU Slave Settings


2-8-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps

2-8-2 Format 8 bits, 1 bit, even 8 bits, 1 bit, even When power is turned ON
(data length, stop bits, 8 bits, 2 bits, no parity
parity) 8 bits, 1 bit, odd

2-8-3 Modbus Slave Address 1 0 (Slave Address 1) When power is turned ON


1
:
247

7-12 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

7-2-6 Serial Option Port 1 (EX)


The settings are applicable to the N……-type CPU Units when Serial Option Board CP2W-CIFD… with
2 ports is mounted.
Since this setting is reflected by power OFF and ON, the PLC Setup and the actual operation settings-
may be different. The actual operation settings can be confirmed in words A616.

Communications Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Communications Settings Standard (9600; Standard When power is turned ON
1, 7, 2, E) Baud rate: 9,600 bps
(Default settings) Start bits: 1 bit
Data length: 7 bits
Parity: Even
Stop bits: 2 bits
Custom
2 Mode RS-232C (No-protocol) RS-232C (No-protocol) When power is turned ON
(When custom settings have been
PC Link (Slave)
selected.)
PC Link (Master)

7-2 PLC Setup Settings


Modbus-RTU Easy Master
Modbus RTU Slave
2-1 RS-232C (No-protocol) Settings
2-1-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
7
115,200 bps

7-2-6 Serial Option Port 1 (EX)


2-1-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits,
7 bits, 2 bits, odd
parity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-1-3 Start Code Disable. Disable. When power is turned ON
Set.
2-1-4 Start Code (setting) 00 Hex 00 Hex When power is turned ON
:
FF hex
2-1-5 End Code None Received Bytes (no end code) When power is turned ON
(Received Bytes)
CR, LF
Set End Code

CP2E CPU Unit Software User’s Manual(W614) 7-13


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-1 2-1-6 Received Bytes (set- 256 bytes 256 bytes When power is turned ON
ting)
1 byte
:
255 bytes
2-1-7 Set End Code (setting) 00 Hex 00 Hex When power is turned ON
:
FF Hex
2-1-8 Delay 0 ms 0 (×10 ms) When power is turned ON
:
9999 (×10 ms)
2 2-3 Modbus-RTU Easy Master Settings
2-3-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-3-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits,
7 bits, 2 bits, odd
parity)
7 bits, 2 bits, no parity
7 bits, 1 bit, even
7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-3-3 Response Timeout 5s 0 (5 s) When power is turned ON
1 (×100 ms)
:
255 (×100 ms)
2-4 PC Link (Slave) Settings
2-4-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-4-2 PLC Link Unit No. 0 0 When power is turned ON
:
7

7-14 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
2 2-5 PC Link (Master) Settings
2-5-1 Baud 9,600 bps 1,200 bps When power is turned ON
2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-5-2 Link Words 10 Words 1 word When power is turned ON
:
10 words
2-5-3 PC Link Mode ALL ALL When power is turned ON
Masters
2-5 2-5-4 No.NT/PC Link Max. 0 0 When power is turned ON
(Highest unit number of
:
PT that can be con-
nected to the PLC) 7

2-6 Modbus RTU Slave Settings


2-6-1 Baud 9,600 bps 1,200 bps When power is turned ON

7-2 PLC Setup Settings


2,400 bps
4,800 bps
9,600 bps
19,200 bps
38,400 bps
57,600 bps
115,200 bps
2-6-2 Format 7 bits, 2 bits, even 7 bits, 2 bits, even When power is turned ON
(data length, stop bits,
par-ity)
7 bits, 2 bits, odd 7
7 bits, 2 bits, no parity
7 bits, 1 bit, even

7-2-6 Serial Option Port 1 (EX)


7 bits, 1 bit, odd
7 bits, 1 bit, no parity
8 bits, 2 bits, even
8 bits, 2 bits, odd
8 bits, 2 bits, no parity
8 bits, 1 bit, even
8 bits, 1 bit, odd
8 bits, 1 bit, no parity
2-6-3 Modbus Slave Address 1 0 (Slave Address 1) When power is turned ON
1
:
247

CP2E CPU Unit Software User’s Manual(W614) 7-15


7 PLC Setup

7-2-7 Built-in Inputs

High-speed Counter Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Use high-speed counter 0 Do not use. Do not use. When power is turned ON
Use.
1-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
1-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
1-2 Reset Z phase, software reset Z phase, software reset (stop When power is turned ON
(stop comparing) comparing)
Note Only a software reset can be
set if an increment pulse Software reset (stop comparing)
input is set for the input set-
ting. Phase Z, software reset (compar-
ing)
Software reset (comparing)
1-3 Input Setting Differential phase input Differential phase input (×4) When power is turned ON
(×4)
Note Make the same input setting Pulse + direction input
for high-speed counters 0, 1,
Up/Down pulse input
and 2.
Increment pulse input
2 Use high-speed counter 1 Do not use. Do not use. When power is turned ON
Use.
2-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
2-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
2-2 Reset Z phase, software reset Z phase, software reset (stop When power is turned ON
(stop comparing) comparing)
Note Only a software reset can be
set if an increment pulse Software reset (stop comparing)
input is set for the input set-
ting. Phase Z, software reset (compar-
ing)
Software reset (comparing)
2-3 Input Setting Differential phase input Differential phase input (×4) When power is turned ON
(×4)
Note Make the same input setting Pulse + direction input
for high-speed counters 0, 1,
Up/Down pulse input
and 2.
Increment Pulse input
3 Use high-speed counter 2 Do not use. Do not use. When power is turned ON
Use.
3-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
3-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
3-2 Reset Software reset Software reset When power is turned ON
Software reset (comparing)
3-3 Input Increment pulse input Increment pulse input When power is turned ON
Setting

7-16 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
4 Use high-speed counter 3 Do not use. Do not use. When power is turned ON
Use.
4-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
4-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
4-2 Reset Software reset Software reset When power is turned ON
Software reset (comparing)
4-3 Input Setting Increment pulse input Increment pulse input When power is turned ON
5 Use high-speed counter 4 Do not use. Do not use. When power is turned ON
Use.
5-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
5-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
5-2 Reset Software reset Software reset When power is turned ON
Software reset (comparing)

7-2 PLC Setup Settings


5-3 Input Setting Increment pulse input Increment pulse input When power is turned ON
6 Use high-speed counter 5 Do not use. Do not use. When power is turned ON
Use.
6-1 Counting mode Linear mode Linear mode At start of operation
Circular mode
6-1-1 Circular Max. Count 0 0 At start of operation
:
4,294,967,295
6-2 Reset Software reset Software reset When power is turned ON 7
Software reset (comparing)
6-3 Input Setting Increment pulse input Increment pulse input When power is turned ON

7-2-7 Built-in Inputs


Interrupt Input Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 IN2: CIO 0.02 Normal Normal When power is turned ON
Interrupt
Quick
2 IN3: CIO 0.03 Normal Normal When power is turned ON
Interrupt
Quick
3 IN4: CIO 0.04 Normal Normal When power is turned ON
Interrupt
Quick
4 IN5: CIO 0.05 Normal Normal When power is turned ON
Interrupt
Quick
5 IN6: CIO 0.06 Normal Normal When power is turned ON
Interrupt
Quick
6 IN7: CIO 0.07 Normal Normal When power is turned ON
Interrupt
Quick

CP2E CPU Unit Software User’s Manual(W614) 7-17


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit
7 IN8: CIO 0.08 Normal Normal When power is turned ON
(N20/30/40/60 CPU Unit only) Interrupt
Quick
8 IN9: CIO 0.09 Normal Normal When power is turned ON
(N20/30/40/60 CPU Unit only) Interrupt
Quick

7-2-8 Pulse Output 0 Settings


The settings are applicable to the N/S……-type CPU Units with transistor outputs.

Base Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Undefined Origin (operation for limit signal Hold Hold At start of operation
turning ON)
Undefined
2 Limit Input Signal Operation Search Only Search Only When power is turned ON
Always
3 Limit Input Signal NC NC At start of operation
NO
4 Search/Return Initial Speed 0 pps 0 pps At start of operation
:
100,000 pps

Origin Search Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Use define origin operation Do not use. Do not use. When power is turned ON
Use.
1-1 Search Direction CW CW At start of operation
CCW
1-2 Detection Method Method 0 Method 0 At start of operation
Method 1
Method 2
1-3 Search Operation Inverse 1 Inverse 1 At start of operation
Inverse 2
1-4 Operation Mode Mode 0 Mode 0 At start of operation
Mode 1
Mode 2
1-5 Origin Input Signal NC NC At start of operation
NO
1-6 Proximity Input Signal NC NC At start of operation
NO
1-7 Search High Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps

7-18 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit

1 1-9 Origin Compensation Value 0 pps -2,147,483,648 At start of operation


:
0
:
+2,147,483,647
1-10 Origin Search Acceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-11 Origin Search Deceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation
:
9,999 (ms)

Origin Return Settings


When setting is read by
Name Default Possible settings

7-2 PLC Setup Settings


CPU Unit
1 Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
2 Acceleration Ratio (rate) 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)
3 Deceleration rate 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)
7

7-2-9 Pulse Output 1 Settings


7-2-9 Pulse Output 1 Settings
The settings are applicable to the N/S……-type CPU Units with transistor outputs.

Base Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Undefined Origin Hold Hold At start of operation
(operation for limit signal turning ON) Undefined
2 Limit Input Signal Operation Search Only Search Only When power is turned ON
Always
3 Limit Input Signal NC NC At start of operation
NO
4 Search/Return Initial Speed 0 pps 0 pps At start of operation
:
100,000 pps

CP2E CPU Unit Software User’s Manual(W614) 7-19


7 PLC Setup

Origin Search Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Use define origin operation Do not use. Do not use. When power is turned ON
Use.
1-1 Search Direction CW CW At start of operation
CCW
1-2 Detection Method Method 0 Method 0 At start of operation
Method 1
Method 2
1-3 Search Operation Inverse 1 Inverse 1 At start of operation
Inverse 2
1-4 Operation Mode Mode 0 Mode 0 At start of operation
Mode 1
Mode 2
1-5 Origin Input Signal NC NC When power is turned ON
NO
1-6 Proximity Input Signal NC NC At start of operation
NO
1-7 Search High Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-9 Origin Compensation Value 0 pps -2,147,483,648 At start of operation
:
0
:
+2,147,483,647
1-10 Origin Search Acceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-11 Origin Search Deceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation
:
9,999 (ms)

7-20 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

Origin Return Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps

2 Acceleration Ratio (rate) 0 (disabled) 1 (pulse/4 ms) At start of operation


:
65,535 (pulse/4 ms)
3 Deceleration rate 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)

7-2-10 Pulse Output 2 Settings


The settings are applicable to the N30/40/60 CPU Units with transistor outputs.

Base Settings

7-2 PLC Setup Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Undefined Origin (operation for limit signal Hold Hold At start of operation
turning ON)
Undefined
2 Limit Input Signal Operation Search Only Search Only When power is turned ON
Always
3 Limit Input Signal NC NC At start of operation
NO
4 Search/Return Initial Speed 0 pps 0 pps At start of operation
7
:
100,000 pps

7-2-10 Pulse Output 2 Settings


Origin Search Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Use define origin operation Do not use. Do not use. When power is turned ON
Use.
1-1 Search Direction CW CW At start of operation
CCW
1-2 Detection Method Method 0 Method 0 At start of operation
Method 1
Method 2
1-3 Search Operation Inverse 1 Inverse 1 At start of operation
Inverse 2
1-4 Operation Mode Mode 0 Mode 0 At start of operation
Mode 1
Mode 2
1-5 Origin Input Signal NC NC At start of operation
NO
1-6 Proximity Input Signal NC NC At start of operation
NO

CP2E CPU Unit Software User’s Manual(W614) 7-21


7 PLC Setup

When setting is read by


Name Default Possible settings
CPU Unit

1 1-7 Search High Speed 0 pps (disabled) 1 pps At start of operation


:
100,000 pps
1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-9 Origin Compensation Value 0 pps -2,147,483,648 At start of operation
:
0
:
+2,147,483,647
1-10 Origin Search Acceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-11 Origin Search Deceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation
:
9,999 (ms)

Origin Return Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
2 Acceleration Ratio (rate) 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)
3 Deceleration rate 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)

7-2-11 Pulse Output 3 Settings


The settings are applicable to the N30/40/60 CPU Units with transistor outputs.

Base Settings
When setting is read by
Name Default Possible settings
CPU Unit
1 Undefined Origin Hold Hold At start of operation
(operation for limit signal turning ON) Undefined
2 Limit Input Signal Operation Search Only Search Only When power is turned ON
Always
3 Limit Input Signal NC NC At start of operation
NO
4 Search/Return Initial Speed 0 pps 0 pps At start of operation
:
100,000 pps

7-22 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

Origin Search Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Use define origin operation Do not use. Do not use. When power is turned ON
Use.
1-1 Search Direction CW CW At start of operation
CCW
1-2 Detection Method Method 0 Method 0 At start of operation
Method 1
Method 2
1-3 Search Operation Inverse 1 Inverse 1 At start of operation
Inverse 2
1-4 Operation Mode Mode 0 Mode 0 At start of operation
Mode 1
Mode 2
1-5 Origin Input Signal NC NC When power is turned ON
NO
1-6 Proximity Input Signal NC NC At start of operation
NO

7-2 PLC Setup Settings


1-7 Search High Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps
1-9 Origin Compensation Value 0 pps -2,147,483,648 At start of operation
:
0 7
:
+2,147,483,647

7-2-11 Pulse Output 3 Settings


1-10 Origin Search Acceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-11 Origin Search Deceleration Ratio 0 (disabled) 1 (pulse/4 ms) At start of operation
(Rate)
:
65,535 (pulse/4 ms)
1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation
:
9,999 (ms)

CP2E CPU Unit Software User’s Manual(W614) 7-23


7 PLC Setup

Origin Return Settings


When setting is read by
Name Default Possible settings
CPU Unit
1 Speed 0 pps (disabled) 1 pps At start of operation
:
100,000 pps

2 Acceleration Ratio (rate) 0 (disabled) 1 (pulse/4 ms) At start of operation


:
65,535 (pulse/4 ms)
3 Deceleration rate 0 (disabled) 1 (pulse/4 ms) At start of operation
:
65,535 (pulse/4 ms)

7-2-12 Built-in Ethernet Settings


The settings are applicable to the N……-type CPU Units.

Ethernet Port Settings


When Setting is read by
Name Default Possible Settings
CPU Unit
1 Broadcast Address 4.3BSD 4.3BSD When power is turned ON or
when Ethernet is reset
4.2BSD

2 IP Address 0.0.0.0 0.0.0.0 When power is turned ON or


when Ethernet is reset
:
255.255.255.255
3 Subnet Mask 0.0.0.0 0.0.0.0 When power is turned ON or
when Ethernet is reset
:
255.255.255.255
4 TCP Keep-alive Time 120 min 0 (120 min) When power is turned ON or
(Default value: 0) when Ethernet is reset
1 min
:
65,535 min
5 FINS Node Address Node address 1 0 (1) When power is turned ON or
(Default value: 0) when Ethernet is reset
:
254

FINS/TCP Settings
When Setting is read by
Name Default Possible Settings
CPU Unit

6 FINS/TCP Port Number Mode 9600 Default (9600) When power is turned ON or
when Ethernet is reset
User

FINS/TCP Port Number (User) 9600 0 (9600) When power is turned ON or


(Default value: 0) when Ethernet is reset
1

65,535

7 IP Address Protect Not Protect Not Protect When power is turned ON or


(Only for FINS/TCP Server) when Ethernet is reset
Protect

7-24 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When Setting is read by


Name Default Possible Settings
CPU Unit

8 FINS/TCP Connection Setting

FINS/TCP Connection No.1

8-1 FINS/TCP Server/Client Mode Server Server When power is turned ON or


when Ethernet is reset
Client

8-2 Connection IP Address 0.0.0.0 0.0.0.0 When power is turned ON or


when Ethernet is reset
:

255.255.255.255

8-3 Auto FINS Node Allocation Address 251 0 (251) When power is turned ON or
(Only valid for FINS/TCP Server (Default value: 0) when Ethernet is reset
:
mode)
253

8-4 Keep-alive Disable Disable When power is turned ON or


when Ethernet is reset
Enable

FINS/TCP Connection No.2

8-5 FINS/TCP Server/Client Mode Server Server When power is turned ON or


when Ethernet is reset
Client

8-6 Connection IP Address 0.0.0.0 0.0.0.0 When power is turned ON or


when Ethernet is reset
:

7-2 PLC Setup Settings


255.255.255.255

8-7 Auto FINS Node Allocation Address 252 0 (252) When power is turned ON or
(Only valid for FINS/TCP Server (Default value: 0) when Ethernet is reset
:
mode)
253

8-8 Keep-alive Disable Disable When power is turned ON or


when Ethernet is reset
Enable

FINS/TCP Connection No.3

8-9 FINS/TCP Server/Client Mode Server Server When power is turned ON or


when Ethernet is reset
Client 7
8-10 Connection IP Address 0.0.0.0 0.0.0.0 When power is turned ON or
when Ethernet is reset
:

7-2-12 Built-in Ethernet Settings


255.255.255.255

8-11 Auto FINS Node Allocation Address 253 0 (253) When power is turned ON or
(Only valid for FINS/TCP Server (Default value: 0) when Ethernet is reset
:
mode)
253

8-12 Keep-alive Disable Disable When power is turned ON or


when Ethernet is reset
Enable

CP2E CPU Unit Software User’s Manual(W614) 7-25


7 PLC Setup

FINS/UDP Settings
When Setting is read by
Name Default Possible Settings
CPU Unit
9 FINS/UDP Port Number Mode 9600 Default (9600) When power is turned ON or
when Ethernet is reset
User

FINS/UDP Port Number (User) 9600 0 (9600) When power is turned ON or


(Default value: 0) when Ethernet is reset
1
:
65,535
10 IP Address Conversion Method Auto Method Auto Method When power is turned ON or
when Ethernet is reset
Auto Method (Static)
Combined Method
IP Address Table Reference
Method
11 FINS/UDP Destination IP Mode Dynamically Dynamically When power is turned ON or
when Ethernet is reset
Static

DNS Server Settings


When Setting is read by
Name Default Possible Settings
CPU Unit
12 DNS Server IP Address 0.0.0.0 0.0.0.0 When power is turned ON or
when Ethernet is reset
:

255.255.255.255

13 DNS Port Number 53 0 (53) When power is turned ON or


(Default value: 0) when Ethernet is reset
1
:
65,535
14 Retry Time 10s 0 (10s) When power is turned ON or
(Default value: 0) when Ethernet is reset
1s
:
65,535s

SNTP Server
When setting is read by
Name Default Possible Settings
CPU Unit
15 Auto Adjust Time Mode Disable Disable When power is turned ON or
when Ethernet is reset
Enable
15-1 Auto Adjust Time 0h0m0s 0h0m0s When power is turned ON or
when Ethernet is reset
:
23h59m59s
15-2 SNTP Server Specify Method IP Address IP Address When power is turned ON or
when Ethernet is reset
Host Name
SNTP Server IP Address 0.0.0.0 0.0.0.0 When power is turned ON or
when Ethernet is reset
:
255.255.255.255
SNTP Server Host Name (46 ASCII) Blank Any String When power is turned ON or
when Ethernet is reset

7-26 CP2E CPU Unit Software User’s Manual(W614)


7 PLC Setup

When setting is read by


Name Default Possible Settings
CPU Unit
15 15-3 SNTP Port Number 123 0 (123) When power is turned ON or
(Default value: 0) when Ethernet is reset
1
:
65,535
15-4 Retry Time 10s 0 (10s) When power is turned ON or
(Default value: 0) when Ethernet is reset
1s
:
255s
15-5 Difference Time +0h0m -12h00m When power is turned ON or
when Ethernet is reset
:
+13h00m

7-2 PLC Setup Settings


7

7-2-12 Built-in Ethernet Settings

CP2E CPU Unit Software User’s Manual(W614) 7-27


7 PLC Setup

7-28 CP2E CPU Unit Software User’s Manual(W614)


Overview of Built-in Functions
and Allocations
This section describes the built-in functions, overall procedure, and allocations for func-
tions of the CP2E.

8-1 Built-in Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2


8-2 Overall Procedure for Using CP2E Built-in Functions. . . . . . . . . . . . . . . . . 8-3
8-3 Terminal Allocations for Built-in Functions . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
8-3-1 Specifying the Functions to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
8-3-2 Selecting Functions in the PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
8-3-3 Allocating Built-in Input Terminals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-6
8-3-4 Allocating Built-in Output Temrinals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8

CP2E CPU Unit Software User’s Manual(W614) 8-1


8 Overview of Built-in Functions and Allocations

8-1 Built-in Functions


The following built-in functions are provided by the CP2E CPU Units.
Type
CP2E E……-type CPU Units CP2E S……-type CPU Units CP2E N……-type CPU Units Reference
Function
Appearance

Quick-response inputs 6 inputs 6 inputs N14 CPU Units: 6 inputs Section 9


N20/30/40/60 CPU Units: 8
inputs
Input interrupts 6 inputs 6 inputs N14 CPU Units: 6 inputs Section 10
N20/30/40/60 CPU Units: 8
inputs
Scheduled interrupts 1 interrupt 1 interrupt 1 interrupt
High-speed counter • Incremental: 100 kHz×2 • Incremental: 100 kHz×2 N14/20 CPU Units: Section 11
counters, 10 kHz×4 counters counters, 10 kHz×4 counters • Incremental: 100 kHz×2
• Up/down: 100 kHz×1 • Up/down: 100 kHz×1 counters, 10 kHz×4 counters
counter, 10 kHz×1 counter counter, 10 kHz×1 counter • Up/down: 100 kHz×1 counter,
• Pulse plus direction: 100 • Pulse plus direction: 100 10 kHz×1 counter
kHz×2 counters kHz×2 counters • Pulse plus direction:
• Differential phases (4×): 50 • Differential phases (4×): 50 100 kHz×2 counters
kHz×1 counter, 5 kHz×1 kHz×1 counter, 5 kHz×1 • Differential phases (4×):
counter counter 50 kHz×1 counter, 5 kHz×1
counter
N30/40/60 CPU Units:
• Incremental: 100 kHz×3
counters, 10 kHz×3 counters
• Up/down: 100 kHz×2 counters
• Pulse plus direction:
100 kHz×2 counters
• Differential phases (4×):
50 kHz×2 counters
Pulse outputs Not supported 2 outputs (pulse plus direction N14/20 CPU Units: 2 outputs Section 12
only) (pulse plus direction only)
An external power supply is N30/40/60 CPU Units: 4 outputs
required for pulse outputs. (pulse plus direction only)
An external power supply is
required for pulse outputs for
N30/40/60 CPU Units.
PWM outputs Not supported 1 output 1 output Section 13
An external power supply is An external power supply is
required for PWM outputs. required for PWM outputs for
N30/40/60 CPU Units.
Built-in serial communi- 1 port (RS-232C) 2 ports (RS-232C+RS-485) Not supported Section 14
cations
Optional serial communi- Not supported Not supported N14/20 CPU Units: 2 ports max. Section 14
cations N30/40/60 CPU Units: 3 ports Section 17
max.
(Using Serial Option Board with
2 ports)
Built-in Ethernet Not supported Not supported N14/20 CPU Unit: 1 port Section 15
N30/40/60 CPU Units: 2 ports
(Switch function)
PID temperature control Supported Supported Supported Section 16-1
Clock functions Not supported Supported Supported Section 16-2
(While power is supplied) (While power is supplied)
DM backup Supported Supported Supported Section 16-3
Security function Supported Supported Supported Section 16-4

8-2 CP2E CPU Unit Software User’s Manual(W614)


8 Overview of Built-in Functions and Allocations

8-2 Overall Procedure for Using CP2E


Built-in Functions
The overall procedure for using built-in CP2E functions is described in this section.

1 Select the functions to use.


Select Functions Example: Interrupts, high-speed counter
inputs, and pulse outputs.

2 Set the functions with the applicable numbers Refer to Section 7

8-2 Overall Procedure for Using CP2E Built-in Functions


Make the Settings in using the CX-Programmer. PLC Setup and 8-3
Example: Using input interrupt IN3 and high- Terminal Alloca-
the PLC Setup
speed counter 0, parameters in the tions for Built-in
PLC Setup must be set for the fol- Functions.
lowing functions.

• Input interrupts • Minimum cycle time


• Quick-response inputs • Serial communications
• High-speed counters • Ethernet
• Origin searches • Analog Option Board

3 Create Ladder Program


Write ladder diagrams using the CX-Pro-
grammer.

Example: Permitting interrupts with the


Special Instructions
MSKS instruction and program-
ming high-speed counters with the
CTBL instruction.

Writing Related Example: Stopping high-speed counters.


Auxiliary Area Words 8
Refer to A-2 Auxil-
Example: Reading the present value of a
Reading Related iary Area Allocations
high-speed counter.
Auxiliary Area Words by Address.

4 Transfer PLC Setup


Transfer the PLC Setup and ladder program
from the CX-Programmer to the CP2E CPU
and Ladder Program Unit.

5 Restart the CP2E


Once turn OFF the power supply to the CP2E
CPU Unit, then turn ON again.

6 Start Operation
Start the CP2E CPU Unit operation.

CP2E CPU Unit Software User’s Manual(W614) 8-3


8 Overview of Built-in Functions and Allocations

8-3 Terminal Allocations for Built-in


Functions

8-3-1 Specifying the Functions to Use

A CP2E CPU Unit uses the same built-in I/O terminals for different functions. Allocate the I/O terminals
in advance, making sure that each terminal is used for only one function.
Specify the input functions in the PLC Setup from the CX-Programmer, and specify the output functions
in PLC Setup and programming instructions.

8-3-2 Selecting Functions in the PLC Setup


Functions are enabled by setting parameters in the PLC Setup. Set the functions so that no more than
one function uses the same terminal. Select function numbers so that high-speed counter inputs and
inputs for other functions, such as interrupt inputs, quick-response inputs, and origin inputs do no con-
flict with each other.
• Input functions can be selected by selecting the Use high speed counter Check Box in a High-
speed Counter Area on the Built-in Input Tab Page or by setting an input to Interrupt or Quick in the
Interrupt Input Area of the same page.

Select the Use high speed


counter Check Box for a
High-speed Counter

8-4 CP2E CPU Unit Software User’s Manual(W614)


8 Overview of Built-in Functions and Allocations

• The input and output terminals used by the origin search function can be enabled by selecting the
Use define origin operation Check Box on a Pulse Output Tab Page.

Select the Use define origin


operation Check Box.

8-3 Terminal Allocations for Built-in Functions


8

8-3-2 Selecting Functions in the PLC Setup

CP2E CPU Unit Software User’s Manual(W614) 8-5


8 Overview of Built-in Functions and Allocations

8-3-3 Allocating Built-in Input Terminals

Allocating Functions to Built-in Input Terminals

Input terminals are allocated functions by setting parameters in the PLC Setup. Set the PLC Setup so
that each terminal is used for only one function.

z E20/30/40/60, S30/40/60 or N20/30/40/60 CPU Units


PLC Setup
Origin search
Interrupt input settings on Built-in Input Tab High-speed counter 0 to 5 settings on
settings on Pulse
Terminal Page Built-in Input Tab Page
Terminal Output 0 to 3 Tab Page
block
number Normal Interrupt Quick Use Use
label
Differential
Quick-response Increment Pulse/
Normal input Interrupt inputs phase ×4 Origin search
inputs pulse input direction
or up/down
CIO 0 00 Normal input 0 − − Counter 0, Counter 0, Counter 0, −
increment input phase A or pulse input
up input
01 Normal input 1 − − Counter 1, Counter 0, Counter 1, −
increment input phase B or pulse input
down input
02 Normal input 2 Interrupt input 2 Quick-response Counter 2, Counter 1, Counter 0, −
input 2 increment input phase A or direction
up input
03 Normal input 3 Interrupt input 3 Quick-response − Counter 1, Counter 1, −
input 3 phase B or direction
down input
04 Normal input 4 Interrupt input 4 Quick-response Counter 3, Counter 0, Counter 0, −
input 4 increment input phase Z or reset input
reset input
05 Normal input 5 Interrupt input 5 Quick-response Counter 4, Counter 1, Counter 1, −
input 5 increment input phase Z or reset input
reset input
06 Normal input 6 Interrupt input 6 Quick-response Counter 5, − − Pulse 0, Origin input
input 6 increment input signal
07 Normal input 7 Interrupt input 7 Quick-response − − − Pulse 1, Origin input
input 7 signal
08 Normal input 8 Interrupt input 8 Quick-response − − − Pulse 2, Origin input
(Note 1) input 8 (Note 1) signal (Note 2)
09 Normal input 9 Interrupt input 9 Quick-response − − − Pulse 3, Origin input
(Note 1) input 9 (Note 1) signal (Note 2)
10 Normal input 10 − − − − − Pulse 0, Origin proximity
input signal
11 Normal input 11 − − − − − Pulse 1, Origin proximity
input signal
CIO 1 00 Normal input 12 − − − − − Pulse 2, Origin proximity
input signal (Note 2)
01 Normal input 13 − − − − − Pulse 3, Origin proximity
input signal (Note 2)
02 to 11 Normal input 14 − − − − − −
to 23
CIO 2 00 to 11 Normal input 24 − − − − − −
to 35

Note 1 Only supported by N20/30/40/60 CPU Units.


2 Only supported by N30/40/60 CPU Units.
3 The same pulse inputs must be used for high-speed counter 0 and high-speed counter 1.
4 High-speed counter 2 cannot be used if the input setting of high-speed counter 0 or high-speed counter 1
is set for differential phase inputs (4×), pulse + direction inputs, or up/down pulse inputs.

8-6 CP2E CPU Unit Software User’s Manual(W614)


8 Overview of Built-in Functions and Allocations

z E14 or N14 CPU Units


PLC Setup
Origin search
Interrupt input settings on Built-in Input Tab High-speed counter 0 to 5 settings on
settings on Pulse
Terminal Page Built-in Input Tab Page
Terminal Output 0/1 Tab Page
block
number Normal Interrupt Quick Use Use
label
Differential
Quick-response Increment Pulse/
Normal input Interrupt inputs phase ×4 Origin search
inputs pulse input direction
or up/down
CIO 0 00 Normal input 0 − − Counter 0, Counter 0, Counter 0, −
increment input phase A or pulse input
up input
01 Normal input 1 − − Counter 1, Counter 0, Counter 1, −
increment input phase B or pulse input
down input
02 Normal input 2 Interrupt Quick-response Counter 2, Counter 1, Counter 0, −
input 2 input 2 increment input phase A or direction
up input
03 Normal input 3 Interrupt Quick-response − Counter 1, Counter 1, Pulse 0, Origin proximity
input 3 input 3 phase B or direction input signal
down input

8-3 Terminal Allocations for Built-in Functions


04 Normal input 4 Interrupt Quick-response Counter 3, Counter 0, Counter 0,
input 4 input 4 increment input Phase Z or reset input
reset input
05 Normal input 5 Interrupt Quick-response Counter 4, Counter 1, Counter 1, Pulse 1, Origin
input 5 input 5 increment input Phase Z or reset input proximity input signal
reset input
06 Normal input 6 Interrupt Quick-response Counter 5, − − Pulse 0, Origin input
input 6 input 6 increment input signal
07 Normal input 7 Interrupt Quick-response − − − Pulse 1, Origin input
input 7 input 7 signal

Note 1 The same pulse inputs must be used for high-speed counter 0 and high-speed counter 1.
2 High-speed counter 2 cannot be used if the input setting of high-speed counter 0 or high-speed counter 1
is set for differential phase inputs (4×), pulse + direction inputs, or up/down pulse inputs.

Prohibiting Repeated Use of Input Terminal Number


The input terminals 00 to 11 of CIO 0 and 00 to 01 of CIO 1 are used for input interrupts, quick- 8
response inputs, high-speed counters, origin searches and normal inputs. Therefore, do not use the
input terminals repeatedly. For example, if quick-response input 2 is used, then input terminal 02 is

8-3-3 Allocating Built-in Input Terminals


occupied, so it cannot be used for normal input 2, input interrupt 2, quick-response input 2, counter 2
(increment), counter 1 (phase-A/increment) or counter 0 (direction).
A priority is as follows when used repeatedly.
Origin search settings > High-speed counter settings > Input settings

CP2E CPU Unit Software User’s Manual(W614) 8-7


8 Overview of Built-in Functions and Allocations

8-3-4 Allocating Built-in Output Temrinals

Allocating Functions to Built-in Output Terminals


Output terminals are allocated functions by setting parameters in the PLC Setup. Set the PLC Setup so
that each terminal is used for only one function.
When a pulse output instruc- PLC Setup When the PWM
Other than those
Output terminal block tion (ITPL, SPED, ACC, PLS2, Origin search settings on instruction is exe-
shown at the right
ORG or IFEED) is executed Pulse Output 0 to 3 Tab Page cuted

Variable-duty-fac-
Terminal Terminal Fixed duty ratio pulse output
Normal outputs tor output
block label number
Pulse + Direction Mode Use PWM output
CIO 100 00 Normal output 0 Pulse output 0, pulse − −
01 Normal output 1 Pulse output 1, pulse − PWM output 0
02 Normal output 2 Pulse output 0, direction − −
03 Normal output 3 Pulse output 1, direction − −
04 Normal output 4 − Pulse 0, Error counter reset −
output
05 Normal output 5 − Pulse 1, Error counter reset −
output
Normal output 6 − Pulse 2, Error counter reset −
06
output (Note)
Normal output 7 − Pulse 3, Error counter reset −
07
output (Note)
CIO 101 00 Normal output 8 Pulse output 2, pulse (Note) − −
01 Normal output 9 Pulse output 3, pulse (Note) − −
02 Normal output 10 Pulse output 2, direction (Note) − −
03 Normal output 11 Pulse output 3, direction (Note) − −
04 to 07 Normal output 12 to 15 − − −
CIO 102 00 to 07 Normal output 16 to 23 − − −

Note Only supported by N30/40/60 CPU Units.

Prohibiting Repeated Use of Output Terminal Number


The output terminals 00 to 07 of CIO 100 and 00 to 03 of CIO 101 are used for pulse outputs, PWM out-
puts and normal outputs. Therefore, do not use the output terminals repeatedly. For example, if pulse
output 0 (direction) is used, then output terminal 02 is occupied, so it cannot be used for normal output
2.

8-8 CP2E CPU Unit Software User’s Manual(W614)


Quick-response Inputs
This section describes the quick-response inputs that can be used to read signals that
are shorter than the cycle time.

9-1 Quick-response Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2


9-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
9-1-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3

CP2E CPU Unit Software User’s Manual(W614) 9-1


9 Quick-response Inputs

9-1 Quick-response Inputs


Quick-response inputs can be used with any model of CP2E CPU Unit.

9-1-1 Overview
The quick-response inputs can read pulses with an ON time as short as 50 µs even if they are shorter
than the cycle time. Use the quick-response inputs to read signals shorter than the cycle time, such as
inputs from photomicrosensors.

Pulse signal from photomicrosensor


or other device

I/O refresh
Cycle time
Built-in input

Input bit

Input bit
ON for one scan
in the next cycle

Cyclic tasks
(ladder programs)
Cycle time
Can read ON signals
shorter than this time.
END
I/O refresh

The pulse widths of quick-response input signals must meet the following conditions.
50μs min. 50μs min.

9-2 CP2E CPU Unit Software User’s Manual(W614)


9 Quick-response Inputs

9-1-2 Flow of Operation

1 PLC Setup
• Set IN2 to IN9 for quick-response inputs on the Built-in Input
Tab Page of the PLC Setup using the CX-Programmer.
• The terminals 02 to 09 of CIO 0 can be used for quick-
response inputs. Bits CIO 0.02 to CIO 0.09 correspond to ter-
minals 02 to 09.
2 Create ladder Cyclic task or
Read the status of CIO 0.02 to CIO 0.09 using the LD instruction
or other instructions.
program interrupt task

Precautions for Correct Use


A built-in input cannot be used as a quick-response input if it is being used as a normal input,
interrupt input, or high-speed counter input. Refer to 8-3-3 Allocating Built-in Input Terminals for
details.

PLC Setup
Click the Built-in Input Tab and select Quick in the interrupt input settings.

9-1 Quick-response Inputs


9
9-1-2 Flow of Operation

Select Quick

Built-in Input Tab Page


Quick-response input setting Corresponding bit address
IN2 Select Quick for IN2 CIO 0.02
IN3 to IN9. CIO 0.03
IN4 CIO 0.04
IN5 CIO 0.05
IN6 CIO 0.06
IN7 CIO 0.07
IN8 CIO 0.08
IN9 CIO 0.09

CP2E CPU Unit Software User’s Manual(W614) 9-3


9 Quick-response Inputs

Note 1 The power supply must be restarted after the PLC Setup is transferred in order to validate the quick-
response input settings.
2 IN8 and IN9 are only supported by N20/30/40/60 CPU Units.

Quick-response Input Terminal


The following terminals can be used for quick-response inputs.

z Input Terminal Block on CPU Unit with 20 I/O Points

Quick-response input IN5: CIO 0.05 Quick-response input IN7: CIO 0.07

Quick-response input IN3: CIO 0.03 Quick-response input IN9: CIO 0.09

Upper Terminal Block

L1 L2/N COM 01 03 05 07 09 11

NC 00 02 04 06 08 10
CIO 0

DC Power Supply

+ - COM
NC

Quick-response input IN2: CIO 0.02 Quick-response input IN8:CIO 0.08

Quick-response input IN4: CIO 0.04 Quick-response input IN6: CIO 0.06

Creating Ladder Programs


Pulse inputs shorter than the cycle time can be read in the CPU Unit I/O memory using normal instruc-
tions. Simply set the interrupt setting for the required input to Quick in the PLC Setup.
The status of CIO 0.02 to CIO 0.09 can be read using instructions such as the LD instruction.
Example: Setting IN2 to Quick in the PLC Setup Interrupt Settings.

Even if the signal that is input to terminal 02 on terminal block


0CH is shorter than the cycle time, the signal will be latched in
one cycle and the status will be stored in CIO 0.02.

0.02

• The minimum pulse width (ON time) that can be read for a quick-response input is 50 µs.
• The status of the input that is stored in the I/O memory for a short input will be cleared during the next
I/O refresh period.

9-4 CP2E CPU Unit Software User’s Manual(W614)


Interrupts
This section describes the interrupts that can be used with CP2E PLCs, including input
interrupts and scheduled interrupts.

10-1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2


10-1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
10-2 Input Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3
10-2-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-3
10-2-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4
10-2-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8
10-3 Scheduled Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10
10-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-10
10-3-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-11
10-4 Precautions for Using Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13
10-4-1 Interrupt Task Priority and Order of Execution . . . . . . . . . . . . . . . . . . . . . . . 10-13
10-4-2 Related Auxiliary Area Words and Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13
10-4-3 Duplicate Processing in each Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-13

10

CP2E CPU Unit Software User’s Manual(W614) 10-1


10 Interrupts

10-1 Interrupts

10-1-1 Overview

CP2E CPU Units normally repeat processes in the following order: overseeing processes, program exe-
cution, I/O refreshing, peripheral servicing. During the program execution stage, cyclic tasks (ladder
programs) are executed.
The interrupt function, on the other hand, allows a specified condition to interrupt a cycle and execute a
specified program.
Interrupts can thus be used to perform high-speed processing that is not restricted by the cycle time.
The CP2E performs the following processing when an interrupt occurs.
(1)When an interrupt occurs, execution of the ladder programs in cyclic tasks is interrupted.
(2)The ladder program in the interrupt task is executed.
(3)When the interrupt task is finished, the ladder program that was being executed is returned to.

(2)Interrupt task executed


Cyclic tasks
(ladder programs) Ladder program
(1)Interrupt occurs

Cycle END

END (3)When the interrupt task is finished,


I/O refreshing the ladder diagram that was being
executed is returned to.

Interrupt Factors and Types of Interrupts


Interrupts are classified by the interrupt factor. There are the following three types of interrupts.
• Changes in status of built-in inputs on the CPU Unit → Input Interrupts in Page 10-3
• Specified intervals measured by internal timers → Scheduled Interrupts in Page 10-10
• PVs of high-speed counter → High-speed Counter Interrupts in Page 11-14

10-2 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

10-2 Input Interrupts


Input interrupts can be used with any model of CP2E CPU Unit.

10-2-1 Overview
A corresponding interrupt task can be executed when a built-in input on the CPU Unit turns ON or turns
OFF.

Interrupt input
Built-in input

Interrupt input bit turns ON or OFF

Interrupt task
Cyclic tasks
(ladder programs) Ladder program
Interrupt occurs
Cycle
END

END
I/O refreshing

Condition for

10-2 Input Interrupts


accepting interrupt
Example: CIO 0.02
(interrupt input IN2)
MSKS instruction
executed to enable
the interrupt
Processing Processing
Cyclic task execution
interrupted Cyclic task execution
interrupted

Interrupt task
10
Interrupt task
2 executed
2 executed
10-2-1 Overview

The pulse widths of interrupt input signals must meet the following conditions.

50μs min.50μs min.

CP2E CPU Unit Software User’s Manual(W614) 10-3


10 Interrupts

10-2-2 Flow of Operation

1 PLC Setup
• Set IN2 to IN9 for interrupt inputs on the Built-in Input
Tab Page of the PLC Setup using the CX-Programmer.
• Terminals 02 to 09 on the CIO 0 terminal block can be
used for interrupt inputs. Bits CIO 0.02 to CIO 0.09 cor-
respond to terminals 02 to 09.

2 Interrupt task
Write the program in the interrupt task. Interrupt tasks 2 to
9 correspond to interrupt inputs 2 to 9.

Create
• Specify whether the interrupt is executed when the input
ladder
turns ON or when it turns OFF in the MSKS instruction.
program Execute MSKS
Set N to 112 to 119 in the MSKS instruction.
instruction in a
cyclic task • Enable input interrupts in the MSKS instruction. Set N to
102 to 109 in the MSKS instruction.

Precautions for Correct Use


A built-in input cannot be used as a normal input, high-speed counter input, or quick-response
input if it is being used as an interrupt input. Refer to 8-3-3 Allocating Built-in Input Terminals for
details.

PLC Setup
Click the Built-in Input Tab and select Interrupt in the interrupt intput settings.

Select Interrupt

10-4 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

Built-in Input Tab Page


Corresponding Input interrupt
Interrupt input settings
bit address task
IN2 Select Interrupt for CIO 0.02 2
IN3 IN2 to IN9. CIO 0.03 3
IN4 CIO 0.04 4
IN5 CIO 0.05 5
IN6 CIO 0.06 6
IN7 CIO 0.07 7
IN8 CIO 0.08 8
IN9 CIO 0.09 9

Note 1 The power supply must be restarted after the PLC Setup is transferred in order to enable the interrupt
input settings.
2 IN8 and IN9 are only supported by N20/30/40/60 CPU Units.

Assigning Interrupt Input Terminals


The following input terminals can be used for interrupt inputs. These terminals correspond to CIO 0.02
to CIO 0.09 in I/O memory.

z Input Terminal Block on CPU Unit with 20 I/O Points

Interrupt input IN5: CIO 0.05 Interrupt input IN7: CIO 0.07

Interrupt input IN3: CIO 0.03 Interrupt input IN9: CIO 0.09

Upper Terminal Block


L1 L2/N COM 01 03 05 07 09 11
DC Power Supply

+ - COM NC 00 02 04 06 08 10
CIO 0
NC
Interrupt input IN2: CIO 0.02 Interrupt input IN8: CIO 0.08

10-2 Input Interrupts


Interrupt input IN4: CIO 0.04 Interrupt input IN6: CIO 0.06

Writing the Ladder Program

z Writing the Interrupt Task’s Ladder Program


Create ladder programs for interrupt tasks 2 to 9, which are executed for the corresponding interrupt 10
inputs. Right-click a program in the CX-Programmer and select Properties. Select interrupt tasks 2
to 9 in the Task Type Field of the Program Properties Dialog Box.
10-2-2 Flow of Operation

CP2E CPU Unit Software User’s Manual(W614) 10-5


10 Interrupts

z Execute MSKS Instruction in a Cyclic Task


Execute the MSKS instruction from the ladder program in a cyclic task to use input interrupts.
MSKS has the following two functions and two of this instruction are normally used in combination.
(1)Specifying whether to detect ON or OFF signals.
(2)Enabling input interrupts.

Execution condition
@MSKS (1)Specifies creating an interrupt when
N the input turns OFF or when it turns
C ON.
@MSKS (2)Enables input interrupts.
N
C

The MSKS instruction must be executed only once to make the settings, so in general execute
MSKS in just one cycle using the upwardly differentiated variation of the instruction.
The first MSKS instruction can be omitted. If it is omitted, an interrupt will be created when the input
turns ON by default.

z Specifying MSKS Operands (N and C)


(1)Specifying to Detect ON or OFF Input Signals
Operand N Operand C
PLC Setup on
Corresponding Interrupt Specifying up/down
Terminal Built-in Input Interrupt
bit address task number differentiation of an
Tab Page identifier
interrupt input
02 on CIO 0 CIO 0.02 Interrupt input 2 112 #0000:
terminal block IN2 Up-differentiation
03 on CIO 0 CIO 0.03 Interrupt input 3 113 #0001:
terminal block IN3
Down-differentiation
04 on CIO 0 CIO 0.04 Interrupt input 4 114
terminal block IN4
05 on CIO 0 CIO 0.05 Interrupt input 5 115
terminal block IN5
06 on CIO 0 CIO 0.06 Interrupt input 6 116
terminal block IN6
07 on CIO 0 CIO 0.07 Interrupt input 7 117
terminal block IN7
08 on CIO 0 CIO 0.08 Interrupt input 8 118
terminal block IN8*
09 on CIO 0 CIO 0.09 Interrupt input 9 119
terminal block IN9*
* Interrupt input 8 and 9 are only supported by N20/30/40/60 CPU Units.

10-6 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

(2)Enabling the Input Interrupt


PLC Setup on Operand N Operand C
Corresponding Interrupt
Terminal Built-in Input Interrupt
bit address task number Enable/Disable
Tab Page identifier
02 on CIO 0 CIO 0.02 Interrupt input 2 102 #0000:
terminal block IN2 Enable interrupt
03 on CIO 0 CIO 0.03 Interrupt input 3 103 #0001:
terminal block IN3
Disable interrupt
04 on CIO 0 CIO 0.04 Interrupt input 4 104
terminal block IN4
05 on CIO 0 CIO 0.05 Interrupt input 5 105
terminal block IN5
06 on CIO 0 CIO 0.06 Interrupt input 6 106
terminal block IN6
07 on CIO 0 CIO 0.07 Interrupt input 7 107
terminal block IN7
08 on CIO 0 CIO 0.08 Interrupt input 8 108
terminal block IN8*
09 on CIO 0 CIO 0.09 Interrupt input 9 109
terminal block IN9*
* Interrupt input 8 and 9 are only supported by N20/30/40/60 CPU Units.
• Example
(1)Specifying Detecting ON or OFF Input Signals
For interrupt input IN2: Specify 112.
Cyclic task
Specifies an interrupt when the input turns ON.
MSKS (2)Enabling Input Interrupt CIO 0.02 turns ON
112 For interrupt input IN2: Specify 102.
#0000 Enables Input interrupt. Built-in input terminal
The specified input interrupt (here, IN2) is 01 03 05 07 09 11
MSKS enabled when the MSKS instruction is executed.
102 00 02 04 06 08 10
#0000
Interrupt CIO 0

10-2 Input Interrupts


Interrupt task 2
END

END

10
10-2-2 Flow of Operation

CP2E CPU Unit Software User’s Manual(W614) 10-7


10 Interrupts

10-2-3 Application Example


In this example, bent parts are detected in a moving workpiece, such as an IC component. When the
sensor input (terminal 02 on terminal block 0CH = CIO 0.02) changes from OFF to ON, the interrupt
task is executed.

Sensor input (interrupt input 2)


Sensor input (interrupt) CIO 0.02 Interrupt task Interrupt task Interrupt task
Workpiece execution execution execution
Sensor input
CIO 0.00

Sensor input
Sensor input 3 Sensor input 1 CIO 0.01
Sensor input 2 Sensor input
CIO 0.03
Reset input
CIO 0.04
OK output
CIO 100.00
NG output 1
CIO 100.01

NG output 2
CIO 100.02
NG output 3
CIO 100.03
NG output 4
CIO 100.04

1 PLC Setup
Set IN2 to Interrupt in the interrupt input settings on the Built-in Input Tab Page.

2 Connecting Interrupt Input Terminals


Terminal 2 on terminal block 0CH is interrupt input IN2.
Interrupt task 2 corresponds to interrupt input 2.

Interrupt input (sensor input):


Sensor input 3: CIO 0.03 CIO 0.02
Sensor input 2: CIO 0.01 Reset input: CIO 0.04
Sensor input 1: CIO 0.00

OK output: CIO 100.00


NG output 2: CIO 100.04
NG output 1: CIO 100.01 NG output 3: CIO 100.03
NG output 4: CIO 100.02

10-8 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

z Programming Example

Cyclic Task

P_First_Cycle

Interrupt input 2 The MSKS instruction is used


Specifies executing to specify an interrupt when the
interrupt when input input turns ON and then it is
turns ON. used to unmask the input
interrupt.
Interrupt input 2
Unmasks the input
interrupt.

NG output sensor input 1

NG output sensor input 2

NG output sensor input 3

0.04

Reset input

10-2 Input Interrupts

Interrupt Task 2 10
10-2-3 Application Example

OK output
Sensor input 1 Sensor input 2 Sensor input 3

NG output 2
Sensor input 1
Sensor input 1

NG output 3
Sensor input 2
Sensor input 2

NG output 4
Sensor input 3
Sensor input 3

CP2E CPU Unit Software User’s Manual(W614) 10-9


10 Interrupts

10-3 Scheduled Interrupts


Scheduled interrupts can be used with any model of CP2E CPU Unit.

10-3-1 Overview
Scheduled interrupts can be used to execute interrupt tasks at fixed time intervals measured by the
CPU Unit’s internal timer.

Minimum interval: 1 ms

Specified interval
Interrupt task
Cyclic tasks
(ladder programs) Interrupt occurs Ladder program
Cycle
END

END
I/O refresh

Condition for
accepting interrupts
MSKS instruction executed Scheduled Interrupt Interval =
to set the scheduled 0.5 ms (example)
interrupt interval
1ms 1ms 1ms
Internal timer

Execution Cyclic task Execution Cyclic task Execution


Cyclic task execution interrupted interrupted interrupted
execution execution

Executing Executing Executing


scheduled scheduled scheduled
interrupt interrupt interrupt
task 1 task 1 task 1

10-10 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

10-3-2 Flow of Operation

Interrupt task Write the program for the corresponding interrupt task 1 (fixed).
Create
ladder Execute MSKS Use MSKS to specify the scheduled interrupt interval.
program instruction in a cyclic The setting can be 1 ms or longer.
task Set N to 4 or 14 in the MSKS instruction.

Writing the Ladder Program

z Writing the Interrupt Task Program


Create the program for interrupt task 1, which is executed for the scheduled interrupt. Right-click a
program in the CX-Programmer and select Properties. Select Interrupt Tasks 01 (scheduled inter-
rupt) in Task Type Field of the Program Properties Dialog Box.

10-3 Scheduled Interrupts


z Execute MSKS in a Cyclic Task
The MSKS instruction must be executed from the ladder program in a cyclic task in order to use
scheduled interrupts.

Execution condition
10
@MSKS
N Specifies scheduled interrupt (interrupt task 1)
10-3-2 Flow of Operation

C Sets the scheduled interrupt interval and starts timing

The MSKS instruction must be executed only once to make the settings, so in general execute
MSKS in just one cycle using the upwardly differentiated variation of the instruction.

CP2E CPU Unit Software User’s Manual(W614) 10-11


10 Interrupts

Specifying MSKS Operands (N and C)


MSKS Operands
MSKS Operands
N C
Interrupt number Scheduled interrupt interval
Scheduled interrupt (interrupt 0 decimal: Disable interrupt (stop internal timer)
task 1)* 10 to 9,999 decimal:Enable interrupt (Reset internal timer
14: Reset and restart and then start timer with interrupt interval between 1.0
4: Reset and restart and 999.9 ms)

* Either is reset.
Example

Scheduled Interrupt Time Unit


Scheduled interrupt
Cyclic tasks
1 ms
MSKS
4
&10

In intervals of 1 ms

Interrupt

Interrupt task 1
END

END

Precautions for Correct Use


• Set a scheduled interrupt interval is longer than the time required to execute the correspond-
ing interrupt task.
• If you shorten the scheduled interrupt interval and increase the execution frequency of the
scheduled interrupt task, the cycle time will increase, and this will affect the execution timing of
cyclic tasks.
• If an interrupt task is being executed for another interrupt (input interrupt or high-speed
counter interrupt) when the scheduled interrupt occurs, the scheduled interrupt will not be exe-
cuted until the other interrupt task had been completed.
Even in this case, measurement of internal timer is continually executed in parallel, so the exe-
cution of scheduled interrupt tasks will not be delayed.
• Scheduled interrupt interval cannot be changed during the startup of scheduled interrupt.
Change the interval after the scheduled interrupt has stopped.

10-12 CP2E CPU Unit Software User’s Manual(W614)


10 Interrupts

10-4 Precautions for Using Interrupts

10-4-1 Interrupt Task Priority and Order of Execution

The priority of interrupt tasks is the same order for input interrupts, scheduled interrupts and high-speed
counter interrupts. Therefore, if interrupt task A (an input interrupt, for example) is being executed when
interrupt task B (a scheduled interrupt, for example) occurs, task A execution will not be interrupted.
Task B execution will be started when task A had been completed.
For example, if an interrupt task is being executed for another interrupt (input interrupt or high-speed
counter interrupt) when a scheduled interrupt occurs, the scheduled interrupt will not be executed until
execution of the other interrupt task had been completed. Even in this case, internal timer is continually
measured in parallel, so the execution of the scheduled interrupt task will not be delayed.

10-4-2 Related Auxiliary Area Words and Bits


When the processing time of an interrupt task exceeds 0.1ms, the processing time of the interrupt task
and the task number of the interrupt with the maximum processing time can be found in the Auxiliary
Area. The actual processing time can also be checked.
Name Addresses Description
Maximum A440 Contains the maximum interrupt task processing time in units of 0.1 ms.
Interrupt Task This value is cleared at the start of operation.
Processing Time
Interrupt Task A441 Contains the task number of the interrupt task with the maximum processing
With Maximum time. Here, #8000 to #800F correspond to tasks 0 to 15 (00 to 0F hex).

10-4 Precautions for Using Interrupts


Processing Time A441.15 will turn ON when the first interrupt occurs after the start of operation.
The maximum processing time for subsequent interrupt tasks will be stored in
the rightmost digit in hexadecimal. This value is cleared at the start of opera-
tion.
Total of Interrupt A442 Contains the total of interrupt task processing time in one cycle in units of
Task Processing 0.1ms. Sets when the value is bigger than the last one once a cycle by com-
Time in One mon processing.This value is cleared at the start of operation.
Cycle

10-4-3 Duplicate Processing in each Task


Observe the following precautions, if a word address in I/O memory is manipulated by instructions both
in a cyclic task and an interrupt task. 10
• If the interrupt task overwrites an I/O memory address used by one of the interrupted instruction’s
operands, the data may be overwritten when the saved data is restored when processing returns to
10-4-1 Interrupt Task Priority and

the cyclic task.


• To prevent certain instructions from being interrupted during processing, insert the DI or EI instruction
Order of Execution

just before and after the instructions, using the DI or EI instruction before the instructions to disable
interrupts and the DI or EI instruction after the instructions to enable interrupts again.

Additional Information

Normally, if an interrupt occurs, execution of the cyclic task will be interrupted immediately, even
during execution of an instruction in the cyclic task, and the partially processed data is saved.
After the interrupt task had been completed, the cyclic task restarts with the data saved before
the interrupt processing.

CP2E CPU Unit Software User’s Manual(W614) 10-13


10 Interrupts

10-14 CP2E CPU Unit Software User’s Manual(W614)


11

High-speed Counters
This section describes the high-speed counter inputs, high-speed counter interrupts,
and the frequency measurement function.

11-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2


11-1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
11-1-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
11-1-3 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-7
11-2 High-speed Counter Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
11-2-1 Pulse Input Methods Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8
11-2-2 Counting Ranges Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-10
11-2-3 Reset Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11
11-2-4 Reading the Present Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-12
11-2-5 Frequency Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13
11-3 High-speed Counter Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14
11-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-14
11-3-2 Present Value Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-17
11-3-3 High-speed Counter Interrupt Instruction . . . . . . . . . . . . . . . . . . . . . . . . . . 11-20
11-4 Related Auxiliary Area Bits and Words . . . . . . . . . . . . . . . . . . . . . . . . . . 11-25
11-5 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-26

CP2E CPU Unit Software User’s Manual(W614) 11-1


11 High-speed Counters

11-1 Overview
High-speed counters can be used with any model of CP2E CPU Unit.

11-1-1 Overview
High-speed counters are used to measure high-speed pulse input signals that cannot be measured by
counter (CNT) instructions.

z Applications
• Detecting the position or length of a workpiece with an input from an incremental rotary encoder.
• Measuring the speed of a workpiece from its position data using frequency measurement and
rotational speed conversion.
• High-speed processing according to the workpiece’s position data.

The present value of the high-speed counter is stored in the Auxiliary Area and can be used as posi-
tion data. When it reaches preset values, interrupts can be generated. The count can be started and
stopped. Depending on the instruction, the frequency (speed) can be read from the present value of
the high-speed counter.

Changes to PV

Read · Reading PV (from Auxiliary Area


Count High-speed counter PV or using PRV instruction)
Encoder
input (stored in Auxiliary Area) · Reading frequency (using PRV instruction)
· Phase A/phase B
· Up/down pulse inputs Read PRV
· Reset input (phase Z)
Etc. High-speed counter PV comparison

Target value comparison

Range comparison for Interrupt task


upper and lower limits

Settings

· Setting target values or range upper/lower


limits and starting comparison, specifying
interrupt task to be started

CTBL

11-2 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-1-2 Flow of Operation

11-1 Overview
1 PLC Setup
• Enable the required high-speed counters.
• Select the Use high speed counter Check Box for high-
speed counters 0 to 5. Set the input setting, counting
mode and reset method on the Built-in Input Tab Page of
the PLC Setup using the CX-Programmer.
• Terminals 00 to 06 on the CIO 0 terminal block can be 11
used for high-speed counters. High-speed counters 0 to
5 correspond to terminals 00 to 06.
2

11-1-2 Flow of Operation


• Read the PV from Auxiliary Area or by executing a PRV
Create Read counter PV
instruction.
ladder
• Execute a PRV instruction.
program Read counter frequency

Precautions for Correct Use


A built-in input cannot be used as a normal input, interrupt input, or quick-response input if it is
being used as a high-speed counter input. Refer to 8-3-3 Allocating Built-in Input Terminals for
details.

PLC Setup
Click the Built-in Input Tab and select the Use high speed counter Check Box for high-speed counters
0 to 5. Set the counting mode, reset method, and input setting.

CP2E CPU Unit Software User’s Manual(W614) 11-3


11 High-speed Counters

Built-in Input Tab Page


Item Setting
Use high Use high-speed Select Use high speed counter for each counter to be used.
speed counter
counter 0 Counting Mode Select Linear mode or Circular mode.
to 5
Circular Max. Count If circular mode is selected, set the maximum ring count.
(maximum ring count) 0 to 4,294,967,295 decimal
Reset • Phase Z and software reset
• Software reset*
• Phase Z and software reset (continue comparing)
• Software reset (continue comparing)*
Input Setting • Differential phase inputs (4×)
• Pulse + direction inputs
• Up/down pulse inputs
• Increment pulse input

* Only a software reset can be used if an increment pulse input is specified.

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the high-speed
counter settings.

Determining High-speed Counter


z Pulse Input Method and High-speed Counter Input Terminals
The following input terminals can be used for high-speed counters with the pulse input method.

E20/30/40/60, S30/40/60 or N20/30/40/60 CPU Units


Input terminal block Pulse input method (Counting mode) Other functions that cannot be used at the same time

Terminal Increment Differential phase Pulse/ Interrupt Quick-response Origin searches


block Terminal
pulse input ×4 or up/down direction Normal input
input input for pulse out-
label input input puts 0 to 3
CIO 0 00 High-speed High-speed High-speed Normal input 0 − − −
Counter 0, Counter 0, phase A Counter 0,
increment or up input pulse input
input
01 High-speed High-speed High-speed Normal input 1 − − −
Counter 1, Counter 0, phase B Counter 1,
increment or down input pulse input
input
02 High-speed High-speed High-speed Normal input 2 Interrupt input 2 Quick-response −
Counter 2, Counter 1, phase A Counter 0, input 2
increment or up input direction
input
03 − High-speed High-speed Normal input 3 Interrupt input 3 Quick-response −
Counter 1, phase B Counter 1, input 3
or down input direction
04 High-speed High-speed High-speed Normal input 4 Interrupt input 4 Quick-response −
Counter 3, Counter 0, phase Z Counter 0, input 4
increment or reset input reset input
input
05 High-speed High-speed High-speed Normal input 5 Interrupt input 5 Quick-response −
Counter 4, Counter 1, phase Z Counter 1, input 5
increment or reset input reset input
input
06 High-speed − − Normal input 6 Interrupt input 6 Quick-response Pulse 0, Origin
Counter 5, input 6 input signal
increment
input
07 − − − Normal input 7 Interrupt input 7 Quick-response Pulse 1, Origin
input 7 input signal
08 − − − Normal input 8 Interrupt input 8 Quick-response Pulse 2, Origin
(Note 1) input 8 (Note 1) input signal
(Note 2)

11-4 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

Input terminal block Pulse input method (Counting mode) Other functions that cannot be used at the same time

Terminal Differential phase Pulse/ Origin searches


Increment Interrupt Quick-response
block Terminal ×4 or up/down direction Normal input for pulse out-

11-1 Overview
label pulse input input input input input puts 0 to 3
CIO 0 09 − − − Normal input 9 Interrupt input 9 Quick-response Pulse 3, Origin
(Note 1) input 9 (Note 1) input signal
(Note 2)
10 − − − Normal input 10 − − Pulse 0, Origin
proximity input
signal
11 − − − − −
Normal input 11 Pulse 1, Origin
proximity input 11
signal
CIO 1 00 − − − Normal input 12 − − Pulse 2, Origin
proximity input

11-1-2 Flow of Operation


signal (Note 2)
01 − − − Normal input 13 − − Pulse 3, Origin
proximity input
signal (Note 2)

Note 1 Only supported by N20/30/40/60 CPU Units.


2 Only supported by N30/40/60 CPU Units.
3 The same pulse input must be used for high-speed counter 0 and high-speed counter 1.
4 High-speed counter 2 cannot be used if the input setting of high-speed counter 0 or high-speed counter 1
is set for differential phase inputs (4x), pulse + direction inputs, or up/down pulse inputs.
5 CIO 0.07 to CIO 0.11 and CIO 1.00 to CIO 1.01 do not overlap with the high-speed counter function, so
they can also be used for high-speed counter.

E14 or N14 CPU Units


Input terminal block Pulse input method (Counting mode) Other functions that cannot be used at the same time

Origin
Terminal Increment Differential phase Pulse/ Interrupt Quick- searches for
block Terminal
pulse input ×4 or up/down direction Normal input
input response pulse outputs 0
label input input input
and 1
CIO 0 00 High-speed High-speed High-speed Normal input 0 − − −
Counter 0, Counter 0, phase A Counter 0,
increment or up input pulse input
input
01 High-speed High-speed High-speed Normal input 1 − − −
Counter 1, Counter 0, phase B Counter 1,
increment or down input pulse input
input
02 High-speed High-speed High-speed Normal input 2 Interrupt input 2 Quick-response −
Counter 2, Counter 1, phase A Counter 0, input 2
increment or up input direction
input
03 − High-speed High-speed Normal input 3 Interrupt input 3 Quick-response Pulse 0, Origin
Counter 1, phase B Counter 1, input 3 proximity input
or down input direction signal
04 High-speed High-speed High-speed Normal input 4 Interrupt input 4 Quick-response −
Counter 3, Counter 0, phase Z Counter 0, input 4
increment or reset input reset input
input
05 High-speed High-speed High-speed Normal input 5 Interrupt input 5 Quick-response Pulse 1, Origin
Counter 4, Counter 1, phase Z Counter 1, input 5 proximity input
increment or reset input reset input signal
input
06 High-speed − − Normal input 6 Interrupt input 6 Quick-response Pulse 0, Origin
Counter 5, input 6 input signal
increment
input
07 − − − Normal input 7 Interrupt input 7 Quick-response Pulse 1, Origin
input 7 input signal

Note 1 The same pulse input must be used for high-speed counter 0 and high-speed counter 1.
2 High-speed counter 2 cannot be used if the input setting of high-speed counter 0 or high-speed counter 1
is set for differential phase inputs (4x), pulse + direction inputs, or up/down pulse inputs.
3 CIO 0.07 does not overlap with the high-speed counter function, so it can also be used for high-speed
counter.

CP2E CPU Unit Software User’s Manual(W614) 11-5


11 High-speed Counters

z Wiring Example for High-speed Counter Input Terminals

Using a 24-VDC Open-collector Encoder


The following example shows the connections of an encoder with phase-A, phase-B, and phase-Z
inputs to high-speed counter 0.

CP2E CPU Unit


(Differential Phase Input Mode)
(High-speed counter 0: Phase A 0 V)
Black Phase A 0.00
Encoder
(power supply: 24 VDC) (High-speed counter 0: Phase B 0 V)
White Phase B 0.01

Orange Phase Z (High-speed counter 0: Phase Z 0 V)


0.04

Example: E6B2-CWZ6C
Brown+Vcc COM
NPN open-collector output (COM 24V)
Blue 0V(COM)

24 VDC power supply


0V
+24V

(Do not use the same I/O power supply as other equipment.)
Power provided 0V Power supply
Encoder 24V 0V
Shielded twisted-pair cable
CP2E CPU Unit
IA
Phase A 0.00

IB 0.01
Phase B

IZ
Phase Z 0.04

COM

Writing the Ladder Program


Execution Program Reference
Generating interrupts for the Specify interrupt tasks with CTBL 11-3 High-speed
high-speed counter PV (num- instructions. Counter Interrupts
ber of pulses) and perform
high-speed processing.
Reading the high-speed Read the high-speed counter PV from 11-2-4 Reading the
counter PV (number of the Auxiliary Area and convert it to Present Value
pulses). position or length data using instruc-
tions or measure the length using con-
mparison instructions such as =, >,
and <.
Reading the high-speed Execute a PRV instruction. 11-2-5 Frequency
counter frequency (speed). Measurement

11-6 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-1-3 Specifications

11-1 Overview
Item Description
Pulse input method Increment pulse Differential phase Up/down pulse Pulse + direction
(Counting mode) inputs inputs (×4) inputs inputs
Input signal Increment Phase-A Up pulse Pulse
− Phase-B Down pulse Direction 11
− Phase-Z Reset Reset

11-1-3 Specifications
Frequency E/S……-type 100 kHz: 50 kHz: 1 counter 100 kHz: 1 counter 100 kHz:
and number CPU Unit 2 counters 5 kHz: 1 counter 10 kHz: 1 counter 2 counters
of high- 10 kHz: 4 counters
speed N14/20 CPU 100 kHz: 50 kHz: 1 counter 100 kHz: 1 counter 100 kHz:
counters Unit 2 counters 2 counters
5 kHz: 1 counter 10 kHz: 1 counter
10 kHz: 4 counters
N30/40/60 100 kHz: 50 kHz: 2 counters 100 kHz: 2 counters 100 kHz:
CPU Unit 3 counters 2 counters
10 kHz: 3 counters
Counting mode Linear mode or circular (ring) mode
Count values Linear mode: 8000 0000 to 7FFF FFFF hex
Ring Mode: 0000 0000 to Ring SV
High-speed counter PV High-speed counter 0: A271 (upper 4 digits) and A270 (lower 4 digits)
storage locations High-speed counter 1: A273 (upper 4 digits) and A272 (lower 4 digits)
High-speed counter 2: A317 (upper 4 digits) and A316 (lower 4 digits)
High-speed counter 3: A319 (upper 4 digits) and A318 (lower 4 digits)
High-speed counter 4: A323 (upper 4 digits) and A322 (lower 4 digits)
High-speed counter 5: A325 (upper 4 digits) and A324 (lower 4 digits)
The PVs are refreshed in the overseeing processes at the start of each cycle. Use
PRV to read the most recent PVs.
Data format: 8 digit hexadecimal
• Range in linear mode: 8000 0000 to 7FFF FFFF hex
• Range in Ring Mode: 0000 0000 to Ring SV (Circular Max. Count)
Control Target value Up to 6 target values and corresponding interrupt task numbers can be registered.
method comparison
Range Up to 6 ranges can be registered, with a separate upper limit, lower limit, and inter-
comparison rupt task number for each range.
Counter reset method • Phase-Z + Software reset
The high-speed counter is reset when the phase-Z signal goes ON while the
Reset Bit (A531.00 to A531.05) is ON. (Phase Z cannot be used for the incre-
ment pulse.)
• Software reset
The high-speed counter is reset when the Reset Bit (A531.00 to A531.05) is
turned ON.
Operation can be set to stop or continue the comparison operation when the high-
speed counter is reset.

CP2E CPU Unit Software User’s Manual(W614) 11-7


11 High-speed Counters

11-2 High-speed Counter Inputs


11-2-1 Pulse Input Methods Settings
There are four pulse input methods for high-speed counters.
• Increment pulse input
• Differential phase input (4×)
• Up/Down pulse input
• Pulse+direction input

Increment Pulse Input


The Increment Pulse Input counts signals on a single-phase pulse input. Only incrementing the count is
possible in this mode.
Conditions for Incrementing
the Count

Pulse Pulse Count value


OFF→ON Increment
ON No change
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ON→OFF No change
OFF No change
· Only rising edges are counted.

Differential Phase Input (4×)


The Differential Phase Input uses two phase signals (phase A and phase B) and increments/decre-
ments the count according to the status of Differential Phase (4×).
Conditions for Incrementing/
Decrementing the Count

Phase A Phase A Phase B Count value


OFF→ON OFF Increment
Phase B ON OFF→ON Increment
ON→OFF ON Increment
OFF ON→OFF Increment
×4 0 1 2 3 4 5 6 7 8 9 10 11 12 11 10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 OFF OFF→ON Decrement
OFF→ON ON Decrement
ON ON→OFF Decrement
ON→OFF OFF Decrement

Up/Down Pulse Input


The Up/Down Pulse Input uses two signals, an increment pulse and a decrement pulse.
Conditions for Incrementing/
Decrementing the Count
Increment Decrement Increment Count value
pulse pulse pulse
OFF→ON OFF Decrement
Decrement ON OFF→ON No change
pulse ON→OFF ON No change
0 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 0 OFF ON→OFF No change
OFF OFF→ON Increment
OFF→ON ON No change
ON ON→OFF No change
ON→OFF OFF No change
· The count is incremented for each increment
pulse and decremented for each decrement
pulse.
· Only rising edges are counted.

11-8 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-2 High-speed Counter Inputs


Pulse + Direction Input
The Pulse + Direction Input uses a direction signal and a pulse signal. The count is incremented or dec-
remented depending on the status (ON or OFF) of the direction signal.
Conditions for Incrementing/
Decrementing the Count

Pulse Direction Pulse Count value

Direction
OFF→ON OFF No change 11
ON OFF→ON Increment
ON→OFF ON No change
0 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 0 OFF ON→OFF No change

11-2-1 Pulse Input Methods Settings


OFF OFF→ON Decrement
OFF→ON ON No change
ON ON→OFF No change
ON→OFF OFF No change
· The count is incremented when the
direction signal is ON and
decremented when it is OFF.
· Only rising edges are counted.

Precautions for Correct Use


• Interval of Phase-Z input signal
Do not input the phase-Z signal at a high frequency. The interval of phase-Z input signal must
be longer than 500µs.
If the phase-Z signal is input at a high frequency, cycle time exceeded error may occur.
Phase-Z signal

500µs min.

• Interval of direction changing


If the input setting is set for pulse+direction inputs, do not change the direction at a high fre-
quency. The interval of direction signal ON or OFF must be longer than 3ms plus the sum of
execution time for interrupt tasks that may possibly happen at the same time.
The sum of execution time for interrupt tasks in one cycle is stored in A442.
If the direction signal is ON or OFF at a high frequency, count values may not agree.
Cycle time exceeded error possibly occurs when changing the direction at a high frequency.
Therefore, please do not connect chattering equipment as direction signal input such as relay
and switch.
Pulse

Direction

3ms plus the sum of execution time


for interrupt tasks

• Interval of pulse input after direction changing


If the input setting is set for pulse+direction inputs, the Interval of pulse input after the direction
changing must be longer than 500µs.
If the pulse is output immediately after the direction changing, count values may not agree.

Pulse

Direction
500µs min.

CP2E CPU Unit Software User’s Manual(W614) 11-9


11 High-speed Counters

Additional Information

The count of a high-speed counter can be monitored to see if it is currently being incremented or
decremented. The count in the current cycle is compared with the count in the previous cycle to
determine if it is being incremented or decremented.
The results are reflected in the High-speed Counter Count Direction Flags.
Address of High-speed
High-speed counter
Counter Count Direction Flag
High-speed counter 0 A274.10
High-speed counter 1 A275.10
High-speed counter 2 A320.10
High-speed counter 3 A321.10
High-speed counter 4 A326.10
High-speed counter 5 A327.10

11-2-2 Counting Ranges Settings


The following counting modes can be selected for high-speed counters: Linear Mode that counts in a
fixed range and Circular (Ring) Mode that counts in a set range of any maximum value.

Linear Mode
Input pulses can be counted in the range between the lower limit and upper limit values. If the pulse
count goes beyond the lower/upper limit, an underflow/overflow will occur and counting will stop.
• Increment Mode
0 4294967295
(000000 Hex) (FFFFFFFF Hex)

PV overflow

• Up/Down Mode

-2147483648 0 +2147483647
(80000000 Hex) (00000000 Hex) (7FFFFFFF Hex)

PV underflow PV overflow

11-10 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-2 High-speed Counter Inputs


Circular (Ring) Mode
Input pulses are counted in a loop within the set range.
• If the count is incremented from the maximum ring count, the count will be reset to 0 automatically
and incrementing will continue.
• If the count is decremented from 0, the count will be set to the maximum ring count automatically and
decrementing will continue.
11
Consequently, underflows and overflows cannot occur when Ring Mode is used.
Count value

11-2-3 Reset Methods


2 32-1

Maximum ring
count

z Maximum Ring Count


Use the PLC Setup to set the maximum ring count (Circular Max. Count), which is the maximum
value of the input pulse counting range. The maximum ring count can be set to any value between
0000 0001 and FFFF FFFF hex (1 to 4,294,967,295 decimal).

Precautions for Correct Use


• There are no negative values in Ring Mode.
• If the maximum ring count is set to 0 in the PLC Setup, the counter will operate with a maxi-
mum ring count of FFFF FFFF hex.

11-2-3 Reset Methods


It is called reset that a high-speed counter’s PV is set to 0.
There are two reset methods
• Phase-Z signal + software reset
• software reset

Phase-Z Signal + Software Reset


The high-speed counter’s PV is reset when the phase-Z signal (reset input) goes from OFF to ON while
the corresponding High-speed Counter Reset Bit (A531.00 to A531.05) is ON.
The CPU Unit recognizes the ON status of the High-speed Counter Reset Bit only at the beginning of
the PLC cycle during the overseeing processes. Consequently, when the Reset Bit is turned ON in the
ladder program, the phase-Z signal does not become effective until the next PLC cycle.
One cycle

Phase Z

Reset bit

PV not PV reset PV reset PV reset PV not reset PV reset


reset

Note The phase-Z signal cannot be used if an incremental counter is specified. Only a software reset can be used.

CP2E CPU Unit Software User’s Manual(W614) 11-11


11 High-speed Counters

Software Reset
The high-speed counter’s PV is reset when the corresponding High-speed Counter Reset Bit (A531.00
to A531.05) goes from OFF to ON.
The CPU Unit recognizes the OFF-to-ON transition of the High-speed Counter Reset Bit only at the begin-
ning of the PLC cycle during the overseeing processes. Reset processing is performed at the same time.
The OFF-to-ON transition will not be recognized if the Reset Bit goes OFF again within the same cycle.
One cycle

Reset bit

PV reset PV not reset PV not reset PV not reset

Additional Information

The comparison operation can be selected to stop or continue in the PLC Setup when a high-
speed counter is reset. This enables applications where the comparison operation can be
restarted from a counter PV of 0 when the counter is reset.

11-2-4 Reading the Present Value


The present value of a high-speed counter can be read in the following two ways.
• Value refreshed at the I/O refresh timing → Read PV from Auxiliary Area.
• Value updated when a ladder program is executed → Read PV by executing a PRV instruction.

Reading the Value Refreshed at the I/O Refresh Timing


The PV that is stored in the following words can be read using the MOVL instruction or other instructions.
Read PV Auxiliary Area word
High-speed counter 0 A271 (upper digits) and A270 (lower digits)
High-speed counter 1 A273 (upper digits) and A272 (lower digits)
High-speed counter 2 A317 (upper digits) and A316 (lower digits)
High-speed counter 3 A319 (upper digits) and A318 (lower digits)
High-speed counter 4 A323 (upper digits) and A322 (lower digits)
High-speed counter 5 A325 (upper digits) and A324 (lower digits)

Reading the Value When a Ladder Program is Executed

z Reading the High-speed Counter PV with a PRV Instruction


Execution condition

@PRV
#0010 C1: Port specifier (example for high-speed counter input 0 (fixed))
#0000 C2: Control data (for reading PV)
D100 S: First destination word
15 0

D100 PV data lower bytes


High-speed counter PV that was read
D101 PV data upper bytes

11-12 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-2 High-speed Counter Inputs


11-2-5 Frequency Measurement

Overview
This function measures the frequency of the high-speed counter (input pulses.)
The input pulse frequency can be read by executing the PRV instruction. The measured frequency is
output in 8-digit hexadecimal and expressed in Hz. The frequency measurement function can be used 11
with high-speed counter 0 only.
The frequency can be measured while a high-speed counter 0 comparison operation is in progress.

11-2-5 Frequency Measurement


Frequency measurement can be performed at the same time as functions such as the high-speed
counter and pulse output without affecting the performance of those functions.

z Reading the High-speed Counter Frequency with a PRV Instruction


Execution condition

@PRV
#0010 C1: Port specifier (example for high-speed counter input 0 (fixed))
#0013 C2: Control data for reading frequency (10-ms sampling)
D100 S: First destination word
15 0
Present frequency
D100 data lower bytes High-speed counter frequency
D101
Present frequency that was read
data upper bytes

Precautions for Correct Use


The frequency measurement function can be used with high-speed counter 0 only.

z Specifications
Item Specifications
Number of frequency mea- 1 input (high-speed counter 0 only)
surement inputs
Frequency measurement High-speed counter 0:
range Differential phase inputs: 0 to 50 kHz
All other input modes: 0 to 100 kHz
Measurement method Execution of the PRV instruction
Stored data Unit Hz
Output data Differential phase input: 0000 0000 to 0003 0D40 hex (0 to 200 kHz)
range* All other input modes: 0000 0000 to 0001 86A0 hex (0 to 100 kHz)

* If the frequency exceeds the maximum value, the maximum value will be stored.

CP2E CPU Unit Software User’s Manual(W614) 11-13


11 High-speed Counters

11-3 High-speed Counter Interrupts


High-speed counter interrupts can be used with any model of CP2E CPU Unit.

11-3-1 Overview
This function counts input pulses with the CPU Unit’s built-in high-speed counter and executes an inter-
rupt task when the count reaches the preset value or falls within a preset range (target-value or zone
comparison). An interrupt task between 0 and 15 can be allocated with the CTBL instruction.

Rotary Encoder
Built-in input

Present value Present value matches set target value

Time

Interrupt task
Cyclic tasks
(ladder programs) Interrupt occurs Ladder diagram
Cycle
END

END
I/O refresh

Target value comparison Range comparison


The specified interrupt program can be started when the The specified interrupt program can be started when the
present value of the high-speed counter matches a target present value of the high-speed counter enters a set range.
value.

Instruction execution Instruction execution


condition condition

CTBL instruction executed CTBL instruction executed


High-speed High-speed
Counter Unit Counter Unit

High-speed counter PV High-speed counter PV

Target value 1
Target value range
Target value 2
0 0
Time Time
Counting enabled Counting enabled
Cyclic task Interrupted Cyclic task Interrupted Cyclic task Cyclic task Interrupted Cyclic task Interrupted Cyclic task
execution execution execution execution execution execution

Interrupt task Interrupt task Interrupt task Interrupt task


execution execution execution execution

11-14 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-3 High-speed Counter


Flow of Operation

Interrupts
• Enable the required high-speed counters.
PLC Setup • Select the Use high speed counter Check Box for
high-speed counters 0 to 5. Set the input setting,
counting mode and reset method on the Built-in
Tab Page of the PLC Setup using the CX-Pro-
grammer. 11
• Terminals 00 to 06 on the 0CH terminal block can
be used for high-speed counters. High-speed
counters 0 to 5 correspond to terminals 00 to 05.

11-3-1 Overview
2 Interrupt task
Write a program for interrupt tasks 0 to 15.

• Set the comparison values for the high-speed


Create
Execution of CTBL and counter and the interrupt tasks (0 to 15) to be
ladder
INI instructions in a started using the CTBL instruction.
program
cyclic task • Start the comparison using the INI instruction.
The comparison can be started simultaneously
when registering the comparison values using
the CTBL instruction.

z High-speed Counter Interrupts Settings


Setting in PLC Setup Interrupt task
Instruction CTBL port specifier (C1)
on Built-in Input Tab Page number
High-speed counter 0 Select Use Check CTBL #0000 0 to 15 (Specified by
Box. user.)
High-speed counter 1 #0001
High-speed counter 2 #0002
High-speed counter 3 #0003
High-speed counter 4 #0004
High-speed counter 5 #0005

Precautions for Correct Use


A built-in input cannot be used as a normal input, interrupt input, or quick-response input if it is
being used as a high-speed counter input. Refer to 8-3-3 Allocating Built-in Input Terminals for
details.

CP2E CPU Unit Software User’s Manual(W614) 11-15


11 High-speed Counters

PLC Setup
Click the Built-in Input Tab and select the Use high-speed counter Check Box for high-speed counters 0
to 5, and then set the counting mode, reset method, and input setting.

Refer to 11-1-2 Flow of Operation in Page 11-3 for details.

Determining High-speed Counter


High-speed counters 0 to 5 can be used for high-speed counter interrupts.
• Refer to 8-3-3 Allocating Built-in Input Terminals for high-speed counter interrupt.
• Refer to 10-1 Interrupts for the interrupts excluding high-speed counter interrupts.

Writing the Ladder Program

z Writing the Interrupt Task Program


Create programs for interrupt tasks 0 to 15, which are executed for the corresponding high-speed
counter interrupts. Right-click a program in the CX-programmer and select Properties. Select any
interrupt task in the Task type Field of the Program Properties Dialog Box.

11-16 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-3 High-speed Counter


z Execution of CTBL and INI Instructions for Cyclic Task
Execute the instructions in the following order.
Register the comparison table with the CTBL (COMPARISON
Register the comparison table TABLE LOAD) instruction. Specify the interrupt tasks to be

Interrupts
started in this step.

Start comparison with the CTBL (COMPARISON TABLE


Start comparison LOAD) or INI (MODE CONTROL) instruction. Here, high-
speed counter interrupts will be valid.
11

11-3-2 Present Value Comparison


Stop with the INI (MODE CONTROL) instruction.
Stop comparison

Refer to 11-3-2 Present Value Comparison for details.

11-3-2 Present Value Comparison


The comparison of the high-speed counter PV has the following two ways: Target Value Comparison
and Range Comparison.

Target Value Comparison


The specified interrupt task is executed when the high-speed counter PV matches a target value regis-
tered in the table.
• The comparison conditions (target values and counting directions) are registered in the comparison
table along with the corresponding interrupt task number. The specified interrupt task will be exe-
cuted when the high-speed counter PV matches the registered target value.
• Comparison is executed in the order set in the comparison table. Once comparison has cycled
through the comparison table, it will return and wait for a match with the first target value again.

The following examples show the operation of an interrupt task for a comparison table.
Example 1

High-speed counter PV
Comparison table
Number of values = 4
Target value 4 Target value 1 (when counting up)
Target value 3
Comparison is Interrupt task = 0
executed according Target value 2 (when counting up)
to the order of the Interrupt task = 1
Target value 2
values in the table. Target value 3 (when counting up)
Interrupt task = 5
Target value 1 Target value 4 (when counting up)
Interrupt task = 8

Time
Interrupt task number that is started. No.0 No.1 No.5 No.8 No.0

CP2E CPU Unit Software User’s Manual(W614) 11-17


11 High-speed Counters

Example 2

High-speed counter PV
Comparison table
Number of values = 4
Target value 1 Target value 1 (when counting up)
Target value 2
Comparison is Interrupt task = 0
executed according Target value 2 (when counting down)
to the order of the Interrupt task = 1
Target value 3
values in the table. Target value 3 (when counting down)
Interrupt task = 5
Target value 4 Target value 4 (when counting down)
Interrupt task = 8

Time
Interrupt task number that is started. No.0 No.1 No.5 No.8

• Up to 6 target values (between 1 and 6) can be registered in the comparison table.


• A different interrupt task can be registered for each target value.
• If the PV is changed, the changed PV will be compared with the target values in the table, even if the
PV is changed while the target value comparison operation is in progress.

Precautions for Correct Use


• When the count direction (incrementing/decrementing) changes at a PV that matches a target
value or a count after a target value, the next target value cannot be matched in that direction.
Set the target values so that they do not occur at the peak or trough of count value changes.

Bad OK
Match / Target value + 1 Target value + 2

Target value 1 Target value 1

Target value 2 Target value 2

Match / Target value + 1 Target value + 2

• The maximum response frequencies of the high-speed counters are given in the following table.
E/S……-type and
Item N30/40/60 CPU Unit
N4/20 CPU Unit
Incremental pulse 100kHz 100kHz
Up and down pulses
High-speed counter 0
Pulse plus direction
Differential phase (×4) 50kHz 50kHz
Incremental pulse 100kHz 100kHz
Up and down pulses 10kHz
High-speed counter 1
Pulse plus direction 100kHz
Differential phase (×4) 5kHz 50kHz
High-speed counter 2 Incremental pulse 10kHz 100kHz
High-speed counter 3 Incremental pulse 10kHz
High-speed counter 4 Incremental pulse
High-speed counter 5 Incremental pulse

11-18 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-3 High-speed Counter


Precautions for Correct Use
• There are restrictions on the maximum response frequencies of the high-speed counters

Interrupts
when using target matching.
Use the counters for target matching under the frequencies in the following table.
If the pulse frequencies input to the high-speed counters are higher than those in the table,
target matching may be omitted.

Enabling/Disabling Counter numbers for


Increment pulse
Pulse plus direction Differential phase (×4)
11
pulse outputs target matching
Up and down pulses
Disabling pulse − 100kHz max. 50kHz max.

11-3-2 Present Value Comparison


outputs or enabling 3-
axes or less pulse out-
puts
Enabling 4-axes pulse Only one point 100kHz max. 50kHz max.
outputs
More than two points 100kHz max. 40kHz max.

• When using target matching, the interval between interrupts for target matches must be
longer than 3 ms plus the sum of execution time for interrupt tasks that may possibly happen
at the same time.
The sum of execution time for interrupt tasks in one cycle is stored in A442.

Range Comparison
The specified interrupt task is executed when the high-speed counter PV is within the range defined by
the upper and lower limit values.
• The comparison conditions (upper and lower limits of the range) are registered in the comparison
table along with the corresponding interrupt task number. The specified interrupt task will be exe-
cuted once when the high-speed counter PV is in the range (Lower limit ≤ PV ≤ Upper limit).

High-speed counter PV Comparison table


Upper limit 1
Upper limit 1 Lower limit 1
Lower limit 1 Interrupt task = 1
Comparison is executed Upper limit 2
regardless of the order of Lower limit 2
the ranges in the table. Interrupt task = 2
Upper limit 2
Lower limit 2

Time
Interrupt task number to execute No.2 No.1 No.1 No.2

• A total of 6 ranges (upper and lower limits) are registered in the comparison table.
• The ranges can overlap.
• A different interrupt task can be registered for each range.
• The counter PV is compared with the 6 ranges once each cycle.
• The interrupt task is executed just once when the comparison condition goes from unmet to met.

CP2E CPU Unit Software User’s Manual(W614) 11-19


11 High-speed Counters

Precautions for Correct Use

When more than one comparison condition is met in a cycle, the first interrupt task in the table
will be executed in that cycle. The next interrupt task in the table will be executed in the next
cycle.

Additional Information

The range comparison table can be used without starting an interrupt task when the comparison
condition is met. The range comparison function can be useful when you just want to know
whether or not the high-speed counter PV is within a particular range.
Use the Range Comparison Condition Met Flags to determine whether the high-speed counter
PV is within a registered range.

11-3-3 High-speed Counter Interrupt Instruction

COMPARISON TABLE LOAD Instruction: CTBL


The CTBL instruction compares the PV of a high-speed counter (0 to 5) to target values or ranges and
executes the corresponding interrupt task (0 to 15) when the specified condition is met.

Execution condition
@CTBL
C1 C1: Port specifier
C2 C2: Control data
S S: First comparison table word

Operand Settings
C1 Port specifier #0000 High-speed counter 0
~
~

#0005 High-speed counter 5


C2 Control data #0000 Registers a target-value comparison table and starts the com-
parison operation.
#0001 Registers a range comparison table and starts the comparison
operation.
#0002 Registers a target-value comparison table.
#0003 Registers a range comparison table.
S First compari- Specifies the first word address of the comparison table, which is described
son table word below.

11-20 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-3 High-speed Counter


z Contents of the Comparison Table
• Target-value Comparison Table
Depending on the number of target values in the table, the target-value comparison table requires
a continuous block of 4 to 19 words.

Interrupts
15 0
S Number of target values 0001 to 0006 hex (1 to 6 target values)

S+1 Lower word of target value 1


00000000 to FFFFFFFF hex
S+2 Upper word of target value 1 11
S+3 Interrupt task number for target value 1

11-3-3 High-speed Counter Interrupt Instruction


S+16 Lower word of target value 6
00000000 to FFFFFFFF hex
S+17 Upper word of target value 6
S+18 Interrupt task number for target value 6

Interrupt Task Number


15 14 12 11 87 4 3 0
0 0 0 0

Interrupt task number


Direction 00 to 0F hex (0 to 15)
OFF: Incrementing,
ON: Decrementing

• Range Comparison Table


The range comparison table requires a continuous block of 30 words for comparison conditions 1
to 6 require 5 words each (two words for the upper range value, two words for the lower range
value, and one word for the interrupt task number).

15 0
S Lower word of range 1 lower limit
0000 0000 to FFFF FFFF hex (See note.)
S+1 Upper word of range 1 lower limit
S+2 Lower word of range 1 upper limit
0000 0000 to FFFF FFFF hex (See note.)
S+3 Upper word of range 1 upper limit
Range 1 interrupt task number

S+25 Lower word of range 6 lower limit


0000 0000 to FFFF FFFF hex (See note.)
S+26 Upper word of range 6 lower limit
S+27 Lower word of range 6 upper limit
0000 0000 to FFFF FFFF hex (See note.)
S+28 Upper word of range 6 upper limit
S+29 Range 6 interrupt task number

Interrupt task number


0000 to 000F hex: Interrupt task number 0 to 15
AAAA hex: Do not execute interrupt task.
FFFF hex: Ignore the settings for this range.

Note Always set the upper limit greater than or equal to the lower limit for any one range.

MODE CONTROL Instruction: INI


The INI instruction is used for the following items.
• Starting and stopping comparison with the high-speed counter comparison table
Use the CTBL instruction to register the target value or range comparison table before using INI to
start or stop comparison.
If the comparison is started simultaneously when registering the comparison table and then the
high-speed counter interrupts are always valid, the INI instruction is not required.

CP2E CPU Unit Software User’s Manual(W614) 11-21


11 High-speed Counters

• Changing the PV of a High-speed Counter

Execution condition
@INI
C1 C1: Port specifier
C2 C2: Control data
S S: First word of new PV

Operand Settings
C1 Port specifier #0010 High-speed counter 0

~
~
#0015 High-speed counter 5
C2 Control data #0000 Start comparison.
#0001 Stop comparison.
#0002 Change the PV.
S First word of S contains the first word of the new PV when C is set to #0002
new PV (change the PV).

Example 1: Target Value Comparison


In this example, high-speed counter 0 operates in linear mode and starts interrupt task 10 when the
PV reaches 30,000 (0000 7530 hex) and starts interrupt task 11 when the PV reaches 20,000 (0000
4E20 hex).

1 Set high-speed counter 0 in the PLC Setup's Built-in Input Tab.


Item Setting
High-speed counter 0 Use counter
Counting mode Linear mode
Circular Max. Count −
Reset method Software reset
Input Setting Up/Down inputs

2 Set the target-value comparison table in words D1000 to D1006.


Word Setting Function
D1000 #0002 Number of target values = 2
D1001 #7530 Rightmost 4 digits of the target value 1 data (30000) Target value =
D1002 #0000 Leftmost 4 digits of the target value 1 data (30000) 30,000(0000 7530 hex)
D1003 #000A Target value 1
Bit 15: 0 (incrementing)
Bits 00 to 07: A hex (interrupt task number 10)
D1004 #4E20 Rightmost 4 digits of the target value 2 data (20000) Target value =
D1005 #0000 Leftmost 4 digits of the target value 2 data (20000) 20,000(0000 4E20 hex)
D1006 #800B Target value 2
Bit 15: 1 (decrementing)
Bits 00 to 07: B hex (interrupt task number 11)

3 Create the programs for interrupt tasks 10 and 11.

11-22 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-3 High-speed Counter


4 Use the CTBL instruction to start the comparison operation with high-speed counter 0 and inter-
rupt tasks 10 and 11.

W0.00

Interrupts
@CTBL
#0000 Use high-speed counter 0.
#0000 Register a target-value comparison
D1000 table and start comparison operation.
First comparison table word. 11
When execution condition W0.00 turns ON, the comparison starts with high-speed counter 0.

11-3-3 High-speed Counter Interrupt Instruction


When the PV of high speed counter 0 reaches 30,000, cyclic task execution is interrupted, and
interrupt task 10 is executed.
When the PV of high speed counter 0 reaches 20,000, cyclic task execution is interrupted, and
interrupt task 11 is executed.
When interrupt task 10 or 11 execution has been completed, execution of the interrupted cyclic
task resumes.

W0.00

0.00

0.01

Upper limit: 30,000 (7530 Hex)


High-speed counter 0 PV
(in A270 and A271)
Lower limit: 20,000 (4E20 Hex)

Counting enabled

Cyclic task Processing Cyclic task Processing Cyclic task


execution interrupted execution interrupted execution

Interrupt task Interrupt task


10 execution 11 execution

Example 2: Range Comparison


In this example, high-speed counter 1 operates in circular (ring) mode and starts interrupt task 12
when the PV is between 25,000 (0000 61A8 hex) and 25,500 (0000 639C hex).
The maximum ring count is set to 50,000 (0000 C350 hex).

1 Set high-speed counter 1 on the PLC Setup’s Built-in Input Tab Page.
Item Setting
High-speed counter 1 Use counter
Counting mode Circular mode
Circular Max. Count 50,000
Reset method Software reset (continue comparing)
Input Setting Up/Down inputs

CP2E CPU Unit Software User’s Manual(W614) 11-23


11 High-speed Counters

2 Set the range comparison table starting at word D2000. Even though range 1 is the only range
being used, all 30 words must still be dedicated to the range comparison table.
Word Setting Function
D2000 #61A8 Rightmost 4 digits of range 1 lower Lower limit value: 25,000
limit
D2001 #0000 Leftmost 4 digits of range 1 lower limit
D2002 #639C Rightmost 4 digits of range 1 upper Upper limit value: 25,500
limit
D2003 #0000 Leftmost 4 digits of range 1 upper limit
D2004 #000C Range 1 interrupt task number = 12 (C hex)
D2005 All Range 2 lower and upper limit values Range 2 settings
to #0000 (Not used and do not need to be set.)
D2008
D2009 #FFFF Disables range 2.

D2014 #FFFF ~
Set the fifth word for ranges 3 to 6 (listed at left) to #FFFF (Range
D2019 settings are invalid) to disable those ranges.
D2024
D2029

3 Create the program for interrupt task 12.

4 Use the CTBL instruction to start the comparison operation with high-speed counter 1 and inter-
rupt task 12.

W0.00

@CTBL
#0001 Use high-speed counter 1.
#0001 Register a range comparison table
D2000 and start comparison operation.
First comparison table word.

When execution condition W0.00 turns ON, the comparison starts with high-speed counter 1.
When the PV of high speed counter 1 is between 25,000 and 25,500, cyclic task execution is
interrupted, and interrupt task 12 is executed.
When interrupt task 12 execution is completed, execution of the interrupted cyclic task resumes.

W0.00

0.02

0.03
High-speed counter 1 PV
(in A272 and A273)

Upper limit: 25,500 (639C hex)

Lower limit: 25,000 (61A8 hex)

Counting enabled

Cyclic task Processing Cyclic task Processing Cyclic task


execution interrupted execution interrupted execution

Interrupt task Interrupt task


12 execution 12 execution

11-24 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-4 Related Auxiliary Area Bits


11-4 Related Auxiliary Area Bits and Words

and Words
Bits and Words Allocated in the Auxiliary Area
High- High- High- High- High- High-
Contents speed speed speed speed speed speed
counter 0 counter 1 counter 2 counter 3 counter 4 counter 5
11
High-speed Leftmost 4 digits A271 A273 A317 A319 A323 A325
counter PV Rightmost 4 digits A270 A272 A316 A318 A322 A324
storage

11-3-3 High-speed Counter Interrupt Instruction


words
Range Range 1 Compari- A274.00 A275.00 A320.00 A321.00 A326.00 A327.00
Comparison son Condition Met
Condition Flag (ON for
Met Flags match.)
Range 2 Compari- A274.01 A275.01 A320.01 A321.01 A326.01 A327.01
son Condition Met
Flag (ON for
match.)
Range 3 Compari- A274.02 A275.02 A320.02 A321.02 A326.02 A327.02
son Condition Met
Flag (ON for
match.)
Range 4 Compari- A274.03 A275.03 A320.03 A321.03 A326.03 A327.03
son Condition Met
Flag (ON for
match.)
Range 5 Compari- A274.04 A275.04 A320.04 A321.04 A326.04 A327.04
son Condition Met
Flag (ON for
match.)
Range 6 Compari- A274.05 A275.05 A320.05 A321.05 A326.05 A327.05
son Condition Met
Flag (ON for
match.)
Comparison ON when a com- A274.08 A275.08 A320.08 A321.08 A326.08 A327.08
In-progress parison operation
Flags is being executed
for the high-speed
counter.
Overflow/ ON when an over- A274.09 A275.09 A320.09 A321.09 A326.09 A327.09
Underflow flow or underflow
Flags has occurred in
the high-speed
counter’s PV.
Count Direc- 0: Decrementing A274.10 A275.10 A320.10 A321.10 A326.10 A327.10
tion Flags 1: Incrementing
High-speed ON at a software A531.00 A531.01 A531.02 A531.03 A531.04 A531.05
Counter reset
Reset Flags

CP2E CPU Unit Software User’s Manual(W614) 11-25


11 High-speed Counters

11-5 Application Example

Using a Rotary Encoder to Measure Positions

z Functions Used: High-speed Counting for a Built-in Input


A high-speed counter input can be used by connecting a rotary encoder to a built-in input. A CP2E
CPU Unit is equipped with more than one high-speed counter input, making it possible to control
devices for multiple axes with a single PLC.
High-speed counters can be used for high-speed processing, using either target value comparison
or range comparison to create interrupts. Interrupt tasks are executed when the counter value
reaches a specific target value or range.

z Operation Overview
A sheet feeder is controlled to feed constant lengths in a given direction, e.g., for vacuum packing of
food products.

Motor speed

Motor start input:


CIO 0.02
Motor run output:
CIO 100.00
Motor low speed
output: CIO 100.01
Normal stop position
output: CIO 100.02
Error stop position
output: CIO 100.03

3550
Number of pulses 3500
counted by high- 3000
speed counter (Pulses)
(A270)

The High-speed Counter Reset Bit


(A531.00) is turned ON in the ladder
program as soon a operation starts
and the reset process is performed.

While the pulse count is between 3,500 and 3,550, normal stop position output (CIO 100.02) will be
ON. If the pulse count exceeds 3550, the error stop position output (CIO 100.03) will turn ON.

11-26 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-5 Application Example


z System Configuration

Wiring Example

Encoder (power Black Phase A


supply: 24 VDC)

White Phase B

Orange Phase Z

Brown
11
Example: E6B2-CWZ6C
NPN open-collector output Blue

24 VDC
power supply
Start motor
100 to 240 VAC

CP2E-N20DR-A

Motor running: CIO 100.00


Error stop
Motor low speed output: CIO 100.01 position output:
CIO 100.03
(indicator)
Example: Inverter
Normal stop
position output:
CIO 100.02
(indicator)

PLC Setup
Use the following procedure to enable high-speed counter 0.

1 Open the PLC Settings Dialog Box.

2 Click the Built-in Input Tab.

CP2E CPU Unit Software User’s Manual(W614) 11-27


11 High-speed Counters

3 Select the Use high speed counter 0 Check Box for high-speed counter 0.

4 Select Linear Mode for the counting mode.

5 Select Software reset (comparing) for the reset method.

6 Select Differential phase input for the input setting.

7 Close the PLC Settings Dialog Box.

8 Restart the PLC.


The changes made to the PLC Setup is applied.

z Programming Example 1
In this example, the CTBL (COMPARISON TABLE LOAD) instruction is used to create an interrupt
when the target value is reached. Slowing and stopping are executed as interrupt tasks, allowing
high-speed processes to be executed without affecting the cycle time.

Ladder Program
Use the CTBL instruction to execute interrupt tasks when the target positions are reached.

Reset with motor stopped


Motor start

The High-speed Counter Reset


Bit 0 is turned ON and the reset
process is performed

Specifies high-speed counter 0


Specifies comparision with target
values and starts comparison
First word of comparision table

Turns ON motor run output

After motor stops, the stop position is checked.


The stop position is normal if the
present value of the high-speed
counter (A270) is between 3500
Motor stopped Normal stop (0DAC hex) and 3550 (0DDE hex).
&3500 &3550 position

The stop position is in error if


the present value of the high-
speed counter (A270) is
Error stop
greater than 3550 (0DDE hex).
position
&3550

11-28 CP2E CPU Unit Software User’s Manual(W614)


11 High-speed Counters

11-5 Application Example


When the PV of the high-speed counter matches target value 1 (3000), interrupt task 4 is executed.

Interrupt task 4
Turns ON the motor
low speed output

When the present vale of the high-speed counter matches target value 2 (3500), interrupt task 5 is 11
executed.

Turns OFF the


motor run output

Interrupt task 5
Turns OFF the motor
low speed output

Turns OFF the motor


stopped output

DM Area Setup
The comparison table for the CTBL (COMPARISON TABLE LOAD) instruction is set in D600 through
D606.
Word Value Contents
D600 0002 Number of target values: 2
D601 0BB8 Target value 1: 3000 (BB8 hex)
D602 0000
D603 0004 Target value 1: Interrupt task No.4
D604 0DAC Target value 2: 3500 (DAC hex)
D605 0000
D606 0005 Target value 2: Interrupt task No.5

CP2E CPU Unit Software User’s Manual(W614) 11-29


11 High-speed Counters

11-30 CP2E CPU Unit Software User’s Manual(W614)


12
Pulse Outputs
This section describes positioning functions such as trapezoidal control, jogging, and
origin searches.

12-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3


12-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
12-1-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
12-1-3 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-15
12-2 Positioning Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
12-2-1 Positioning Control Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
12-2-2 Relative Positioning and Absolute Positioning . . . . . . . . . . . . . . . . . . . . . . . 12-16
12-2-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-18
12-3 Jogging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20
12-3-1 High-speed Jogging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20
12-3-2 Low-speed Jogging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20
12-3-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-20
12-4 Implementing Interrupt Feeding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
12-4-1 Interrupt Feeding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
12-4-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
12-4-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-24
12-5 Positioning Linear Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26
12-5-1 Positioning Linear Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-26
12-5-2 Positioning Linear Interpolation Configuration . . . . . . . . . . . . . . . . . . . . . . . 12-27
12-5-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-28
12-6 Defining Origin Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-30
12-6-1 Origin Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-30
12-6-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-31
12-6-3 Settings in PLC Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-31
12-6-4 Origin Search Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-34
12-6-5 Origin Search Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-35
12-6-6 Origin Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-42
12-6-7 Changing the Present Value of the Pulse Output . . . . . . . . . . . . . . . . . . . . . 12-43
12-7 Reading the Pulse Output Present Value . . . . . . . . . . . . . . . . . . . . . . . . . 12-44
12-8 Related Auxiliary Area Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-45

CP2E CPU Unit Software User’s Manual(W614) 12-1


12 Pulse Outputs

12-9 Application Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-46


12-9-1 Vertically Conveying PCBs (Multiple Progressive Positioning). . . . . . . . . . . . 12-46
12-9-2 Feeding Wrapping Material: Interrupt Feeding. . . . . . . . . . . . . . . . . . . . . . . . 12-51
12-10Precautions when Using Pulse Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . 12-59
12-11Pulse Output Pattern. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-64
12-11-1 Speed Control (Continuous Mode). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-64
12-11-2 Positioning Control (Independent Mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-66

12-2 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-1 Overview
Pulse outputs can be used only with the CP2E N/S……-type CPU Unit with transistor outputs.

12-1-1 Overview

12-1 Overview
Pulse outputs can be output from the CPU Unit's built-in outputs using instructions to perform position-
ing or speed control with a servomotor or a stepping motor that accepts pulse inputs. It is also possible
to perform origin searches or origin returns.
zTrapezoidal control
Frequency (speed)
12

12-1-1 Overview
Travel distance
Built-in output

Pulse output Time

zJogging
Frequency (speed)
Servo Drive (or
stepping driver)

Travel distance
Time

Servomotor (or
stepping motor) zOrigin search
Frequency (speed)

Travel distance

Time

Positioning is performed with a servomotor or stepping motor in the following configuration.

CP2E

·Trapezoidal control with a


PLS2 instruction
PLS2

·Jogging with a SPED


Servo Drive (or
instruction
stepping driver)
SPED

·Jogging with an ACC Pulse output


instruction
ACC

Pulse output PV in
Auxiliary Area

·Origin search with ORG Origin input


Origin proximity input instruction (phase-Z)

ORG (Positioning
CW limit input completed)

CCW limit input Error counter


reset

CP2E CPU Unit Software User’s Manual(W614) 12-3


12 Pulse Outputs

Wiring for S……-type CPU Unit


An external power supply is required for S……-type CPU Units when using the PWM output.
Provide a DC24V external power supply to V+ and V- terminals as follows.

Wiring Example
Sinking outputs

L L

V+ 00 01 02

V- COM(V-) COM 03

Although V- and COM(V-) are connected internally, also wire them externally.

Sourcing outputs

L L

V+ 00 01 02

V- COM(V+) COM 03

Although V+ and COM(V+) are connected internally, also wire them externally.
Do not connect an external power supply to N……-type CPU Units.

12-1-2 Flow of Operation

1 PLC Setup
• Setting is required for the following situations:
• Performing an origin search.
• Using the Limit Input Signal as an input to func-
tions other than origin searches.

2 Create ladder Cyclic task,


Execute instructions related to pulse control.
Set pulse output 0 to 03, and whether to use termi-
program interrupt task nals 00 and 02, or 01 and 03 on the CIO 100 and
CIO 101 terminal blocks for pulse outputs.

12-4 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

PLC Setup
To perform an origin search or to use a Limit Input Signal as an input to a function other than origin
search, set the parameters on the Pulse Output 0 to 3 Tab Pages in the PLC Setup.

12-1 Overview
12

12-1-2 Flow of Operation


Pulse Output 0 to 3 Tab Page
Item Setting Description
Base Undefined Origin Hold When a Limit Input Signal is input, the pulse output is
Settings stopped and the previous status is held.
Undefined When a Limit Input Signal is input, the pulse output is
stopped and origin becomes undefined.
Limit Input Signal Search Only The CW/CCW Limit Input Signal is used for origin
Operation searches only.
Always The CW/CCW Limit Input Signal is used by functions
other than origin search.
Limit Input Signal NC Select when using NC contact (b contact) for the Limit
Input Signal.
NO Select when using NO contact (a contact) for the Limit
Input Signal.
Search/Return Ini- Set the motor’s starting speed when performing an origin search. Specified in
tial Speed pulses per second (pps).

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the pulse output
settings.
Refer to 12-6 Defining Origin Position for origin search settings in the PLC Setup.

CP2E CPU Unit Software User’s Manual(W614) 12-5


12 Pulse Outputs

Setting the Pulse Output Port Number, Assigning Pulse Output


Terminals, and Wiring
z Pulse Output Method
Only the following pulse output plus a direction output can be used as the pulse output method.

Pulses

Direction ON (=CW) OFF (=CCW)

z Pulse Output Port Number and Output Terminals


The following terminals are used for pulse outputs according to the pulse output port number.
Output terminal Other functions that cannot be
Pulse output method
block used at the same time
Terminal
Terminal
block Pulse plus direction Normal output PWM output
number
label
CIO 100 00 Pulse output 0, pulse Normal output 0 −
01 Pulse output 1, pulse Normal output 1 PWM output
02 Pulse output 0, direction Normal output 2 −
03 Pulse output 1, direction Normal output 3 −
CIO 101 00 Pulse output 2, pulse Normal output 8 −
01 Pulse output 3, pulse Normal output 9 −
02 Pulse output 2, direction Normal output 10 −
03 Pulse output 3, direction Normal output 11 −

12-6 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Origin Searches
Use the following input and output terminals for origin searches.

Input Terminals
• N20/30/40/60 or S30/40/60 CPU Units
Input terminal block Setting in PLC Setup Other functions that cannot be used at the same time

12-1 Overview
High-speed
Terminal counter setting
Terminal Enable origin searches Normal Interrupt Quick-response
block
number for pulse outputs 0 to 3 inputs inputs inputs Increment
label
pulse input
CIO 0 06 Pulse 0, Origin input signal Normal Interrupt Quick-response High-speed
input 6 input 6 input 6 counter 5 12
07 Pulse 1, Origin input signal Normal Interrupt Quick-response −
input 7 input 7 input 7

12-1-2 Flow of Operation


08 Pulse 2, Origin input signal Normal Interrupt Quick-response −
(Note 1) input 8 input 8 input 8 (Note 2)
(Note 2)
09 Pulse 3, Origin input signal Normal Interrupt Quick-response −
(Note 1) input 9 input 9 input 9 (Note 2)
(Note 2)
10 Pulse 0, Origin proximity Normal − − −
input signal input 10
11 Pulse 1, Origin proximity Normal − − −
input signal input 11
CIO 1 00 Pulse 2, Origin proximity Normal − − −
input signal (Note 1) input 12
01 Pulse 3, Origin proximity Normal − − −
input signal (Note 1) input 13

Note 1 Only supported by N30/40/60 CPU Units.


2 Only supported by N20/30/40/60 CPU Units.
• N14 CPU Units
Input terminal block Setting in PLC Setup Other functions that cannot be used at the same time
High-speed
Terminal
Terminal Enable origin searches Normal Interrupt Quick-response counter setting
block
number for pulse outputs 0 and 1 inputs inputs inputs Increment
label
pulse input
CIO 0 03 Pulse 0, Origin proximity Normal Interrupt Quick-response −
input signal input 3 input 3 input 3
: :
05 Pulse 1, Origin proximity Normal Interrupt Quick-response High-speed
input signal input 5 input 5 input 5 counter 4
06 Pulse 2, Origin input signal Normal Interrupt Quick-response High-speed
input 6 input 6 input 6 counter 5
07 Pulse 3, Origin input signal Normal Interrupt Quick-response −
input 7 input 7 input 7

CP2E CPU Unit Software User’s Manual(W614) 12-7


12 Pulse Outputs

Output Terminals
Other functions that cannot
Output terminal block Setting in PLC Setup
be used at the same time
Terminal Terminal Enable origin searches for pulse
Normal outputs
block label number outputs 0 and 1
CIO 100 04 Pulse 0, Error counter reset output Normal output 4 (Note 2)
05 Pulse 1, Error counter reset output Normal output 5 (Note 2)
06 Pulse 2, Error counter reset output (Note 1) Normal output 6
07 Pulse 3, Error counter reset output (Note 1) Normal output 7

Note 1 Only supported by N30/40/60 CPU Units.


2 When the origin search is in operating mode 0, normal output 4 and 5 can be used at the same time.

Connecting the Servo Drive and External Sensors


z Connections for Pulse Output 0
Terminal block Origin search
Terminal Terminal Addresses Signal
block Operating mode 0 Operating mode 1 Operating mode 2
label number

CIO 100 00 CIO 100.00 Stored in A276 Pulse Connect to Servo Drive’s pulse input (PULS).
and A277.
02 CIO 100.02 Direction Connect to Servo Drive’s direction input (SIGN).
Normal input The external signal must be CW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A540.08 in the
ladder program.
Normal input The external signal must be CCW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A540.09 in the
ladder program.
CIO 0 03 CIO 0.03 Origin prox- Connect to sensor for N14 CPU Unit.
imity input
06 CIO 0.06 Origin input Connect to open- Connect to the Connect to the
collector output phase-Z signal from phase-Z signal from
from sensor or the Servo Drive. the Servo Drive.
other device.
10 CIO 0.10 Origin prox- Connect to sensor for N20/30/40/60 CPU Unit.
imity input
CIO 100 04 CIO 100.04 Error Not used. Connect to error counter reset (ECRST)
counter of the Servo Drive.
reset output
Normal input The external signal must be Positioning Not used. Connect the Posi-
received as an input and completed tioning Completed
the input status must be input Signal (INP) from the
written to A540.10 in the Servo Drive to a nor-
ladder program. mal input terminal.

12-8 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Connections for Pulse Output 1


Terminal block Origin search
Terminal Addresses Signal
Terminal
block Operating mode 0 Operating mode 1 Operating mode 2
number
label
CIO 100 01 CIO 100.01 Stored in A278 Pulse Connect to Servo Drive’s pulse input (PULS).
and A279

12-1 Overview
03 CIO 100.03 Direction Connect to Servo Drive’s direction input (SIGN).
Normal input The external signal must be CW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A541.08 in the
ladder program.
Normal input The external signal must be CCW limit Connect sensor to a normal input terminal.
received as an input and
the input status must be
sensor 12
written to A541.09 in the
ladder program.

12-1-2 Flow of Operation


CIO 0 05 CIO 0.05 Origin prox- Connect to sensor for N14 CPU Unit.
imity input
07 CIO 0.07 Origin input Connect to open- Connect to the Connect to the
collector output phase-Z signal phase-Z signal
from sensor or from the Servo from the Servo
other device. Drive. Drive.
11 CIO 0.11 Origin prox- Connect to sensor for N20/30/40/60 CPU Unit.
imity input
CIO 100 05 CIO 100.05 Error counter Not used. Connect to error counter reset (ECRST)
reset output of the Servo Drive.
Normal input The external signal must be Positioning Not used. Connect the Posi-
received as an input and completed tioning Completed
the input status must be input Signal (INP) from
written to A541.10 in the the Servo Drive to
ladder program. a normal input ter-
minal.

z Connections for Pulse Output 2 (Only for N30/40/60 CPU Units)


Terminal block Origin search
Terminal Addresses Signal
Terminal
block Operating mode 0 Operating mode 1 Operating mode 2
number
label
CIO 101 00 CIO 101.01 Stored in A52 Pulse Connect to Servo Drive’s pulse input (PULS).
and A53.
02 CIO 101.02 Direction Connect to Servo Drive’s direction input (SIGN).
Normal input The external signal must be CW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A542.08 in the
ladder program.
Normal input The external signal must be CCW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A542.09 in the
ladder program.
CIO 0 08 CIO 0.08 Origin input Connect to open- Connect to the Connect to the
collector output phase-Z signal phase-Z signal
from sensor or from the Servo from the Servo
other device. Drive. Drive.
CIO 1 00 CIO 1.00 Origin prox- Connect to sensor
imity input
CIO 100 06 CIO 100.06 Error counter Not used. Connect to error counter reset (ECRST)
reset output of the Servo Drive.
Normal input The external signal must be Positioning Not used. Connect the Posi-
received as an input and completed tioning Completed
the input status must be input Signal (INP) from
written to A542.10 in the the Servo Drive to
ladder program. a normal input ter-
minal.

CP2E CPU Unit Software User’s Manual(W614) 12-9


12 Pulse Outputs

z Connections for Pulse Output 3 (Only for N30/40/60 CPU Units)


Terminal block Origin search
Terminal Addresses Signal
Terminal
block Operating mode 0 Operating mode 1 Operating mode 2
number
label
CIO 101 01 CIO 101.01 Stored in A54 Pulse Connect to Servo Drive’s pulse input (PULS).
and A55.
03 CIO 101.03 Direction Connect to Servo Drive’s direction input (SIGN).
Normal input The external signal must be CW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A543.08 in the
ladder program.
Normal input The external signal must be CCW limit Connect sensor to a normal input terminal.
received as an input and sensor
the input status must be
written to A543.09 in the
ladder program.
CIO 0 09 CIO 0.09 Origin input Connect to open- Connect to the Connect to the
collector output phase-Z signal phase-Z signal
from sensor or from the Servo from the Servo
other device. Drive. Drive.
CIO 1 01 CIO 1.01 Origin prox- Connect to sensor
imity input
CIO 100 07 CIO 100.07 Error counter Not used. Connect to error counter reset (ECRST)
reset output of the Servo Drive.
Normal input The external signal must be Positioning Not used. Connect the Posi-
received as an input and completed tioning Completed
the input status must be input Signal (INP) from
written to A543.10 in the the Servo Drive to
ladder program. a normal input ter-
minal.

12-10 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Pulse Output Wiring


N……-type (Example: Sinking outputs)

24-VDC
CP2E CPU Unit built-in output terminals power
supply
+ - Servo Drive for 24-VDC input

12-1 Overview
PULS
(+)
PULS
100.00
100.01 (-)

Pulse output SGN

(+)
SGN 12
100.02
100.03 (-)

Direction output

12-1-2 Flow of Operation


COM

Instruction pulse mode = feed pulse


and forward/reverse signal

S……-type (Example: Sinking outputs)


It is necessary to wire an external power supply to S……-type CPU Units.
Connect a DC24V external power supply between V+ and V- in order to use terminals 00 and 01 on
terminal block CIO 100.
Note COM corresponding to CIO 100.00 and CIO 100.01 has been internally connected with V- for sinking
output models, with V+ for sourcing output models.

24-VDC
CP2E CPU Unit built-in output terminals power
supply
+ - Servo Drive for 24-VDC input
V+

PULS
(+)
PULS
100.00
100.01 (-)

Pulse output SGN

(+)
SGN
100.02
100.03 (-)

Direction output
COM

V-

Instruction pulse mode = feed pulse


and forward/reverse signal

CP2E CPU Unit Software User’s Manual(W614) 12-11


12 Pulse Outputs

Connecting to OMRON Servo Drives


Use the following cables to connect to an OMRON Servo Drive.
Cable mode: † Indicates the cable length
OMRON Servo Drive
(1m or 2m)
G5 Series General-purpose Input Type (R88D-KT) R88A-CPG†††S

Set the Servo Drive’s command pulse mode to feed pulse and forward/reverse signals because the
method of pulse output from a CP2E CPU Unit is pulse + direction.

z Connecting to a G5-series Servo Drive


Origin Search: Operating Mode 1
CP2E N/S-type CPU Unit (Sinking outputs)

G5-series R88D-KT
Output terminal block R88A-CPGS PIN Signal
Pulse output (CIO 100.00) 1 +24VCW
Pulse 4 -PULS
output 0 Direction output (CIO 100.02) 2 +24VCCW
6 -SIGN

Error counter reset output 0 (CIO 100.04) 3 ECRST

COM
V+ (S-type only)
V- (S-type only)
Input terminal block 25 ZGND
Pulse 0 origin input signal (CIO 0.06) 19 Z
COM 7 +24VIN
24-VDC Servo Drive
RUN input X1
Pulse 0 origin proximity input signal (CIO 0.10) 29 RUN

36 ALMCOM
10 BKIRCOM
X1 37 /ALM
24-VDC
XB 11 BKIR

Hood FG

Only S††-type CPU Units can wire V+ and V-. Do not wire them in N††-type CPU Units.

12-12 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

R88A-CPG†††S Cables for G5-series Servo Drives


Wire Wire
No. Symbol No. Symbol
Mark Colors Mark Colors
1 Orange/Red (1) +24VCW 26 White/Red (3) SI3
2 Orange/Black (1) +24VCCW 27 Pink/Black (3) SI4
3 Gray/Red (1) +CW/+PULS/+FA 28 White/Black (3) SI5

12-1 Overview
4 Gray/Black (1) -CW/-PULS/-FA 29 Yellow/Red (3) SI6
5 White/Red (1) +CCW/+SIGN/+FB 30 Pink/Red (3) SI7
6 White/Black (1) -CCW/-SIGN/-FB 31 Yellow/Black (3) SI8
7 Yellow/Red (1) +24VIN 32 Gray/Black (4) SI9
8 Pink/Red (1) SI1 33 Orange/Red (4) SI10
9 Pink/Black (1) SI2 34 White/Red (4) SO2- 12
10 Orange/Red (2) SO1- 35 White/Black (4) SO2+
11 Orange/Black (2) SO1+ 36 Yellow/Red (4) ALMCOM

12-1-2 Flow of Operation


12 Yellow/Black (1) - 37 Yellow/Black (4) /ALM
13 Gray/Black (2) SENGND 38 Pink/Red (4) SO4-
14 White/Red (2) REF/TREF1/VLIM 39 Pink/Black (4) SO4+
15 White/Black (2) AGND1 40 Gray/Red (4) -
16 Yellow/Red (2) PCL/TREF2 41 Orange/Black (4) -

Yellow/Black (2) 42 Gray/Red (5) BAT


17 AGND2
Pink/Black (2) 43 Gray/Black (5) BATGND
18 Pink/Red (2) NCL 44 White/Red (5) +CWLD
19 Orange/Red (2) Z 45 White/Black (5) -CWLD
20 Gray/Red (2) SEN 46 Yellow/Red (5) +CCWLD
21 Orange/Red (3) +A 47 Yellow/Black (5) -CCWLD
22 Orange/Black (3) -A 48 Pink/Black (5) -B
23 Gray/Red (3) +Z 49 Pink/Red (5) +B
24 Gray/Black (3) -Z 50 - -
25 Orange/Black (5) ZGND Hood - FG

10150-3000PE Connector Plug (3M)


10350-52A0-008 Connector Plug (3M)
AWG24 × 25P UL20276 Cable
Each twisted pair has wires of the same color and number of marks.
Example: Orange/Red (1) and Orange/Black (1) are twisted pair cables

CP2E CPU Unit Software User’s Manual(W614) 12-13


12 Pulse Outputs

Executing Pulse Control Instructions in a Ladder Program


The pulse outputs are used by executing pulse control instructions in the ladder program.

z Applicable Instructions
The following instructions are used.
Purpose Overview Instruction Reference
Performing trapezoidal control Performs trapezoidal pulse output PLS2: PULSE Refer to 12-2
control with independent accelera- OUTPUT
tion and deceleration rates.
(The number of pulses can be set.)
Jogging Without acceleration Performs pulse output control without SPED: SPEED Refer to 12-3
and deceleration acceleration or deceleration. OUTPUT
With acceleration Performs trapezoidal pulse output ACC:
and deceleration control with the same acceleration ACCELERATION
and deceleration rates. CONTROL
Performing interrupt feeding Performs interrupt feeding with inter- IFEED: INTERRUPT Refer to 12-4
rupt input and pulse output. FEEDING
Positioning Linear Interpolation Performs 2-axis to 4-axis linear inter- ITPL: LINEAR Refer to 12-5
polation. INTERPOLATION
Performing origin searches Actually moves the motor with pulse ORG: ORIGIN Refer to 12-6-4
outputs and defines the machine ori- SEARCH
gin based on the Origin Proximity
Input and Origin Input signals.
Performing origin returns Returns to the origin position from ORG: ORIGIN Refer to 12-6-6
any position. SEARCH
Changing or reading the pulse Changes the PV of the pulse output. INI: MODE Refer to 12-6-7
output PV (This operation defines the origin CONTROL
location.)
Reads the PV of the pulse output. PRV: HIGH-SPEED Refer to 12-7
COUNTER PV READ

z Outputting to the Auxiliary Area Using the OUT Instruction


The OUT instruction in the ladder program is used to write signals received from the CW limit sensor
and CCW limit sensor connected to normal inputs to the Auxiliary Area bits.
Normal input from CW Limit Input Signal
CW limit sensor A540.08, A541.08,
A542.08 or A543.08

Normal input from CCW Limit Input Signal


CCW limit sensor A540.09, A541.09,
A542.09 or A543.09

Bits Written in the Auxiliary Area


Auxiliary Area
Name
Word Bit
A540 08 Pulse Output 0 CW Limit Input Signal Signals must be received from exter-
09 Pulse Output 0 CCW Limit Input Signal nal sensors connected to normal
A541 08 Pulse Output 1 CW Limit Input Signal inputs and then written to the Auxil-
09 Pulse Output 1 CCW Limit Input Signal iary Area by the user program.
A542 08 Pulse Output 2 CW Limit Input Signal
09 Pulse Output 2 CCW Limit Input Signal
A543 08 Pulse Output 3 CW Limit Input Signal
09 Pulse Output 3 CCW Limit Input Signal

12-14 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-1-3 Specifications
Item Specifications
Output mode Continuous mode (for speed control) or independent mode (for position con-

12-1 Overview
trol)
Positioning (independent mode) instruc- PULS and SPED, PULS and ACC, or PLS2
tions
Speed control (continuous mode) SPED or ACC
instructions
Origin (origin search and origin return) ORG
instructions 12
Interrupt feeding instructions IFEED

12-1-3 Specifications
Linear interpolation instructions ITPL (N††-type CPU Unit only)
Output frequency 1 Hz to 100 kHz (1 Hz units)
S††-type and N14/20 CPU Unit: 2 pulse outputs
N30/40/60 CPU Unit: 4 pulse outputs
Frequency acceleration and decelera- Set in increments of 1 Hz for acceleration/deceleration rates from 1 to 65,535 Hz
tion rates (every 4 ms).
Changing SVs during instruction execu- The target frequency, acceleration/deceleration rate, and target position can
tion be changed.
ORG, IFEED and ITPL instructions cannot be changed.
Duty factor Fixed at 50%
The duty factor is less than 50% only when the output is less than 125 Hz by
linear interpolation.
Pulse output method Pulse + direction outputs (CW/CCW outputs cannot be used.)
Number of output pulses Relative coordinates: 0000 0000 to 7FFF FFFF hex(Accelerating or decelerat-
ing in either direction: 2,147,483,647)
Absolute coordinates: 8000 0000 to 7FFF FFFF hex(-2,147,483,648 to
2,147,483,647)
Pulse output PV’s relative/absolute Absolute coordinates are specified automatically when the origin location has
coordinate specifications been defined by setting the pulse output PV with the INI instruction or perform-
ing an origin search with the ORG instruction. Relative coordinates are used
when the origin location is undefined.
Relative pulse/absolute pulse specifica- The pulse type can be specified with an operand in the PULS or PLS2 instruc-
tions tion.
Only absolute pulse can be specified with linear interpolation (ITPL) instruc-
tion.

Note The absolute pulse specification can be used when absolute coordi-
nates are specified for the pulse output PV, i.e. the origin location has
been defined.The absolute pulse specification cannot be used when rel-
ative coordinates are specified, i.e. the origin location is undefined. An
instruction error will occur.
Pulse output PV’s storage location The following Auxiliary Area words contain the pulse output PVs
Pulse output 0: A277 (leftmost 4 digits) and A276 (rightmost 4 digits)
Pulse output 1: A279 (leftmost 4 digits) and A278 (rightmost 4 digits)
Pulse output 2: A53 (leftmost 4 digits) and A52 (rightmost 4 digits)
Pulse output 3: A55 (leftmost 4 digits) and A54 (rightmost 4 digits)
The PVs are refreshed during regular I/O refreshing.

CP2E CPU Unit Software User’s Manual(W614) 12-15


12 Pulse Outputs

12-2 Positioning Control


This section describes how to use pulse outputs with trapezoidal acceleration and deceleration when
using the PLS2 instruction.

12-2-1 Positioning Control Configuration


If the target frequency, starting frequency, acceleration and deceleration rate, direction are set before-
hand, the following time chart will perform trapezoidal positioning control.
Specify the output waveform in the instruction operands.

Target frequency Acceleration


Deceleration rate
rate

Specified number of
pulses
Starting frequency

Target frequency 1 Hz to 100 kHz (in increments of 1 Hz)


Starting frequency 0 Hz to 100 kHz (in increments of 1 Hz)
Acceleration rate Set in increments of 1 Hz from 1 to 65,535 Hz (every 4 ms).
Deceleration rate Set in increments of 1 Hz from 1 to 65,535 Hz (every 4 ms).
Direction specification Set to CW or CCW.
Specified number of Relative coordinates: 0000 0000 to 7FFF FFFF hex (Incre-
pulses menting and decrementing in each direction: 2,147,483,647)
Absolute coordinates: 8000 0000 to 7FFF FFFF hex
(-2,147,483,648 to 2,147,483,647)

12-2-2 Relative Positioning and Absolute Positioning

z Selecting Relative or Absolute Coordinates


The pulse output PV’s coordinate system (absolute or relative) is selected automatically, as follows:
• When the origin is undefined, the system operates in relative coordinates.
• When the origin has been defined, the system operates in absolute coordinates.
Origin undefined (Origin search
Origin has been Origin has been defined by
has not been performed and PV
Conditions defined by an origin executing the INI instruc-
has not been changed with the
search tion to change the PV
INI instruction.)
Pulse output Absolute coordinates Relative coordinates
PV’s coordinate
system

Refer to 12-6-1 Origin Searches for details.

12-16 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Relationship between the Coordinate System and Pulse Specification


The following table shows the pulse output operation for the four possible combinations of the coor-
dinate systems (absolute or relative) and the pulse output (absolute or relative) specified when the

12-2 Positioning Control


PULS or PLS2 instruction is executed.
Pulse output Relative coordinate system Absolute coordinate system
specified in PULS Origin undefined: Origin defined:
or PLS2 The No-origin Flag will be ON. The No-origin Flag will be OFF.
Relative pulse Positions the system to another position relative to the present position.
specification Number of movement pulses = Number of pulses setting
The pulse output PV after instruction execution = The pulse output PV after instruction
Number of movement pulses = Number of execution = PV + Number of movement
pulses setting pulses. 12
The pulse output PV is reset to 0 just before The following example shows the num-
pulses are output. After that, the specified ber of pulses setting = 100 counterclock-

12-2-2 Relative Positioning and Absolute Positioning


number of pulses is output. wise.
The following example shows the number of Number of pulses setting
pulses setting = 100 counterclockwise.

=
Number of movement
pulses
Number of pulses setting
=

Number of 100
movement pulses Pulse output
0 Target position Present position PV
100 Origin

Target position Present position=0


Pulse output PV Pulse output PV range:
8000 0000 to 7FFF FFFF hex
Pulse output PV range: Number of pulses setting range:
8000 0000 to 7FFF FFFF hex 0000 0000 to 7FFF FFFF hex
Number of pulses setting range:
0000 0000 to 7FFF FFFF hex
Absolute pulse The absolute pulse specification cannot be Positions the system to an absolute
specification used when the origin location is undefined, i.e., position relative to the origin.The num-
when the system is operating in the relative ber of movement pulses and movement
coordinate system. An instruction execution direction are calculated automatically
error will occur. from the present position (pulse output
PV) and target position.
The following example shows the num-
ber of pulses setting = +100.

+100

+200
Pulse output
0 Target position= Present position PV
Number of pulses setting
Origin

Number of movement pulses = Number


of pulses setting − Pulse output PV
when instruction is executed. The move-
ment direction is determined automati-
cally.
Pulse output PV when instruction is exe-
cuted = Number of pulses setting
Pulse output PV range:
8000 0000 to 7FFF FFFF hex
Number of pulses setting range:
8000 0000 to 7FFF FFFF hex

CP2E CPU Unit Software User’s Manual(W614) 12-17


12 Pulse Outputs

Precautions for Correct Use

The absolute pulse cannot be specified with the origin undefined. Please specify them when the
origin is defined by performing the origin searches.

Additional Information

The origin position is undefined in the following case. Please define the origin position by per-
forming the origin searches again.
• When the pulse output reset flag is turned ON
• When the RUN or MONITOR mode is changed to the PROGRAM mode

12-2-3 Application Example

Specifications and Operation


When the start input (CIO 0.00) goes ON, this example program outputs 600,000 pulses from pulse
output 1 to turn the motor.

Target frequency 50,000 Hz Acceleration


rate
300Hz/4ms Deceleration rate
200Hz/4ms
Number of output
pulses
Starting frequency 100Hz 600,000 pulses

Start input 0.00

Applicable Instructions
PLS2

Preparations

z PLC Setup
There are no settings that need to be made in the PLC Setup.

12-18 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z DM Area Settings
• Settings for PLS2 Instruction (D0 to D7)
Setting Address Data

12-2 Positioning Control


Acceleration rate: 300 Hz/4 ms D0 #012C
Deceleration rate: 200 Hz/4 ms D1 #00C8
Target frequency: 50,000 Hz D2 #C350
D3 #0000
Number of output pulses: 600,000 D4 #27C0
pulses D5 #0009
Starting frequency: 100 Hz D6 #0064
D7 #0000
12

12-2-3 Application Example


Ladder Program

0.00
@PLS2
#0001 ← Pulse output 1
Start input
#0100 ← Specifies Pulse + Direction output method, CW, and relative pulses
D0 ← Acceleration rate, deceleration rate, target frequency, number of pulses setting
D6 ← Starting frequency

Additional Information

• Absolute pulses can be specified when the origin position has been defined.
• If a target frequency that cannot be reached has been set, the target frequency will be reduced
automatically, i.e., triangular control will be performed. In some cases where the acceleration
rate is substantially greater than the deceleration rate, the operation will not be true triangular
control. The motor will be operated at a constant speed for a short time between the accelera-
tion and deceleration.

CP2E CPU Unit Software User’s Manual(W614) 12-19


12 Pulse Outputs

12-3 Jogging
Jogging can be performed by using the SPED (SPEED OUTPUT) and ACC (ACCELERATION CON-
TROL) instructions. This section describes the steps for jogging.

12-3-1 High-speed Jogging


Start pulse output with acceleration or deceleration using the ACC instruction. In this case, acceleration
and deceleration rate must be the same. Set the target frequency of the ACC instruction to 0 Hz to stop
the pulse output.

Acceleration
Target frequency and
deceleration
rate

Pulse output started Pulse output stopped

Target frequency Starting pulse output: 1 Hz to 100 kHz (in increments of 1 Hz)
Stopping pulse output: 0 Hz
Acceleration and deceleration rate Set in increments of 1 Hz from 1 to 65,535 Hz (every 4 ms).
Direction specification Set to CW or CCW.
Mode specification Set to continuous mode.

12-3-2 Low-speed Jogging

Start pulse output without acceleration or deceleration using the SPED instruction. Set the target fre-
quency of the SPED instruction to 0 Hz to stop the pulse output.

Target frequency

Pulse output started Pulse output stopped

Target frequency Starting pulse output: 1 Hz to 100 kHz (in increments of 1 Hz)
Stopping pulse output: 0 Hz
Direction specification Set to CW or CCW.
Mode specification Set to continuous mode.

12-3-3 Application Example

Specifications and Operation


The following example shows jogging without acceleration or deceleration executed using a SPED
instruction. It is used for low-speed jogging.
• Clockwise low-speed jogging will be executed from pulse output 1 while CIO 0.00 is ON.
• Counterclockwise low-speed jogging will be executed from pulse output 1 while CIO 0.01 is ON.

12-20 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

CW Target frequency 1,000Hz

Pulse frequency

CCW
CW low-speed jogging (CIO 0.00)

12-3 Jogging
CCW low-speed jogging (CIO 0.01)

The example shows jogging with acceleration and deceleration executed using an ACC instruction. It is
used for high-speed jogging.
• Clockwise high-speed jogging will be executed from pulse output 1 while CIO 0.04 is ON.
12
• Counterclockwise high-speed jogging will be executed from pulse output 1 while CIO 0.05 is ON.

12-3-3 Application Example


CW Target frequency 1,000Hz

Acceleration/
Pulse frequency deceleration rate
100Hz/4ms

Acceleration/
deceleration rate
100Hz/4ms
CCW

CW high-speed jogging (CIO 0.04)

CCW high-speed jogging (CIO 0.05)

Preparations

z PLC Setup
There are no settings that need to be made in the PLC Setup.

z DM Area Settings
• Settings to Control Speed while Jogging (D0 to D1 and D10 to D15)
Setting Address Data
Target frequency (low speed): 1,000 Hz D0 #03E8
D1 #0000
Acceleration rate: 100 Hz/4 ms D10 #0064
Target frequency (high speed): 100,000 Hz D11 #86A0
D12 #0001
Acceleration/deceleration rate: 100 Hz/4 ms D13 #0064
(Not used.)
Target frequency (stop): 0 Hz D14 #0000
D15 #0000

CP2E CPU Unit Software User’s Manual(W614) 12-21


12 Pulse Outputs

Ladder Program

0.00 A281.04
SPED
Low-speed Pulse Output #0001 ← Pulse output 1
#0100 ← Specifies Pulse + Direction output method, CW, and continuous mode.
CW Start in Progress D0 ← Target frequency

SET W0.00
W0.00 0.00
SPED
Low-speed Low-speed #0001
CW Start #0100
CW output #0000
in progress
RSET W0.00
0.01 A281.04
SPED
Low-speed Pulse Output #0001 ← Pulse output 1
CCW Start in Progress #0110 ← Specifies Pulse + Direction output method, CCW, and continuous mode.
D0 ← Target frequency

SET W0.01
W0.01 0.01
SPED
Low-speed Low-speed #0001
CCW output CCW Start #0110
#0000
in progress
RSET W0.01
0.04 A281.04
ACC
High-speed Pulse Output #0001 ← Pulse output 1
CW Start in Progress #0100 ← Specifies Pulse + Direction output method, CW, and continuous mode.
D10 ← Acceleration/deceleration rate and target frequency

SET W0.02
W0.02 0.04
ACC
High-speed High-speed #0001
CW output CW Start #0100
D13
in progress
RSET W0.02
0.05 A281.04
ACC
High-speed Pulse Output #0001 ← Pulse output 1
CCW Start in Progress #0110 ← Specifies Pulse + Direction output method, CCW, and continuous mode.
D10 ← Acceleration/deceleration rate and target frequency

SET W0.03
W0.03 0.05
ACC
#0001
High-speed High-speed
#0110
CCW output CCW Start D13
in progress
RSET W0.03

Additional Information

The PLS2 instruction can be used to set a starting frequency or separate acceleration and decel-
eration rates, but there are limitations on the operating range because the end point must be
specified in the PLS2 instruction.

12-22 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-4 Implementing Interrupt Feeding


12-4 Implementing Interrupt Feeding
This section describes how to use interrupt feeding when using the IFEED instruction.

12-4-1 Interrupt Feeding


Interrupt feeding is performed with the IFEED instruction. IFEED controls interrupt feeding by combin-
ing the specified pulse output and interrupt input. An interrupt input is used as a trigger during speed
control to switch to position control and then move a specified amount before decelerating to a stop.
An interrupt task is not necessary, so no delays are caused by the interrupt startup time or the occur-
rence of other interrupts. The accuracy of feeding after an interrupt input occurs can therefore be 12
improved.

12-4-1 Interrupt Feeding


Pulse frequency

Interrupt input occurs.


Target Specified number of pulses
frequency

Acceleration Speed Deceleration rate


Position
rate control control
Time
IFEED executed

Additional Information

• Only specific pulse outputs and interrupt inputs can be used together.
If you want to pair any other pulse outputs and interrupt inputs, or if you want to change set-
tings during pulse output, use the ACC and PLS2 instructions together.
If the ACC and PLS2 instructions are used, delays will occur for the interrupt startup time and
possibly for other interrupts.
• The IFEED instruction cannot be executed when the pulse output port specified by the axis
specifier of the IFEED instruction is already outputting pulses by the SPED, ACC, PLS2, ORG,
IFEED and ITPL instructions. P_ER flag turns ON.

12-4-2 Flow of Operation

1 PLC Setup
• Select Interrupt Input in the Interrupt Input
Dialog Box that is accessed from the Built-in
Input Tab Page of the PLC Setup using the
CX-Programmer.
2 Create ladder program.
• Set whether to start the interrupt on OFF
transitions or ON transitions in the input
using the MSKS instruction.
• Set pulse output ports 0 to 3, output mode,
output direction, acceleration/deceleration
rate, target frequency, and number of output
pulses.
• Execute the IFEED instruction.

CP2E CPU Unit Software User’s Manual(W614) 12-23


12 Pulse Outputs

12-4-3 Application Example


Pulse output 0 and interrupt input 6 are used.

PLC Setup

Pulse Ouptput Interrupt Input


Pulse Ouptput 0 IN6
Pulse Ouptput 1 IN7
Pulse Ouptput 2* IN8
Pulse Ouptput 3* IN9

* Pulse output 2 and pulse output 3 can be used with N30/40/60 CPU unit.

12-24 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-4 Implementing Interrupt Feeding


Ladder Program
The IFEED instruction is executed after turning interrupt input 6 to OFF with the MSKS instruction.

W0.00
@MSKS
116 Interruptinput 6
#0001 Input signal OFF detection
Execution condition
@IFEED
#0100 Interrupt input 6 and pulse output 0
Pulse + direction and CW direction
#0000
Acceleration rate:
12
D0 First word of D0 #0032
setting table S: 50 Hz/4 ms
S+1: D1 #0014 Deceleration rate:
20 Hz/4 ms

12-4-3 Application Example


S+2: D2 #01F4
Pulse frequency Target frequency:
S+3: D3 #0000 500 Hz
S+4: D4 #0064 Number of output pulses:
Interrupt input 6 occurs. 100 pulses
S+5: D5 #0000
500 Hz 100 pulses

50 Hz/4 ms 20 Hz/4 ms
Speed Position
control control
Time
IFEED executed

Precautions for Correct Use


• Before executing the IFEED instruction, use the MSKS instruction to disable the specified
interrupt if it is currently not masked. An instruction error will occur if the IFEED instruction is
executed when the interrupt is not masked.
• Interrupt inputs 6, 7, 8, and 9 are used with the IFEED instruction. The terminals used for inter-
rupt inputs 6, 7, 8 and 9 are also used for the origin and origin proximity inputs for pulse out-
puts. If the IFEED instruction is used for pulse output, do not use the origin search function.

z Checking Status during Interrupt Feeding


The interrupt feeding status can be read from the following bits.
Pulse Pulse Pulse Pulse
Name Refresh timing
output 0 output 1 output 2 output 3
Interrupt A280.08 A281.08 A56.08 A57.08 • Cleared when power is turned ON.
Feeding In- • Cleared when starting/stopping operation.
progress Flag • Cleared after completing interrupt feeding.
• Turned ON when interrupt input is received
after starting pulse output with IFEED instruc-
tion
Interrupt A280.09 A281.09 A56.09 A57.09 • Cleared when power is turned ON.
Feeding Error • Cleared when operation starts.
Flag • Cleared when IFEED instruction processing is
started.
• Turned ON if an overflow or underflow occurs
when an interrupt input is received, or if an
overflow or underflow occurs while the speci-
fied number of pulses is being moved, after
operation is started with the IFEED instruction
with the origin defined.

CP2E CPU Unit Software User’s Manual(W614) 12-25


12 Pulse Outputs

12-5 Positioning Linear Interpolation


This section describes how to position linear interpolation when using the ITPL instruction.
Linear interpolation can be used only with the CP2E N††-type CPU Unit with transistor outputs.

12-5-1 Positioning Linear Interpolation


Linear interpolation positioning is performed with the ITPL instruction. The ITPL instruction executes
positioning by using linear interpolation operation to the specified postion.
Positioning by linear interpolation enables higher-speed positioning than single-axis positioning.
• Two linear interpolations can be used for an N14/20 CPU Unit, and up to four linear interpolations can
be used for an N30/40/60 CPU Unit.
• Linear interpolation can be used with absolute coordinates, it cannot be used with relative coordi-
nates.
Execute the ITPL instruction after the origin is defined.
Two-axis interpolation Three-axis interpolation Four-axis interpolation
Linear interpolation 0 Pulse output 0, 1 Pulse output 0, 1, 2 Pulse output 0, 1, 2,3
Linear interpolation 1 Pulse output 2, 3 - -

12-26 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-5 Positioning Linear Interpolation


12-5-2 Positioning Linear Interpolation Configuration
The target frequency, starting frequency, acceleration and deceleration rate, the number of output
pulses are set beforehand, and linear interpolation positioning control is performed by executing the
instruction.
The following example shows the two-axis linear interpolation.
Port 1 position
Target position
(S+6, S+8)

Port 1 amount of movement


12

12-5-2 Positioning Linear Interpolation Configuration


Startup position
Port 0 amount of movement
Port 0 position

Frequency on the line

Target frequency Deceleration rate(S+1)

(S+2) Acceleration rate(S)

Startup frequency

(S+4)

Time
Port 0 frequency

Time

Port 1 frequency

Time

• The target frequency and starting frequency set the frequency of linear interpolation positioning. The
frequency and travel distance of each axis are automatically set internally.
• The stop during linear interpolation can be immediate stop or deceleration stop.
In the case of a deceleration stop, it stops on a linear interpolation line. Please execute the linear
interpolation instruction again to restart.

Precautions for Correct Use

The linear interpolation positioning can not be performed with the origin undefined. Please spec-
ify them when the origin is defined by performing the origin searches.
If the output speed is less than 125 Hz, pulse output cannot be performed because the number
of pulse per cycle is less than one pulse. As a result, the pulse duty factor may not be 50%.

CP2E CPU Unit Software User’s Manual(W614) 12-27


12 Pulse Outputs

Additional Information

• The ITPL instruction can not be executed when the pulse output port specified by the axis
specifier of the ITPL instruction is already outputting pulses by the SPED, ACC, PLS2, ORG,
IFEED and ITPL instructions. P_ER flag turns ON.
• The distance and the operation time that can be moved by linear interpolation have an upper
limit. Please specify the linear distance to 100,000,000 pulses or less, and the operation time
to 1,000 seconds or less.
• Set the starting frequency ≤ target frequency. If the starting frequency > target frequency, it
operates at the target frequency.

12-5-3 Application Example


The ITPL instruction uses pulse output 0 and pulse output 1 to perform linear interpolation positioning.
When W1.00 is turned ON, the linear interpolation will decelerate to stop.
Note The origin must be defined before executing the ITPL instruction.

W0.00

@ITPL(893)
D100 01F4 Acceleration rate: 500Hz/4ms

#0030 Linear interpolation D101 0190 Deceleration rate: 400Hz/4ms

#0101 D102 7530


Target frequency: 30kHz
D103 0000
D100
D104 03E8
W1.00 Startup frequency: 1000Hz
D105 0000
@INI(880)
D106 3500
Target position 0: 800,000
#0030 Linear interpolation D107 000C

#0004 Decelerative stopping D108 1170


Target position 1: 70,000
D109 0001
0

Pulse output 1
Deceleration rate
400Hz/4ms

70,000
Target frequency
30kHz

Acceleration
rate
500Hz/4ms

Startup position

800,000
Pulse output 0

12-28 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-5 Positioning Linear Interpolation


z Related Auxiliary Area Flags
There is no special related auxiliary area flags for linear interpolation positioning. The actions of the
pulse output related auxiliary area flags during the linear interpolation positioning are as follows.

Name Action
Pulse Output PV Storage Words Current value is stored.
Pulse Output Reser Bit During linear interpolation, the pulse output PV cannot be cleared even if the
reset flag is turned ON.
CW Limit Input Signal Flag Valid only when Limit Input Signal Operation in PLC Setting is Always.
CCW Limit Input Signal Flag Valid only when Limit Input Signal Operation in PLC Setting is Always.
Accel/Decel Flag ON when the linear interpolation is accelerating or decelerating. All the pulse 12
outputs specified by the linear interpolation instruction operate in the same
way.

12-5-3 Application Example


It still operates when the linear interpolation movement length is 0.
Output Completed Flag ON when the linear interpolation is completed. All the pulse outputs specified
by the linear interpolation instruction operate in the same way.
It still operates when the linear interpolation movement length is 0.
Output In-progress Flag ON during the linear interpolation. All the pulse outputs specified by the linear
interpolation instruction operate in the same way.
It still operates when the linear interpolation movement length is 0.

CP2E CPU Unit Software User’s Manual(W614) 12-29


12 Pulse Outputs

12-6 Defining Origin Position


The CP2E CPU Units have two methods that can be used to define the origin position.
• Origin Search
The ORG instruction outputs pulses to turn the motor according to the pattern specified in the origin
search parameters. As the motor turns, the origin search function defines the origin from the following
three kinds of position input signals.
• Origin input signal
• Origin proximity input signal
• CW limit input signal and CCW limit input signal
• Changing the Pulse Output PV
When setting the current position as the origin, execute INI to reset the pulse output PV to 0.

12-6-1 Origin Searches


When the ORG instruction executes an origin search, it outputs pulses to actually move the motor and
defines the origin position using the input signals that indicate the origin proximity and origin positions.
The input signals that indicate the origin position can be received from the servomotor’s built-in phase-Z
signal or external sensors such as photoelectric sensors, proximity sensors, or limit switches.

In the following example, the motor is started at a specified speed, accelerated to the origin search high
speed, and run at that speed until the origin proximity position is detected. After the Origin Proximity
Input is detected, the motor is decelerated to the origin search low speed and run at that speed until the
origin position is detected. The motor is stopped at the origin position.

1
Origin Proximity
Input Signal 0

Origin Input 1
Signal
0
Pulse frequency
Origin search high speed Origin search deceleration rate

Origin search
acceleration rate
Deceleration point Origin search proximity speed

Origin search
initial speed

Time
Start Decelerate from high to low speed Stop

Execution of ORG Indicated by the Origin Indicated by the


Proximity Input Signal Origin Input Signal

(Example for reversal mode 1


and method 0 (described later))

Additional Information

The motor can be moved even if the origin position has not been defined, but positioning opera-
tions will be limited as follows:
• Origin return: Cannot be used.
• Positioning with absolute pulse specification: Cannot be used.
• Positioning with relative pulse specification: Outputs the specified number of pulses after set-
ting the present position to 0.

12-30 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-6 Defining Origin Position


12-6-2 Flow of Operation

1 PLC Setup • Set the origin search parameters in the


Pulse Output 0 to 3 Tab Pages of the PLC
Setup using the CX-Programmer.

2 Ladder Cyclic task,


• Set pulse output 0 to 3.
• Output the status of the Limit Signal Inputs
program interrupt task and Positioning Completed Signal to Auxil-
iary Area bits.
• Execute ORG. Specify an origin search. 12

12-6-2 Flow of Operation


12-6-3 Settings in PLC Setup
To perform an origin search or to use a Limit Input Signal as an input to a function other than origin
search, set the parameters on the Pulse Output 0 to 3 Tab Pages in the PLC Setup.

CP2E CPU Unit Software User’s Manual(W614) 12-31


12 Pulse Outputs

Pulse Output 0 to 3 Tab Page


Item Selection Description
Base Undefined Hold When a Limit Input Signal is input, the pulse output is stopped
Settings Origin and the previous status is held.
Undefined When a Limit Input Signal is input, the pulse output is stopped
and origin becomes undefined.
Limit Input Search Only The CW/CCW Limit Input Signal is used for origin searches only.
Signal Opera- Always The CW/CCW Limit Input Signal is used by functions other than
tion origin search.
Limit Input NC Select when using NC contact (b contact) for the Limit Input Sig-
Signal nal.
NO Select when using NO contact (a contact) for the Limit Input Sig-
nal.
Search/ Set the motor’s starting speed when performing an origin search or origin return.
Return Specified in units of pulses per second (pps).
Initial Speed Setting range: 0 to 100k pps
The origin search will not be performed in these cases:
Origin search high speed ≤ Origin search proximity speed.
Origin search proximity speed ≤ Origin search initial speed.
Define Use define Select this check box to use origin searches.
Origin origin opera-
Opera- tion
tion Search Direc- Set the direction for detecting the Origin Input Signal. An origin search is performed so
Settings tion that the Origin Input Signal’s rising edge is detected when moving in the origin search
direction.
CW Performs origin search in the clockwise direction.
CCW Performs origin search in the counterclockwise direction.
Detection Set one of the following three methods to determine the parameters related to the
Method Origin Proximity Input Signal.
Method 0 The direction is reversed at the Origin Proximity Input Signal. The
Origin Input Signal is accepted after the Origin Proximity Input
Signal turns ON and then OFF.
Method 1 The direction is not reversed at the Origin Proximity Input
Signal.
The Origin Input Signal is accepted after the Origin Proximity
Input Signal turns ON.
Method 2 The Origin Proximity Input Signal is not used.
The Origin Input Signal is accepted without using the Origin Prox-
imity Input Signal.
Only origin search proximity speed can be the origin search
speed.
Search Select one of the following two modes for the origin search operation pattern.
Operation Inverse 1 The direction is reversed when the Limit Input Signal is received
while moving in the origin search direction.
Inverse 2 An error is generated and operation is stopped if the Limit Input
Signal is received while moving in the origin search direction.
Operation This parameter determines the I/O signals that are used for origin search.
Mode Mode 0 Use when connecting to a stepping motor that does not have a
Positioning Completed Signal.
Mode 1 In this mode, the Positioning Completed Signal from the Servo
Drive is not used. Use this mode when you want to reduce the
processing time.
Mode 2 In this mode, the Positioning Completed Signal from the Servo
Drive is used. Use this mode when you want high
positioning accuracy.
Origin Input Specifies the type of Origin Input Signal (NC or NO).
Signal NC Sets a normally closed (b contact) Origin Input Signal.
NO Sets a normally open (a contact) Origin Input Signal.
Proximity Specifies the type of Origin Proximity Input Signal (NC or NO).
Input Signal NC Sets a normally closed (b contact) Origin Proximity Input Signal.
NO Sets a normally open (a contact) Origin Proximity Input Signal.

12-32 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Item Selection Description

12-6 Defining Origin Position


Define Search High Sets the motor’s target speed when the origin search is executed. Specify the speed in
Origin Speed the number of pulses per second (pps).
Opera- Setting range: 1 to 100k pps
tion
The origin search will not be performed in these cases:
Settings
Origin search high speed ≤ Origin search proximity speed.
Origin search proximity speed ≤ Origin search initial speed.
Search Prox- Sets the motor’s speed after the Origin Proximity Input Signal is detected. Specify the
imity Speed speed in the number of pulses per second (pps).
Setting range: 1 to 100k pps
The origin search will not be performed in these cases:
12
Origin search high speed ≤ Origin search proximity speed.
Origin search proximity speed ≤ Origin search initial speed.

12-6-3 Settings in PLC Setup


Search Com- After the origin has been defined, the origin compensation can be set to compensate
pensation for a shift in the Proximity Sensor’s ON position, motor replacement, or other change.
Value Setting range: -2,147,483,648 to 2,147,483,647 pulses
Once the origin has been detected in an origin search, the number of pulses specified
in the origin compensation is output, the present position is reset to 0, and the pulse
output’s No-origin Flag is turned OFF.
Search Sets the motor’s acceleration rate when the origin Setting range: 1 to 65,535 Hz/
Acceleration search is executed. Specify the amount to increase 4 ms
Ratio the speed (Hz) per 4-ms interval.
Search Sets the motor’s deceleration rate when the origin Setting range: 1 to 65,535 Hz/
Deceleration search function is decelerating. Specify the amount to 4 ms
Ratio decrease the speed (Hz) per 4-ms interval.
Positioning When the operating mode is set to mode 2, this setting Setting range: 0 to 9,999 ms*
Monitor Time specifies how long to wait (in ms) for the Positioning
Completed Signal after the positioning operation has
been completed, i.e., the pulse output has been com-
pleted. A Positioning Timeout Error (error code 0300)
will be generated if the motor driver’s Positioning Com-
pleted Signal does not come ON within the specified
time.
Origin Speed Sets the motor’s target speed when the origin return is Setting range: 1 to 100k pps
Return executed. Specify the speed in the number of pulses
per second (pps).
Acceleration Sets the motor’s acceleration rate when the origin Setting range: 1 to 65,535 Hz/
Ratio return operation starts. Specify the amount to increase 4 ms
the speed (Hz) per 4-ms interval.
Deceleration Sets the motor’s deceleration rate when the origin Setting range: 1 to 65,535 Hz/
Ratio return function is decelerating. Specify the amount to 4 ms
decrease the speed (Hz) per 4-ms interval.

* The actual monitoring time will be the Positioning Monitor Time rounded up to the nearest 10-ms unit + 10 ms
max. If the Positioning Monitor Time is set to 0, the function will be disabled and the Unit will continue waiting for
the Positioning Completed Signal to come ON. (A Positioning Timeout Error will not be generated.)

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the
settings for using the origin search.

CP2E CPU Unit Software User’s Manual(W614) 12-33


12 Pulse Outputs

12-6-4 Origin Search Instructions

Origin Search Instruction: ORG


Execute the ORG instruction in the ladder program to perform an origin search with the specified
parameters.
C1:Port specifier
ORG Pulse output 0: #0000
Pulse output 1: #0001
C1
Pulse output 2: #0002
C2 Pulse output 3: #0003
C2:Control data
Origin search and pulse + direction output method: #0100

Precautions for Correct Use

Limit Sensor Application


Create a program that can identify the limit sensor when using the origin search.
The OUT instruction is used in the ladder program to write signals received from the CW limit
sensor and CCW limit sensor connected to normal inputs to the Auxiliary Area bits.

Normal input from CW CW Limit Input Signal


limit sensor A540.08, A541.08,
A542.08 or A543.08

Normal input from CCW CCW Limit Input Signal


limit sensor A540.09, A541.09,
A542.09 or A543.09

Bits Written in the Auxiliary Area


Auxiliary Area
Name
Word Bit
A540 08 Pulse Output 0 CW Limit Input Signal Signals received from external sen-
09 Pulse Output 0 CCW Limit Input Signal sors connected to normal inputs
must be written to the Auxiliary Area
A541 08 Pulse Output 1 CW Limit Input Signal bits in the user program.
09 Pulse Output 1 CCW Limit Input Signal
A542 08 Pulse Output 2 CW Limit Input Signal
09 Pulse Output 2 CCW Limit Input Signal
A543 08 Pulse Output 3 CW Limit Input Signal
09 Pulse Output 3 CCW Limit Input Signal

12-34 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-6 Defining Origin Position


12-6-5 Origin Search Operations

Operating Mode
The operating mode parameter specifies the kind of I/O signals that are used in the origin search.
I/O signal Mode 0 Mode 1 Mode 2
Driver Stepping motor* Servomotor
Operation Origin Input Inputs signals are arranged Even if an Origin Input Signal is received during
Signal so deceleration starts when deceleration, it is ignored. After the motor has
the Origin Proximity Input reached the origin search proximity speed and the 12
Signal is received and then Origin Input Signal is received, the motor stops, com-
the Origin Input Signal is pleting the origin search process.
received while the motor is
decelerating to the origin
search proximity speed. If an
Origin Input Signal is
detected during this deceler-
ation, an Origin Input Signal
error will occur and the
motor will decelerate to a
stop.
Positioning The Positioning Completed The Positioning Com- After detecting the origin,
Completed Signal from the driver is not pleted Signal from the the origin search pro-
Signal connected. * driver is not connected. cess is not completed
Use this mode when you until the Positioning
want to reduce the pro- Completed Signal is
cessing time, even at the received.
expense of positioning Use this mode when you
accuracy. want high positioning
accuracy.

* There are stepping motor drivers that are equipped with a Positioning Completed Signal like a servomotor. Oper-
ating modes 1 and 2 can be used with these stepping motor drivers.

The use of an error counter reset output and positioning completed input depends on the mode as
described in the following table.
I/O signal Mode 0 Mode 1 Mode 2
Origin Input Connected to the open- Connected to the phase-Z Connected to the phase-Z
Signal collector output from a sen- signal from the Servo Drive. signal from the Servo Drive.
sor or other device.
Error counter Not used. Connected to the error Connected to the error
reset output (The origin search operation counter reset of the Servo counter reset of the Servo
is completed when the origin Drive. Drive.
is detected.)
Positioning Not used. Not used. Connected to the Position-
completed input ing Completed Signal from
the Servo Drive.

CP2E CPU Unit Software User’s Manual(W614) 12-35


12 Pulse Outputs

Operations Detecting the Origin during Deceleration from High


Speed

z Operating Mode 0 (without Error Counter Reset Output, without Positioning


Completed Input)
Connect the sensor’s open-collector output signal to the Origin Input Signal. The Origin Input Sig-
nal’s response time is 0.1 ms when set as NO contacts.
When the Origin Proximity Input Signal is received, the motor will begin decelerating from the origin
search high speed to the origin search proximity speed. In this operating mode, the Origin Input Sig-
nal will be detected if it is received during this deceleration and an Origin Input Signal Error (error
code 0202) will be generated. In this case, the motor will decelerate to a stop.

Origin input turns ON during


deceleration

Origin Proximity 1
Input Signal 0

Origin Input 1
Signal 0

Original pulse output pattern

Pulse output
CCW CW
Starts when ORG is executed Origin Input Signal Error (error code 0202)

z Operating Mode 1 (with Error Counter Reset Output, without Positioning


Completed Input)
Connect the phase-Z signal from the Servo Drive to the Origin Input Signal.
When the Origin Input Signal is received, the pulse output will be stopped and the Error Counter
Reset Signal will be output for about 20 to 30 ms.

1
Origin Input Signal
(phase-Z signal) 0

1
Pulse output
0

Error Counter
Reset Signal
Approx. 20 to 30 ms

Though the Origin Proximity Input Signal is received, the signal will be ignored and the motor will
begin decelerating from the origin search high speed to the origin search proximity speed. In this
operating mode, the motor will stop at the Origin Input Signal after deceleration is completed.

12-36 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Operating Mode 1 with Origin Proximity Input Signal Reverse (Origin


Detection Method Setting = 0)

12-6 Defining Origin Position


The Origin Input Signal can be detected immediately after the Origin Proximity Input Signal turns
OFF if the deceleration time is short, e.g., when starting from within the Origin Proximity Input Sig-
nal. Set an Origin Proximity Input Signal dog setting that is long enough (longer than the decelera-
tion time.)

Verify that the Origin Proximity Input Signal’s dog setting


1 is long enough (longer than the deceleration time.)
Origin Proximity
Input Signal 0

Origin Input Signal 1


(phase-Z signal) 0
Origin Input 12
Signal is
ignored during Motor stopped by an Origin Input
Pulse output deceleration Signal received after deceleration

12-6-5 Origin Search Operations


CCW CW
(The deceleration time is
relatively long in this case.) Starts Stop
when ORG is executed Ideal time for the Origin Proximity
Input Signal to go OFF
(Settings when the deceleration time is short)

CCW CW
(The deceleration time is Stop*
relatively short in this case.)
* The Origin Input Signal can be detected
Starts
when ORG is executed immediately after the Origin Proximity
Input Signal turns OFF if the deceleration
time is short, e.g., when starting from
within the Origin Proximity Input Signal.

Operating Mode 1 without Origin Proximity Input Signal Reverse (Origin


Detection Method Setting = 1)
Depending on the length of the deceleration time, the stopping position may change when the Origin
Input Signal is detected during deceleration.

1
Origin Proximity
Input Signal 0

Origin Input Signal 1


(phase-Z signal) 0 Origin Input
Signal is
ignored Motor stopped by an
during
Pulse output deceleration Origin Input Signal

CCW CW
(The deceleration time is
relatively long in this case.) Starts Stop
when ORG
is executed Motor stopped by an Origin Input
Signal received after deceleration

CCW CW
(The deceleration time is
relatively short in this case.) Starts Stop
when ORG is executed

CP2E CPU Unit Software User’s Manual(W614) 12-37


12 Pulse Outputs

z Operating Mode 2 (with Error Counter Reset Output, with Positioning


Completed Input)
This operating mode is the same as mode 1, except the Positioning Completed Signal (INP) from
the Servo Drive is used. Connect the Positioning Completed Signal from the Servo Drive to a normal
input.
If origin compensation is not being applied, the Positioning Completed Signal is checked after the
Error Counter Reset Output. If origin compensation is being applied, the Positioning Completed Sig-
nal is checked after the compensation operation is completed.

Pulse output

Time
Stop

1
Error Counter
Reset Output 0

Positioning 1
Completed Signal 0

Origin Detection Method Setting


z Origin Detection Method 0: Origin Proximity Input Signal Reversal Required
(Recommended Method)
Deceleration starts when Origin
Proximity Input Signal turns ON.
1
Origin Proximity
Input Signal 0
After the Origin Proximity Input Signal turns
ON and then OFF, the motor is stopped
when the Origin Input Signal turns ON.
1
Origin Input Signal
0

High speed for origin search


Pulse output
Deceleration
Acceleration
Proximity speed for origin search
Initial speed
CCW CW
Start when ORG is executed Stop

12-38 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Origin Detection Method 1: Origin Proximity Input Signal Reversal Not


Required

12-6 Defining Origin Position


Deceleration starts when Origin
Proximity Input Signal turns ON.
Origin Proximity 1
Input Signal 0
After the Origin Proximity Input Signal turns
ON, the motor is stopped when the Origin
Input Signal turns ON.
1
Origin Input Signal
0

High speed for origin search


Pulse output
Acceleration Deceleration 12
Proximity speed for origin search
Initial speed
CCW CW

12-6-5 Origin Search Operations


Start when ORG is executed Stop

z Origin Detection Method 2: Origin Proximity Input Signal Not Used


The motor is stopped when the
Origin Input Signal turns ON.
1
Origin Input Signal
0

Proximity speed
Pulse output for origin search

Acceleration
Initial speed
Start when ORG is executed Stop

CP2E CPU Unit Software User’s Manual(W614) 12-39


12 Pulse Outputs

Operation Patterns for Origin Search Operating Mode and Origin


Detection Method Settings
The following examples show how the operation patterns are affected by the origin detection method
and origin search operating mode.
These examples have a CW origin search direction. (The search direction and Limit Input Signal direc-
tion would be different for an origin search in the CCW direction.)
Method 0 is the recommended method for reversal mode 1 (Inverse 1).
z Using Reversal Mode 1 (Inverse 1)
Origin search operation
Reversal mode 1 (Inverse 1)
Origin detection method
0: Origin Proximity Input Signal Origin Proximity 1
reversal required. Input Signal 0
1
(Recommended method) Origin Input Signal
0
High speed for origin search
Pulse output Proximity speed for origin search

CCW CW
Start Stop

CCW CW
Stop
CW Limit Input Signal (See note.)
Start

CCW CW
Stop Start

Note When the Limit Input Signal is received, the motor stops without
deceleration, reverses direction, and accelerates.
1: Origin Proximity Input Signal 1
Origin Proximity
reversal not required. Input Signal 0
1
Origin Input Signal
0

Pulse output
CCW CW
Start Stop

CCW CW
Stop
CW Limit Input Signal (See note.)
Start

CCW CW
Stop Start
Note When the Limit Input Signal is received, the motor stops without
deceleration, reverses direction, and accelerates.

2: Origin Proximity Input Signal not 1


Origin Input Signal
used. 0

Proximity speed for origin search


Pulse output

CCW CW

Start Stop

CCW CW

Stop Start CW Limit Input Signal (See note.)

CCW CW

Stop Start
Note When the Limit Input Signal is received, the motor stops without
deceleration, reverses direction, and accelerates.

12-40 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Using Reversal Mode 2 (Inverse 2)

12-6 Defining Origin Position


Origin search operation
Reversal mode 2 (Inverse 2)
Origin detection method
0: Origin Proximity Input Signal 1
Origin Proximity
reversal required. Input Signal 0
1
Origin Input Signal
0

Pulse output

CCW CW

Start Stop
12

CCW CW

12-6-5 Origin Search Operations


Stop
CW Limit Input Signal (See note.)
Start

CCW CW

Start Limit stop


(error code:0200)
Note When the Limit Input Signal is received, the motor stops
without deceleration.

1: Origin Proximity Input Signal 1


Origin Proximity
reversal not required. Input Signal 0
1
Origin Input Signal
0

Pulse output

CCW CW

Start Stop

CCW CW

Stop CW Limit Input Signal (See note.)


Start

CCW CW
Start Limit stop
(error code:0200)
Note When the Limit Input Signal is received, the motor stops
without deceleration.

2: Origin Proximity Input Signal not


1
used. Origin Input Signal
0

Proximity speed for origin search


Pulse output

CCW CW

Start Stop

CCW CW

Stop Start CW Limit Input Signal (See note.)

CCW CW

Start Limit stop


(error code:0201)
Note When the Limit Input Signal is received, the motor stops
without deceleration.

CP2E CPU Unit Software User’s Manual(W614) 12-41


12 Pulse Outputs

12-6-6 Origin Return


It is the function to move the origin to the defined position by origin searches or changing PVs.
An origin return operation moves the motor to the origin position from any other position. The origin
return operation is controlled by ORG.
The origin return operation returns the motor to the origin by starting at the specified speed, accelerat-
ing to the target speed, moving at the target speed, and then decelerating to a stop at the origin posi-
tion.

Pulse frequency Origin return target speed Origin return


deceleration rate
Origin return
acceleration rate

Origin return
initial speed

Time
Start Stop

Started by executing ORG

PLC Setup
The various origin return parameters are set on the Pulse Output 0 Tab Page in the PLC Setup.

z Origin Return Parameters


Name Setting Setting range
Base Search/Return Sets the motor’s starting speed when the 0 to 100k pps
Settings Initial Speed origin return is executed. Specify the speed
in the number of pulses per second (pps).
Origin Speed Sets the motor’s target speed when the 1 to 100k pps
Return origin return is executed. Specify the speed
in the number of pulses per second (pps).
Acceleration Ratio Sets the motor’s acceleration rate when the 1 to 65,535
(Rate) origin return function is accelerating. Specify (Hz/4ms)
the amount to increase the speed (Hz) per
4-ms interval.
Deceleration Ratio Sets the motor’s deceleration rate when the 1 to 65,535
(Rate) origin return function is decelerating. Specify (Hz/4ms)
the amount to decrease the speed (Hz) per
4-ms interval.

Origin Return Instruction


C1:Port specifier
ORG Pulse output 0: #0000
C1 Pulse output 1: #0001
Pulse output 2: #0002
C2 Pulse output 3: #0003
C2:Control data
Origin search and pulse + direction output method: #0100

Note An instruction execution error will occur if the origin is not defined (relative coordinate system)
when the ORG instruction is executed to perform an origin return operation.

12-42 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-6 Defining Origin Position


12-6-7 Changing the Present Value of the Pulse Output
The present value of the pulse output can be changed by using the INI instruction. To define the present
value as the origin, set the pulse output PV to 0 using the INI instruction.

INI instruction executed

New origin Present origin


Pulse output
PV
12
z Example: Setting the Present Position as the Origin

12-6-7 Changing the Present Value of the Pulse Output


Execution condition

@INI
#0000 C1: Port specifier (example for pulse output 0)
#0002 C2: Control data (example for changing PV)
D100 S:First word with new PV

15 0
D100 #0 0 0 0
D101 #0 0 0 0

Operands Settings
C1 Port specifier #0000 Pulse output 0
#0001 Pulse output 1
#0002 Pulse output 2
#0003 Pulse output 3
C2 Control data #0002 Changes PV
S First word with new PV Store the new PV in S and S+1 (32 bits).

CP2E CPU Unit Software User’s Manual(W614) 12-43


12 Pulse Outputs

12-7 Reading the Pulse Output Present


Value
The present value of a pulse output can be read in the following two ways.
• Value refreshed at the I/O refresh timing Æ Read PV from Auxiliary Area.
• Value updated when a program is executed Æ Read PV by executing a PRV instruction.

Reading the PV Refreshed at the I/O Refresh Timing


The PV that is stored in the following words can be read using the MOVL instruction or other instruc-
tions.
Read PV Auxiliary Area words
Pulse output 0 A277 (upper digits) and A276 (lower digits)
Pulse output 1 A279 (upper digits) and A278 (lower digits)
Pulse output 2 A53 (upper digits) and A52 (lower digits)
Pulse output 3 A55 (upper digits) and A54 (lower digits)

Reading the Value When a Program is Executed

z Reading the Pulse Output PV with a PRV Instruction

Execution condition

@PRV
#0000 C1: Port specifier (example for pulse output 0)
#0000 C2: Control data (example for reading PV)
D100 D: First destination word
15 0
D100 Present value data lower bytes
Pulse output PV that was read
D101 Present value data upper bytes

12-44 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-8 Related Auxiliary Area Flags

12-8 Related Auxiliary Area Flags


Auxiliary Area Allocations
Pulse Pulse Pulse Pulse
Name Description Values
output 0 output 1 output 2 output 3
Pulse Output PV PV range: 8000 0000 to 7FFF FFFF hex Leftmost 4 digits A277 A279 A53 A55
Storage Words (-2,147,483,648 to 2,147,483,647) Rightmost 4 digits A276 A278 A52 A54
Pulse Output The pulse output PV will be cleared when 0: Not cleared. A540.00 A541.00 A542.00 A543.00
Reset Bit this bit is turned ON. 1: Clear PV.
CW Limit Input This flag shows the status of the CW Limit ON when turned A540.08 A541.08 A542.08 A543.08
Signal Flag Input Signal, which is used in the origin ON from an
12
search. external input.
The status of the signal from the CW limit
input sensor connected to a normal input
must be written to A540.08, A541.08,
A542.08 or A543.08.
CCW Limit Input This flag shows the status of the CCW ON when turned A540.09 A541.09 A542.09 A543.09
Signal Flag Limit Input Signal, which is used in the ori- ON from an
gin search. external input.
The status of the signal from the CCW
limit input sensor connected to a normal
input must be written to A540.09,
A541.09, A542.09 or A543.09.
Positioning This flag shows the status of the position- ON when turned A540.10 A541.10 A542.10 A543.10
completed input ing completed input signal, which is used ON from an
signal in the origin search. external input.
The status of the Positioning Completed
Signal from the Servo Drive connected to
a normal input must be written to
A540.10, A541.10, A542.10 or A543.10.
Accel/Decel Flag ON when pulses are being output accord- 0: Constant A280.00 A281.00 A56.00 A57.00
ing to an ORG, ACC, PLS2, IFEED or speed
ITPL instruction and the output frequency 1: Accelerating or
is being changed in steps (accelerating or decelerating
decelerating).
Overflow/Underflow ON when an overflow or underflow has 0: Normal A280.01 A281.01 A56.01 A57.01
Flag occurred in the pulse output PV. 1: Overflow or
underflow
Output Amount Set ON when the number of output pulses has 0: No setting A280.02 A281.02 A56.02 A57.02
Flag been set with the PULS instruction. 1: Setting made
Output Completed ON when the number of output pulses set 0: Output not A280.03 A281.03 A56.03 A57.03
Flag with the PULS, PLS2, IFEED or ITPL completed.
instruction has been output. 1: Output
completed.
Output In-progress ON when pulses are being output from the 0: Stopped A280.04 A281.04 A56.04 A57.04
Flag pulse output. 1: Outputting
pulses.
No-origin Flag ON when the origin has not been defined 0: Origin defined. A280.05 A281.05 A56.05 A57.05
for the pulse output. 1: Origin
undefined.
At-origin Flag ON when the pulse output PV matches 0: Not stopped at A280.06 A281.06 A56.06 A57.06
the origin (0). origin.
1: Stopped at
origin.
Output Stopped ON when an error occurred while output- 0: No error A280.07 A281.07 A56.07 A57.07
Error Flag ting pulses in the origin search function. 1: Stop error
occurred.
Stop Error Code When a Pulse Output Stop Error occurs, − A444 A445 A438 A439
the error code is stored in that pulse out-
puts corresponding Stop Error Code word.

CP2E CPU Unit Software User’s Manual(W614) 12-45


12 Pulse Outputs

12-9 Application Examples

12-9-1 Vertically Conveying PCBs (Multiple Progressive Positioning)

Specifications and Operation


z Outline
(1) PCBs with components mounted are stored in a stocker.
(2) When a stocker becomes full, it is moved to the conveyance point.

Positioning Operation for Vertical Conveyor


Stocker conveyance
position

(2) (3)
From mounter

(1)

z Operation Pattern
(1) An origin search is performed.
(2) Fixed-distance positioning is repeated.
(3) The system is returned to the original position.

CCW Origin (servo Origin CW


limit phase Z) proximity limit

(1) Origin search

CCW (2) Fixed-distance CW


positioning repeated

50,000 Hz
(C350 Hex)

10,000
(2710 Hex)

CCW CW
Acceleration/deceleration:
(3) Return to start 1,000 Hz/4 ms (03E8 hex)

PCB storage PCB storage Stocker Stocker movement


enabled completed moved completed

12-46 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z Wiring Example Using G5-series Servo Drive


Origin Search Start Switch (CIO 0.00)

12-9 Application Examples


Emergency Stop Switch (CIO 0.01)

Stocker Moved (CIO 100.01) PCB Storage Completed (CIO 0.03)


Stocker Movement Completed PCB Storage Enabled (CIO 100.03)
(CIO 0.04)

G5-series
Servo Drive

R88A-CPG††S 12

CP2E N/S……-type CPU Unit (Sinking outputs)

G5-series R88D-KT
Output terminal block R88A-CPG………S PIN Signal
Pulse output (CIO 100.00) 1 +24VCW * Instruction pulse mode =
Pulse 4 -PULS feed pulse and
output 0 Direction output (CIO 100.02) 2 +24VCCW forward/reverse signal
6 -SIGN

Error counter reset output 0 (CIO 100.04) ECRST

COM
V+ (S……-type only)
V- (S……-type only)
Input terminal block 25 ZGND
Pulse 0 origin input signal (CIO 0.06) 19 Z
COM 7 +24VIN
24-VDC Servo Drive
RUN input X1
Pulse 0 origin proximity input signal (CIO 0.10) 29 RUN

36 ALMCOM
10 BKIRCOM
X1 37 /ALM
24-VDC
XB 11 BKIR

Hood FG

Only S††-type CPU Units can wire V+ and V-. Do not wire them in N††-type CPU Units.
z Operation
1 An origin search is performed using the Origin Search Start Switch (CIO 0.00).

2 When the origin search is finished, the PCB Storage Enabled Output (CIO 100.03) is turned ON.

3 When a PCB has been stored, the stocker is raised (relative positioning) using the PCB Storage
Completed Input (CIO 0.03).
4 Storing PCBs is repeated until the stocker is full.

5 The number of PCBs in the stocker is counted with counter C0 by counting the number of times
the stocker is raised.
6 When the stocker is full, it is moved (CIO 100.01) and only the conveyor is lowered (absolute
positioning) when stoker movement is completed (CIO 0.04).
7 An emergency stop is executed to stop pulse output with the Emergency Stop Switch Input (CIO 0.01).

CP2E CPU Unit Software User’s Manual(W614) 12-47


12 Pulse Outputs

Preparations
z PLC Setup
Setting
Use define origin operation for pulse output 0.

Note The Use define origin operation setting is read from the PLC Setup when the power supply is turned ON.

z DM Area Settings
• Settings for PLS2 for Fixed-distance Positioning (D0 to D7)
Setting details Address Data
Acceleration rate: 1,000 Hz/4 ms D0 #03E8
Deceleration rate: 1,000 Hz/4 ms D1 #03E8
Target frequency: 50,000 Hz D2 #C350
D3 #0000
Number of output pulses: 10,000 pulses D4 #2710
D5 #0000
Starting frequency: 0 Hz D6 #0000
D7 #0000
• Settings for PLS2 to Return to Start (D10 to D17)
Setting details Address Data
Acceleration rate: 300 Hz/4 ms D10 #012C
Deceleration rate: 200 Hz/4 ms D11 #00C8
Target frequency: 50,000 Hz D12 #C350
D13 #0000
Number of output pulses: 0 pulse D14 #0000
D15 #0000
Starting frequency: 100 Hz D16 #0064
D17 #0000
• Number of Repeats of Fixed-distance Positioning Operation (D20)
Setting details Address Data
Number of repeats of fixed-distance positioning D20 #000F
operation (number of PCBs in stocker)

12-48 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Ladder Program

12-9 Application Examples


Jog Operation

0.00 W0.01 W0.00


Origin search in progress
Origin search Origin search
start switch completed
@ORG
W0.00
#0000
#0100
Origin search
in progress A280.05 W0.01
Origin search completed
12
No-origin Flag

12-9-1 Vertically Conveying PCBs (Multiple Progressive Positioning)


100.03
W0.01 W0.02
PCB storage enabled
Origin search Lift positioning
completed start
W0.05 0.03 W0.02
Lift positioning start
PCB stored PCB storage completed
100.03

PCB storage enabled

Positioning
Lift 10,000 pulses (relative) at a time
W0.02 W0.04 W0.03
Lift positioning in progress
Lift positioning Lift positioning
start completed
@PLS2
W0.03
#0000
Lift positioning #0100
in progress D0
D6

A280.03 W0.04
Lift positioning completed
Pulse Output Completed Flag
Counter for number of lifts (number of PCBs stored)
W0.04
CNTX
Lift positioning completed 0000
W0.09 D20

Lower positioning
completed
P_First_Cycle

First Cycle Flag

CP2E CPU Unit Software User’s Manual(W614) 12-49


12 Pulse Outputs

When the stocker is not full (C0 = OFF), store PCB,


and repeat lift positioning after PCB storage is completed.
W0.05
W0.04 C000
PCB stored
Lift positioning Stocker full
completed

When the stocker is full (C0 = ON), move the stocker,


and start lower positioning after stocker movement is completed.
W0.04 C000 W0.06
Stocker moved
Lift positioning Stocker full
completed
W0.06 W0.07 100.01
Stocker moving output
Stocker Lower
moved positioning
100.01 0.04 W0.07
Lower positioning
Stocker moving Stocker movement completed
output

Positioning
Lower to "0" position (absolute pulses)
W0.08
W0.07 W0.09
Lower positioning in progress
Lower positioning Lower positioning
start completed @PLS2
W0.08
#0000
Lower positioning #0101
in progress D10
D16

A280.03 W0.09
Lower positioning completed
Pulse Output Completed Flag

Emergency stop (Pulse output stopped)


0.01
@INI
Emergency stop switch #0000
#0003
0
Repeat limit input settings
Limit inputs are allocated to external sensors using the following programming.

A540.08
0.05
CW Limit Input Signal Flag
Built-in input

0.07 A540.09
CCW Limit Input Signal Flag
Built-in input

12-50 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-9-2 Feeding Wrapping Material: Interrupt Feeding

12-9 Application Examples


Specifications and Operation

z Feeding Wrapping Material in a Vertical Pillow Wrapper

Start switch (CIO 0.00)

Emergency stop switch (CIO 0.01)

12
Marker sensor Speed

12-9-2 Feeding Wrapping Material: Interrupt Feeding


(input 0.06) control

Position
control

Pulse output

z Operation Pattern
Speed control is used to feed wrapping material to the initial position. When the marker sensor input
(rising) is received, fixed-distance positioning is performed before stopping.

10,000 Hz
500 Hz/4ms (2710 Hex)
(01F4 Hex)

Position control
Speed control 5,000 (1388 hex)
pulses output before stopping.

IFEED executed
Marker sensor
input (0.06)

z Operation

1 Speed control is used to feed wrapping material to the initial position by executing the IFEED
instruction when the Start Switch (CIO 0.00) is activated.

2 When the Marker Sensor Input (CIO 0.06) is received, the operation is switched to position con-
trol.

3 The axis is moved the specified travel amount and then stopped.

4 An emergency stop is executed to stop pulse output with the Emergency Stop Switch input (CIO
0.01).

CP2E CPU Unit Software User’s Manual(W614) 12-51


12 Pulse Outputs

Preparations

z PLC Setup
Setting
Enable using built-in input IN6 as an interrupt input.

Note The interrupt input setting is read from the PLC Setup when the power supply is turned ON.

z DM Area Settings
• Speed Control Settings to Feed Wrapping Material to Initial Position and Positioning Control Set-
tings for Wrapping Material
Setting Address Data
Acceleration rate: 500 Hz/4 ms D10 #01F4
Deceleration rate: 500 Hz/4 ms D11 #01F4
Target frequency: 10,000 Hz D12 #2710
D13 #0000
Number of output pulses: 5,000 D14 #1388
pulses D15 #0000

Ladder Program

z Cyclic Task Program (Executed at Startup)


Feeding Material with Speed Control

0.00 W0.01 W0.00


Material being fed
Material Material
feed start positioning
completed @IFEED
W0.00
#0000
Material #0100
being fed D10

A280.03 W0.01
Material positioning completed
Pulse Output
Completed Flag

Emergency Stop
0.01
@INI
Emergency stop switch #0000
#0003
0

Note When the interrupt input is falling, it is necessary to specify edge detection falling with MSKS instruction.
In this example, the MSKS instruction can be omitted because it is rising.

12-52 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-9-3 Palletize: Two-axis Multipoint Positioning

12-9 Application Examples


Specifications and Operation
z Overview
Origin Search Start Switch (CIO 0.00)
X axis Y axis Cylinder
Immediate Stop Switch (CIO 0.01)

Limit input
Pulse output 0 CW (CIO 1.00)
Pulse output 0 CCW (CIO 1.01)
12
Pulse output 1 CW (CIO 1.02)
Pulse output 1 CCW (CIO 1.03)

Workpiece is

12-9-3 Palletize: Two-axis Multipoint Positioning


G5-series Servo Drive
grasped and moved.

Y axis
Pulse output 1

X axis
Pulse output 0

z Operation Pattern
1. Perform origin search.
2. A workpiece is grasped and moved to position A.
3. The workpiece is repeatedly moved between the grasp position and the assembly positions using
linear interpolation operation.

1. Origin search

50000 30000 5000


(C350 hex) (7530 hex) (1388 hex) Origin
Y axis (CW)
2. Move to position A.
Pulse output 1
Speed 50 KHz

3. Move to other positions. A 5000


(1388 hex)
Hz
1. Origin search

Speed 80 KHz 8 0K
eed
Sp
B D 25000
(61A8 hex)
Speed 80 KHz

35000
C
(88B8 hex)

X axis (CW)
Pulse output 0

CP2E CPU Unit Software User’s Manual(W614) 12-53


12 Pulse Outputs

z Operation

1 An origin search of X axis (pulse output 0) and Y axis (pulse output 1) is performed using the Ori-
gin Search Start Switch (CIO 0.00).

2 When the origin search is finished, the following operations are performed continuously using lin-
ear interpolation 0.
Move in to A.
Move to B and return to A.
Move to C and return to A.
Move to D and return to A.

3 An immediate stop is executed to stop pulse output with the Immediate Stop input (CIO 0.01).

Preparations

z PLC Setup
Setting
Origin Search Detailed Settings for pulse output 0 and 1

Note The setting of the option to use the origin search is read from the PLC Setup when the power supply is
turned ON.

12-54 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

z DM Area Settings
• ITPL(893) Settings to Move from Origin to Position A

12-9 Application Examples


Setting Address Data
Acceleration rate: 2,000 pps/4 ms D10 & 2,000
Deceleration rate: 2,000 pps/4 ms D11 & 2,000
Target frequency: 50,000 pps D12, D13 & 50,000
Starting frequency: 0 pps D14, D15 &0
Number of output pulses (X axis): D16, D17 +5,000
5,000 pulses
Number of output pulses (Y axis): D18, D19 +5,000
5,000 pulses 12

12-9-3 Palletize: Two-axis Multipoint Positioning


• Settings to Move from Position A to Position B using Linear Interpolation
Setting Address Data
Acceleration rate: 2,000 pps/4 ms D30 & 2,000
Deceleration rate: 2,000 pps/4 ms D31 & 2,000
Target frequency: 80,000 pps D32, D33 & 80,000
Starting frequency: 0 pps D34, D35 &0
Number of output pulses (X axis): D36, D37 +25,000
25,000 pulses
Number of output pulses (Y axis): D38, D39 +50,000
50,000 pulses

• Settings to Move from Position A to Position C using Linear Interpolation


Setting Address Data
Acceleration rate: 2,000 pps/4 ms D50 & 2,000
Deceleration rate: 2,000 pps/4 ms D51 & 2,000
Target frequency: 80,000 pps D52, D53 & 80,000
Starting frequency: 0 pps D54, D55 &0
Number of output pulses (X axis): 35,000 D56, D57 +35,000
pulses
Number of output pulses (Y axis): 50,000 D58, D59 +50,000
pulses

• Settings to Move from Position A to Position D using Linear Interpolation


Setting Address Data
Acceleration rate: 2,000 pps/4 ms D70 & 2,000
Deceleration rate: 2,000 pps/4 ms D71 & 2,000
Target frequency: 80,000 pps D72, D73 & 80,000
Starting frequency: 0 pps D74, D75 &0
Number of output pulses (X axis): 25,000 D76, D77 +25,000
pulses
Number of output pulses (Y axis): 30,000 D78, D79 +30,000
pulses

CP2E CPU Unit Software User’s Manual(W614) 12-55


12 Pulse Outputs

Ladder Program
Origin Search for X and Y Axes

0.00
SET Setting
Origin Search Switch W0.00 Bit address

W1.14
W0.00
Origin search start

W1.15
RSET Resetting
Origin search completed W0.00 Bit address

Operation 1: Positioning to A
W0.00
SET Setting

W0.01 Bit address

W1.00
W0.01
Positioning to A start

W2.00
RSET Resetting
Positioning to A completed W0.01 Bit address

Operation 2: Positioning to B

W0.01
SET Setting

W0.02 Bit address

W1.01
W0.02
Positioning to B start

W2.01
RSET Resetting
Positioning to B completed W0.02 Bit address

Operation 2: Positioning to A
W0.02
SET Setting

W0.03 Bit address

W3.00
W0.03
Positioning to A start

W2.00
RSET Resetting
Positioning to A completed W0.03 Bit address

Operation 3: Positioning to C
W0.03
SET Setting
W0.04 Bit address

W1.02
W0.04
Positioning to C start

W2.02
RSET Resetting

Positioning to C completed W0.04 Bit address

12-56 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Operation 3: Positioning to A

W0.04
SET Setting

12-9 Application Examples


W0.05 Bit address

W3.01
W0.05
Positioning to A start

W2.00
RSET Resetting
Positioning to A completed W0.05 Bit address

Operation 4: Positioning to D
W0.05
SET Setting

W0.06 Bit address

W1.03 12
W0.06
Positioning to D start

W2.03

12-9-3 Palletize: Two-axis Multipoint Positioning


RSET Resetting
Positioning to D completed
W0.06 Bit address

Operation 5: Positioning to A
W0.06
SET Setting
W0.07 Bit address

W3.02
W0.07
Positioning to A start

W2.00
RSET Resetting
Positioning to A completed W0.07 Bit address

Origin Search Start and Completion for X and Y Axes


W1.14
@ORG(889) Origin Search
Origin search #0 Port specifier: Pulse output 0
start
#0 Control data
@ORG(889) Origin Search
#1 Port specifier: Pulse output 1
#0 Control data

W1.15
A280.05 A281.05
Origin search completed
No Origin Flag No Origin Flag

Positioning to A Start and Completion for X and Y Axes


W1.00
@ITPL (893) Linear interpolation
Positioning to A
start #0030 Port specifier: Linear interpolation 0
W3.00
#0101 Control data
Positioning to A D10 First word of setting table
start
W3.01
Positioning to A
start
W3.02

Positioning to A
start W2.00
A280.03 A281.03
Positioning to A completed
Pulse output completed Pulse output completed

CP2E CPU Unit Software User’s Manual(W614) 12-57


12 Pulse Outputs

Positioning to B Start and Completion for X and Y Axes

W1.01
@ITPL (893) Linear interpolation
Positioning to #0030 Port specifier: Linear interpolation 0
B start
#0101 Control data
D30 First word of setting table

W2.01
A280.03 A281.03
Positioning to B completed
Pulse output completed Pulse output completed

Positioning to C Start and Completion for X and Y Axes


W1.02
@ITPL (893) Linear interpolation
Positioning to #0030 Port specifier: Linear interpolation 0
C start
#0101 Control data
D50 First word of setting table

W2.02
A280.03 A281.03
Positioning to C completed
Pulse output Pulse output
completed completed

Positioning to D Start and Completion for X and Y Axes


W1.03
@ITPL (893) Linear interpolation
Positioning #0030 Port specifier: Linear interpolation 0
to D start
#0101 Control data
D70 First word of setting table

W2.03
A280.03 A281.03
Positioning to D completed
Pulse output completed Pulse output completed

Immediate stop (Pulse output stopped)


0.01
@INI (880) Operation Mode Control
Immediate #0030 Port specifier: Linear interpolation 0
stop switch
#0003 Control data: Stop pulse output
D90

Limit input Settings A540.08


1.00
CW limit input signal X axis

Limit input Settings A540.09


1.01 CCW limit input signal X axis

Limit input Settings A541.08


1.02 CW limit input signal Y axis

Limit input Settings A541.09


1.03 CCW limit input signal Y axis

12-58 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-10 Precautions when Using Pulse Outputs


12-10Precautions when Using Pulse Outputs

Movement Direction when Specifying Absolute Pulses

When operating with the absolute pulse specification, the movement direction (CW/CCW) is selected
automatically based on the relationship between the pulse output PV when the instruction is executed
and the specified target position. The direction (CW/CCW) specified in an ACC, SPED or PLS2 instruc-
tion is not effective.

12
Using CW/CCW Limit Inputs for Pulse Output Functions other than
Origin Searches

12-9-3 Palletize: Two-axis Multipoint Positioning


Pulse outputs will stop according to the PLC Setup when either the CW or CCW Limit Input Signals
turns ON. It is also possible to select whether or not the defined origin will be cleared when a CW or
CCW Limit Input Signal turns ON for a pulse output function.

Difference between Set Frequencies and Actual Frequencies


The CP2E CPU Unit’s pulse output frequency is determined by dividing the source clock frequency
(15 MHz) by an integer ratio. Consequently, there may be a slight difference between the set frequency
and the actual frequency, and that difference increases as the frequency increases. The actual fre-
quency can be calculated from the following equations.

z Pulse Output System


Integer dividing ratio calculated
from user’s set frequency

Output pulses (actual frequency)


Source clock Frequency divider
15MHz

z Equations

Source clock frequency


Actual frequency (Hz)=
Dividing ratio

Source clock frequency × 2 + Set frequency


Dividing ratio=INT
Set frequency (Hz) × 2

The INT function extracts an integer from the fraction. The non-integer remainder is rounded.

CP2E CPU Unit Software User’s Manual(W614) 12-59


12 Pulse Outputs

z Differences between Set Frequencies and Actual Frequencies


Source clock frequency: 15 MHz
Set frequency (kHz) Actual frequency (kHz)
99.668 to 100.000 100.000
99.010 to 99.667 99.338
: :
49.917 to 50.083 50.000
49.752 to 49.916 49.834
49.587 to 49.751 49.669
: :
9.997 to 10.003 10.000
9.991 to 9.996 9.993
9.984 to 9.990 9.987

Combinations of Pulse Control Instructions


The following tables show when a second pulse control instruction can be started if a pulse control
operation is already being executed.
A second independent-mode positioning instruction can be started if an independent-mode positioning
instruction is being executed, and a second continuous-mode speed control instruction can be started if
a continuous-mode speed control instruction is being executed. Operation cannot be switched between
the independent and continuous modes, although a PLS2 instruction can be executed while a ACC
instruction (continuous mode) is being executed.
It is possible to start another operation during acceleration/deceleration and start another positioning
instruction during positioning.
Yes:Can be executed. No:Error occurs.
Instruction being started
Instruction being SPED SPED ACC ACC
executed INI (Inde- (Contin- (Inde- (Contin- PLS2 ORG IFEED ITPL
pendent) uous) pendent) uous)
SPED (Independent) Yes Yes No Yes No No No No No
(*1) (*3)
SPED (Continuous) Yes No Yes No Yes No No No No
(*2) (*5)
ACC Steady speed Yes No No Yes No Yes No No No
(Inde- (*4) (*6)
pen- Accelerating or Yes No No Yes No Yes No No No
dent) decelerating (*4) (*6)
ACC Steady speed Yes No No No Yes Yes No No No
(Contin- (*5) (*7)
uous) Accelerating or Yes No No No Yes Yes No No No
decelerating (*5) (*7)
PLS2 Steady speed Yes No No Yes No Yes No No No
(*4) (*8)
Accelerating or Yes No No Yes No Yes No No No
decelerating (*4) (*8)
ORG Steady speed Yes No No No No No No No No
Accelerating or Yes No No No No No No No No
decelerating
IFEED Steady speed Yes No No No No No No Yes No
(*9)
Accelerating or Yes No No No No No No Yes No
decelerating (*9)
ITPL Steady speed Yes No No No No No No No No
Accelerating or Yes No No No No No No No No
decelerating

12-60 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-10 Precautions when Using Pulse Outputs


*1 SPED (Independent) to SPED (Independent)
• The number of output pulses cannot be changed.
• The frequency can be changed.
*2 SPED (Continuous) to SPED (Continuous)
• The frequency can be changed.
*3 SPED (Independent) to ACC (Independent)
• The number of output pulses cannot be changed.
• The frequency can be changed.
• The acceleration/deceleration rate can be changed.
*4 ACC (Independent) to ACC (Independent) or PLS2 to ACC (Independent)
• The number of output pulses cannot be changed.
• The frequency can be changed.
12
• The acceleration/deceleration rate can be changed. (The rate can even be changed during acceleration or
deceleration.)

12-9-3 Palletize: Two-axis Multipoint Positioning


*5 SPED (Continuous) to ACC (Continuous) or ACC (Continuous) to ACC (Continuous)
• The frequency can be changed. (The target frequency can even be changed during acceleration or decel-
eration.)
• The acceleration/deceleration rate can be changed. (The rate can even be changed during acceleration or
deceleration.)
*6 ACC (Independent) to PLS2
• The number of output pulses can be changed. (The setting can even be changed during acceleration or
deceleration.)
• The frequency can be changed. (The target frequency can even be changed during acceleration or decel-
eration.)
• The acceleration/deceleration rate can be changed. (The rate can even be changed during acceleration or
deceleration.)
*7 ACC (Continuous) to PLS2
• The frequency can be changed. (The target frequency can even be changed during acceleration or decel-
eration.)
• The acceleration/deceleration rate can be changed. (The rate can even be changed during acceleration or
deceleration.)
*8 PLS2 to PLS2
• The number of output pulses can be changed. (The setting can even be changed during acceleration or
deceleration.)
• The frequency can be changed. (The target frequency can even be changed during acceleration or decel-
eration.)
• The acceleration/deceleration rate can be changed. (The rate can even be changed during acceleration or
deceleration.)
*9 IFEED to IFEED
• Possible only when target frequency is 0 Hz (deceleration stop).

Origin Search Error Processing


The CP2E CPU Unit’s pulse output function performs a basic error check before starting to output
pulses (when the instruction is executed) and will not output pulses if the settings are incorrect.
There are other errors that can occur with the origin search function during pulse output, which may
stop the pulse output.
If an error occurs that stops pulse output, the pulse output’s Output Stopped Error Flag will be turned
ON and the Pulse Output Stop Error Code will be written to Error Code word. Use these flags and error
codes to identify the cause of the error.
The Pulse Output Stop Errors will not affect the CPU Unit’s operating status. (The Pulse Output Stop
Errors do not cause a fatal or non-fatal error in the CPU Unit.)

CP2E CPU Unit Software User’s Manual(W614) 12-61


12 Pulse Outputs

z Related Auxiliary Area Flags


Pulse Pulse Pulse Pulse
Function Settings
output 0 output 1 output 2 output 3
Output Stopped Error Flags 0: No error A280.07 A281.07 A56.07 A57.07
ON when an error occurred while outputting 1: Stop error
pulses in the origin search function. occurred.
Stop Error Codes A444 A445 A438 A439
When a Pulse Output Stop Error occurs, the error code is
stored in that pulse outputs corresponding Stop Error Code
word.

z Pulse Output Stop Error Codes


Error Operation after
Error name Likely cause Corrective action
code error
CW Limit Stop 0100 Stopped due to a CW limit sig- Move in the CCW direction. Immediate stop
Input Signal nal input. No effect on other
CCW Limit 0101 Stopped due to a CCW limit Move in the CW direction. port
Stop Input signal input.
Signal
No Origin 0200 The parameters indicate that Check the wiring of the Origin Proximity No effect on other
Proximity the Origin Proximity Input Sig- Input Signal as well as the PLC Setup’s Ori- port
Input Signal nal is being used, but a Origin gin Proximity Input Signal Type setting (NC
Proximity Input Signal was not or NO) and execute the origin search again.
received during the origin
search.
No Origin 0201 The Origin Input Signal was Check the wiring of the Origin Input Signal
Input Signal not received during the origin as well as the PLC Setup’s Origin Input Sig-
search. nal Type setting (NC or NO) and execute the
origin search again.
Origin Input 0202 During an origin search in Take one or both of the following steps so Decelerates to a
Signal Error operating mode 0, the Origin that the Origin Input Signal is received after stop.
Input Signal was received dur- deceleration is completed. No effect on other
ing the deceleration started • Increase the distance between the Origin port
after the Origin Proximity Input Proximity Input Signal sensor and Origin
Signal was received. Input Signal sensor.
• Decrease the origin search high speed.
Limit Inputs in 0203 The origin search cannot be Check the wiring of the limit signals in both Operation will not
Both Direc- performed because the limit directions as well as the PLC Setup’s Limit start.
tions signals for both directions are Signal Type setting (NC or NO) and execute No effect on other
being input simultaneously. the origin search again. port
Simultaneous 0204 The Origin Proximity Input Sig- Check the wiring of the Origin Proximity Immediate stop
Origin Proxim- nal and the Limit Input Signal in Input Signal and the Limit Input Signal. Also No effect on other
ity and Limit the search direction are being check the PLC Setup’s Origin Proximity port
Inputs input simultaneously during an Input Signal Type and Limit Signal Type set-
origin search. tings (NC or NO) and then execute the ori-
gin search again.
Limit Input 0205 • When an origin search in one Check the wiring of the Limit Input Signal Immediate stop
Signal Already direction is being performed, and the PLC Setup’s I/O settings. Also No effect on other
Being Input the Limit Input Signal is check the PLC Setup’s Limit Signal Type port
already being input in the ori- setting (NC or NO) and then execute the ori-
gin search direction. gin search again.
• When a non-regional origin
search is being performed,
the Origin Input Signal and
the Limit Input Signal in the
opposite direction (from the
search direction) are being
input simultaneously.

12-62 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

12-10 Precautions when Using Pulse Outputs


Error Operation after
Error name Likely cause Corrective action
code error
Origin Proxim- 0206 • When an origin search with Check the installation positions of the Origin Immediate stop
ity Input Signal reversal at the limit is being Proximity Input Signal, Origin Input Signal, No effect on other
Origin performed, the Limit Input and Limit Input Signal as well as the PLC port
Reverse Error Signal in the search direction Setup’s I/O settings. Also check the PLC
was input while the Origin Setup’s Signal Type settings (NC or NO) for
Proximity Input Signal was each input signal and then execute the ori-
reversing. gin search again.
• When an origin search with
reversal at the limit is being
performed and the Origin
Proximity Input Signal is not
being used, the Limit Input
Signal in the search direction 12
was input while the Origin
Input Signal was reversing.
Positioning 0300 The Servo Drive’s Positioning Adjust the Positioning Monitor Time setting No effect on other

12-9-3 Palletize: Two-axis Multipoint Positioning


Timeout Error Completed Signal does not or Servo system gain setting. Check the port
come ON within the Positioning Positioning Completed Signal wiring, cor-
Monitor Time specified in the rect it if necessary, and then execute the ori-
PLC Setup. gin search again.

CP2E CPU Unit Software User’s Manual(W614) 12-63


12 Pulse Outputs

12-11Pulse Output Pattern


The CP2E CPU Unit’s pulse output function enables operation in Continuous Mode, for which the num-
ber of output pluses is not specified, or in Independent Mode, for which the number of output pulses is
specified. Continuous Mode is used for speed control and Independent Mode is used for positioning.

12-11-1 Speed Control (Continuous Mode)


The following operations can be performed in Continuous Mode by combining instructions.

Starting a Pulse Output


Example Procedure
Operation Frequency changes Description
application Instruction Settings
Output with Changing the Pulse frequency Outputs SPED • Port
specified speed (fre- pulses at a (Continuous) • Pulse + direction
Target frequency
speed quency) in one specified • Continuous
step frequency.
• Target frequency
Time
Execution of SPED

Output with Accelerating the Pulse frequency Outputs ACC • Port


specified speed pulses and (Continuous) • Pulse + direction
Target frequency
acceleration (frequency) at a Acceleration/ changes the • Continuous
deceleration
and speed fixed rate rate
frequency at a
• Acceleration/
fixed rate.
Time deceleration rate
Execution of ACC • Target frequency

Changing Settings
Example Procedure
Operation Frequency changes Description
application Instruction Settings
Change Changing the Pulse frequency Changes the SPED • Port
speed in one speed during frequency (Continuous) • Continuous
Target frequency
step operation (higher or ↓ • Target frequency
lower) of the
Present frequency SPED
pulse output
Time (Continuous)
in one step.
Execution of SPED

Change Changing the Pulse frequency Changes the ACC or • Port


speed speed smoothly frequency SPED • Continuous
Target frequency
smoothly during operation Acceleration/ from the (Continuous) • Target frequency
deceleration
rate
present fre- ↓
Present frequency • Acceleration/
quency at a
Time ACC deceleration rate
fixed rate. The
Execution of ACC (Continuous)
frequency can
be acceler-
ated or decel-
erated.

12-64 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Example Procedure
Operation Frequency changes Description
application Instruction Settings

12-11 Pulse Output Pattern


Changing the Pulse frequency Acceleration/ Changes the ACC • Port
deceleration rate n
speed in a Acceleration/
acceleration or (Continuous) • Continuous
Target frequency deceleration rate 2
polyline curve Acceleration/
deceleration ↓ • Target frequency
during operation deceleration
rate 1 rate during
Present frequency ACC • Acceleration/
acceleration or
Time (Continuous) deceleration rate
deceleration.
Execution of ACC
Execution of ACC
Execution of ACC

Change Not supported.


direction
12

Stopping a Pulse Output

12-11-1 Speed Control (Continuous Mode)


Example Procedure
Operation Frequency changes Description
application Instruction Settings
Stop pulse Immediate stop Pulse frequency Stops the SPED or • Port
output pulse output ACC • Stop pulse
Present
frequency immediately. (Continuous) output

Time INI
Execution of INI

Stop pulse Immediate stop Pulse frequency Stops the SPED • Port
output pulse output (Continuous) • Continuous
Present
frequency
immediately. ↓ • Target
SPED frequency=0
Time
(Continuous)
Execution of SPED

Stop pulse Decelerate to a Pulse frequency Decelerates SPED or • Port


Acceleration/deceleration
output stop Present rate (Rate set at the start the pulse out- ACC • Continuous
smoothly frequency of the operation.) put to a stop.* (Continuous) • Target
↓ frequency=0
Target
frequency=0 Time ACC
Execution of ACC (Continuous)

* If an ACC instruction started the operation, the original acceleration/deceleration rate will remain in effect.
If a SPED instruction started the operation, the acceleration/deceleration rate will be invalid and the pulse output will stop
immediately.

CP2E CPU Unit Software User’s Manual(W614) 12-65


12 Pulse Outputs

12-11-2 Positioning Control (Independent Mode)


The following operations can be performed in Independent Mode by combining instructions.

Starting a Pulse Output


Procedure
Example
Operation Frequency changes Description Instruc-
application Settings
tion
Output with Positioning Pulse frequency Starts outputting PULS • Number of
specified without accel- Specified number of pulses pulses at the speci- pulses
(Specified with PULS) ↓
speed eration or Target fied frequency and • Relative or
frequency SPED
deceleration stops immediately absolute
(Indepen-
when the specified pulse speci-
Time dent)
number of pulses fication
Execution of SPED Outputs the specified number
of pulses and then stops.
has been output. • Port
The target position • Pulse +
(specified number of Direction
pulses) cannot be
• Independent
changed during
positioning. • Target fre-
quency
Simple trape- Positioning Pulse frequency
Accelerates and PULS • Number of
zoidal control with trapezoi- Specified number of pulses decelerates at the ↓ pulses
(Specified with PULS)
dal accelera- Target same fixed rate and • Relative or
Acceleration/ ACC
tion and frequency deceleration rate stops immediately absolute
(Indepen-
deceleration when the specified pulse speci-
Time dent)
(Same rate number of pulses fication
used for accel- Execution of ACC Outputs the specified has been output.* • Port
number of pulses and
eration and then stops.
• Pulse +
deceleration;
Direction
no starting
speed). • Independent
The number of • Accelera-
pulses cannot tion and
be changed decelera-
during posi- tion rate
tioning. • Target fre-
quency
Complex Positioning Pulse
Accelerates and PLS2 • Number of
Specified number of pulses
trapezoidal with trapezoi- frequency
decelerates at a pulses
Target
control dal accelera- frequency Acceleration
Deceleration rate
fixed rates. The • Relative or
rate
tion and pulse output is absolute
Starting
deceleration frequency
Stop frequency
stopped when the pulse speci-
(Separate Time specified number of fication
rates used for Execution Output stops pulses has been • Port
of PLS2 Deceleration point
Target
acceleration frequency reached
output.*
• Pulse +
and decelera- The target position Direction
tion; starting (specified number of
speed) • Accelera-
pulses) can be
tion rate
The number of changed during
pulses can be positioning. • Decelera-
changed dur- tion rate
ing position- • Target fre-
ing. quency
• Starting fre-
quency

12-66 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

* Triangular Control
If the specified number of pulses is less than the number required just to reach the target frequency and
return to zero, the function will automatically reduce the acceleration/deceleration time and perform triangu-

12-11 Pulse Output Pattern


lar control (acceleration and deceleration only.) An error will not occur.

Pulse frequency Specified number of pulses Pulse frequency


(Specified with PULS) Specified number of pulses
(Specified with PLS2)
Target
frequency
Target
frequency

Time Time

Execution of ACC Execution of PLS2

12
Changing Settings
Procedure

12-11-2 Positioning Control (Independent Mode)


Example
Operation Frequency changes Description
application Instruction Settings
Change Changing Number of pulses SPED can be exe- PULS • Number of
Specified number of specified with PULS
speed in the speed in Pulse frequency
pulses (Specified with does not change.
cuted during posi- ↓ pulses
one step one step New target frequency PULS.) tioning to change • Relative or
SPED
during oper- Target frequency (raise or lower) the absolute
(Independent)
ation pulse output fre- pulse speci-
quency in one step. ↓ fication
Time
The target position SPED • Port
Execution of SPED
(independent mode) (specified number (Independent)
SPED (independent mode) • Pulse +
executed again to change the of pulses) is not
target frequency. (The target Direction
position is not changed.)
changed.
• Indepen-
dent
• Target fre-
quency
Change Changing Number of pulses ACC can be exe- PULS • Number of
specified with PULS
speed the target Pulse frequency
Specified number of
pulses (Specified does not change. cuted during posi- ↓ pulses
smoothly speed (fre- with PULS.) tioning to change • Relative or
New target frequency ACC
(with quency) the acceleration/ absolute
Target frequency
Acceleration/ (Independent)
accelera- during posi- deceleration rate deceleration rate pulse speci-
tion rate = tioning and target fre- ↓ fication
Time
decelera- (accelera- quency. ACC • Port
Execution of ACC
tion rate) tion rate = (independent mode) The target position (Independent)
• Pulse +
decelera- ACC (independent mode) executed
(specified number
again to change the target frequency. PLS2 Direction
tion rate) (The target position is not changed,
of pulses) is not
but the acceleration/deceleration rate
↓ • Indepen-
is changed.)
changed.
ACC dent
(Independent) • Accelera-
tion/decel-
eration rate
• Target fre-
quency

CP2E CPU Unit Software User’s Manual(W614) 12-67


12 Pulse Outputs

Example Procedure
Operation Frequency changes Description
application Instruction Settings
Change Changing Pulse frequency Specified number of pulses PLS2 can be exe- PULS • Number of
(Specified with PULS.)
speed the target New target frequency cuted during posi- ↓ pulses
smoothly speed (fre- Target frequency tioning to change • Relative or
Acceleration/ ACC
(with quency) deceleration the acceleration absolute
rate (Independent)
unequal during posi- rate, deceleration pulse speci-
accelera- tioning
Time
rate, and target fre- ↓ fication
Execution of ACC
tion and (different (independent mode) quency. PLS2 • Port
PLS2 executed to change the target
decelera- accelera- To prevent the tar-
frequency and acceleration/deceleration
PLS2 • Pulse +
tion rates) tion and rates.(The target position is not
get position from
↓ Direction
changed. The original target position is
decelera- specified again.)
being changed
tion rates) PLS2 • Accelera-
intentionally, the
tion rate
original target posi-
tion must be speci- • Decelera-
fied in absolute tion rate
coordinates. • Target fre-
quency
• Starting fre-
quency
Change Change the Pulse frequency Number of pulses
PLS2 can be exe- PULS • Number of
target target posi- Secified number
changed with PLS2. cuted during posi- ↓ pulses
of pulses
position tion during tioning to change • Relative or
Target frequency Acceleration/ ACC
positioning deceleration the target position absolute
rate (Independent)
(multiple (number of pulses). pulse speci-
Time
↓ fication
start Execution of PLS2
When the target
function) position cannot be PLS2 • Port
PLS2 executed to change the target
position.(The target frequency and
acceleration/deceleration rates are
changed without PLS2 • Pulse +
not changed.) maintaining the
↓ Direction
same speed range,
PLS2 • Accelera-
an error will occur
tion rate
and the original
operation will con- • Decelera-
tinue to the original tion rate
target position. • Target fre-
quency
• Starting fre-
quency

12-68 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Example Procedure

12-11 Pulse Output Pattern


Operation applica- Frequency changes Description Instruc-
tion Settings
tion
Change Change PLS2 can be executed PULS • Number of
Number of pulses
target posi- the target Pulse frequency Specified number changed with PLS2. during positioning to ↓ pulses
of pulses
tion and position New target frequency change the target position • Relative or
ACC
speed and target Target frequency (number of pulses), absolute
Acceleration/ (Indepen-
smoothly speed (fre- deceleration acceleration rate, decel- pulse spec-
rate dent)
quency) eration rate, and target ification
during
Time
frequency. ↓
Execution of ACC • Port
positioning (Independent mode)
When the settings cannot PLS2
PLS2 executed to change the target • Pulse +
(multiple
start func-
position, target frequency, and
acceleration/deceleration rates
be changed without main- Direction 12
taining the same speed
tion) • Accelera-
range, an error will occur
tion rate
and the original opera-

12-11-2 Positioning Control (Independent Mode)


tion will continue to the • Decelera-
original target position. tion rate
• Target fre-
quency
• Starting
frequency
Change Pulse frequency Number of pulses specified
PLS2 can be executed PLS2 • Number of
by PLS2.
the accel- Acceleration/
deceleration rate n during positioning (accel- ↓ pulses
eration and New target frequency Acceleration/
eration or deceleration) to • Accelera-
deceleration rate 3
Target frequency Acceleration/ PLS2
decelera- deceleration rate 2 change the acceleration tion rate
Acceleration/
tion rates deceleration
rate 1
rate or deceleration rate. • Decelera-
during Time
tion rate
positioning Execution of PLS2 Execution of PLS2
Execution of PLS2
(multiple Execution of PLS2
start func-
tion)
Change Change Pulse frequency
PLS2 can be executed PULS • Number of
direction the direc- Secified number Change of direction at the
during positioning with ↓ pulses
tion during of pulses specified deceleration rate absolute pulse specifica- • Absolute
Target ACC
positioning frequency
Number of pulses (position) tion to change to absolute pulse spec-
(Indepen-
changed by PLS2
pulses and reverse direc- ification
Time dent)
tion. • Port
Execution
of PLS2 ↓
Execution of PLS2 • Pulse +
PLS2
Direction
PLS2 • Accelera-
↓ tion rate
PLS2 • Decelera-
tion rate
• Target fre-
quency
• Starting
frequency

CP2E CPU Unit Software User’s Manual(W614) 12-69


12 Pulse Outputs

Stopping a Pulse Output


Example Procedure
Operation Frequency changes Description
application Instruction Settings
Stop pulse Immediate Pulse frequency
Stops the pulse output immedi- PULS Stop pulse
output stop ately and clears the number of ↓ output
(Number of Present output pulses setting.
frequency ACC or SPED
pulses set-
(Independent)
ting is not
preserved.) Time

Execution Execution INI
of SPED of INI
PLS2

INI
Stop pulse Immediate Pulse frequency
Stops the pulse output immedi- PULS • Port
output stop ately and clears the number of ↓ • Indepen-
(Number of Present output pulses setting. dent
frequency SPED
pulses set- • Target fre-
(Independent)
ting is not quency = 0
preserved.) Time

Execution Execution SPED
of SPED of SPED
(Independent)

Stop sloped Decelerate Pulse frequency Decelerates the pulse output PULS • Port
pulse out- to a stop Present
to a stop. ↓ • Indepen-
Original acceleration/
put frequency deceleration rate
If ACC started the operation, dent
ACC or SPED
smoothly. the original acceleration/decel- • Target fre-
(Independent)
(Number of eration rate will remain in quency = 0
pulses set-
Target
frequency=0
Time

Execution of ACC
effect.
ting is not If SPED started the operation, ACC
preserved.) the acceleration/deceleration (Independent)
rate will be invalid and the PLS2
pulse output will stop immedi-

ately.
ACC
(Independent)

12-70 CP2E CPU Unit Software User’s Manual(W614)


12 Pulse Outputs

Switching from Speed Control (Continuous Mode) to Positioning

12-11 Pulse Output Pattern


(Independent Mode)
Example Procedure
Frequency changes Description
application Instruction Settings
Change Outputs the number of pulses PLS2 can be executed ACC • Port
from speed specified in PLS2 (Both relative and during a speed control (Continuous) • Acceleration
absolute pulse specification can be
control to used.) operation started with ↓ rate
Pulse frequency
fixed dis- ACC to change to position- • Deceleration
PLS2
tance posi- Target ing operation. rate
frequency
tioning
during
An error will occur if a con- • Target fre- 12
stant speed cannot be quency*
operation Time
achieved after switching
Execution of ACC
• Number of
the mode. If this happens,

12-11-2 Positioning Control (Independent Mode)


(continuous) pulses
Execution of PLS2 the instruction execution
will be ignored and the
Fixed dis- previous operation will be
Pulse frequency
tance feed continued.
interrupt Present
frequency

Time

Execution of ACC
(continuous)
Execution of PLS2 with the following settings
 Number of pulses = number of pulses until stop
 Relative pulse specification
 Target frequency = present frequency
 Acceleration rate = Not 0
 Deceleration rate = target deceleration rate

High-speed When an interrupt input IFEED • Port


interrupt Pulse frequency occurs during speed con- • Acceleration
feeding trol for the IFEED instruc- rate
Interrupt input occurs. tion, operation changes to • Target fre-
Target Specified number
frequency of pulses
positioning. An interrupt quency
Deceleration task is not used.
Acceleration Speed Position
rate
• Pulse output
rate control control There is no delay for the
Time
set value
starting time of the inter-
IFEED executed • Deceleration
rupt task, improving the
rate
feeding accuracy.

* The starting frequency is ignored.

CP2E CPU Unit Software User’s Manual(W614) 12-71


12 Pulse Outputs

12-72 CP2E CPU Unit Software User’s Manual(W614)


PWM Outputs
13
This section describes the PWM Outputs (variable-duty-factor pulse outputs).

13-1 PWM Outputs (Variable-duty-factor Pulse Outputs) . . . . . . . . . . . . . . . . . 13-2


13-1-1 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
13-1-2 Ladder Program Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4

CP2E CPU Unit Software User’s Manual(W614) 13-1


13 PWM Outputs

13-1 PWM Outputs (Variable-duty-factor


Pulse Outputs)
PWM outputs can be used only with the CP2E N/S……-type CPU Unit with transistor outputs.
A PWM (Pulse Width Modulation) pulse can be output with a specified duty factor. The duty factor is the
ratio of the pulse’s ON time and OFF time in one pulse cycle. Use the PWM instruction to generate
PWM pulses from a built-in output. The duty factor can be changed during pulse output.

z Application example
• Controlling temperature on a time-proportional basis using the PWM output.
• Controlling the brightness of lighting.

Built-in output

PWM output

100% Period is determined


by frequency
15%

Duty factor:15%

50%

Duty factor:50%

75%

Duty factor:75%

Specifications
Item Specification
Duty factor 0.0% to 100.0% in 0.1% increments
(Duty factor accuracy is +1%/-0% at 10 kHz, +5%/-0% at 10 to 32 kHz .)
Frequency 2.0 Hz to 6,553.5 Hz (Set in 0.1-Hz increments.)*
2 Hz to 32,000 Hz (Set in 1-Hz increments.)*
Output mode Continuous mode
Instruction PWM
* The duty factor accuracy declines significantly at high frequencies because of limitations in the output circuit at
high frequencies.

Additional Information

For N30/40/60 CPU Units, the output indicator of terminal 01 on terminal block CIO100 is always
lit during PWM output.

13-2 CP2E CPU Unit Software User’s Manual(W614)


13 PWM Outputs

13-1 PWM Outputs (Variable-duty-factor Pulse Outputs)


Wiring for S……-type CPU Unit
An external power supply is required for S……-type CPU Units when using the PWM output.
Provide a DC24V external power supply to V+ and V- terminals as follows.

z Wiring Example
Sinking outputs

V+ 00 01 02

V- COM(V-) COM 03

13
Although V- and COM(V-) are connected internally, also wire them externally.

Sourcing outputs

V+ 00 01 02

V- COM(V+) COM 03

Although V+ and COM(V+) are connected internally, also wire them externally.
Do not connect an external power supply to N……-type CPU Units.

CP2E CPU Unit Software User’s Manual(W614) 13-3


13 PWM Outputs

13-1-1 Flow of Operation

1 Setting pulse output port number,


assigning pulse output terminals,
Terminal 01 on terminal block CIO100 is used for PWM
output 0.
and wiring.

2 Greate ladder Cyclic task,


• The PWM instruction is used to control PWM outputs.
• PWM outputs are stopped with the INI instruction.
program interrupt task.

z Pulse Output Port Number and Pulse Output Terminals


The following terminals can be used for pulse outputs according to the pulse output method.
Output terminal block Other functions that cannot be used at the same time
Specifications made
Terminal Terminal Pulse output method
with PWM instruction Normal output
block label number Pulse + direction
CIO 100 00 − Pulse output 0, pulse Normal output 0
01 PWM output 0 Pulse output 1, pulse Normal output 1
02 − Pulse output 0, direction Normal output 2
03 − Pulse output 1, direction Normal output 3
CIO 101 00 − Pulse output 2, pulse Normal output 8
01 − Pulse output 3, pulse Normal output 9
02 − Pulse output 2, direction Normal output 10
03 − Pulse output 3, direction Normal output 11

13-1-2 Ladder Program Example

Specifications and Operation


When the start input (CIO 0.00) turns ON in this example, pulses with a duty factor of 40% at a fre-
quency of 2,000 Hz are output from PWM output 0. When the stop input (CIO 0.01) turns ON, PWM
output 0 is stopped.

Frequency: Duty factor:


2,000 Hz, 500 μs 40%, 200 μs
Start input (CIO 0.00)

Stop input (CIO 0.01)

13-4 CP2E CPU Unit Software User’s Manual(W614)


13 PWM Outputs

13-1 PWM Outputs (Variable-duty-factor Pulse Outputs)


Applicable Instructions
PWM
INI

Preparations

z PLC Setup
There are no settings that need to be made in the PLC Setup.

z DM Area Settings
• PWM Operand Settings (D0 and D1)
13
Setting Operand Data
Frequency: 2,000.0 Hz D0 #4E20

13-1-2 Ladder Program Example


Duty factor: 40.0% D1 #0190

z Ladder Diagram

0.00
@PWM
Start input #1000 ←PWM output 0 (Duty factor in increments of 0.1%, Frequency in increments of 0.1 Hz)
D0 ←Frequency setting
D1 ←Duty factor setting
0.01
@INI
Stop input #1000 ←PWM output 0
#0003 ←Stops pulse output
D10 ←Not used.

CP2E CPU Unit Software User’s Manual(W614) 13-5


13 PWM Outputs

13-6 CP2E CPU Unit Software User’s Manual(W614)


Serial Communications
This section describes communications with Programmable Terminals (PTs) without
using communications programming, no-protocol communications with general compo-
nents, and connections with a Modbus-RTU Easy Master, Modbus-RTU slave, Serial 14
PLC Link, and host computer.

14-1 Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3


14-1-1 Types of CPU Units and Serial Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3
14-1-2 Overview of Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5
14-2 Program-free Communications with Programmable Terminals . . . . . . . 14-7
14-2-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-7
14-2-2 Flow of Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8
14-2-3 PLC Setup and PT System Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8
14-3 No-protocol Communications with General Components . . . . . . . . . . . 14-10
14-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-10
14-3-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11
14-3-3 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-11
14-3-4 Related Auxiliary Area Bits and Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-12
14-4 Modbus-RTU Easy Master Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
14-4-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
14-4-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
14-4-3 Setting and Word Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-15
14-4-4 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-18
14-5 Serial PLC Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-27
14-5-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-27
14-5-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-28
14-5-3 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-28
14-5-4 Operating Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-30
14-5-5 Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-37
14-6 Connecting the Host Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
14-6-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
14-6-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-39
14-6-3 Command/response Format and List of Commands . . . . . . . . . . . . . . . . . . 14-40
14-7 Modbus-RTU Slave Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-42
14-7-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-42

CP2E CPU Unit Software User’s Manual(W614) 14-1


14 Serial Communications

14-7-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43


14-7-3 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-43
14-7-4 Operation Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-44
14-7-5 Command and Response Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-45
14-7-6 Related special auxiliary relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-51
14-8 Precautions on the usage of RS-485 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-52

14-2 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-1 Serial Communications


Serial communications can be used with any model of CP2E CPU Unit.

14-1-1 Types of CPU Units and Serial Ports

Serial Ports

14-1 Serial Communications


z E/S……-type CPU Unit
E14/20/30/40/60 CPU Units have only one built-in RS-232C port. There are no option slots.
S30/40/60 CPU Units have one built-in RS-232C port and one built-in RS-485 port. There are no
option slots.
E14/20 CPU Unit E30/40/60, S30/40/60 CPU Unit

14

14-1-1 Types of CPU Units and Serial Ports


Built-in RS-232C Port Built-in RS-485 Port
(S30/40/60 CPU Unit only)
Built-in RS-232C Port

z N……-type CPU Unit


N14/20 CPU Units have only one option slot.
N30/40/60 CPU Units have two option slots.
RS-232C or RS-422A/485 Option Boards can be mounted for serial communications.
N14/20 CPU Unit N30/40/60 CPU Unit

Serial Port 1 Serial Port 2


  When CP1W-CIF01/CIF11/CIF12-V1, When CP1W-CIF01/CIF11/CIF12-V1 Option Board is mounted.
  CP2W-CIFD Option Board is mounted. * Option Board with 2 ports cannot be used.
Serial Port 1
Serial Port 1 (EX)
  When CP1W-CIF01/CIF11/CIF12-V1, CP2W-CIFD Option Board is mounted.
  Only when CP2W-CIFD Option Board
Serial Port 1 (EX)
  with 2 ports is mounted.
  Only when CP2W-CIFD Option Board with 2 ports is mounted.

Installation Example
Option Board with 2 ports RS-422A/485 Option Board
CP2W-CIFD CP1W-CIF12-V1

CP2W-CIFD Serial Option Board with two ports


can be mounted to option slot 1, so two ports can
be controlled by one slot, and a total of three-port
serial communications is possible together with
option slot 2.

Serial Port 1 Serial Port 1 (EX) Serial Port 2


Option Slot 1 Option Slot 2

CP2E CPU Unit Software User’s Manual(W614) 14-3


14 Serial Communications

Serial Ports and Compatible Protocols


Serial Port Serial Port 1 Serial Port 2
Serial Port 1 (EX)
Protocol Built-in RS-232C Built-in RS-485
Host Link Supported Supported Not supported
1:N NT Link Supported Supported Not supported
Serial PLC Links (Master) Supported Supported Supported
Serial PLC Links (Slave) Supported Supported Supported
RS-232C (No-protocol mode) Supported Supported Supported
Modbus-RTU Easy Master Supported Supported Supported
Modbus-RTU Slave Supported Supported Supported

Overview of Connection with Serial Ports


Option slot
Connected devices Connected devices

NB-series PT, NS-series PT NB-series PT, NS-series PT


or NV-series PT or NV-series PT

1:N NT Link
1:N NT Link Host Link
Host Link

N14/20 CPU Unit General component


General component

Option slot 1 Option slot 2


No-protocol
No-protocol communications
communications

Inverter
Inverter

Modbus-RTU Easy Modbus-RTU Easy


Master communications Master communications

N30/40/60 CPU Unit

CP-series PLC
or CJ2M PLC CP-series PLC or CJ2M PLC

Serial PLC Links*1


Serial PLC Links*1

Host computer Built-in Host computer (A Programming


(A Programming Device cannot be connected.) RS-232C Port Device cannot be connected.)
E14/20 CPU Unit

Host Link Host Link

Other company’s PLC Other company’s PLC

Modbus-RTU Slave*2 Modbus-RTU Slave*2


E30/40/60, S30/40/60
CPU Unit

Built-in Built-in RS-485 port


RS-232C port (S30/40/60 only)
*1 Serial PLC Links can only be used on one port.
*2 Modbus-RTU Slave can only be used on one port.

14-4 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-1-2 Overview of Serial Communications


The CP2E CPU Units support the following types of serial communications.
Built-in Built-in
Serial
Communications RS-232C/ RS-485/
Connected devices Description Port 1
protocol Serial Serial
(EX)
Port 1 Port 2

14-1 Serial Communications


Programmable Terminal Data can be exchanged Host Link or 1:N OK OK NO
with PTs without using a NT Link
NS-series PT communications program
in the CPU Unit.

Note Only one PT can be


RS-232C
Host Link or NT Link
connected when
using a 1:N NT
CP2E Link. It is not possi-
ble to connect two
PTs.
General component Communicates with gen- No-protocol OK OK OK
eral devices, such as bar- communications
14
code readers and
CP2E
measuring instruments,

14-1-2 Overview of Serial Communications


with an RS-232C or RS-
RS-232C or RS-422A/485
422A/485 port without a
command-response for-
mat. The TXD and RXD
instructions are executed
General device with
in the ladder program in
serial communications the CPU Unit to transmit
data from the transmis-
sion port or read data in
the reception port.
Modbus-RTU slave devices, such as Data can be easily Modbus-RTU Easy OK OK OK
inverters exchanged with general Master Function
devices that support Mod-
bus-RTU slave functional-
CP2E
ity (such as inverters) and
are equipped with an RS-
RS-232C or RS-422A/485
232C port or RS-
422A/485 port.

Inverter

Data links between CPU Units Data links can be created Serial PLC Links*2 OK OK OK
for up to nine CP-series
CP2E CPU Unit Polling Unit or CJ2M CPU Units,
including one Polling Unit
RS-422A/485
and up to eight Polled
Shared data Units. Up to 10 words can
be shared per Unit.*1

CP2E CPU Unit Polled Unit CP1L CPU Unit Polled Unit

CP2E CPU Unit Software User’s Manual(W614) 14-5


14 Serial Communications

Built-in Built-in
Serial
Communications RS-232C/ RS-485/
Connected devices Description Port 1
protocol Serial Serial
(EX)
Port 1 Port 2
Host computers PLC data can be read by Host Link OK OK NO
the host computer or writ-
ten to the PLC from the
computer. The host com-
Computer
puter sends a Host Link
command (C Mode) or a
RS-232C
FINS command to the
Host Link CPU Unit to read/write
I/O memory, change the
operating mode, or to
force-set/reset bits in the
CPU Unit.

Modbus-RTU Master devices Data can be read or writ- Modbus-RTU OK OK OK


ten to the CP2E by Mod- Slave Fuction*2
bus-RTU master of other
Other company's PLC company’s PLCs.
Master

RS-485
Modbus-RTU

CP2E
Slave

*1 A PT cannot be included in the Serial PLC Links.


*2 Serial PLC Links and Modbus-RTU Slave cannot be used on two ports at the same time.

Note The Built-in RS-485 port of S……-type CPU Units and the RS-485 port of CP2W-CIFD2/CIFD3 can only communicate in
half duplex.

Additional Information

Refer to A-3 Wiring for Serial Communications in the CP2E CPU Unit Hardware User’s Manual
(Cat.No.W613) for Serial communication wiring.

14-6 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-2 Program-free Communications with Programmable Terminals


14-2 Program-free Communications with
Programmable Terminals

14-2-1 Overview

Communications without special communications programming is possible between a CP2E CPU Unit
and a Programmable Terminal (PT) by using the Host Link or 1:N NT Link protocol.
Connect the serial port of the CP2E CPU Unit and PT with Host Link or NT Link (1:N) communication
mode, and connect the CP2E CPU Unit and PT 1:1 as shown below.
PT: NB, NS or NV series

RS-232C
Host Link or 1:N NT Link 14
CP2E CPU Unit

14-2-1 Overview
z Connectable Programmable Terminals (PTs)
High-speed Links (115,200 bps) can be used with NB-series, NS-series, or NV-series PTs.

Precautions for Correct Use


• Communications are not possible for CP2E CPU Units using the 1:1 NT Link protocol. Do not
connect more than one PT to a CP2E CPU Unit even if the 1:N NT Link protocol is used.
• SAP (Smart Active Parts) on NS-series PTs cannot be used for CP2E CPU Units.

CP2E CPU Unit Software User’s Manual(W614) 14-7


14 Serial Communications

14-2-2 Flow of Connection

CP2E CPU Unit PT (e.g. NB-series)

1 Select Built-in RS-232C, Built-in RS-485 Create a project using the


or Serial Port in the PLC Setup of the NB-Designer and select COM1 or
CP2E CPU Unit using the CX-Designer
PLC Setup COM2 in the communications
CX-Programmer. settings.
(Set the serial communication mode to
Host Link and set the baud rate.)

2 Transfer the PLC Setup.


Transfer screen data created
Transfer screen using the NB-Designer to the
NB-series PT.

3 Check the communications settings


NB-series PT in the NB-series PT on the Comm
System Menu Settings Tab Page in the system
menu.

4 Set the same communications settings in the CP2E CPU Unit’s PLC Setup and in the NB-series PT.

5 Connect the CP2E CPU Unit and PT using the RS-232C or RS-422A/485 ports.

14-2-3 PLC Setup and PT System Settings


Set the parameters in the PLC Setup and the PT’s System Menu.

PLC Setup
Click the Built-in RS-232C, Built-in RS-485 or Serial Port Tab in the PLC Settings Dialog Box.

14-8 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-2 Program-free Communications with Programmable Terminals


Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page
Parameter Setting
Communications Settings Select the Custom Option and set the baud rate to 115,200 and the format to 7,2,E.
(It is not necessary to change the format setting when connecting to NS-series with
1:N NT Link.)
Mode Select Host Link.
Select NT Link (1: N) for the NS-series.
Unit Number Set to 0.
(When connecting with
Host Link)
NT/PC Link Max. If only one NS-series PT (unit number 0) is connected, set this parameter to 1. In
(When connecting to NS- any other case of NS-series PTs, select the unit number (1 to 7) of the connected
series with NT Link) NS-series PT.

PT System Menu
Example: NB-series PT
• Set the baud rate to 115,200, the data bit to 7, the parity check to even, and the stop bit to 2 on the 14
COM1 Settings or the COM2 Settings in the PT property.

14-2-3 PLC Setup and PT System Settings


Example: NS-series PT
1. Select NT Links (1:N) from Serial Port A or Serial Port B on the Memory Switch Menu under the Sys-
tem Menu on the PT.
2. Press the SET Touch Switch to set the baud rate to high speed.
A baud rate of 115,200 bps in the PLC Setup is the same as setting high speed for the PT.

Connection with Other Company’s Display Devices


Select Host Link in the serial communications mode settings of the CP2E CPU Unit and set all other
communications parameters to the same values as the other company’s display device.

CP2E CPU Unit Software User’s Manual(W614) 14-9


14 Serial Communications

14-3 No-protocol Communications with


General Components

14-3-1 Overview

CP2E CPU Units and general devices with serial communications ports can be used for no-protocol
communications.
No-protocol communications enable sending and receiving data using the TRANSMIT (TXD) and
RECEIVE (RXD) instructions without using a protocol and without data conversion (e.g., no retry pro-
cessing, data type conversion, or process branching based on received data).
The serial communications mode is set to RS-232C.

CP2E CPU Unit

TXD or RXD

Sending/ RS-232C or RS422A/485


receiving data

General component
(e.g., barcode reader)

No-protocol communications are used to send data in one direction to or from general external devices
that have an RS-232C or RS-422A/485 port using TXD or RXD.
For example, simple (no-protocol) communications can be used to input data from a barcode reader or
output data to a printer.
The following table lists the no-protocol communication functions supported by CP2E PLCs.
Max. Frame format
Communica- Transfer
Method amount of Other functions
tions direction Start code End code
data
Data PLC → Execution 256 bytes Yes: 00 to FF Yes: 00 to FF • Send delay time (delay
transmission External of TXD in hex hex or CR+LF between TXD execution and
device the ladder No: None No: None (The sending data from specified
program amount of data port): 0 to 99,990 ms at the
to receive is minimum(unit: 10 ms)
specified • Controlling RS and ER signals
between 1 and
Data External Execution 256 bytes Monitoring CS and DR signals
256 bytes when
reception device → of RXD in
no end code is
PLC the ladder
specified.)
program

Note 1 Because the built-in RS-485 port of the S……-type CPU Unit and the RS-485 port of CP2W-CIFD2/CIFD3
use 2-wire connections, so they can only communicate in half duplex. Communications are not possible in
full duplex.

14-10 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-3 No-protocol Communications with General Components


2 The following serial communication ports cannot control RS and ER signals or monitor CS and DR signals.
• ER and DR signals are not supported by the built-in RS-232C port on the E/S……-type CPU Unit.
• RS, ER, CS and DR signals are not supported by the built-in RS-485 port of the S……-type CPU Unit and
CP1W-CIF11/CIF12-V1 Option Board.
• RS, ER, CS and DR signals are not supported by the RS-232C and RS-485 port of CP2W-CIFD1/CIFD2/
CIFD3 Option Board with two ports.

14-3-2 Flow of Operation

1 Wiring communications
Connect the CP2E CPU Unit and external device using
RS-232C or RS-422A/485 ports.

2 PLC Setup
Select Built-in RS-232C, Built-in RS-485 or Serial Port
in the PLC Setup and transfer the PLC Setup from the
CX-Programmer to the CP2E CPU Unit.
(Set the serial communications mode to RS-232C, and
set the communications conditions.)
14
3 Create
ladder
Cyclic tasks
• PLC to External device: Execute the TXD instruction.
• External device to PLC: Execute the RXD instruction.

14-3-2 Flow of Operation


Program Interrupt tasks

14-3-3 PLC Setup


Click the Built-in RS-232C, Built-in RS-485 or Serial Port Tab in the PLC Settings Dialog Box.

CP2E CPU Unit Software User’s Manual(W614) 14-11


14 Serial Communications

Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page


Parameter Setting
Communications Set the communications settings to the same values as the connected device.
Settings If the connected device is set to 9,600 bps, two stop bits, and even parity, select the
Custom Option, set the baud rate to 9,600 and format to 7,2,E.
Mode Select RS-232C.
End Code • To specify the number of bytes of received data, select Received bytes and set the
number of bytes from 1 to 256.
• To use CR+LF as the end code, set CR+LF.
• To set the end code to any value between 00 to FF hex, set a value between
0x0000 and 0x00FF.

14-3-4 Related Auxiliary Area Bits and Words


Address Name Details
A392.04 Serial Port 1/Built-in RS-232C ON when a communications error occurs at the serial port 1 or built-in
Port Communications Error RS-232C port. The port must be restarted when this flag turns ON.
Flag
A392.05 Serial Port 1/Built-in RS-232C ON when the serial port 1 or built-in RS-232C port is able to send data
Port Send Ready Flag in no-protocol mode.
(No-protocol mode)
A392.06 Serial Port 1/Built-in RS-232C ON when the serial port 1 or built-in RS-232C port has completed the
Port Reception Completed reception in no-protocol mode.
Flag • When the number of bytes was specified: ON when the specified
(No-protocol mode) number of bytes is received.
• When the end code was specified: ON when the end code is received
or 256 bytes are received.
A392.07 Serial Port 1/Built-in RS-232C ON when a data overflow occurred during reception through the serial
Port Reception Overflow Flag port 1 or built-in RS-232C port in no-protocol mode.
(No-protocol mode) • When the number of bytes was specified:
ON when more data is received after the reception was completed but
before RXD was executed.
• When the end code was specified:
ON when more data is received after the end code was received but
before RXD is executed.
ON when 257 bytes are received before the end code.
If a start code is specified, ON when the end code is received after
the start code is received.
A392.12 Serial Port 2/Built-in RS-485 ON when a communications error has occurred at the serial port 2 or
Port Communications Error built-in RS-485 port. The port must be restarted when this flag turns
Flag ON.
A392.13 Serial Port 2/Built-in RS-485 ON when the serial port 2 or built-in RS-485 port is able to send data in
Port Send Ready Flag no-protocol mode.
(No-protocol Mode)
A392.14 Serial Port 2/Built-in RS-485 ON when the serial port 2 or built-in RS-485 port has completed the
Port Reception Completed reception in no-protocol mode.
Flag • When the number of bytes was specified: ON when the specified
(No-protocol Mode) number of bytes is received.
• When the end code was specified: ON when the end code is received
or 256 bytes are received.

14-12 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-3 No-protocol Communications with General Components


Address Name Details
A392.15 Serial Port 2/Built-in RS-485 ON when a data overflow occurred during reception through the serial
Port Reception Overflow Flag port 2 or built-in RS-485 port in no-protocol mode.
(No-protocol Mode) • When the number of bytes was specified:
ON when more data is received after the reception was completed but
before RXD was executed.
• When the end code was specified:
ON when more data is received after the end code was received but
before RXD is executed.
ON when 257 bytes are received before the end code.
If a start code is specified, ON when the end code is received after
the start code is received.
A50.04 Serial Port 1 (EX) ON when a communications error occurs at the serial port 1 (EX). The
Communication Error Flag port must be restarted when this Flag turns ON.
A50.05 Serial Port 1 (EX) ON when the serial port 1 (EX) is able to send data in no-protocol mode.
Send Ready Flag
(No-protocol mode)
A50.06 Serial Port 1 (EX) ON when the serial port 1 (EX) has completed the reception in no-proto-
Reception Completed Flag col mode.
(No-protocol mode) • When the number of bytes was specified: ON when the specified
number of bytes is received. 14
• When the end code was specified: ON when the end code is received
or 256 bytes are received.

14-3-4 Related Auxiliary Area Bits and Words


A50.07 Serial Port 1 (EX) ON when a data overflow occurred during reception through the serial
Reception Overflow Flag port 1 (EX) in no-protocol mode.
(No-protocol mode) • When the number of bytes was specified:
ON when more data is received after the reception was completed but
before RXD was executed.
• When the end code was specified:
ON when more data is received after the end code was received but
before RXD is executed.
A393.00 to Serial Port 1/Built-in RS-232C • Indicates (in binary) the number of bytes of data received when the
A393.15 Port Reception Counter serial port 1 or built-in RS-232C port is in no-protocol mode.
(No-protocol Mode) • The start code and end code are not included.
A394.00 to Serial Port 2/Built-in RS-485 • Indicates (in binary) the number of bytes of data received when the
A394.15 Port Reception Counter serial port 2 or built-in RS-485 port is in no-protocol mode.
(No-protocol Mode) • The start code and end code are not included.
A51.00 to Serial Port 1 (EX) • Indicates (in binary) the number of bytes of data received when the
A51.15 Reception Counter serial port 1 (EX) in no-protocol mode.
(No-protocl Mode) • The start code and end code are not included.

CP2E CPU Unit Software User’s Manual(W614) 14-13


14 Serial Communications

14-4 Modbus-RTU Easy Master Function

14-4-1 Overview

Using the Modbus-RTU Easy Master enables easy control of Modbus-compatible slaves, such as
inverters, using serial communications. The serial communications mode is set to Modbus-RTU Easy
Master.

15 08 07 00
D1200 - - Slave address
D1201 - - Function code
D1202 Number of communications data bytes
Communications are easily achieved D1203
by simply turning ON A640.00 after Communications data

~
setting the Modbus-RTU command in
the DM fixed allocation words.

Slave address Function code Communications data

Slave address Function code Communications data


Modbus-RTU
Modbus-RTU Master Execution
Bit for Port 1 A640.00
OMRON Inverters
3G3MX2-V1, 3G3RX2,
3G3RX-V1

CP2E CPU Unit

Modbus-RTU commands can be sent simply by turning ON a software switch after setting the Modbus
slave address, function, and data in the DM fixed allocation words for the Modbus-RTU Easy Master.
The response when received is automatically stored in the DM fixed allocation words for the Modbus-
RTU Easy Master.

14-4-2 Flow of Operation

1 Wiring communications
Connect the CP2E CPU Unit and Modbus-RTU Slave
using RS-232C or RS-422A/485 ports.

2 PLC Setup
Select Built-in RS-232C, Built-in RS-485 or Serial Port in
the PLC Setup and transfer the PLC Setup from the CX-
Programmer to the CP2E CPU Unit. (Set the serial com-
munications mode to Modbus Easy Master, and set the
communications conditions.)

3 Create Cyclic tasks


• Set the Modbus-RTU frame in the DM Fixed Allocation
Words.
ladder
Program Interrupt tasks • Turn ON the Modbus-RTU Master Execution Bit
(A640.00, A641.00 or A638.00).

14-14 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-4-3 Setting and Word Allocation


DM fixed allocation words and Auxiliary Area words are allocated for the Modbus-RTU Easy Master
according to the CPU Unit type and connected port as shown below.

14-4 Modbus-RTU Easy Master Function


CP2E CPU Unit serial port DM fixed allocation words Auxiliary Area bits
CP2E E……-type CPU Built-in RS-232C port D1200 to D1299 A640.00 to A640.02
Unit
CP2E S……-type CPU Built-in RS-232C port D1200 to D1299 A640.00 to A640.02
Unit Built-in RS-485 port D1300 to D1399 A641.00 to A641.02
CP2E N14/20 CPU Serial Port 1 D1200 to D1299 A640.00 to A640.02
Unit Serial Port 1 (EX) D1400 to D1499 A638.00 to A638.02
CP2E N30/40/60 CPU Serial Port 1 D1200 to D1299 A640.00 to A640.02
Unit Serial Port 2 D1300 to D1399 A641.00 to A641.02
Serial Port 1 (EX) D1400 to D1499 A638.00 to A638.02

z DM Fixed Allocation Words 14


Word
Built-in RS232C Built-in RS-485

14-4-3 Setting and Word Allocation


port of CP2E port of CP2E
Serial Port 1
E/S……-type S……-type CPU Bits Contents
(EX) of CP2E
CPU Unit or Unit or Serial
N……-type CPU
Serial Port 1 of Port 2 of CP2E
Unit
CP2E N……-type N30/40/60 CPU
CPU Unit Unit
D1200 D1300 D1400 00 to 07 Command Slave address (00 to F7 hex)
08 to 15 Reserved (Always 00 hex.)
D1201 D1301 D1401 00 to 07 Function code
08 to 15 Reserved (Always 00 hex.)
D1202 D1302 D1402 00 to 15 Number of communications
data bytes (0000 to 005E hex)
D1203 to D1249 D1303 to D1349 D1403 to D1449 00 to 15 Communications data (94
bytes maximum)
D1250 D1350 D1450 00 to 07 Response Slave address (01 to F7 hex)
08 to 15 Reserved (Always 00 hex.)
D1251 D1351 D1451 00 to 07 Function code
08 to 15 Reserved
D1252 D1352 D1452 00 to 07 Error code
(See error codes in the follow-
ing table. )
08 to 15 Reserved (Always 00 hex.)
D1253 D1353 D1453 00 to 15 Number of response bytes
(0000 to 03EA hex)
D1254 to D1299 D1354 to D1399 D1454 to D1499 00 to 15 Response data (92 bytes
maximum)

CP2E CPU Unit Software User’s Manual(W614) 14-15


14 Serial Communications

z Error Codes
Code Description Description
00 hex Normal end −
01 hex Illegal address The slave address specified in the parameter is illegal (248 or higher).
02 hex Illegal function code The function code specified in the parameter is illegal.
03 hex Data length overflow There are more than 94 data bytes.
04 hex Serial communications mode The Modbus-RTU Easy Master function was executed when the
error serial communications mode was not the Modbus-RTU Easy Mas-
ter Mode or when the option board is not equipped.
80 hex Response timeout A response was not received from the slave.
81 hex Parity error A parity error occurred.
82 hex Framing error A framing error occurred.
83 hex Overrun error An overrun error occurred.
84 hex CRC error A CRC error occurred.
85 hex Incorrect confirmation address The slave address in the response is different from the one in the
request.
86 hex Incorrect confirmation function The function code in the response is different from the one in the
code request.
87 hex Response size overflow The response frame is larger than the storage area (92 bytes).
88 hex Exception response An exception response was received from the slave.
89 hex Service being executed A service is already being executed (reception traffic congestion).
8A hex Execution canceled Executing the service has been canceled.
8F hex Other error Other FINS response code was received.

z Related Auxiliary Area Words and Bits


The Modbus-RTU command set in the DM fixed allocation words for the Modbus-RTU Easy Master
is automatically sent when the Modbus-RTU Master Execution Bit is turned ON. The results (normal
or error) will be given in corresponding flags.
Word Bit Port Contents
A640 02 Built-in RS232C port of Modbus-RTU Master Execution Error Flag
CP2E E/S……-type CPU ON: Execution error.
Unit or Serial Port 1 of
OFF: Execution normal or still in progress.
CP2E N……-type CPU Unit
01 Modbus-RTU Master Execution Normal Flag
ON: Execution normal.
OFF: Execution error or still in progress.
00 Modbus-RTU Master Execution Bit
Turned ON: Execution started
ON: Execution in progress.
OFF: Not executed or execution completed.
A641 02 Built-in RS-485 port of Modbus-RTU Master Execution Error Flag
CP2E S……-type CPU Unit ON: Execution error.
or Serial Port 2 of CP2E
OFF: Execution normal or still in progress.
N30/40/60 CPU Unit
01 Modbus-RTU Master Execution Normal Flag
ON: Execution normal.
OFF: Execution error or still in progress.
00 Modbus-RTU Master Execution Bit
Turned ON: Execution started
ON: Execution in progress.
OFF: Not executed or execution completed.

14-16 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Word Bit Port Contents


A638 02 Serial Port 1 (EX) of CP2E Modbus-RTU Master Execution Error Flag
N……-type CPU Unit ON: Execution error.
OFF: Execution normal or still in progress.
01 Modbus-RTU Master Execution Normal Flag

14-4 Modbus-RTU Easy Master Function


ON: Execution normal.
OFF: Execution error or still in progress.
00 Modbus-RTU Master Execution Bit
Turned ON: Execution started
ON: Execution in progress.
OFF: Not executed or execution completed.

When the Modbus-RTU communication abnormality occurs, the following bits are turned ON.
Address Name Contents
A392.04 Serial Port 1/Built-in RS-232C Port Turns ON when a timeout error, an overrun error, a
Communication Error Flag framing error or a parity error occurs on Modbus-RTU
Easy Master with serial port 1 or built-in RS-232C port.
A392.12 Serial Port 2/Built-in RS-485 Port Com- Turns ON when a timeout error, an overrun error, a
munication Error Flag framing error or a parity error occurs on Modbus-RTU
14
Easy Master with serial port 2 or built-in RS-485 port.
A50.04 Serial Port 1(EX) Communication Error Turns ON when a timeout error, an overrun error, a

14-4-3 Setting and Word Allocation


Flag framing error or a parity error occurs on Modbus-RTU
Easy Master on serial port 1(EX).

CP2E CPU Unit Software User’s Manual(W614) 14-17


14 Serial Communications

14-4-4 Programming Examples


A bobbin winder on a spinning machine will be used in the following example.
The speed of the bobbin winder must be controlled as the thread is wound because the speed of the
thread is constant.

Constant thread speed

Fast rotation Slow rotation

Frequency
setting
60.00Hz 55.00Hz 50.00Hz

Initial frequency setting Frequency Frequency


W0.00: ON setting A setting B
W0.01: ON W0.02: ON
RUN Command
W1.00

The start/stop and target speed is changed according to inputs from multiple contacts. Acceleration and
deceleration are controlled using the acceleration and deceleration of an inverter.

14-18 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Wiring Examples
The OMRON 3G3MX2-V1 Inverter is connected to the option slot 2 of the CP2E N……-type CPU Unit
or the built-in RS-485 port of the CP2E S……-type CPU Unit using RS-485 for frequency and start/stop

14-4 Modbus-RTU Easy Master Function


control.

z When a RS-422A/485 Option Board is Mounted on a CP2E N……-type CPU


Unit

CP1W-CIF11/CIF12-V1 3G3MX2-V1
RS-422A/485 Option Board
Symbol
RDA- Control circuit
RDB+ terminal block
SDA- 50 m max. (communications
SDB+ terminals)
FG

CP1W-CIF11/CIF12-V1
RS-422A/485 Option Board

z When Using a Built-in RS-485 Port of CP2E S……-type CPU Unit 14


3G3MX2-V1

Built-in RS-485 Port

14-4-4 Programming Examples


RS-485 Symbol
A- Control circuit
B+ terminal block
50 m max. (communication
FG
s terminals)

Built-in RS-485 Port

z CP1W-CIF11/CIF12-V1 Settings
Set the DIP switch as shown in the following table

(Back)

CPU Unit connector


DIP switch for operation settings

No. Setting ON / OFF Description


1 Terminating resistance selection ON Connects terminating resistance
2 2/4-wire selection ON 2-wire connections
3 2/4-wire selection ON 2-wire connections
4 − OFF Always OFF
5 RS control for RD ON Enabled
6 RS control for SD ON Enabled

CP2E CPU Unit Software User’s Manual(W614) 14-19


14 Serial Communications

z 3G3MX2-V1 Settings
Set the following parameters according to the communication specifications.
As for C071, C074 and C075, modified data are not reflected until the power is reconnected or a
reset is performed. To perform a reset, turn the reset terminal (18: RS) OFF, ON and then OFF
again.

Parameter Default Setting


Function name Data Unit
No. setting example
A001 Frequency Reference 03: Modbus communication 02 - 03
Selection 1 (Modbus-RTU)
A002 RUN Command Selection 1 03: Modbus communication 02 - 03
(Modbus-RTU)
C071 Communication Speed 03: 2,400 bps 05 - 05
Selection 04: 4,800 bps (9600bps)
05: 9,600 bps
06: 19.2 kbps
07: 38.4 kbps
08: 57.6 kbps
09: 76.8 kbps
10: 115.2 kbps
C072 Communication Station 1. to 247. 1 1 - 1
No. Selection
C074 Communication Parity 00: No parity 00 - 01
Selection 01: Even (Even)
02: Odd
C075 Communication Stop Bit 1: 1 bit 1 - 1
Selection 2: 2 bits (1 bit)
C076 Operation Selection on 00: Trip 02 - 02
Communication Error 01: Trip after deceleration stop (Ignore)
02: Ignore
03: Free run
04: Deceleration stop
C077 Communications Error 0.00: Timeout disabled 0.00 s 0.00s
Timeout Time 0.01 to 99.99
C078 Communication Wait Time 0. to 1000. 0 ms 0ms

14-20 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

z PLC Setup
Click the Built-in RS-232C, Built-in RS-485 or Serial Port Tab in the PLC Settings Dialog Box.

14-4 Modbus-RTU Easy Master Function


14

14-4-4 Programming Examples


Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page
Parameter Settings
Communications Set the Modbus communications settings to match those of the
Settings Inverter.
If the Inverter is set to 9,600 bps, one stop bit, and even parity, select
the Custom Option and set the baud rate to 9,600.
Set the format to 8,1,E.
Mode Select Modbus-RTU Easy Master.
Response Timeout Set the default value of 0×100 ms.

CP2E CPU Unit Software User’s Manual(W614) 14-21


14 Serial Communications

z Programming Example
W0.00

MOV(021)
Initial
Frequency Slave address
#1
Setting 01 Hex
D1300

MOV(021)
FUNCTION code
#6
06 Hex
D1301

MOV(021) Frequency setting at


Communication data operation startup
#4 Write 60.00 Hz (1770 Hex)
4 bytes (Hex)
to register number 0002
D1302 (Hex)

MOV(021)
Register number 0002 Hex
(Register number -1) #1
0001 Hex
D1303

MOV(021)
Frequency setting 60.00 Hz
#1770
1770 Hex
D1304

W1.00

MOV(021)
RUN
Command Slave address
#1
01 Hex
D1300

MOV(021)
FUNCTION code
#5
05 Hex
D1301

MOV(021)
Communication data Start operation
#4 Write ON (FF00 Hex) to coil
4 bytes (Hex)
number 0001 (Hex)
D1302

MOV(021)
Register number 0001 Hex
(Register number -1) #0
0001 Hex
D1303

MOV(021)
ON
#FF00
FF00 Hex
D1304

14-22 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

W0.01

MOV(021)
Frequency
Setting A Slave address
#1
01 Hex
D1300

14-4 Modbus-RTU Easy Master Function


MOV(021)
FUNCTION code
06 Hex #6

D1301

MOV(021)
Frequency setting A
Communication data Write 55.00 Hz (157C Hex)
#4
4 bytes (Hex) to register number 0002
D1302 (Hex)

MOV(021)
Register number 0002 Hex 14
(Register number -1) #1
0001 Hex
D1303

14-4-4 Programming Examples


MOV(021)
Frequency setting 55.00 Hz
157C Hex #157C

D1304

W0.02

MOV(021)
Frequency
Setting B Slave address
#1
01 Hex
D1300

MOV(021)
FUNCTION code
#6
06 Hex
D1301

MOV(021)
Frequency setting B
Communication data Write 50.00 Hz (1388 Hex)
#4
4 bytes (Hex) to register number 0002
D1302 (Hex)

MOV(021)
Register number 0002 Hex
(Register number -1) #1
0001 Hex
D1303

MOV(021)
Frequency setting 55.00 Hz #1388
1388 Hex
D1304

CP2E CPU Unit Software User’s Manual(W614) 14-23


14 Serial Communications

W1.00

MOV(021)
RUN
Command Slave address
#1
01 Hex
D1300

MOV(021)
FUNCTION code
#5
05 Hex
D1301

MOV(021)
Communication data Stop operation
4 bytes (Hex) #4 Write OFF (0000 Hex) to
coil number 0001 (Hex)
D1302

MOV(021)
Register number 0001 Hex
(Register number -1) #0
0001 Hex
D1303

MOV(021)
OFF
#0000
0000 Hex
D1304
P On

TIMX(550)
Always ON flag
000

&10 Start and continue Modbus


communications from
T000 1 second after turning
ON the power supply.
SET
A641.01
A641.00

Modbus-RTU Master Execution Bit

14-24 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

z Flags for Modbus-RTU Easy Master for Serial Port 2 or Built-in RS-485 Port

A641.00 Execution Bit

A641.01 Execution Normal Flag

14-4 Modbus-RTU Easy Master Function


A641.02 Execution Error Flag

(1) (2) (3)

(1)Turn ON A641.00 (Execution Bit) to send command data stored starting at D1300. For details, refer
to Data Memory (DM) Area Settings on page 14-26.
Words
Bits Setting
Serial Option Port
D1300 00 to 07 Command Slave address (00 to F7 hex)
08 to 15 Reserved (Always 00 hex.)
D1301 00 to 07 Function code 14
08 to 15 Reserved (Always 00 hex.)
D1302 00 to 15 Number of communications data bytes (0000 to

14-4-4 Programming Examples


005E hex)
D1303 to D1349 00 to 15 Communications data (94 bytes max.)

Precautions for Correct Use

The Execution Bit will automatically turn OFF. Do not turn OFF the bit through the ladder.

(2)When a command has been sent successfully, A641.01 (Execution Normal Flag) will turn ON, and
the response data will be stored starting from D1350.
Words
Bits Setting
Serial Option Port
D1350 00 to 07 Response Slave address (01 to F7 hex)
08 to 15 Reserved (Always 00 hex.)
D1351 00 to 07 Function code
08 to 15 Reserved
D1352 00 to 07 Error code
08 to 15 Reserved (Always 00 hex.)
D1353 00 to 15 Number of response bytes (0000 to 03EA hex)
D1354 to D1399 00 to 15 Response data (92 bytes max.)

(3)If a communications error occurs, A641.02 (Execution Error Flag) will turn ON, and the error code
will be stored in D1352.

CP2E CPU Unit Software User’s Manual(W614) 14-25


14 Serial Communications

z Data Memory (DM) Area Settings

DM Fixed Allocation Words for Modbus-RTU Easy Master


The settings are changed by the MOV instruction, and are used to change, start and stop frequency
reference.
RUN Command (Example of coil writing)
Communication data
Slave FUNCTION Communication
Setting D1303 to D1349 (maximum)
address code data bytes
94 bytes (47 words) max.
Address D1300 D1301 D1302 D1303 D1304
Value 00 01 00 05 00 04 00 00
Description 3G3MX2-V1 Coil writing Communication Coil number for Start: FF00 (Hex)
Slave address: 01 command data RUN command: Stop: 0000 (Hex)
(Hex) 05 (Hex) 4 bytes (Hex) 0001 Hex
* (Coil number) -1

Output Frequency (Example of holding register writing)


Communication data
Slave FUNCTION Communication
Setting D1303 to D1349 (maximum)
address code data bytes
94 bytes (47 words) max.
Address D1300 D1301 D1302 D1303 D1304
Value 00 01 00 06 00 04 00 01
Description 3G3MX2-V1 holding register Communication Output frequency Frequency setting
Slave address: 01 writing command data (lower) register value
(Hex) 06 (Hex) 4 bytes (Hex) number: 0002 Set in 0.01 Hz
Hex Set to 60.00 Hz, it
* (Register is 1770 (Hex)
number) -1

For details on 3G3MX2-V1 parameters and Modbus-RTU communication data, refer to the
3G3MX2-V1 User’s Manual (I585).

With the Modbus-RTU Easy Master, a CRC-16 checksum does not need to be set in the DM Area,
because it is calculated automatically.

14-26 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-5 Serial PLC Links

14-5-1 Overview

Serial PLC Links enable exchanging data between CP2E CPU Units, CP1H/CP1L/CP1E CPU Units, or
CJ2M CPU Units without using special programming. The serial communications mode is set to Serial
PLC Links. Up to 9 PLCs can be linked.

14-5 Serial PLC Links


Configuration

z Connecting CP2E, CP1H, CP1L, CP1E or CJ2M CPU Units 1:N (8 Nodes
Maximum)

CP2E CPU Unit (Polling Unit)


RS-422A/485 Option Board
or Built-in RS-485 Port
14
RS-422A/485

14-5-1 Overview
Shared data
CJ2M CPU Unit
(Polled Unit)

CP2E CPU Unit CP1L


(Polled Unit) CPU Unit
(Polled Unit)

8 nodes maximum

z Connecting CP2E, CP1H, CP1L, CP1E or CJ2M CPU Units 1:1

CP2E CPU Unit


(Polling Unit)

RS-232C or RS422A/485
Shared data

CP1E or
CP1L CPU
Unit (Polled
Unit)

Precautions for Correct Use


With the CP2E CPU Units, a Programmable Terminal (PT) cannot be included in a Serial PLC
Link.

CP2E CPU Unit Software User’s Manual(W614) 14-27


14 Serial Communications

14-5-2 Flow of Operation

1 Wiring communications
Connect the CP2E CPU Unit and other CPU Units using
RS-232C or RS-422A/485 ports.

2 PLC Setup
Set Built-in RS-232C, Built-in RS-485 or Serial Port in
the PLC Setup and transfer the PLC Setup from the CX-
Programmer to the CP2E CPU Unit. (Set the serial com-
munications mode to Serial PC Link (Master) or Serial
PC Link (Slave) and set the communications conditions,
link words, and PLC Link method.)

3 Start communications

Precautions for Correct Use


More than two serial ports cannot be used for PLC Links at the same time.
If more than two serial ports are set for PLC Links (either as polling or polled nodes), a PLC
Setup setting error (nonfatal error) will occur and the PLC Setup Setting Error Flag (A402.10) will
turn ON.

14-5-3 PLC Setup

Settings at the Polling Unit

14-28 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page


Parameter Setting
Communications Settings Set the communications settings to the same values as the connected
PLCs.
If the connected PLCs are set to 115,200 bps, select the Custom Option,
set the baud rate to 115200. The format can be set to any value.
Mode Select PC Link (Master).
Link Words Set to 10 (default) for the Master only. 10 words (default)
PC Link Mode Select All or Master.
NT/PC Link Max. Set the highest unit number of the connected slaves.

14-5 Serial PLC Links


Settings at the Polled Unit

14

14-5-3 PLC Setup


Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page
Parameter Setting
Communications Settings Set the communications settings to the same values as the connected
PLCs.
If the connected PLCs are set to 115,200 bps, select the Custom Option,
set the baud rate to 115200. The format can be set to any value.
Mode Select PC Link (Slave).
PC Link Unit No. Set the unit number (0 to 7).

CP2E CPU Unit Software User’s Manual(W614) 14-29


14 Serial Communications

14-5-4 Operating Specifications


Serial PLC Links can be used for all the serial communication ports for CP2E CPU Units. However,
three serial ports cannot be used simultaneously for Serial PLC Links.
Item Specifications
Applicable PLCs CP2E, CP1H, CP1L, CP1E, CJ2M
Baud rate 38,400 bps, 115,200 bps
Applicable serial ports Built-in RS-232C ports, built-in RS-485 ports or serial option ports
If more than two ports are set for Serial PLC Links (either as polling node or
polled node), a PLC Setup setting error (nonfatal error) will occur and the
PLC Setup Setting Error Flag (A402.10) will turn ON.
Connection method RS-422A/485 or RS-232C connection via RS-422A/485 Option Board, built-
in RS-485 port or RS-232C port.
Words allocated in CIO Area Serial PLC Link Words: CIO 200 to CIO 289 (Up to 10 words can be
allocated for each CPU Unit.)
Maximum number of Units 9 Units max., comprising 1 Polling Unit and 8 Polled Units.
Link methods (data refresh Complete link method or Polling Unit link method
methods)

Data Refresh Methods


The following two methods can be used to refresh data.
• Complete link method
• Polling Unit link method

14-30 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

z Complete Link
The data from all nodes in the Serial PLC Links are reflected in both the Polling Unit and the Polled
Units.
The only exceptions are the addresses of Polled Units that are not present in the network. These
data areas are undefined in all nodes.

Example: Complete Link Method, Highest Unit Number: 3


In the following diagram, Polled Unit No. 2 is a Unit not present in the network, so the area allocated
for Polled Unit No. 2 is undefined in all nodes.

14-5 Serial PLC Links


Polling Unit Polled Unit No. 0 Polled Unit No. 1 Polled Unit No. 3

Local area Polling Unit Polling Unit Polling Unit

Polled Unit No. 0 Local area Polled Unit No. 0 Polled Unit No. 0

Polled Unit No. 1 Polled Unit No. 1 Local area Polled Unit No. 1

Undefined Undefined Undefined Undefined

Polled Unit No. 3 Polled Unit No. 3 Polled Unit No. 3 Local area

(Not used) (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used) 14


(Not used) (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used)

14-5-4 Operating Specifications


Example for Ten Link Words (Maximum Number of Words)
Each CPU Unit (either CP2E, CP1E, CP1L, CP1H, or CJ2M) sends data to the same words in all
other CPU Units for the Polling Unit and all Polled Units. Data is sent between the words that are
allocated to the Polling Unit and Polled Units according to unit numbers.
CP2E CPU Unit CP2E CPU Unit CP1L CPU Unit
Example: CJ2M CPU Unit
(Polling Unit) (Polled Unit No. 0) (Polled Unit No. 1)
(Polled Unit No. 2)

Serial PLC Link Words Serial PLC Link Words Serial PLC Link Words Serial PLC Link Words
CIO 200 to 209 CIO 200 to 209 CIO 3100 to 3109 CIO 3100 to 3109
No.0 CIO 210 to 219 No.0 CIO 210 to 219 No.0 CIO 3110 to 3119 No.0 CIO 3110 to 3119
No.1 CIO 220 to 229 No.1 CIO 220 to 229 No.1 CIO 3120 to 3129 No.1 CIO 3120 to 3129
No.2 CIO 230 to 239 No.2 CIO 230 to 239 No.2 CIO 3130 to 3139 No.2 CIO 3130 to 3139
No.3 CIO 240 to 249 No.3 CIO 240 to 249 No.3 CIO 3140 to 3149 No.3 CIO 3140 to 3149
No.4 CIO 250 to 259 No.4 CIO 250 to 259 No.4 CIO 3150 to 3159 No.4 CIO 3150 to 3159
No.5 CIO 260 to 269 No.5 CIO 260 to 269 No.5 CIO 3160 to 3169 No.5 CIO 3160 to 3169
No.6 CIO 270 to 279 No.6 CIO 270 to 279 No.6 CIO 3170 to 3179 No.6 CIO 3170 to 3179
No.7 CIO 280 to 289 No.7 CIO 280 to 289 No.7 CIO 3180 to 3189 No.7 CIO 3180 to 3189

CP2E CPU Unit Software User’s Manual(W614) 14-31


14 Serial Communications

z Polling Unit Link Method


The data for all the Polled Units in the Serial PLC Links are reflected in the Polling Unit only, and
each Polled Unit reflects the data of the Polling Unit only.
The advantage of the Polling Unit link method is that the addresses allocated for the local Polled Unit
data are the same in each Polled Unit, allowing data to be accessed using common ladder program-
ming.
The areas allocated for Polled Units not present in the network are undefined in the Polling Unit only.
Example: Polling Unit Link Method, Highest Unit Number: 3
In the following diagram, Polled Unit No. 2 is a Unit not participating in the network, so the corre-
sponding area in the Polling Unit is undefined.

Polling Unit Polled Unit No. 0 Polled Unit No. 1 Polled Unit No. 3

Local area Polling Unit Polling Unit Polling Unit

Polled Unit No. 0 Local area Local area Local area

Polled Unit No. 1 (Not used) (Not used) (Not used)

Undefined (Not used) (Not used) (Not used)

Polled Unit No. 3 (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used)

(Not used) (Not used) (Not used) (Not used)

Example for Ten Link Words (Maximum Number of Words)


The CPU Unit that is the Polling Unit (either CP2E, CP1E, CP1H, CP1L, or CJ2M) sends its data
(CIO 200 to CIO 209) to the same words (CIO 200 to CIO 209) in all other CPU Units.
The Polled Units (either CP2E, CP1E, CP1H, CP1L, or CJ2M) send their data (CIO 210 to CIO 219)
to consecutive sets of 10 words (CIO 210 to CIO 289) in the Polling Unit.

CP2E CPU Unit CP2E CPU Unit CP1L CPU Unit Example: CJ2M CPU Unit
(Polling Unit) (Polled Unit No. 0) (Polled Unit No. 1) (Polled Unit No. 2)

Serial PLC Link Words Serial PLC Link Words Serial PLC Link Words Serial PLC Link Words
CIO 200 to 209 CIO 200 to 209 CIO 3100 to 3109 CIO 3100 to 3109
No.0 CIO 210 to 219 CIO 210 to 219 CIO 3110 to 3119 CIO 3110 to 3119
No.1 CIO 220 to 229
No.2 CIO 230 to 239
No.3 CIO 240 to 249
No.4 CIO 250 to 259
No.5 CIO 260 to 269
No.6 CIO 270 to 279
No.7 CIO 280 to 289

14-32 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

z Allocated Words

Complete Link Method


Address Link words 1 word 2 words 3 words to 10 words
CIO 200 Polling Unit CIO 200 CIO 200 to CIO 200 to CIO 200 to
201 202 209
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 0 203 205 219
Polled Unit CIO 202 CIO 204 to CIO 206 to CIO 220 to
No. 1 205 208 229

14-5 Serial PLC Links


Polled Unit CIO 203 CIO 206 to CIO 209 to CIO 230 to
No. 2 207 211 239
Polled Unit CIO 204 CIO 208 to CIO 212 to CIO 240 to
Serial PLC No. 3 209 214 249
Link Area Polled Unit CIO 205 CIO 210 to CIO 215 to CIO 250 to
No. 4 211 217 259
Polled Unit CIO 206 CIO 212 to CIO 218 to CIO 260 to
No. 5 213 220 269
Polled Unit CIO 207 CIO 214 to CIO 221 to CIO 270 to 14
No. 6 215 223 279
Polled Unit CIO 208 CIO 216 to CIO 224 to CIO 280 to

14-5-4 Operating Specifications


No. 7 217 226 289
CIO 289 Not used. CIO 209 to CIO 218 to CIO 227 to ---
289 289 289

Polling Unit Link Method


Address Link words 1 word 2 words 3 words to 10 words
CIO 200 Polling Unit CIO 200 CIO 200 to CIO 200 to CIO 200 to
201 202 209
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 0 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 1 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 2 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
Serial PLC No. 3 203 205 219
Link Words Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 4 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 5 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 6 203 205 219
Polled Unit CIO 201 CIO 202 to CIO 203 to CIO 210 to
No. 7 203 205 219
CIO 289 Not used. CIO 202 to CIO 204 to CIO 206 to ---
289 289 289

CP2E CPU Unit Software User’s Manual(W614) 14-33


14 Serial Communications

z Related Auxiliary Area Bits and Words

Serial Port1/Built-in RS-232C Port


Name Address Details Read/write Refresh timing
Serial Port 1/Built-in A393.00 to When the serial port 1 or built-in Read • Cleared when power is turned ON.
RS-232C Port Com- A393.07 RS-232C port is being used in NT • Turns ON the bit corresponding to the unit number
municating with link mode, the bit corresponding to of the Polled Unit that is communicating via the
Polled Unit Flags* the Unit performing communica- serial port 1 or built-in RS-232C port in NT link
tions will be ON. Bits 00 to 07 corre- mode or Serial PLC Link mode.
spond to unit numbers 0 to 7,
• Bits 00 to 07 correspond to unit numbers 0 to 7,
respectively.
respectively.
ON: Communicating
OFF: Not communicating
Serial Port 1/Built-in A526.00 Turn ON this bit to restart the serial Read/write • Cleared when power is turned ON.
RS-232C Port port 1 or built-in RS-232C port. • Turn ON to restart the serial port 1 or built-in RS-
Restart Bit 232C port.
Note The bit is automatically turned OFF by the
system when restart processing has been
completed.
Serial Port 1/Built-in A528.00 to When an error occurs at the serial Read/write • Cleared when power is turned ON.
RS-232C Port Error A528.07 port 1 or built-in RS-232C port, the • When an error occurs at the serial port 1 or built-in
Flags corresponding error bit is turned
RS-232C port, the corresponding error bit is turned
ON.
Bit 0: Not used. ON.
Bit 1: Not used. • The flag is automatically turned OFF by the system
Bit 2: Parity error when the serial port 1 or built-in RS-232C port is
Bit 3: Framing error restarted.
Bit 4: Overrun error
Bit 5: Timeout error • In NT link mode, only bit 05 (timeout error) is
Bit 6: Not used. enabled.
Bit 7: Not used. • In Serial PLC Link mode, only the following bits are
enabled.
Errors at the Polling Unit:
Bit 05: Timeout error
Errors at Polled Units:
Bit 04: Overrun error
Bit 03: Framing error
Bit 02: Parity error

Note If the error occurred in Serial PLC link mode,


the console will retry before communication
establish. Rehabilitation of the communica-
tions is no need for port restart. If user elimi-
nates error, the communication will
automatically establish between console and
servo.
However, error flag will be saved as the
record. If you want to clear the error flag,
please restart port.

14-34 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Serial Port 2/Built-in RS-485 Port


Name Address Details Read/write Refresh timing
Serial Port 2/ A394.00 to When the serial port 2 or built-in Read • Cleared when power is turned ON.
Built-in RS-485 Port A394.07 RS-485 port is being used in NT • Turns ON the bit corresponding to the unit number
Communicating link mode, the bit corresponding to of the Polled Unit that is communicating via the
with Polled Unit the Unit performing communica- serial port 2 or built-in RS-485 port in NT link mode
Flags* tions will be ON. Bits 00 to 07 corre- or Serial PLC Link mode.
spond to unit numbers 0 to 7,
• Bits 00 to 07 correspond to unit numbers 0 to 7,
respectively.
respectively.
ON: Communicating
OFF: Not communicating
Serial Port 2/ A526.01 Turn ON this bit to restart the serial Read/write • Cleared when power is turned ON.
Built-in RS-485 Port port 2 or built-in RS-485 port. • Turn ON to restart the serial port 2 or built-in RS-
Restart Flags 485 port.

14-5 Serial PLC Links


Note The bit is automatically turned OFF by the
system when restart processing has been
completed.
Serial Port 2/ A528.08 to When an error occurs at the serial Read/Write • Cleared when power is turned ON.
Built-in RS-485 Port A528.15 port 2 or built-in RS-485 port, the • When an error occurs at the serial port 2 or built-in
Error Flags corresponding RS-485 port, the corresponding error bit is turned
error bit is turned ON. ON.
Bit 8: Not used.
• The flag is automatically turned OFF by the system
Bit 9: Not used.
when the serial port 2 or built-in RS-485 port is
Bit 10: Parity error
restarted.
Bit 11: Framing error
Bit 12: Overrun error • In NT link mode, only bit 13 (timeout error) is
Bit 13: Timeout error
Bit 14: Not used.
enabled.
• In Serial PLC Link mode, only the following bits are
14
Bit 15: Not used. enabled.
Errors at the Polling Unit:

14-5-4 Operating Specifications


Bit 13: Timeout error
Errors at Polled Units:
Bit 12: Overrun error
Bit 11: Framing error
Bit 10: Parity error

Note If the error occurred in Serial PLC link mode,


the console will retry before communication
establish. Rehabilitation of the communica-
tions is no need for port restart. If user elimi-
nates error, the communication will
automatically establish between console and
servo.
However, error flag will be saved as the
record. If you want to clear the error flag,
please restart port.

CP2E CPU Unit Software User’s Manual(W614) 14-35


14 Serial Communications

Serial Port 1 (EX)


Name Address Details Read/write Refresh timing
Serial Port 1 (EX) A51.00 to When the serial port 1 (EX) is being Read • Cleared when power is turned ON.
Communication with A51.07 used in PLC link mode, the bit cor- • Turns ON the bit corresponding to the unit number
Polled Unit Flags* responding to the Unit performing of the Polled Unit that is communicating via the
communications will be ON. Bits 00 serial port 1 (EX) in Serial PLC Link mode.
to 07 correspond to unit numbers 0
• Bits 00 to 07 correspond to unit numbers 0 to 7,
to 7, respectively.
respectively.
ON: Communicating
OFF: Not communicating
Serial Port 1 (EX) A526.02 Turn ON this bit to restart the serial Read/write • Cleared when power is turned ON.
Restart Bit port 1 (EX). • Turn ON to restart the serial port 1 (EX).
Note The bit is automatically turned OFF by the
system when restart processing has been
completed.
Serial Port 1 (EX) A521.00 to When an error occurs at the serial Read/Write • Cleared when power is turned ON.
Error Flags A521.08 port 1 (EX), the corresponding error • When an error occurs at the serial port 1 (EX), the
bit is turned ON.
corresponding error bit is turned ON.
Bit 0: Not used.
Bit 1: Not used. • The flag is automatically turned OFF by the system
Bit 2: Parity error when the serial port 1 (EX) is restarted.
Bit 3: Framing error • In Serial PLC Link mode, only the following bits are
Bit 4: Overrun error
enabled.
Bit 5: Timeout error
Bit 6: Not used. Errors at the Polling Unit:
Bit 7: Not used. Bit 05: Timeout error
Errors at Polled Units:
Bit 04: Overrun error
Bit 03: Framing error
Bit 02: Parity error

Note If the error occurred in Serial PLC link mode,


the console will retry before communication
establish. Rehabilitation of the communica-
tions is no need for port restart. If user elimi-
nates error, the communication will
automatically establish between console and
servo.
However, error flag will be saved as the
record. If you want to clear the error flag,
please restart port.

* In the same way as for the 1:N NT Link, the status (communicating/not communicating) of the Polled Unit in
Serial PLC Links can be checked from the Polling Unit (CPU Unit) by reading the Serial Port 1 Communicating
with Polled Unit Flag (A393.00 to A393.07 for unit numbers 0 to 7) , the Serial Port 1 (EX) Communicating with
Polled Unit Flag (A51.00 to A51.17 for unit number of 0 to 7) or the Serial Port 2 Communicating with Polled Unit
Flag (A394.00 to A394.07 for unit numbers 0 to 7).
When errors occur in the Serial PLC Links communication, PC Link Master station would retry before the com-
munication reestablished. So it is not necessary for users to restart the port for restoring the communication. If
the errors have been removed, the communication between PC Link (Master) and PC Link (Slave) will be rees-
tablished automatically. But the error flags remained. Please restart the port if you want to clear the error flags.

14-36 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-5-5 Example Application

Operation
The present temperature information is exchanged between the boilers. This information is used to
adjust the temperature control of one boiler depending on the status of the other boilers and for moni-
toring individual boilers.
Boiler A Boiler B Boiler C

14-5 Serial PLC Links


z Wiring Example
Boiler A: CP2E (Polling Unit) Boiler B: CP2E (Polled Unit No. 0) Boiler C: CP2E (Polled Unit No. 1)
CP1W-TS101 CP1W-TS101 CP1W-TS101
Temperature Temperature Temperature
CP2E CPU Unit Sensor Unit CP2E CPU Unit Sensor Unit CP2E CPU Unit Sensor Unit 14

14-5-5 Example Application


CIO 2, CIO 3 CIO 2, CIO 3 CIO 2, CIO 3

Two Pt100 Sensor Inputs Two Pt100 Sensor Inputs Two Pt100 Sensor Inputs
CP1W-CIF11 CP1W-CIF11 CP1W-CIF11
RS-422A/485 RS-422A/485 RS-422A/485
Option Board Option Board Option Board
……-type CPU Unit
When a RS-422A/485 Option Board is mounted on a CP2E N……
RDA- RDA- RDA-
RDB+ RDB+ RDB+
SDA- SDA- SDA-
SDB+ SDB+ SDB+
FG FG FG

……-type CPU Unit or When an Option Board


Built-in RS-485 Port of CP2E S……
……-type CPU Unit
with 2 ports is mounted on a CP2E N……
Built-in RS-485 Port Built-in RS-485 Port Built-in RS-485 Port
CP2W-CIFD2/CIFD3 CP2W-CIFD2/CIFD3 CP2W-CIFD2/CIFD3
1 A- A- 1 A- 1
2 B+ B+ 2 B+ 2
3 FG Simple PLC link FG 3 FG 3

z CP1W-CIF11 RS422/485 Option Board DIP Switch Settings


(Back)

CPU Unit connector


DIP switch for operation
settings

Polling Polled Polled


No. Settings Description
Unit Unit No. 0 Unit No. 1
1 Terminating resistance selection ON OFF ON PLCs at both ends must have ter-
minating resistance connected.
2 2-wire or 4-wire selection ON ON ON 2-wire
3 2-wire or 4-wire selection ON ON ON 2-wire
4 − OFF OFF OFF Always OFF
5 RS control selection for RD OFF OFF OFF Control disabled
6 RS control selection for SD ON ON ON Control enabled

CP2E CPU Unit Software User’s Manual(W614) 14-37


14 Serial Communications

z PLC Setup
Item Boiler A (Polling Unit) Boiler B (Polled Unit No. 0) Boiler C (Polled Unit No. 1)
Communications Settings Custom
Baud Rate 115200bps
Parameters 7.2.E (default)
Mode PC Link (Master) PC link (Slave)
Link words 10 (default) − −
PC Link Mode ALL − −
NT/PC Link Max. 1 − −
PC Link Unit No. − 0 1

z Programming Example
Data in the Serial PLC Link Areas are transferred using data links by the Serial PLC Link and without
using any special programming. The ladder program is used to transfer the data that needs to be
linked to the data link area.
Boiler A Boiler B Boiler C
CP2E (Polling Unit) CP2E (Polled Unit No.1) CP2E (Polled Unit No. 0)
CIO 0
Input Bits Input Bits Input Bits
CIO 1
CIO 2 A_Temperature data 0 B_Temperature data 0 C_Temperature data 0
CIO 3 A_Temperature data 1 B_Temperature data 1 C_Temperature data 1

CIO 100 Output Bits Output Bits Output Bits

CIO 200 A_Temperature data 0 A_Temperature data 0 A_Temperature data 0


CIO 201 A_Temperature data 1 A_Temperature data 1 A_Temperature data 1

CIO 209
CIO 210 B_Temperature data 0 B_Temperature data 0 B_Temperature data 0
CIO 211 B_Temperature data 1 B_Temperature data 1 B_Temperature data 1
Serial PLC
Link Areas
CIO 219
CIO 220 C_Temperature data 0 C_Temperature data 0 C_Temperature data 0
CIO 221 C_Temperature data 1 C_Temperature data 1 C_Temperature data 1

CIO 229
CIO 289

z Ladder Diagram
Boiler A Boiler B Boiler C
CP2E CPU Unit CP2E CPU Unit CP2E CPU Unit
(Polling Unit) (Polled Unit No. 0) (Polled Unit No. 1)

#2 #2 #2
2 2 2
200 210 220

Transfer CIO 2 and CIO 3 to Transfer CIO 2 and CIO 3 to Transfer CIO 2 and CIO 3 to
CIO 200 and CIO 201 using a CIO 210 and CIO 211 using a CIO 220 and CIO 221 using a
BLOCK TRANSFER instruction. BLOCK TRANSFER instruction. BLOCK TRANSFER instruction

14-38 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-6 Connecting the Host Computer

14-6-1 Overview

14-6 Connecting the Host Computer


Commands are sent from a host computer to the CP2E CPU Unit to read and write data. The serial
communications mode is set to Host Link.
Note Because the built-in RS-485 port of the S……-type CPU Unit and the RS-485 port of CP2W-CIFD2/CIFD3
use 2-wire connections, so they can only communicate in half duplex. Communications are not possible in
full duplex.

Communica-
Command flow Command type Configuration Application Remarks
tions method
Host computer Host link Create frame Directly connect the host com- Use this
→ PLC command in the host puter in a 1:1 or 1:N system. method when
(C Mode) computer communicating
and send the primarily from
Host link command command to the host com- −
the PLC.
OR

Command
puter to the
14
Receive the PLC.
response.

14-6-1 Overview
FINS command Directly connect the host com- Use these The FINS com-
(with Host Link puter in a 1:1 system or 1:N methods when mand must be
header and system. communicating placed between
terminator) sent. primarily from a Host Link
FINS the host com- header and ter-
Host Link
header
Host Link
terminator
OR puter to PLCs minator and
Command
in the network. then sent by the
host computer.

14-6-2 Flow of Operation

1 Communications wiring
Connect the computer and CP2E CPU Unit using
RS-232C ports or RS-485 ports.

2 PLC Setup
Set the PLC Setup (select Host Link for the serial
communications mode and set the communications
conditions) and transfer the PLC Setup from the
CX-Programmer to the CP2E CPU Unit.

3 Program from host


Send the following commands from the host computer.
• C-mode commands
• FINS commands

CP2E CPU Unit Software User’s Manual(W614) 14-39


14 Serial Communications

14-6-3 Command/response Format and List of Commands


The outline of command/response format and each command are listed below.
For the details of the host link commands and FINS commands, refer to Communication Instructions
Reference Manual (Cat.No.W342).

z List of C Mode Commands


C mode commands (host link commands) are shown below.
Type Header code Name Function
I/O memory RR CIO area read Read the specified words from the specified words
read of CIO area
RH Holding area read Read the specified words from the specified words
of Holding area (H)
RC Timer and Counter PV area read Read the specified present values of timer and
counter from the specified words
RG Timer and Counter Completion Flag Read the specified Completion Flag of timer and
read counter from the specified words
RD DM area read Read the specified words from the specified words
of DM area (D)
RJ Auxiliary area read Read the specified words from the specified words
of Auxiliary area (A)
I/O memory WR CIO area write Write the specified source words from the specified
write words of CIO area in the unit of word
WH Holding area write Write the specified source words from the specified
words of Holding area (H) in the unit of word
I/O memory WC Timer and Counter PV area write Write the specified source words from the specified
write words of Timer and Counter present value area in
the unit of word
WD DM area write Write the specified source words from the specified
words of DM area (D) in the unit of word
WJ Auxiliary area write Write the specified source words from the specified
words of Auxiliary area (A) in the unit of word
CPU Unit MS CPU Unit status read Read the CPU Unit operating conditions (operating
status mode, forced set/reset, fatal error)
related SC Status change Change the operating mode of CPU Unit
MF Error information read Read the occurring error information of CPU Unit
(fatal error, non-fatal error)
Test TS Test Directly return 1 block sent from the host computer
I/O memory QQMR I/O memory area mixed read registra- Register the I/O memory words or bits that need to
area mixed tion read into the table
read QQIR I/O memory area mixed registration Read all of the I/O memory area words and bits
that were registered
Host link XZ Abort (command only) Interrupt the operation that being processed using
communica- the host link command, and return to the initial sta-
tion process- tus after abortion
ing ** Initial (command only) Initialize the transmission control sequence for all
the host link unit numbers
IC Command undefined error (response Response when the command's header code can-
only) not be broken

14-40 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

z List of FINS commands


FINS commands are shown below.
Command
Type Name Function
code
I/O memory 01 01 I/O memory area read Read the contents of continuous I/O memory area
area access 01 02 I/O memory area write Write the contents of continuous I/O memory area

14-6 Connecting the Host Computer


01 03 I/O memory area write all at once Replenish the specified ranges of I/O memory area
with the same data
01 04 I/O memory area mixed read Read the contents of discontinuous I/O memory
area
Parameter 02 01 Parameter area read Read the contents of continuous parameter area
area access 02 02 Parameter area write Write the contents of continuous parameter area
(unable to execute in MONITOR or RUN mode)
02 03 Parameter area write (clear) all at Replenish the specified ranges of parameter area
once with the same data
Operating 04 01 Operating mode change (Operation Change the operating mode of CPU Unit to RUN or
mode start) MONITOR mode
change 04 02 Operating mode change (Operation Change the operating mode of CPU Unit to PRO-
stop) GRAM mode
14
System con- 05 01 CPU Unit information read Read CPU Unit information
figuration

14-6-4 Restrictions on the Usage of Host Link


read
Status read 06 01 CPU Unit status read Read the status information of CPU Unit
06 20 Cycle time read Read cycle time (MAX, MIN, AVERAGE)
Time infor- 07 01 Time information read Read present year, month, day of the month, hour,
mation minute, second, day of the week
access 07 02 Time information write Change present year, month, day of the month,
hour, minute, second, day of the week
Message 09 20 Message read/cancel Read FAL and FALS
display
related
Debugging 21 03 Error log pointer clearance Clear all the pointer of error log to zero
related 23 01 Force-set/reset Force-set, force-reset and release (unable to spec-
ify multi-bit)
23 02 All bits release Release the forced status of all bits

14-6-4 Restrictions on the Usage of Host Link


The CP2E serial port does not support the following functions:
• The issue of FINS command by the SEND, RECV or CMND instruction from the serial port is not sup-
ported.
• Serial gateway function is not supported.

CP2E CPU Unit Software User’s Manual(W614) 14-41


14 Serial Communications

14-7 Modbus-RTU Slave Function

14-7-1 Overview

Modbus-RTU Slave enables to read and write CP2E data from Modbus-compatible masters, such as
host PLCs or host computers, using serial communications.
The serial communication mode is set to Modbus-RTU Slave.
Modbus-RTU master device CP2E CPU Unit

Slave Function Communication


Host PLC address code data
Host computer etc. Function Communication
Slave
address code data

By setting the Modbus-RTU slave address on the CP2E side, the target slave address, function code
and data from the master devices can be transmited.

Specifications
Item Contents
Mode Modbus-RTU Slave
Baud rate 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 bps
Data length 8 bits *1
Parity Odd, Even, None
Stop bits 1 bit (2 bits only when setting to no parity) *2
Slave addresse 1 to 247 *3
Frame format Slave address: 1 byte
Function code: 1 byte
Data: 0 to 252 bytes
CRC code: 2 bytes

*1 The data length is always 8 bits.


*2 The number of stop bits is determined by the parity setting.
When setting with parity (even/odd), 1 bit
When setting without parity, 2 bits
*3 The address cannot be set to 0. In commands, 0 is used to indicate broadcast commands.

14-42 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-7-2 Flow of Operation

1 Wiring communications
Connect CP2E CPU Unit and Modbus-RTU master
device using RS-232C or RS-422A/485 ports.

14-7 Modbus-RTU Slave Function


2 PLC Setup
Select Built-in RS232C, Built-in RS485 or Serial Port in
the PLC Setup and transfer the PLC Setup from the CX-
Programmer to the CP2E CPU Unit.
• Set the seial communication mode to Modbus-RTU
Slave
• Set the baud rate and format
• Set Modbus Slave address

3 Create
ladder
Cyclic tasks
When receiving a Modbus-RTU command from a
Modbus-RTU Master, it automatically responds without a
ladder program.
program Interrupt tasks
14

14-7-3 PLC Setup

14-7-2 Flow of Operation


Built-in RS-232C, Built-in RS-485 or Serial Port Tab Page
Parameter Settings
Communications Settings Set the communications settings to the same values as the connected Mod-
bus-RTU master device.
If the connected device is set to 19,200 bps, one stop bit, and even parity,
select the Custom Option. Set the baud rate to 19,200 and the format to
8,1,E.
Mode Select Modbus RTU Slave.
Modbus Slave Address Set the CP2E slave address.

CP2E CPU Unit Software User’s Manual(W614) 14-43


14 Serial Communications

14-7-4 Operation Specifications


Modbus has the following four common data models.
CP2E allocates each area of these data models to an I/O Memory area.
CP2E CPU unit
Modbus data model Data type Read/Write
I/O Memory allcation
Discrete Inputs Bit read None
Coils Bit read Auxiliary Area (W)
Input Registers Word (16 bit) read/write None
Holding Registers Word (16 bit) read/write Data Memory (D)

Modbus Data Models CP2E CPU Unit


I/O Memory

Discrete 0 None
Modbus-RTU Command Inputs 1
2
:
Coils 0 Auxiliary Area 0
Read Coils 1 (W) 1
Read Holding Registers 2 2
: :
Write Single Register
Write Multiple Coils Input 0 None
Write Multiple Registers Registers 1
2
:
Holding 0 Data Memory 0
Registers 1 (D) 1
2 2
: :

z CP2E Fixed Allocations


The following table gives the relationship between Modbus data model and CP2E I/O memory of CP2E
CPU unit.
Address specified
Corresponding CP2E I/O
Modbus data model Modbus address in Modbus-RTU
Memory address
commands
Discrete Inputs --- --- ---
Coils 1 to 2048 0 to 2047 W0.00 to W127.15
Input Registers --- --- ---
Holding Registers 1 to 4096 0 to 4095 CP2E E……-type
D0 to D4095
1 to 8192 0 to 8191 CP2E S……-type
D0 to D8191
1 to 16384 0 to 16383 CP2E N……-type
D0 to D16383

Additional Information

Addresses in Modbus data models start from 1, but addresses specified in Modbus-RTU com-
mands and addresses in the CP2E CPU Unit start from 0. Refer to the above table when speci-
fying addresses in applications.

14-44 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-7-5 Command and Response Details

Supported Command List


The CP2E CPU unit supports the following Modbus-RTU commands.

14-7 Modbus-RTU Slave Function


Function Code Modbus Name Function
01 Hex Read Coils Reads multiple bits from the Auxiliary Area (W) of I/O
Memory
03 Hex Read Holding Registers Reads multiple words from the Data Memory (D)
06 Hex Write Single Register Write a channel to Data Memory (D)
0F Hex Write Multiple Coils Writes multiple bits to the Auxiliary Area (W)
10 Hex Write Multiple Registers Write multiple channel to Data Memory (D)

The frame format used in Modbus-RTU slave mode is as follows:


Slave address Function code Data CRC
1 byte 1 byte 0 to 252 bytes 2 bytes (See note.)
14
Note The CRC code is given in the order low byte, high byte.

14-7-5 Command and Response Details


Additional Information

Setting the slave address to 0 indicates a broadcast command. The CP2E CPU unit does not
return a response for broadcast commands.

Precautions for Correct Use


Program retry processing in the application of Modbus-RTU master (PLC, Host computer, etc.)
when a transmission error or other communications error occurs.

Command and Response Details

z Read Multiple Bits from the Auxiliary Area (W) (Read Coils)
Command (Modbus-RTU Master)
Field name Data length Data
Function code 1 byte 01 Hex
Coil starting address 2 bytes 0 to 7FFHex (0 to 2047)
W0.00 to W127.15
Quantity of coils 2 bytes 1 to 7FFHex (1 to 2047)

Note The maximum number of coils depends on the assigned starting address.
Response (CP2E)
Field name Data length Data
Function code 1 byte 01 Hex
Byte count 1 byte N
Coil status n bytes n=N or N+1

CP2E CPU Unit Software User’s Manual(W614) 14-45


14 Serial Communications

Example: Reading 19 bits from W1.04 to W2.06


Command (Modbus-RTU Master) Response (CP2E)
Field name Data Field name Data
Function code 01 Hex Function code 01 Hex
Coil starting address (H) 00 Hex Byte count 03 Hex
Coil starting address (L) 14 Hex Coil status 27 to 20 CD Hex
(20 bits W1.04~) (W1.11 to W1.04)
Quantity of coils (H) 00 Hex Coil status 35 to 28 B6 Hex
(W2.03 to W1.12)
Quantity of coils (L) 13 Hex (19 bits) Coil status 38 to 36 05 Hex*
(W1.04 to W2.06) (W3.06 to W3.04)

* The remaining bits less than one byte will be read as 0.


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0CH 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1CH 31 1 30 0 29 1 28 1 27 1 26 1 25 0 24 0 23 1 22 0 21 1 20 0 19 18 17 16
2CH 47 46 45 44 43 42 41 40 39 38 1 37 0 36 1 35 0 34 1 33 1 32 0
3CH 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48

Note The subscript numbers in the shaded boxes indicate the ON/OFF (1/0) status of the bits that are read.

z Read Multiple Words from the Data Memory (D) (Read Holding Registers)
Command (Modbus-RTU Master)
Field name Data length Data
Function code 1 byte 03 Hex
Register starting address 2 bytes E……-type: 0 to 0FFF Hex (D0 to D4095)
S……-type: 0 to 1FFF Hex (D0 to D8191)
N……-type: 0 to 3FFF Hex (D0 to D16383)
Quantity of Registers 2 bytes 1 to 7D Hex (1 to 125)

Note The maximum number of coils depends on the assigned starting address.
Response (CP2E)
Field name Data length Data
Function code 1 byte 03 Hex
Byte count 1 byte 2×N (N: Quantity of registers)
Register value 2×N bytes

14-46 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Example: Reading 3 words from D1000 to D1002


Command (Modbus-RTU Master) Response (CP2E)
Field name Data Field name Data
Function code 03 Hex Function code 03 Hex
Register starting address 03 Hex Byte count 06 Hex
(H)

14-7 Modbus-RTU Slave Function


Register starting address E8 Hex Register value (H) AB Hex
(L) (D1000~) (D1000 H)
Quantity of Registers (H) 00 Hex Register value (L) 12 Hex
(D1000 L)
Quantity of Registers (L) 03Hex (3CH) Register value (H) 56 Hex
(D1000 to D1002) (D1001 H)
Register value (L) 78 Hex
(D1001 L)
Register value (H) 97 Hex
(D1002 H)
Register value (L) 13 Hex
(D1002 L)
14
DM 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1000 A B 1 2

14-7-5 Command and Response Details


1001 5 6 7 8
1002 9 7 1 3

z Write a word in the Data Memory (D) (Write Single Register)


Command (Modbus-RTU Master)
Field name Data length Data
Function code 1 byte 06 Hex
Register address 2 bytes E……-type: 0 to 0FFF Hex (D0 to D4095)
S……-type: 0 to 1FFF Hex (D0 to D8191)
N……-type: 0 to 3FFF Hex (D0 to D16383)
Register value 2 bytes 0000 to FFFF Hex

Response (CP2E)
Field name Data length Data
Function code 1 byte 06 Hex
Register address 2 bytes E……-type: 0 to 0FFF Hex (D0 to D4095)
S……-type: 0 to 1FFF Hex (D0 to D8191)
N……-type: 0 to 3FFF Hex (D0 to D16383)
Register value 2 bytes 0000 to FFFF Hex

CP2E CPU Unit Software User’s Manual(W614) 14-47


14 Serial Communications

Example: Writing 3AC5 Hex to D2000


Command (Modbus-RTU Master) Response (CP2E)
Field name Data Field name Data
Function code 06 Hex Function code 06 Hex
Register address (H) 07 Hex Register address (H) 07 Hex
Register address (L) D0 Hex Register address (L) D0 Hex
(D2000)
Register value (H) 3A Hex Register value (H) 3A Hex
(D1000 H)
Register value (L) C5 Hex Register value (L) C5 Hex
(D1000 L)

DM 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2000 3 A C 5
2001
2002

z Write Multiple Bits in the Auxiliary Area (W) (Write Multiple Coils)
Command (Modbus-RTU Master)
Field name Data length Data
Function code 1 byte 0F Hex
Starting address 2 bytes 0 to 07FF Hex (0 to 2047)
W0.00 to W127.15
Quantity of output 2 bytes 0001 to 07B0 Hex (1 to 1968)
Byte count 1 byte N = Quantity of output / 8, if the remainder is not 0, N+1
Output value N bytes

Response (CP2E)
Field name Data length Data
Function code 1 byte 0F Hex
Starting address 2 bytes 0 to 07FF Hex (0 to 2047)
W0.00 to W127.15
Quantity of output 2 bytes 0001 to 07B0 Hex (1 to 1968)

14-48 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

Example: Writing 10 bits (xxxx xx11 1100 1101) from W1.04 to W1.13
Command (Modbus-RTU Master) Response (CP2E)
Field name Data Field name Data
Function code 06 Hex Function code 0F Hex
Starting address (H) 00 Hex Starting address (H) 00 Hex
Starting address (L) 14 Hex Starting address (L) 14 Hex

14-7 Modbus-RTU Slave Function


(W1.04~)
Quantity of output (H) 00 Hex Quantity of output (H) 00 Hex
Quantity of output (L) 0A Hex Quantity of output (L) 0A Hex
(10 bits)
Byte count 02 Hex
Output value(H) 3A Hex
Output value(L) 01 Hex

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0CH 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1CH 31 0 30 0 29 0 28 1 27 0 26 0 25 1 24 1 23 1 22 0 21 1 20 0 19 0 18 0 17 0 16 0

14
Note The subscript numbers in the shaded boxes indicate the ON/OFF (1/0) status of the bits that are written.
Other bits in the same word are set to 0.

14-7-5 Command and Response Details


z Write Multiple Words in the Data Memory (D) (Write Multiple Registers)
Command (Modbus-RTU Master)
Field name Data length Data
Function code 1 byte 10 Hex
Starting address 2 bytes E……-type: 0 to 0FFF Hex (D0 to D4095)
S……-type: 0 to 1FFF Hex (D0 to D8191)
N……-type: 0 to 3FFF Hex (D0 to D16383)
Quantity of registers 2 bytes 0001 to 07B Hex (1 to 123)
Byte count 1 byte 2×N (N: Quantity of registers)
Registers value 2×N bytes

Response (CP2E)
Field name Data length Data
Function code 1 byte 10 Hex
Starting address 2 bytes 0 to 7FF Hex (0 to 2047)
W0.00 to W127.15
Quantity of registers 2 bytes 0001~07BHex (1~123)

CP2E CPU Unit Software User’s Manual(W614) 14-49


14 Serial Communications

Example: Writing 3AC5, 9713 Hex to 2 Words, D1000 and D1001


Command (Modbus-RTU Master) Response (CP2E)
Field name Data Field name Data
Function code 10 Hex Function code 10 Hex
Starting address (H) 03 Hex Starting address (H) 03 Hex
Starting address (L) E8 Hex Starting address (L) E8 Hex
(D1000~)
Quantity of registers (H) 00 HEX Quantity of registers (H) 00 Hex
Quantity of registers (L) 02 Hex Quantity of registers (L) 02 Hex
(2CH)
Byte count 04 Hex
Registers value (H) 3A Hex
Registers value (L) C5 Hex
Registers value (H) 97 Hex
Registers value (L) 13 Hex

DM 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1000 3 A C 5
1001 9 7 1 3

z Error Response
Field name Data length Data
Function code 1 byte Function code + 80 Hex
For example: 86 Hex for Write Single Register (06Hex)
Exception code 1 byte Reference below

Error code Field name Description


01 Hex Illegal function code • An unsupported function code is specified
02 Hex Illegal data address • There is an error in the specified start address
• The specified start address and Data length exceed the
valid range
03 Hex Illegal data value • Data number does not match data length

14-50 CP2E CPU Unit Software User’s Manual(W614)


14 Serial Communications

14-7-6 Related special auxiliary relay


Address Name Content
A392.04 Built-in RS-232C Turns ON when a communication error (framing error, parity
Port/Serial Port 1 error, overrun error, CRC error) occurs in the built-in RS-
Communication Error Flag 232C port or serial port 1.

14-7 Modbus-RTU Slave Function


If this flag occurs, it is necessary to restart the port. How-
ever, in the case of a CRC error, port restart is not neces-
sary because it turns off automatically when the next normal
Modbus-RTU command is received.
A526.00 Built-in RS-232C When performing port restart on the built-in RS-232C port
Port/Serial Port 1 Port or serial port 1, perform 0 Æ 1.
Restart Flag After restart processing, it will be 0 (OFF) automatically.
A528.00 to A528.07 Built-in RS-232C When an error occurs in built-in RS-232C port or serial port
Port/Serial Port 1 Error Flag 1, the error code is stored.
Bit 2: Parity error
Bit 3: Framing error
Bit 4: Overrun error
A392.12 Built-in RS-485 Port/Serial Turns ON when a communication error (framing error, parity 14
Port 2 Communication error, overrun error, CRC error) occurs in the built-in RS-485
Error Flag port or serial port 2.
If this flag occurs, it is necessary to restart the port. How-

14-7-6 Related special auxiliary relay


ever, in the case of a CRC error, port restart is not neces-
sary because it turns off automatically when the next normal
Modbus-RTU command is received.
A526.01 Built-in RS-485 Port/Serial To restart the port for built-in RS-485 port or serial port 2,
Port 2 Restart Flag perform 0 Æ 1.
After restart processing, it will be 0 (OFF) automatically.
A528.08 to A528.15 Built-in RS-485 Port/Serial When an error occurs in built-in RS-485 port or serial port 2,
Port 2 Error Flag the error code is stored.
Bit 2: Parity error
Bit 3: Framing error
Bit 4: Overrun error
A50.04 Serial Port 1 (EX) • Turns ON when a communication error (framing error,
Communication Error Flag parity error, overrun error, CRC error) occurs in serial port
1 (EX).
If this flag occurs, it is necessary to restart the port. How-
ever, in the case of a CRC error, port restart is not neces-
sary because it turns off automatically when the next
normal Modbus-RTU command is received.
A526.02 Serial Port 1 (EX) Port • When performing port restart on serial port 1 (EX), per-
Restart Flag form 0 Æ 1.
After restart processing, it will be 0 (OFF) automatically.
A521.00 to A521.07 Serial Port 1 (EX) Error • When an error occurs in serial port 1 (EX), the error code
Flag is stored.
Bit 2: Parity error
Bit 3: Framing error
Bit 4: Overrun error

CP2E CPU Unit Software User’s Manual(W614) 14-51


14 Serial Communications

14-8 Precautions on the usage of RS-485


When using 2-wire RS-485 with the built-in RS-485 of the S……-type CPU Unit, or the RS422A/485
Option Board CP1W-CIF11/CIF12-V1 and CP2W-CIFD2/CIFD3 Option Board with two ports, pay atten-
tion to the following precautions and construct application.

When using the RS-485 (2-wire), it can only communicate in half duplex.
Please secure the waiting time shown below till the next data transmission after the remote device
receives data from CP2E. If the receive data are transmitted from the remote device within the waiting
time shown below after CP2E data transmission, the data may not be received by CP2E.

Send data
Remote device Send data

Send data
CP2E

Secure the waiting time shown below till the next data
transmission after the data reception from CP2E.
Baud rate
9600 to 115200 bit/s:1ms min.
1200 to 4800 bit/s:3ms min.

14-52 CP2E CPU Unit Software User’s Manual(W614)


Ethernet
This section gives an outline of the built-in Ethernet function, explains its specification
and how to make the settings required for operation.

15-1 System Configuration and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-3 15


15-1-1 Connecting the CX-Programmer to PLCs Online via Ethernet . . . . . . . . . . . . 15-4
15-1-2 Exchanging Data between OMRON PLCs using Ethernet . . . . . . . . . . . . . . . 15-5
15-1-3 Creating an Original Communications Procedure Using TCP/IP (UDP/IP)
for the Host Application or Communicating with PLCs from Another
Manufacturer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6
15-1-4 Automatically Adjusting the PLC’s Internal Clock at Regular Intervals . . . . . . 15-6
15-2 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7
15-2-1 General Specifications (Ethernet). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7
15-2-2 Comparison with Previous Models (Ethernet Related) . . . . . . . . . . . . . . . . . . 15-8
15-3 Basic Setting for Ethernet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
15-3-1 Overview of Startup Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
15-3-2 PLC Setup Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11
15-3-3 Basic Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13
15-3-4 Communications Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15
15-4 FINS Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-16
15-4-1 FINS Communications Service Specifications . . . . . . . . . . . . . . . . . . . . . . . 15-16
15-4-2 FINS Communications Service. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
15-4-3 Procedure for Using FINS/UDP, FINS/TCP . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
15-4-4 PLC Setup for FINS/UDP and FINS/TCP Applications. . . . . . . . . . . . . . . . . 15-18
15-4-5 Auxiliary Area Allocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22
15-4-6 New FINS Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-22
15-5-7 Socket/TCP Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-50
15-5 Socket Services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-36
15-5-1 Overview of Socket Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-36
15-5-2 Procedure for Using Socket Service Functions . . . . . . . . . . . . . . . . . . . . . . 15-36
15-5-3 Socket Services and Socket Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-37
15-5-4 PLC Setup for Socket Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-38
15-5-5 Auxiliary Area Allocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-39
15-5-6 Data Memory Area Allocations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-42
15-5-7 Socket/TCP Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-50

CP2E CPU Unit Software User’s Manual(W614) 15-1


15 Ethernet

15-6 Automatic Clock Adjustment and Specifying Servers by Host Name. . . 15-54
15-6-1 Automatic Clock Adjustment Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-54
15-6-2 Specifying Servers by Host Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-54
15-6-3 Procedure for Using the Automatic Clock Adjustment Function. . . . . . . . . . . 15-55
15-6-4 PLC Setup for DNS and Automatic clock Adjustment . . . . . . . . . . . . . . . . . . 15-55
15-6-5 Auxiliary Area Allocations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-58

15-2 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-1 System Configuration and Features


N14/20 CPU Units have one built-in Ethernet port. N30/40/60 CPU Units have two Ethernet ports, and
the second port is only for switch. A variety of protocols make available a wide range of applications for
use on an Ethernet network. The protocols can be selected include sending and receiving data by
TCP/IP or UDP/IP (socket services), sending and receiving commands by OMRON’s standard protocol
FINS, and automatically adjusting the PLC’s internal clock by SNTP.

15-1 System Configuration and Features


The following diagram shows an example of an overall system configuration using CP2E N……-type
CPU Units.

(1) Connecting the CX-Programmer to the PLCs online via Ethernet

CX-Programmer

FINS

Internet
IP router (3) Configuring an independent communications protocol
for the host application using TCP/IP (UDP/IP)
Intranet
Firewall
Server Room Office Floor

DNS server CX-Programmer Independent user 15


SNTP server application

FINS UDP/TCP socket


Ethernet Ethernet
Router

Router

(Factory line)
CX-Programmer
NB-series PT

Writing
commands FINS FINS
Ethernet

(1) Connecting the CX-Programmer to


PLCs online via Ethernet

FINS message
(4) Automatically adjusting the communications
(5) Auto IP
PLC's internal clock
periodically

CP2E-N……D…-… FINS message CP2E-N……D…-…


communications

(2) Sending and receiving data via Ethernet


between OMRON PLCs

CP2E CPU Unit Software User’s Manual(W614) 15-3


15 Ethernet

15-1-1 Connecting the CX-Programmer to PLCs Online via Ethernet

Auto IP Operation
Auto IP protocol is supported by CP2E N……-type CPU Units.
With Auto-IP, CX-Programmer’s online connection command can be executed without any IP setting in
computer side when PLC is physically connected with the computer directly.
CX-Programmer can list all the CP2E N……-type CPU Units connected in a same segment with the
computer. And the information of PLC (such as IP address, MAC address) will be displayed.

Connecting within the Same Segment


Use the UDP/IP version of the FINS communications service (i.e., FINS/UDP). FINS/UDP is supported
by many OMRON products and is compatible with earlier OMRON Ethernet Units. The CX-Programmer
can be connected and used with FINS/UDP.

Connecting through Multiple Segments


Use the TCP/IP version of the FINS communications service (i.e., FINS/TCP). It provides automatic
recovery at the TCP/IP layer from communications errors (such as packet loss) that occur during multi-
level routing.
For CX-Programmer, FINS/TCP can be used to directly connect to the PLC online.

Connecting from a Personal Computer with a Dynamic Private IP


Address
Depending on whether or not the connection will be within the same segment, either use an IP address
conversion method for dynamic IP addresses in the FINS/UDP service or use the FINS/TCP service.
It is possible to connect online to a PLC using the CX-Programmer from a computer serving as a tem-
porarily connected node or a permanent DHCP client.
For CX-Programmer, FINS/TCP can be used to directly connect to the PLC online.

15-4 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-1-2 Exchanging Data between OMRON PLCs using Ethernet

Connecting within the Same Segment


Use the FINS/UDP, and construct applications using the SEND(090), RECV(098), and CMND(490)
instructions in the ladder program. The protocol processing for FINS/UDP is simpler than for FINS/TCP,
giving FINS/UDP certain advantages in terms of performance. Another feature of FINS/UDP is that it

15-1 System Configuration and Features


can be used for broadcasting.
On the other hand, with FINS/UDP it is necessary to provide measures, such as retries, for handling
communications errors.

Connecting through Multiple Segments


Use the FINS/TCP, and construct applications using the SEND(090), RECV(098), and CMND(490)
instructions in the ladder program. FINS/TCP is supported by many OMRON products and is compati-
ble with earlier OMRON Ethernet Units. It provides automatic recovery at the TCP/IP layer from com-
munications errors (such as packet loss) that occur during multilevel routing.
Intranet
Production line A
Ethernet Unit
15

15-1-2 Exchanging Data between OMRON PLCs using Ethernet


Ethernet
Router
FINS message Connecting through multiple segments:
communications Use FINS/TCP.
Router
Production line B

CP2E-N……D…-… CP2E-N……D…-…

FINS message
communications

Connecting within the same segment:


Use FINS/UDP.

CP2E CPU Unit Software User’s Manual(W614) 15-5


15 Ethernet

15-1-3 Creating an Original Communications Procedure Using TCP/IP


(UDP/IP) for the Host Application or Communicating with PLCs
from Another Manufacturer

Communications by UDP/IP and TCP/IP (Socket Services Function)


The standard Ethernet protocols, UDP/IP and TCP/IP, are supported, making it possible to communi-
cate with a wide range of devices, workstations, computers, and Ethernet Units from other manufactur-
ers.
Up to three ports can be used for various protocols, enabling the use of various applications.

Simplified Socket Services


The socket services function for TCP or UDP can be simplified by presetting parameters and using ded-
icated bits. In addition, the size of received data accumulated in the reception buffer is now stored, and
a Data Received Flag has been added. These features eliminate the need for ladder programs to mon-
itor the timing for completion of socket service processing, and thus reduce the amount of labor
required for program development.

15-1-4 Automatically Adjusting the PLC’s Internal Clock at Regular


Intervals

Operation
Use the automatic clock adjustment function.
With the automatic clock adjustment function, the SNTP server’s clock is taken as the standard for auto-
matically adjusting the built-in clock of the PLC. The adjustment can be regularly executed at a speci-
fied time (once a day) and it can be executed each time by the ladder program.
To use the automatic clock adjustment function, there must be a separate SNTP server on the network.
Aside from the IP address, the host name used for DNS service can be specified for the SNTP server.

Specification of Servers by Host Name


In addition to directly specifying the IP address for a SNTP server, it is also possible (by means of the
PLC’s DNS client function) to specify the server by host name. This enables automatic searches for IP
addresses for purposes such as system checking, even when the IP addresses for servers have been
changed.
Note A separate DNS server is required to specify servers by host name using DNS.

15-6 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-2 Specifications

15-2-1 General Specifications (Ethernet)


Item Specifications
Type 100/10Base-TX (Auto-MDIX)
Transfer Media access method CSMA/CD
Modulation method Baseband
Transmission paths Star form
Baud rate 100 Mbit/s (100Base-TX) 10 Mbit/s (10Base-T)
• Half/full auto-negotiation for each port
• Link speed auto-sensing for each port

15-2 Specifications
Transmission media • Unshielded twisted-pair (UDP) •
Unshielded twisted-pair (UDP)
cable cable
Categories: 5, 5e Categories: 3, 4, 5, 5e
• Shielded twisted-pair (STP) cable •
Shielded twisted-pair (STP) cable
Categories: 100Ω at 5, 5e Categories: 100Ω at 3, 4, 5, 5e
Transmission distance 100 m (distance between hub and node)
Cascade connection There is no limitation on the usage of switching hub
Protocols TCP, UDP, ARP, ICMP (ping only), SNTP, DNS 15
Applications FINS, Socket, SNTP, DNS (Client)

15-2-1 General Specifications (Ethernet)


z Switching Hub for CP2E N30/40/60 CPU Units
Ethernet 100Base-TX, 10Base-T
Auto MID/MID-X Yes
Auto negotiation Yes
Store-and-forward system Yes
Buffer 32K bytes
MAC address 1000
Broadcast storm detection Yes
QoS No
SNMP No
VLAN No
IGMP snooping No
STP (Spanning Tree Protocol) No
Port mirroring No

Additional Information

The switching hub function works normally even if a fatal/non-fatal error or CPU WDT error
occurs. The switching hub function does not work when the power of the CPU Unit is turned
OFF.

CP2E CPU Unit Software User’s Manual(W614) 15-7


15 Ethernet

15-2-2 Comparison with Previous Models (Ethernet Related)


Model CP2E N……-type CPU CP1W-CIF41 CS1W-ETN21
Units CJ1W-ETN21
Local IP address 192.168.250.FINS node 192.168.250.1 192.168.250.FINS node
address address
FINS node address Set in PLC setup Set in system settings Set by rotary switch
Physical layer 100/10Base-TX 100/10Base-TX 100/10Base-TX
(Auto-MDIX) (Auto-MDIX)
Number of nodes 254 254 254
Data length of FINS message 1004 bytes (Max) 1004 bytes (Max) 2012 bytes (Max)
FINS buffer size 16K bytes 8K bytes 392K bytes
Driver buffer number Input: 8×608 bytes Input: 16×256 bytes Input: 50×1.5K bytes
Output: 4×1600 bytes Output: 8×256 bytes Output: 50×1.5K bytes
Process of driver buffer overflow The last packet will be The last packet will be The last packet will be
dropped. dropped. dropped.
Connection number (FINS/TCP) 3 for user 2 (only server) 16
1 for CX-Programmer auto
connection
PLC maintenance via the Internet Not supported Not supported Not supported
Server specification Specification by IP Not supported Specification by IP address
address or by host name or by host name
(DNS Client Function) (DNS Client Function)
FINS Automatic IP address A computer automatically A computer automatically A computer automatically
comm. acquisition acquiring IP addresses acquiring IP addresses acquiring IP addresses can
service can send commands to can send commands to send commands to the PLC
the PLC and receive the PLC and receive and receive responses.
responses. responses.
FINS communication with Possible (with automatic Possible (with automatic Possible (with automatic allo-
computer without fixed allocation) (Client FINS allocation) (Client FINS cation) (Client FINS auto-
node address automatic node address automatic node address matic node address
allocation function, TCP/IP allocation function, TCP/IP allocation function, TCP/IP
only) only) only)
Handling TCP/IP With FINS communica- With FINS communica- With FINS communications,
tions, both UDP/IP and tions, both UDP/IP and both UDP/IP and TCP/IP (16
TCP/IP (3 max.) possible. TCP/IP (2 max.) possible. max.) possible.
(Only can be set to server)
Simultaneous connection Possible (with both Possible (with both Possible (with both UDP/IP
of multiple applications in UDP/IP and TCP/IP) UDP/IP and TCP/IP) and TCP/IP)
a computer
Mail function Not supported Not supported E-mail attachments with I/O
memory data are possible for
the mail send function.
(SMTP, file attachment) With
the mail receive function,
commands can be received
from the PLC. (POP3, mail
receive)
FTP server function Not supported Not supported Supported
Socket services function Supported Not supported Supported
Automatic clock information Supported Not supported Supported
adjustment
IP conflict (GARP) Supported Not supported Supported
TCP keep-alive function Supported Not supported Supported
Multicast function Not supported Not supported Not supported
Web function Not supported Supported Supported
Switch function Supported Not supported Not Supported

15-8 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Improved FINS Message Communications from CP1W-CIF41


The following functions have been maintained according to the existing Ethernet Unit models for CP1W-
CIF41.
• The maximum number of nodes is 254.
• Communications are enabled even if the host computer’s IP address is dynamic.
• An automatic client FINS node address allocation function makes it possible to connect online to the
PLC even if no FINS node address has been set for the host computer.
• FINS message communications are enabled in both UDP/IP and TCP/IP, and it is enabled in TCP/IP
with up to 3 simultaneous connections.
→Previously CP1W-CIF41 is enabled in TCP/IP with up to 2 simultaneous connections and all can
only be set to server.
• Multiple FINS applications, such as the CX-Programmer, on the same computer can be connected

15-2 Specifications
online to the PLC via Ethernet.

15

15-2-2 Comparison with Previous Models (Ethernet Related)

CP2E CPU Unit Software User’s Manual(W614) 15-9


15 Ethernet

15-3 Basic Setting for Ethernet

15-3-1 Overview of Startup Procedure

Refer to Ethernet Units Construction of Networks Operation Manual for CS/CJ Series
Determine the local IP address (Cat. No. W420) SECTION 5 Determining IP Addresses.
and address conversion method.

Connect to the network Refer to CP2E CPU Unit Hardware User’s Manual (Cat. No. W613) A-4 Network
using twisted-pair cable. Installation.

Turn ON power to the CPU Unit.

Connecting to the CPU Unit


without making any settings.

Use auto connection method or Set the IP address freely with the
the default IP address. CX-Programmer.
(See note 1.)
Refer to 15-3-3 Basic Settings.

Refer to Ethernet Units Construction of Networks Operation Manual for CS/CJ Series
Create the routing tables.
(Cat. No. W420) 6-4 Creating Routing Tables.
(See note 2.)

Perform PLC setup. Refer to 15-3-3 Basic Settings.


(Create IP router tables.)

Note 1 The local IP address and other parameters can be set from the CX-Programmer.
2 It is not necessary step, and the CX-Integrator version 2.67 or higher (CX-One version 4.51 or higher) is
required.
When the FINS communications service is used, routing tables must be created in advance. Routing
tables are required in the following circumstances.
• When communicating with a PLC or computer on another network (e.g. remote programming or monitor-
ing using FINS message or a CX-programmer)
• When routing tables are used for one or more other nodes on the same network

15-10 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-3-2 PLC Setup Procedure


Use the CX-Programmer (Ver. 9.72 or higher) for the CP2E N……-type CPU Unit Setup, and follow the
procedure described below.

1 Connect the CX-Programmer online.


The CX-Programmer can be connected to the PLC in the following ways:
Connect the personal computer to the PLC by Ethernet.
With Auto-IP function, CX-Programmer’s online connection command can be executed without
any IP setting in computer side when the PLC is physically connected with the computer directly.

15-3 Basic Setting for Ethernet


For details on connecting the CX-Programmer to the PLC, refer to 4-3 Connection Method with an
Ethernet Port in the CP2E CPU Unit Hardware User’s Manual (Cat. No. W613).

2 Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab to display the
window for making the Ethernet Port Setup.
The default settings are shown below.

15

15-3-2 PLC Setup Procedure


3 Make the required settings (i.e., the IP address in this case).

CP2E CPU Unit Software User’s Manual(W614) 15-11


15 Ethernet

4 Transfer the settings to the PLC.


Click on Yes in the following dialog box.

5 In order for the Ethernet Setup to go into effect, the Ethernet Port must be restarted.
Please use the following way to reset the Ethernet Port.

After the LNK/ACT indicator has turned OFF and then turned ON again (Ethernet cable should
be connected), the Ethernet port will recognize the new settings.

15-12 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-3-3 Basic Settings


The following items comprise the basic settings in the PLC’s Ethernet port setup.

Basic Setting
CX-Programmer tab Settings
Built-in Ethernet IP address
Subnet mask
Broadcast
TCP/IP keep-alive

15-3 Basic Setting for Ethernet


IP router table

CX-Programmer Setup
Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab in PLC setup dialog.

15

15-3-3 Basic Settings


Item Contents Default
IP Address Set the local IP address. 0.0.0.0
(192.168.250. FINS
node address )
Sub-net Mask Set the subnet mask, which supports CIDR. 0.0.0.0
This is required if a method other than the IP address table method is used (default net mask for IP
for address conversion. address setting)
The subnet mask can be set between 192.0.0.0 and 255.255.255.252.
Broadcast Set the method for specifying IP addresses for broadcasting in FINS/UDP. All 1 (4.3BSD)
• All 1 (4.3BSD): Broadcast with host number set to all ones.
• All 0 (4.2BSD): Broadcast with host number set to all zeros.
Normally the default setting should be used.
TCP/IP keep-alive Set the liveness-checking interval. When socket services using either 0
FINS/TCP or TCP/IP are used, the connection will be terminated if there is (120 minutes)
no response from the remote node (either a server or client) within the time
set here. (Enabled for socket services using FINS/TCP or TCP/IP only.)
Setting range: 0 to 65,535 minutes
This setting applies to the keep-alive setting for each connection set with
the FINS/TCP Setting button.
IP Router Table Set when the PLC is to communicate through the IP router with nodes on None
another IP network segment.

CP2E CPU Unit Software User’s Manual(W614) 15-13


15 Ethernet

Note 1 Make settings using the PLC settings function in the CX-Programmer (to be included in version 9.72 and
higher).
2 For details, refer to 2-9 Basic Settings in the Ethernet Units Construction of Networks Operation Manual
(Cat. No. W420).

IP Router Table
An IP router table is a table of correspondences for finding IP addresses for the IP routers that relay tar-
get segments when the Unit communicates via IP routers with nodes on other IP network segments.

z Setting Example
In this example setting for Node A, a network with a Network ID of 130.26.1.1 is connected to an IP
router with an IP address of 130.28.36.253.
130.28.XX (Network ID) 130.26.XX (Network ID)

130.28.36.253 130.26.2.254 Node A


CP2E-N
IP router 130.26.1.1

Set the IP Address to the network number (i.e., the net ID) of the other IP network segment with
which communications are to be executed. The length of the network number (i.e., the number of
bytes) will vary depending on the IP address class. Four bytes are reserved for setting the IP
Address, so set the network number from the beginning and then set 00 in the remaining space.
A maximum of eight settings can be registered. The default is no setting.
Only one default IP router can be set.
The default IP router is selected when no Network ID exists in the IP router table for the destination
network number. To set the default IP router, set 0.0.0.0 for the IP address and set the default IP
router's IP address for the router address.

15-14 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-3-4 Communications Test


If the basic settings (in particular the IP address and subnet mask) have been made correctly, then it
should be possible to communicate with nodes on the Ethernet.
The following describes how to use the PING command to perform communications testing between
CP2E N……-type CPU Units.

PING Command

15-3 Basic Setting for Ethernet


The PING command sends an echo request packet to a remote node and receives an echo response
packet to confirm that the remote node is communicating correctly. The PING command uses the ICMP
echo request and responses. The echo response packet is automatically returned by the ICMP.
The PING command is normally used to check the connections of remote nodes when configuring a
network. The PLC supports the ICMP echo reply functions.
If the PLC returns a normal response to the PING command, then the remote nodes are physically con-
nected correctly.

CP2E-N……D…-… Remote Node


(host computer or Ethernet Unit)

TCP UDP 15

ICMP

15-3-4 Communications Test


IP

Ethernet

Echo response

Echo request

The PLC automatically returns the echo response packet in response to an echo request packet sent
by another node (host computer or other Ethernet Unit).

CP2E CPU Unit Software User’s Manual(W614) 15-15


15 Ethernet

15-4 FINS Communications

15-4-1 FINS Communications Service Specifications


Item Specification
Number of nodes 254
Message Length 1016 bytes max.
Date Length (See note 1.) 1004 bytes max.
Number of buffer 16
Protocol name FINS/UDP method FINS/TCP method
Protocol used UDP/IP TCP/IP
The selection of UDP/IP or TCP/IP is made by means of the FINS/UDP or FINS/TCP button
in Built-in Ethernet Tab in the CX-Programmer's PLC Setup.
Number of connections --- 3 for user, 1 for CX-Programmer auto connection
Port number (See note 2.) 9600 (default) 9600 (default)
Can be changed. Can be changed.
Protection No Yes (Specification of client IP
addresses when unit is used as a server)
Other Items set for each UDP port Items set for each connection
• Broadcast • Server/client specification
• Address conversion method • Remote IP address specification
Server: Specify IP addresses of clients permitted to
connect.
Client: Specify remote Ethernet Unit (server) IP
address.
• Automatic FINS node address allocation:
Specify automatic allocation of client FINS node
addresses.
• Keep-alive:
Specify whether remote node keep-alive is to be used.
Internal table This is a table of correspondences for remote FINS node addresses, remote IP addresses,
TCP/UDP, and remote port numbers. It is created automatically when power is turned ON to
the PLC or when the unit is restarted, and it is automatically changed when a connection is
established by means of the FINS/TCP method or when a FINS command received.
The following functions are enabled by using this table.
• IP address conversion using the FINS/UDP method
• Automatic FINS node address conversion after a connection is established using the
FINS/TCP method
• Automatic client FINS node address allocation using the FINS/TCP method
• Simultaneous connection of multiple FINS applications

Note 1 Refer to the following diagram for the relation between message length and date length.

10 bytes 2 bytes 1004 bytes max.

FINS header Command code Date length

Message length: 1016 bytes max.


2 The FINS/UDP and FINS/TCP port numbers for CX-Programmer Auto Connection are always set to 9600, although
the FINS/UDP and FINS/TCP port numbers for user are set to other values.

15-16 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-4-2 FINS Communications Service


FINS commands can be sent to or received from other PLCs or computers on the same Ethernet net-
work by executing SEND(090), RECV(098), or CMND(490) instructions in the ladder diagram program.
This enables various control operations such as the reading and writing of I/O memory between PLCs,
mode changes.

Ethernet

15-4 FINS Communications


IP UDP or TCP FINS IP UDP or TCP FINS

CP2E-N……D…-… CP2E-N……D…-… Ethernet Unit

User program
SEND(090),
RECV(098), or
CMND(490)
instruction

Executing, from the host computer, FINS commands with UDP/IP or TCP/IP headers enables various
15
control operations, such as the reading and writing of I/O memory between PLCs, mode changes.

15-4-2 FINS Communications Service


For example, it is possible to connect online via Ethernet from FINS communications applications such
as the CX-Programmer, and to perform remote programming and monitoring.

15-4-3 Procedure for Using FINS/UDP, FINS/TCP

Procedure for Using FINS/UDP

1. Make the basic settings.


Refer to 15-3-3 Basic Settings.

2. Make the settings for FINS/UDP in the PLC Setup with CX-Programmer.

3. Make the routing table settings and transfer them to each PLC. (See note.)
Set the routing tables with CX-Integrator, and transfer it to each PLC.

4. Create a ladder program that includes the SEND, RECV, and CMND
instructions.

Note Routing tables are required in the following situations:


• When communicating with a PLC or computer on another network (e.g., remote programming or monitor-
ing using FINS messages or a CX-Programmer).
• When routing tables are used for one or more other nodes on the same network.
It is not necessary to set routing tables if the nodes are connected as one network.
• Routing table can be set by CX-Integrator version 2.67 or higher (CX-One version 4.51 or higher). For the
details of the routing table, refer to CX-Integrator Ver.2.… Operation Manual (Cat. No. W464).

CP2E CPU Unit Software User’s Manual(W614) 15-17


15 Ethernet

Procedure for Using FINS/TCP

1. Make the basic settings.


Refer to 15-3-3 Basic Settings.

2. Make the settings for FINS/TCP in the PLC Setup with CX-Programmer.

3. Make the routing table settings and transfer them to each PLC. (See note.)
Set the routing tables with CX-Integrator, and transfer it to each PLC.

4. Create a ladder program that includes the SEND, RECV, and CMND
instructions.

Note Routing tables are required in the following situations:


• When communicating with a PLC or computer on another network (e.g., remote programming or monitor-
ing using FINS messages or a CX-Programmer).
• When routing tables are used for one or more other nodes on the same network.
It is not necessary to set routing tables if the nodes are connected as one network.
• Routing table can be set by CX-Integrator version 2.67 or higher (CX-One version 4.51 or higher). For the
details of the routing table, refer to CX-Integrator Ver.2.… Operation Manual (Cat. No. W464).

15-4-4 PLC Setup for FINS/UDP and FINS/TCP Applications


Aside from the basic settings, the required settings vary depending on the particular communications
applications that are used. All these settings are in the Built-in Ethernet Tab. Click on the relative button
can open the setup dialog.

FINS/UDP and FINS/TCP Setting

z FINS/UDP
Button name Settings
FINS/UDP Setting Conversion
FINS/UDP Port
IP Address Table
Destination IP Address
Change Dynamically

z FINS/TCP
Button name Settings
FINS/TCP Setting FINS/TCP Port
FINS/TCP Connection Setting

15-18 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

CX-Programmer Setup
z FINS/UDP
Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab. Click the
FINS/UDP Setting button to display the FINS/UDP setup dialog.

Built-in Ethernet Tab

15-4 FINS Communications


Item Contents Default 15
Fins Node No. Set the node address of the CP2E N……-type CPU Unit. Node address 1
• When conversion method is set to Auto(Dynamic/Static), Fins Node (Setting value 0)

15-4-4 PLC Setup for FINS/UDP and FINS/TCP Applications


Address = Host ID of IP Address.
IP Address: xx.xx.xx.FINS Node Address
• When conversion method is set to IP address table or Combined, the
node address can be set regardless of the host ID of IP address.

FINS/UDP

CP2E CPU Unit Software User’s Manual(W614) 15-19


15 Ethernet

Item Contents Default


FINS/UDP Port Specify the local UDP port number to be used for the FINS communica- 0 (9,600)
tions service. The UDP port number is the number used for UDP identifi-
cation of the application layer (i.e., the FINS communications service in
this case).
• Default (9,600)
• User defined (Setting range: 1 to 65,535)
Note Make the settings so that UDP port number does not overlap with
port number 123 for SNTP and port number 53 for DNS.
Conversion Select any of the following as the method for finding and converting IP Auto (dynamic)
addresses from FINS node addresses. (Enabled for FINS/UDP only.)
• Automatic generation (dynamic): Auto (dynamic)
• Automatic generation (static): Auto (Static)
• IP address table method: Table used
• Combined method: Mixed
Destination IP Address Select to dynamically change the remote (destination) IP address for Checked
(Change Dynamically) FINS/UDP. To prohibit dynamic changes, deselect this box. (Change Dynami-
cally)
IP Address Table Set the IP address table that defines the relationship between FINS node None
addresses and IP addresses.
With FINS/UDP, this is enabled only when the IP address table method or
combined method is set as the IP address conversion method.

Note 1 Make settings using the PLC settings function in the CX-Programmer (to be included in ver-
sion 9.72 and higher).
2 For the details of IP address conversion, IP address dynamically changing and IP address
table, refer to Section 5 Determining IP Addresses in the CS/CJ Series Ethernet Units Con-
struction of Networks Operation Manual (Cat. No. W420).

z FINS/TCP
Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab. Click the
FINS/TCP Setting button to display the FINS/TCP setup dialog.

15-20 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Item Contents Default


FINS/TCP Port Specify the local TCP port number to be used for the FINS communications 0 (9,600)
service. The TCP port number is the number used for TCP identification of
the application layer (i.e., the FINS communications service in this case).
• Default (9,600)
• User defined (Setting range: 1 to 65,535)
FINS/TCP con- Shows the connection number. This is a network API used when TCP is
nection Setting used for the FINS communications service. It corresponds to a socket in the
socket services. Up to 3 can be used at a time, and they are identified by
connection numbers 1 to 3. The PLC can thus simultaneously execute the
FINS communications service by TCP with up to 3 remote nodes.
Protect by IP When this option is selected, if the PLC is set for use as a server, and if a Not protected
Address connection number other than 0.0.0.0 is set for a destination IP address, any

15-4 FINS Communications


connection request from other than the number set for that IP address will be
denied.
Select this option to prevent faulty operation (by FINS commands) from spe-
cific nodes from affecting the PLC.

The following settings can be made for each connection number.


Item Contents Default
FINS/TCP For each connection number, this setting specifies the PLC for use as either Server
Server/Client a server or a client.
• When the PLC is used as a server:
The PLC opens a connection with that connection number and waits for
service requests from clients. Connection numbers are used in ascending 15
order and allocated to clients in the order connections are made.
• When the PLC is used as a client:

15-4-4 PLC Setup for FINS/UDP and FINS/TCP Applications


The PLC establishes a connection with the server set as the destination IP
address. Once the connection has been established, FINS/TCP is used for
FINS communications.
Destination IP • When the PLC is used as a server: 0.0.0.0
Address If the option is selected to use IP addresses to protect, set the IP
addresses as required at clients from which connection is permitted. If not
set for those connections, the default setting of 0.0.0.0 can be used.
• When the PLC is used as a client:
Set the IP address for the remote PLC (i.e., the server) that is to be con-
nected by FINS/TCP. It is required that an IP address be set for the remote
PLC.
Auto allocated If the client (normally a personal computer) application supports FINS/TCP, Connection
FINS node and if FINS node addresses are not fixed, the client will take 0 as its node No.1 to 3
address. Then, when a FINS command arrives, the number set here (from No.1: 0 (251)
251 to 253) will automatically be allocated as the client’s FINS node
address. No.2: 0 (252)
No.3: 0 (253)
keep-alive For each connection number, set whether or not the remote node connection Not use
check function is to be used for the FINS/TCP server and client.
If the keep-alive box is checked here, then, when the remote node goes with-
out responding for longer than the monitor time set in the Setup, the connec-
tion will be terminated. If a remote node turns OFF without warning, the
connection will remain open indefinitely, so this option should be used when-
ever possible.

For details, refer to SECTION 6 FINS Communications Service in the Ethernet Units Operation
Manual Construction of Networks (Cat. No. W420).

CP2E CPU Unit Software User’s Manual(W614) 15-21


15 Ethernet

15-4-5 Auxiliary Area Allocations


The following table and descriptions cover the words and bits in the Auxiliary Area of PLC memory that
are related to the FINS/UDP and FINS/TCP.
Address Bit(s) Name Status Unit operation Access
A47 0 FINS/TCP ON Turned ON by the Unit when a connection is estab- Read only
Connection lished.
Flag 1 OFF Turned OFF by the Unit when the connection is ter-
minated.
1 FINS/TCP ON Turned ON by the Unit when a connection is estab-
Connection lished.
Flag 2 OFF Turned OFF by the Unit when the connection is ter-
minated.
2 FINS/TCP ON Turned ON by the Unit when a connection is estab-
Connection lished.
Flag 3 OFF Turned OFF by the Unit when the connection is ter-
minated.

15-4-6 New FINS Commands

New FINS Commands Code List


The command codes listed in the following table are new added commands to CP2E N……-type CPU
Units.
For the details of other FINS commands, refer to the SYSMAC CS/CJ/CP/NSJ-series Communications
Commands Reference Manual (Cat. No. W342).
Command code Name Unit address
MRC SRC
04 03 RESET 0xFA
05 01 ETHERNET PORT DATA READ
27 30 FINS/TCP CONNECTION REMOTE 0x00
NODE CHANGE REQUEST
31 FINS/TCP CONNECTION STATUS
READ
50 IP ADDRESS TABLE WRITE
51 IP ROUTER TABLE WRITE
60 IP ADDRESS TABLE READ
61 IP ROUTER TABLE READ

Note 1 There are two unit address (DA2 in FINS header) used in CP2E N……-type CPU Units.

0xFA It is used for the two new added FINS commands relative with built-in
Ethernet Port. (Ethernet controller reset command and Ethernet Port
information read command)
0x00 It is used for the FINS commands other than the two commands above.

2 Ethernet controller reset command and Ethernet Port information read command can only be executed by
other PLCs or computers on the Ethernet network. It cannot be executed in the local node by CMND
instruction.

15-22 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Response Code List


Response codes are 2-byte codes which indicate the results of command execution. They are returned
in the response following the command code.
The first byte of a response code is the MRES (main response code), which categorizes the results of
command execution. The second byte is the SRES (sub-response code) which specifies the results.
MRC: Main request code
Command Response SRC: Sub-request code
code code MRES: Main response code
SRES: Sub-response code
MRC SRC MRES SRES

15-4 FINS Communications


Additional Information

Certain bits (6, 7 or 15) of the response code will be ON.


When bit 6 or 7 turns ON, it indicates that an error has occurred in the destination CPU Unit.
Refer the the CPU Unit manual to remove the error.
When bit 15 turns ON, it indicates that an error has occurred during the network relay.
The following diagram describes what is a response code.
Bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

1 Main Response Code (MRES) 0 (SRES)


Sub Response Code
15

15-4-6 New FINS Commands


1: CPU Unit fatal error occurs 1: CPU Unit non-fatal error occurs
1: Relay error occurs

The MRES codes are shown in the following table along with the results they indicate.
MRES Execution results
00 Normal completion
01 Local node error
02 Remote node error
03 Unit error (controller error)
04 Service not supported
05 Routing error
10 Command format error
11 Parameter error
22 Status error
23 Operating environment error
25 Unit error

Refer to the SYSMAC CS/CJ/CP/NSJ-series Communications Commands Reference Manual (Cat. No.
W342) or the operation manuals for the relevant unit for further information on response codes.

CP2E CPU Unit Software User’s Manual(W614) 15-23


15 Ethernet

Command/Response Reference
This section describes the FINS commands that can be sent to PLC’s Ethernet module and the
responses to each command.
The command, response, and (where applicable) the results storage blocks are given with the com-
mands in graphic form as shown in the following diagram. If the data is fixed, it is included in the blocks.
If the data is variable, it is described following the blocks. Each box represents 1 byte; every two boxes
represents 1 word. The following diagram shows 2 bytes, or 1 word.

Two bytes
The results storage format is the format used to store transfer results.
Response codes applicable to the command are described at the end of the command description. If
any UNIX error codes are generated, these are also described. Refer to your UNIX error symbol defini-
tion file /usr/include/sys/errno.h for details. UNIX errors are returned in the results storage area.
Note Except for special cases, all send/receive data is in hexadecimal format.

New FINS Commands Addressed to Built-in Ethernet Port (0xFA)


z Command Code List
The command codes listed in the following table can be sent to the built-in Ethernet port.
The destination unit address (DA2) in FINS frame should be set as 0xFA.
Command code Name
MRC SRC
04 03 RESET
05 01 ETHERNET PORT DATA READ

z RESET: 0403
Reset the Ethernet Unit.

Command Block

04 03

Command code

Response Block

04 03

Command Response
code code

15-24 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Precautions for Correct Use

No response will be returned if the command ends normally. A response will be returned only if
an error occurs.
In some cases, send requests (SEND/RECV instructions) made from the PLC to the built-in
Ethernet port just before execution of the RESET command may not be executed.
Except for the FINS communications service sockets, all open sockets (for sockets services) are
closed immediately before resetting.

Response Codes

15-4 FINS Communications


Response code Description
1004 Command format error

z ETHERNET PORT CONTROLLER DATA READ: 0501


Reads the following data from the Ethernet port, PLC model, PLC version, IP address, subnet mask,
FINS UDP port number, mode settings, Ethernet address.

Command Block

05 01
15

Command code

15-4-6 New FINS Commands


Response Block

05 01 20 byte 20 byte 4 byte 4 byte 6 byte

Command Response Model Version IP address Subnet FINS UDP Mode Ethernet address
code code mask port number setting

Parameters
Model, Version (Response)
The PLC model and version are returned as ASCII characters occupying 20 bytes each (i.e., 20
characters each). If all bytes are not used, the remaining bytes will be all spaces (ASCII 20 Hex).
Example Model: CP2E-ETN21
Version: V1.00

IP Address, Subnet Mask (Response)


The built-in Ethernet port’s IP address and subnet mask are returned as 4 bytes each.

FINS UDP Port Number (Response)


The built-in Ethernet port’s UDP port number for FINS is returned as 2 bytes.

Mode Setting (Response)


The mode setting in the system setup is returned.

CP2E CPU Unit Software User’s Manual(W614) 15-25


15 Ethernet

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

0 0 0 0 0 0 0 0 0

Broadcast address setting


IP address conversion method
FINS/UDP port No. setting
FINS/TCP port No. setting
FINS/UDP destination IP mode
SNTP server specification method

• Broadcast Address Setting


0: Broadcast with host number set to all ones (4.3BSD specifications)
1: Broadcast with host number set to all zeroes (4.2BSD specifications)
• IP Address Conversion Method Setting
00, 01: Automatic generation method
10: IP address table reference method
11: Combined method (IP address table reference + automatic generation)
• FINS/UDP Port Number Setting
0: Default (9600)
1: Unit Setup value
• FFINS/TCP Port Number Setting
0: Default (9600)
1: Unit Setup value
• FINS/UDP Destination IP Mode
0: Dynamical mode
1: Static mode
• SNTP Server Specification Method
0: IP address
1: Host name

Ethernet Address (Response)


The Ethernet address of the Ethernet port is returned. The Ethernet address is the address marked
on the label on the top of the PLC.

Response Codes
Response code Description
0000 Normal
1004 Command format error

15-26 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

New FINS Commands Addressed to CPU Port (0x00)

z Command Code List


This section describes the new FINS commands that can be sent to the CPU port and the
responses that are returned.
The command codes listed in the following table can be sent to the CPU port.
The destination unit address (DA2) in FINS frame should be set as 0x00.
Command code Name
MRC SRC

15-4 FINS Communications


27 30 FINS/TCP CONNECTION REMOTE
NODE CHANGE REQUEST
31 FINS/TCP CONNECTION STATUS READ
50 IP ADDRESS TABLE WRITE
51 IP ROUTER TABLE WRITE
60 IP ADDRESS TABLE READ
61 IP ROUTER TABLE READ

z FINS/TCP CONNECTION REMOTE NODE CHANGE REQUEST: 2730


Requests a remote node change for the FINS/TCP connection.
15

Command Block

15-4-6 New FINS Commands


27 30

Command FINS/TCP Remote IP Remote TCP


code connection No. address port number

Response Block

27 30

Command Response
code code

Parameters
FINS/TCP Connection No. (Command)
Specifies, in two bytes, the FINS/TCP connection number (1 to 3) for which the change is to be
made.

Remote IP Address (Command)


Specifies the remote node’s IP address (must be non-zero) in hexadecimal.

Remote Port Number (Command)


Specifies the remote TCP port number (must be non-zero) with this command.

CP2E CPU Unit Software User’s Manual(W614) 15-27


15 Ethernet

Response Codes
Response code Description
0000 Normal
0105 Node address setting error
Local IP address setting error
1004 Command format error
1100 Connection number not set from 1 to 3
Remote IP address set to 0
Remote TCP port number set to 0
2230 Connection already established with specified remote node
2231 Specified connection number not set as FINS/TCP client in
Unit Setup
2232 Remote node change processing for specified connection
number aborted because change request received during
processing

z FINS/TCP CONNECTION STATUS READ: 2731


Reads the FINS/TCP connection status.

Command Block

27 31

Command FINS/TCP
code connection No.

Response Block

27 31

Command Response FINS/TCP Connection Local IP address Local TCP Remote IP Remote TCP TCP transition
code code connection service port number address port number
No.

Parameters
FIFINS/TCP Connection No. (Command, Response)
Command: Specifies, in two bytes, the FINS/TCP connection number (1 to 3) for which the status is
to be read.
Response: Specifies the FINS/TCP connection number (1 to 3) for which the status was read.

Connection Service (Response)


Specifies the service that is being used for the FINS/TCP connection as a number.
0003: FINS/TCP server
0004: FINS/TCP client

Local IP Address (Response)


Specifies the IP address for the local node in hexadecimal.

Local TCP Port Number (Response)


Specifies the TCP port number for the local node.

Remote IP Address (Response)


Specifies the IP address for the remote node in hexadecimal.

15-28 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Remote TCP Port Number (Response)


Specifies the TCP port number for the remote node.

TCP Transitions (Response)


Specifies the TCP connection status using the following numbers.
For details on TCP status changes, refer to A-6-1 TCP Status Transitions.
Number Status Meaning
00000000 CLOSED Connection closed.
00000001 LISTEN Waiting for connection.
00000002 SYN SENT SYN sent in active status.
00000003 SYN RECEIVED SYN received and sent.

15-4 FINS Communications


00000004 ESTABLISHED Already established.
00000005 CLOSE WAIT FIN received and waiting for completion.
00000006 FIN WAIT 1 Completed and FIN sent.
00000007 CLOSING Completed and exchanged FIN. Awaiting ACK.
00000008 LAST ACK FIN sent and completed. Awaiting ACK.
00000009 FIN WAIT 2 Completed and ACK received. Awaiting FIN.
0000000A TIME WAIT After closing, pauses twice the maximum seg-
ment life (2MSL).

Response Codes 15
Response code Description

15-4-6 New FINS Commands


0000 Normal
0105 Node address setting error
Local IP address setting error
1004 Command format error
1100 Connection number not set from 1 to 3

z IP ADDRESS TABLE WRITE: 2750


Writes the IP address table.

Command Block

27 50 6 bytes 6 bytes

Command Number IP address IP address


code of records table records table records

Response Block

27 51

Command Response
code code

Parameters
Number of Records (Command)
The number of records to write is specified in hexadecimal between 0000 and 0020 (0 to 32 deci-
mal) in the command. If this value is set to 0, the IP address table will be cleared so that no records
are registered.

CP2E CPU Unit Software User’s Manual(W614) 15-29


15 Ethernet

IP Address Table Records (Command)


Specify the IP address table records. The number of records specified must be provided. The total
number of bytes in the IP address table records is calculated as the number of records × 6
bytes/record. The configuration of the 6 bytes of data in each record is as shown in the following dia-
gram.
1 6 bytes

00

FINS node IP address


number

• FINS Node Address


Node address for communications via the FINS command (hexadecimal).
• IP Address
IP address used by TCP/IP protocol (hexadecimal).

Precautions for Correct Use

The new I/O address table records will not be effective until the PC is restarted or the Ethernet
Unit is reset.
An error response will be returned if the IP address conversion method in the system mode set-
tings is set for automatic generation.

Response Codes
Response code Description
0000 Normal (echo reply received from the remote node)
1004 Command format error
1003 The number of records specified does not match the sent data
length.
110C The number of records is not between 0 and 32.
The FINS node address is not between 1 and 126
The IP address is 0.
2307 IP address conversion method is set for automatic generation.

z IP ROUTER TABLE WRITE: 2751


Writes the IP router table.

Command Block

27 51 8 bytes 8 bytes

Command Number IP router IP router


code of records table records table records

Response Block

27 51

Command Response
code code

15-30 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Parameters
Number of Records (Command)
The number of records to write is specified in hexadecimal between 0000 and 0008 in the com-
mand. If this value is set to 0, the IP router table will be cleared so that no records are registered.

IP Router Table Records (Command)


Specify the IP router table records. The number of records specified must be provided. The total
number of bytes in the IP router table records is calculated as the number of records × 8
bytes/record. The configuration of the 8 bytes of data in each record is as shown in the following dia-
gram.
1 8 bytes

15-4 FINS Communications


IP Network address Router IP address
(Network ID)

• IP Network Address
The network ID from the IP address in hexadecimal. The network ID part corresponding to the
address class (determined by the leftmost 3 bits) set here, is enabled.
• Router IP Address
The IP address (in hexadecimal) of a router connected to a network specified with IP addresses.
15
Response Codes
Response code Description

15-4-6 New FINS Commands


0000 Normal
1004 Command format error
1003 The number of records specified does not match the sent data
length.
110C The number of records is not between 0 and 8.
The router IP address is 0.

z IP ADDRESS TABLE READ: 2760


Reads the IP address table.

Command Block

27 60

Command Number of
code records

Response Block

27 60 6 bytes 6 bytes

Command Response Maximum Number Number IP address IP address


code code number of stored of records table records table records
of stored records
records

CP2E CPU Unit Software User’s Manual(W614) 15-31


15 Ethernet

Parameters
Number of Records (Command, Response)
The number of records to read is specified between 0000 and 0020 (0 to 32 decimal) in the com-
mand. If this value is set to 0, the number of stored records is returned but the IP address table
records are not returned. The response returns the actual number of records read.

Maximum Number of Stored Records (Response)


The maximum number of records that can be stored in the IP address table is returned. The maxi-
mum number of stored records is fixed at 0020 (32 records).

Number of Stored Records (Response)


The number of IP address table records stored at the time the command is executed is returned as
a hexadecimal number.

IP Address Table Records (Response)


The number of IP address table records specified in the number of records parameter is returned.
The total number of bytes in the IP address table records is calculated as the number of records × 6
bytes/record. The configuration of the 6 bytes of data in each record is as shown in the following dia-
gram.
1 6 bytes

00

FINS node IP address


number

• FINS Node Address


Node address for communications via the FINS command (in hexadecimal).
• IP Address
IP number used by TCP/IP protocol (in hexadecimal).

Precautions for Correct Use

If the IP address table contains fewer records than the number specified in the number of
records parameter, all the records contained in the IP address table when the command is exe-
cuted will be returned and the command execution will end normally.
An error response will be returned if the IP address conversion method in the system mode set-
tings is set to the automatic generation method.

Response Codes
Response code Description
0000 Normal
1004 Command format error
2307 IP address conversion method is set to the automatic genera-
tion method.

z IP ROUTER TABLE READ: 2761


Reads the IP router table.

Command Block

27 61

Command Number
code of records

15-32 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Response Block

27 61 8 bytes 8 bytes

Command Response Maximum Number Number IP router IP router


code code number of stored of records table records table records
of stored records
records

Parameters
Number of Records (Command, Response)
The number of records to read is specified between 0000 and 0008 (0 to 8 decimal) in the com-
mand. If this value is set to 0, the number of stored records will be returned but the IP router table
records will not be returned. The response returns the actual number of records read.

15-4 FINS Communications


Maximum Number of Stored Records (Response)
The maximum number of records that can be stored in the IP router table is returned. The maximum
number of stored records is fixed at 0008 (8 records).

Number of Stored Records (Response)


The number of IP router table records stored at the time the command is executed is returned in
hexadecimal.

IP Router table Records (Response)


15
The number of IP router table records specified in the number of records parameter is returned. The
total number of bytes in the IP router table records is calculated as the number of records × 8

15-4-6 New FINS Commands


bytes/record. The configuration of the 8 bytes of data in each record is shown below.
1 8 bytes

IP Network address Router IP address


(Network ID)

• IP Network Address
The network ID from the IP address in hexadecimal. The network ID part corresponding to the
address class (determined by the leftmost 3 bits) set here, is enabled.
• Router IP Address
The IP address (in hexadecimal) of a router connected to a network specified with IP addresses.

Precautions for Correct Use

If the IP router table contains fewer records than the number specified in the number of records
parameter, all the records contained in the IP router table when the command is executed will be
returned and the command execution will end normally.

Response Codes
Response code Description
0000 Normal
1004 Command format error

CP2E CPU Unit Software User’s Manual(W614) 15-33


15 Ethernet

15-4-7 CMND/SEND/RECV Instructions

The data and FINS commands can be transmitted between the CP2E N……-type CPU Unit and other
devices using the CMND, SEND or RECV instuction.
Setting the network address and the node address of the instrction in the CP2E N……-type CPU Unit
ladder program, it is possible to send the data and FINS commands to another device, or receive data
from another device.

Sample Program
cCP2E N……-type CPU Unit requests the data to be transmitted from dCP2E N……-type CPU Unit
(node address 3) in the local network and receives the data.
When W0.00 and A202.7 (the Communications Port Enabled Flag for port 07) are ON, 20 words are
read from D100 to D119 of dCP2E N……-type (node address 3), transmitted to cCP2E N……-type
and stored in D200 to D219 using the RECV instruction.

Send request
RECV instruction

Response data

c CP2E N††-type CPU Unit d CP2E N††-type CPU Unit


Port number 7 Node address: 3
Response requested Unit address: 00 (CPU Unit)
Retries: 3
Response monitoring time 10s

D200 D100
D201 D101
20 words 20 words
: :
D219 D119

W0.00 A202.07
RECV
S D00100 First source word (remote node)
D D00200 First destination word (local node)
C D00300 First control word

15 87 0
D: D00300 0 0 1 4 Number of words to receive (send request): 0014 hex (20 words)

C+1: D00301 0 0 0 0 Source network address: 00 hex (local network)

C+2: D00302 0 3 0 0 Source node address: 3 hex, Source unit address: 00 hex (CPU Unit)

C+3: D00303 0 7 0 3 Response requested (fixed), Logical port number: 7 hex, Retries: 3 hex

C+4: D00304 0 0 6 4 Response monitoring time: 0064 hex (10 sec.)

15-34 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-4-8 Restrictions When Using FINS Communication Services

CP2E CPU Unit does not support network relay function.


The PTs and host computers connected to the CP2E N……-type CPU Unit cannot communicate (such
as FINS message communication, remote programming or monitoring by the CX-Programmer) with the
PLCs or computers on the network by Host Link.

Built-in Ethernet port


Serial port

CS/CJ/CP Series PT
Ethernet port Computer

15-4 FINS Communications


CP2E N-type
CPU Unit
Network Host Link

CP2E N……-type CPU Unit can be only configed as the end point of the network.
It cannot be used as a rely node for the network. It can send or receive FINS command through up to 3
layers of the network. 15
CP2E N-type

15-4-8 Restrictions When Using FINS Communication Services


CPU Unit

Network 1 CP2E cannot config as relay node

PLC2

Network 2

PLC3

Network 3

CP2E N-type CP2E N-type


CPU Unit CPU Unit

CP2E CPU Unit Software User’s Manual(W614) 15-35


15 Ethernet

15-5 Socket Services


The socket services allow devices on the Ethernet to send and receive various data using either the
UDP or TCP protocol.

15-5-1 Overview of Socket Service


The way to use socket services is to set the required parameters in the parameter area allocated in the
DM Area, and then to request particular UDP or TCP socket services by turning ON dedicated control
bits in the AR Area. When the PLC has completed the requested process, the same bit is turned OFF to
provide notification. Data that is sent or received is automatically handled according to the I/O memory
locations specified in the parameter area.
A total of three ports (UDP and TCP combined) can be used for socket services.
UNIX computer, etc.
(node with socket
services interface)

Ethernet

TCP/UDP
protocol
CP2E-N……-type
CPU Unit
UDP TCP
Socket

Service request switch


IP

TCP/UDP Parameters
protocol

15-5-2 Procedure for Using Socket Service Functions

1. Make the basic settings.


Refer to 15-3-3 Basic Settings.

2. Use the CX-Programmer or Programming Console to make the socket


service settings in the socket service parameter areas 1 to 3 (m+8 to m+37)
allocated in the DM Area.
Note The first word m in the allocated DM Area = D16000

3. Select Transfer to PLC from the Options Menu, and then click the Yes
button. The Setup data in the allocated DM Area will be transferred to the
CPU Unit.

15-36 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Precautions for Correct Use

A Socket Service Parameter Area cannot be used for other sockets once open processing has
been successfully completed for it. Check the socket status before attempting to open a socket.
TCP socket status is provided in words m+4 to m+6 in the DM Area for sockets 1 to 3.
When a send or receive request is made, the data will be automatically sent or received accord-
ing to the send/receive data address in the Socket Service Parameter Area. When processing
has been completed, a response code will be automatically stored in the Socket Service Param-
eters.

15-5-3 Socket Services and Socket Status

15-5 Socket Services


When using socket services, it is important to consider the timing of the status changes in the Socket
Status Area. The diagram below shows a flowchart for opening UDP. The flow is similar for other socket
services. Replace the names of the appropriate flags in the flowchart to adapt it to other socket ser-
vices.

Start UDP Open.

Program Flow Error Evaluation


15
Check TCP Connection/UDP Open Flag. OFF? The specified UDP socket is
NO already open.
Is Bit 15 (Open Flag) in the socket status word for YES

15-5-3 Socket Services and Socket Status


the socket being used OFF?
(Checks to see if the socket is open before com-
munications and close processing.)

Turn ON UDP Open Request Switch.

This Socket Service Request Switch is used to request


opening of a UDP socket to the Ethernet Unit.

Confirm end of processing. ON/OFF?

This Socket Service Request Switch that was turned OFF


ON will be turned OFF by the Ethernet Unit when
processing has been completed.

An error occurred. The specified


Check response code. 0000? socket could not be opened.
NO
Is the response code 0000, indicating a normal end? YES

UDP socket opened.

Note For details about timing charts, refer to SECTION 6 Socket Services in the Ethernet Units Construction of
Applications Operation Manual (Cat. No. W421).
Socket services cannot support CMND command.

CP2E CPU Unit Software User’s Manual(W614) 15-37


15 Ethernet

15-5-4 PLC Setup for Socket Services

Socket Services Setting


CX-Programmer tab Setting
Built-in Ethernet TCP/IP keep-alive

Item Contents Default


TCP/IP keep-alive Set the liveness-checking interval. When socket services using either 0
FINS/TCP or TCP/IP are used, the connection will be terminated if there (120 minutes)
is no response from the remote node (either a server or client) within the
time set here. (Enabled for socket services using FINS/TCP or TCP/IP
only.)
Setting range: 0 to 65,535 minutes
This setting applies to the keep-alive setting for each connection set
with the FINS/TCP Setting button.

Note Make settings using the PLC settings function in the CX-Programmer (to be included in version 9.72 and
higher).

15-38 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-5-5 Auxiliary Area Allocations


The following table and descriptions cover the words and bits in the Auxiliary Area of PLC memory that
are related to the socket services.

Ethernet Service Request

Address Bit(s) Name Status Unit operation Access


A566 2 Socket Force- ON All sockets are forcibly closed when this bit Read/Write
close Switch turns ON.
OFF Turned OFF by Unit after sockets are closed.

z Socket Force-close Switch (Bit 2)

15-5 Socket Services


All UDP and TCP sockets used for socket services can be force-closed by turning ON this switch.
This can be used for operations such as error processing.
Be careful not to force-close sockets during communications, or an error will occur. After all sockets
have been force-closed, the PLC will turn the switch OFF again. Do not attempt to forcibly manipu-
late this switch before it is automatically turned OFF by the PLC.
Ports used exclusively by the Ethernet Unit will not be closed.

15
Socket Service

15-5-5 Auxiliary Area Allocations


Bit
15 8 7 0
A567 TCP/UDP Socket No. 1 Status
A568 TCP/UDP Socket No. 2 Status
A569 TCP/UDP Socket No. 3 Status
A570 Reserved
A571 Socket Service Request Switches 2 Socket Service Request Switches 1
A572 Reserved Socket Service Request Switches 3

z Status of TCP/UDP Sockets 1 to 3


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
A567 to A569

Data Received Flag Opening Flag

Results Storage Error Flag Receiving Flag

TCP/UDP Open Flag Sending Flag

Closing Flag

CP2E CPU Unit Software User’s Manual(W614) 15-39


15 Ethernet

Bit Flag Status Manipulated Unit operation Access


by
0 Opening Flag ON Unit ON during open processing. (Turns ON when Read only
open request is received.)
OFF Unit OFF when open processing has been com-
pleted.
1 Receiving Flag ON Unit ON during receive processing. (Turns ON
when receive request is received.)
OFF Unit OFF when receive processing has been com-
pleted.
2 Sending Flag ON Unit ON during send processing. (Turns ON when
send request is received.)
OFF Unit OFF when send processing has been com-
pleted.
3 Closing Flag ON Unit ON during close processing. (Turns ON when
close request is received.)
OFF Unit OFF when close processing has been com-
pleted.
4 to 12 (Not used.) --- --- --- ---
13 Data Received Flag ON Unit ON when data from a remote node has been Read only
received at an open TCP socket.
OFF Unit OFF when receive processing has been
requested for an open TCP socket.
14 Results Storage ON Unit CP2E CPU Units are supported by CX-One
Error Flag version 4.51 or higher and CX-Programmer
version 9.72 or higher.
OFF Unit Turns OFF when the next request is received.
15 TCP/UDP Open ON Unit ON when open processing has been com-
Flag pleted.
OFF Unit OFF when close processing has been com-
pleted. (Stays OFF for abnormal open pro-
cessing completion.)

Note Do not forcibly manipulate the above status flags during socket service is used.

z Socket Service Request Switches 1 to 3


15 14 13 12 11 10 9 8

7 6 5 4 3 2 1 0

A571 to A572
UDP Open Request Switch
TCP Passive Open Request Switch
TCP Active Open Request Switch
Send Request Switch
Receive Request Switch
Close Request Switch

15-40 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Bit Switch Status Manipulated Unit operation Access


by
8 0 UDP Open Request ON User UDP socket opened when switch is turned Read/Write
Switch ON.
OFF Unit Unit turns OFF switch when open processing
has been completed (i.e., when a connection
has been made).
9 1 TCP Passive Open ON User Passive TCP socket opened when switch is
Request Switch turned ON.
OFF Unit Unit turns OFF switch when open processing
has been completed (i.e., when a connection
has been made).
10 2 TCP Active Open ON User Active TCP socket opened when switch is
Request Switch turned ON.
OFF Unit Unit turns OFF switch when open processing
has been completed (i.e., when a connection

15-5 Socket Services


has been made).
11 3 Send Request ON User Send processing executed when switch is
Switch turned ON.
(The protocol (TCP/UDP) is determined when
the socket is opened.)
OFF Unit Unit turns OFF switch when send processing
has been completed.
12 4 Receive Request ON User Receive processing executed when switch is
Switch turned ON.
(The protocol (TCP/UDP) is determined when 15
the socket is opened.)
OFF Unit Unit turns OFF switch when receive process-

15-5-5 Auxiliary Area Allocations


ing has been completed.
13 5 Close Request ON User Close processing executed when switch is
Switch turned ON.
(The protocol (TCP/UDP) is determined when
the socket is opened.)
OFF Unit Unit turns OFF switch when close processing
has been completed.
14 6 Reserved --- --- --- ---
15 7 Reserved --- --- --- ---

CP2E CPU Unit Software User’s Manual(W614) 15-41


15 Ethernet

15-5-6 Data Memory Area Allocations


The memory allocation about socket service is shown in the following diagram. These data will be allo-
cated to the DM area of the PLC.
Beginning word m = 16000

Offset Word
Bit
15 08 07 00
m D16000 TCP Socket No. 1 Number of Bytes Received
m+1 D16001 TCP Socket No. 2 Number of Bytes Received

m+2 D16002 TCP Socket No. 3 Number of Bytes Received

m+3 D16003 Reserved

m+4 D16004 TCP Socket No. 1 Connection Status

m+5 D16005 TCP Socket No. 2 Connection Status

m+6 D16006 TCP Socket No. 3 Connection Status


m+7 D16007 Reserved
m+8
D16008 to D16017 Socket Services Parameter Area 1
m+17
m+18
D16018 to D16027 Socket Services Parameter Area 2
m+27
m+28
D16028 to D16037 Socket Services Parameter Area 3
m+37
m+38
D16038 to D16047 Reserved
m+47

z TCP Socket No. (1 to 3): Number of Bytes Received


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
m to m+2 Number of Bytes Received (0000 to 0400 hex)

For each TCP socket, the number of bytes of data in the reception buffer is stored in one word. A max-
imum of 4,096 bytes of data can be held in the reception buffer, but a value of only up to the maximum
value (1,024 bytes) that can be set for receive requests by manipulating control bits is stored.
0000 hex: 0 bytes
0400 hex: 1,024 bytes
The Data Received Flag in the CIO Area turns ON and OFF linked to this word. This area is given a
value of 0000 hex when a receive request is executed by manipulating control bits. If any data
remains in the reception buffer after the receive request processing is completed, the remaining
number of bytes is stored and the Data Received Flag turns ON again.
Before a receive request is executed, a check is performed to confirm that the required data is avail-
able.

z TCP Socket No. (1 to 3): Connection Status


15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
m+4 to m+6

TCP connection status

The connection status for each TCP socket is stored by code in this word. For details, refer to A-6-1
TCP Status Transitions.

15-42 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

z Socket Services Parameter Area 1 to 3


Offset Socket ... Socket
No. 1 No. 3 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
+0 m+8 ... m+28 Socket option UDP/TCP socket number (1 to 3)
+1 m+9 m+29 Local UDP/TCP port number (0000 to FFFF Hex)
+2 m+10 m+30 Remote IP address
m+11 m+31 (00000000 to FFFFFFFF Hex)
+4 m+12 ... m+32 Remote UDP/TCP port number (0000 to FFFF Hex)
+5 m+13 m+33 Number of send/receive bytes (0000 to 0400 Hex (1024))
+6 m+14 m+34 Send/receive data address
m+15 m+35 (Same as FINS variable area designation method.)
+8 m+16 m+36 Timeout value (0000 to FFFF Hex)
+9 m+17 ... m+37 Response code

When socket services are requested by control bit manipulation, the settings must be made in

15-5 Socket Services


advance in a Socket Service Parameter Area. The parameters used will vary depending on the ser-
vice requested.

Parameter Settings
The following table shows the parameters that are required for each service and the use of the
parameters by the socket service.
15
z UDP Socket Services

15-5-6 Data Memory Area Allocations


Parameter No. of Range Socket service
words (decimal values in parentheses)
UDP UDP UDP UDP
open receive send close
Socket option 1 Specified bit --- --- --- ---
UDP/TCP socket No. 0001 to 0003 hexadecimal W W W W
(1 to 3)
Local UDP/TCP port No. 1 0000 to FFFF hexadecimal W --- --- ---
(0 to 65,535)
Remote IP address 2 00000000 to FFFFFFFF --- R W ---
hexadecimal
(0.0.0.0 to 255.255.255.255)
Remote UDP/TCP port No. 1 0000 to FFFF hexadecimal --- R W ---
(0 to 65,535)
Number of bytes to 1 0000 to 0400 hexadecimal --- RW RW ---
send/receive (0 to 1,024 bytes)
Send/Receive data address 2 Memory area address --- W W ---
Time out time 1 0000 to FFFF hexadecimal --- W --- ---
(Unit: 100 ms) (0 to 65,535)
(0: No limit, 0.1 to 6,553.5 s)
Response code 1 --- R R R R

Note W: Written by user


RW: Written by user at execution and then read for results at completion
R: Read by user for results at completion
---: Not used.

CP2E CPU Unit Software User’s Manual(W614) 15-43


15 Ethernet

z TCP Socket Services


Parameter No. of Range Socket service
words (decimal values in parentheses)
TCP TCP TCP TCP TCP
passive active receive send close
open open
Socket option 1 Specified bit W W --- --- ---
UDP/TCP socket 0001 to 0003 hexadecimal W W W W W
No. (1 to 3)
Local UDP/TCP port 1 0000 to FFFF hexadecimal W RW --- --- ---
No. (0 to 65,535)
Remote IP address 2 00000000 to FFFFFFFF RW W --- --- ---
hexadecimal
(0.0.0.0 to 255.255.255.255)
Remote UDP/TCP 1 0000 to FFFF hexadecimal RW W --- --- ---
port No. (0 to 65,535)
Number of bytes to 1 0000 to 04D0 hexadecimal --- --- RW RW ---
send/ receive (0 to 1,024 bytes)
Send/Receive data 2 Memory area address --- --- W W ---
address
Time out time (Unit: 1 0000 to FFFF hexadecimal W --- W --- ---
100 ms) (0 to 65,535)
(0: No limit, 0.1 to 6,553.5 s)
Response code 1 --- R R R R R

Note W: Written by user


RW: Written by user at execution and then read for results at completion
R: Read by user for results at completion
n---: Not used.

Parameters

z Socket Option
For the TCP OPEN REQUEST (ACTIVE or PASSIVE) command, specifies whether or not the keep-
alive function is to be used. When the keep-alive function is used, bit 8 is ON.

z UDP/TCP Socket No.


Specify the number of the UDP or TCP socket to open.

z Local UDP/TCP Port No.


Specify the number of the UDP or TCP port for the socket to use for communications.
• Do not specify the port being used as the FINS UDP port (default: 9600) in an open request for a
UDP socket.
• Do not specify the port being used as the FINS TCP port (default: 9600) in an open request for a
TCP (active or passive) socket.
• Do not specify auto connection UDP port number 9600 in an open request for a UDP socket.
• Do not specify auto connection TCP port number 9600 in an open request for a TCP (active or
passive) socket.
• As a rule, use port numbers 1,024 and higher.
If port number 0 is specified when for an active TCP open, the TCP port number will be automati-
cally allocated and the number of the port that was opened will be stored in the local UDP/TCP port
number in the Socket Service Parameter Area (i.e., the actual port number will be overwritten on the
value of 0 set by the user).

15-44 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

z Remote IP Address
Specify the IP address of the remote device.
• Offset +2 in the Socket Service Parameter Area contains the upper bytes of the Remote IP
Address, and offset +3 contains the lower bytes.
Example: The contents of offsets +2 and +3 would be as shown below when the Remote IP
Address is 196.36.32.55 (C4.24.20.37 hexadecimal).
+2: C424
+3: 2037
• This parameter is not used when making a receive request for a UDP socket. The remote IP
address will be stored with the response data and will be written as the Remote IP Address in the
Socket Service Parameter Area.
• When opening a passive TCP socket, the combination of the remote IP address and the remote
TCP port number can be used to affect processing as shown in the following table.
Remote IP Remote TCP Processing

15-5 Socket Services


Address Port No.
0 0 All connection requests accepted.
0 Not 0 Connection requests accepted only for the
same port number.
Not 0 0 Connection requests accepted only for the
same IP address.
Not 0 Not 0 Connection requests accepted only for the
same port number and IP address.
15
If the Remote IP Address is set to 0, a connection can be made to any remote node and the remote
IP address of the node that is connected will be stored as the Remote IP Address in the Socket Ser-

15-5-6 Data Memory Area Allocations


vice Parameter Area. If a specific remote IP address is set, then a connection can be made only to
the node with the specified address.
If the Remote TCP Port No. is set to 0, a connection can be made to any remote node regardless of
the TCP port number it is using. If a specific remote TCP port number is set, then a connection can
be made only to a node using the specified TCP port number.

z Remote UDP/TCP Port No.


Specify the UDP or TCP port number used by the remote device.
• This parameter is not used when making a receive request for a UDP socket. The remote
UDP/TCP port number will be stored with the response data and will be written as the Remote
UDP/TCP Port No. in the Socket Service Parameter Area.
• When opening a passive TCP socket, the combination of the remote IP address and the remote
TCP port number can be used to affect processing as shown in the table for the Remote IP
Address, above. If the Remote UDP/TCP Port No. is set to 0, the UDP/TCP port number of the
remote device will be written as the Remote UDP/TCP Port No. in the Socket Service Parameter
Area.

z Time Out Time


Set the time limit in units of 0.1 s for completion of communications from the time that the Receive
Request Switch (TCP or UDP) or the TCP Passive Open Request Switch is turned ON. A response
code of 0080 hexadecimal (timeout) will be stored if communications time out. If 0 is set, the
requested service will not be timed.

z Number of Bytes to Send/Receive


Send the number of bytes to be sent or the number of bytes to receive. When the transfer has been
completed, the actual number of bytes that have been sent or received will be written here.

CP2E CPU Unit Software User’s Manual(W614) 15-45


15 Ethernet

z Send/Receive Data Address


Specify the address of the first word to send or the address of the first word where data is to be
received. Always set the bit number to 00 hexadecimal.

Offset 15 8 7 0
+6 Area Leftmost 2 digits
designation of word address
Rightmost 2 digits Bit number
+7
of word address (always 00 Hex)

The following specifications can be used.


Area Word address Area Word address
designation (hexadecimal)
(hexadecimal)
CIO, HR, CIO 0000 to 0289 B0 0000 to 0121
and AR
HR H000 to H127 B2 0000 to 007F
Areas
AR A448 to A959 B3 01C0 to 03BF
DM Area DM D00000 to D16383 82 0000 to 3FFF

z Response Codes
When processing of a request has been completed for socket services executed using Socket Ser-
vice Request Switches, a response code will be stored in the Response Code word in the Socket
Service Parameter Area. The following response codes will be stored depending on the service that
was requested.

UDP Socket Open Request


Response Meaning
code
0000 Normal end
0105 Local IP address setting error.
1100 UDP socket number is not 1 to 8 or local UDP port number is 0.
110C Request Switch turned ON during other processing.
220F Specified socket is already open.
2211 Unit is busy; cannot execute.
2606 Specified socket is already open as TCP socket; cannot open UDPsocket.
2607 Specified Socket Service Parameter Area is already being used foranother socket.
0049 The same UDP port number has been specified more than once (EADDRINUSE).
0081 The specified socket was closed during open processing.

15-46 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

UDP Socket Receive Request


Response code Meaning
0000 Normal end
0302 CPU Unit error; cannot execute.
1100 Number of bytes to receive is not in allowable range.
1101 The area designation of the Send/Receive Data Address is not inallowable range.
1103 The bit number in the Send/Receive Data Address is not 00.
110C Request Switch turned ON during other processing.
220F Specified socket is already processing a receive request.
2210 The specified socket is not open.
2211 Unit is busy; cannot execute service.
2607 Specified Socket Service Parameter Area is already being used foranother socket.

15-5 Socket Services


0080 Receive request timed out.
0081 The specified socket was closed during reception processing.

UDP Socket Send Request


Response Meaning
code
0000 Normal end
0302 CPU Unit error; cannot execute.
15
1100 Number of bytes to send is not in allowable range or the remote IPaddress is 0.
1101 The area designation of the Send/Receive Data Address is not inallowable range.

15-5-6 Data Memory Area Allocations


1103 The bit number in the Send/Receive Data Address is not 00.
110C Request Switch turned ON during other processing.
220F Specified socket is already processing a send request.
2210 The specified socket is not open.
2211 Unit is busy; cannot execute.
2607 Specified Socket Service Parameter Area is already being used foranother socket.
003E Internal buffer cannot be obtained due to high reception traffic (ENOBUFS).
004C The network ID is incorrect or the remote IP address is incorrect(EADDRNOTAVAIL)
004E The network ID is not in the IP router table, router settings are incorrect, or the remote IP
address is incorrect (ENETUNREACH).
0081 The specified socket was closed during send processing.

UDP Socket Close Request


Response Meaning
code
0000 Normal end
0302 CPU Unit error; cannot execute.
2210 The specified socket is not open.
2607 Specified Socket Service Parameter Area is already being used foranother socket.

CP2E CPU Unit Software User’s Manual(W614) 15-47


15 Ethernet

TCP Socket Passive Open Request


Response Meaning
code
0000 Normal end
0105 Local IP address setting error.
1100 TCP socket number is not 1 to 8 or local TCP port number is 0.
110C Request Switch turned ON during other processing.
220F Specified socket is already open or already processing an openrequest.
2211 Unit is busy; cannot execute.
2606 Specified socket is already open as UDP socket; cannot open TCP socket.
2607 Specified Socket Service Parameter Area is already being used foranother socket.
0045 Error in communications with remote node (ECONNABORTED).
0049 The same TCP port number has been specified more than once(EADDRINUSE).
004B (See note.) Error in communications with remote node (ECONNRESET).
0053 Error in communications with remote node (ETIMEDOUT) or remotenode does not exist.
0080 Open request timed out.
0081 The specified socket was closed during open processing.

Note These response codes will be returned only on large, multilevel networks.

TCP Socket Active Open Request


Response Meaning
code
0000 Normal end
0105 Local IP address setting error.
1100 TCP socket number is not 1 to 8 or local TCP port number is 0.
110C Request Switch turned ON during other processing.
220F Specified socket is already open or already processing an openrequest.
2211 Unit is busy; cannot execute.
2606 Specified socket is already open as UDP socket; cannot open TCP socket.
2607 Specified Socket Service Parameter Area is already being used foranother socket.
000D Remote IP address parameter error (EACCES).
0045 Error in communications with remote node (ECONNABORTED).
0049 The same port number has been specified more than once (EAD-DRINUSE).
004B (See note.) Error in communications with remote node (ECONNRESET).
004C Remote IP address parameter error (EADDRNOTAVAIL).Wrong parameter designation.An
attempt was made to set the local TCP port of the local node toActive Open.
0053 Communications error with remote node (ETIMEDOUT).No remote node.
0081 The specified socket was closed during open processing.

Note These response codes will be returned only on large, multilevel networks.

15-48 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

TCP Socket Receive Request


Response Meaning
code
0000 Normal end
0302 CPU Unit error; cannot execute.
1100 Number of receive bytes not in allowable range.
1101 The area designation of the Send/Receive Data Address is not inallowable range.
1103 The bit number in the Send/Receive Data Address is not 00.
110C Request Switch turned ON during other processing.
220F Specified socket is already processing a receive request.
2210 Specified socket has not been connected.
2211 Unit is busy; cannot execute.
2607 Specified Socket Service Parameter Area is already being used foranother socket.

15-5 Socket Services


0045 (See note.) Error in communications with remote node (ECONNABORTED).
0053 Error in communications with remote host (ETIMEDOUT).
0080 Receive request timed out.
0081 The specified socket was closed during receive processing.

Note These response codes will be returned only on large, multilevel networks.

TCP Socket Send Request 15


Response Meaning
code

15-5-6 Data Memory Area Allocations


0000 Normal end
0302 CPU Unit error; cannot execute.
1100 Number of bytes to send not in allowable range.
1101 The area designation of the Send/Receive Data Address is not inallowable range.
1103 The bit number in the Send/Receive Data Address is not 00.
110C Request Switch turned ON during other processing.
220F Specified socket is already processing a send request.
2210 The specified socket is not been connected.
2211 Unit is busy; cannot execute.
2607 Specified Socket Service Parameter Area is already being used foranother socket.
003E Internal buffer cannot be obtained due to high reception traffic(ENOBUFS).
0045 (See note.) Error in communications with remote node (ECONNABORTED).
004E (See note.) Remote IP address parameter error (ENETUNREACH).
0081 The specified socket was closed during send processing.

CP2E CPU Unit Software User’s Manual(W614) 15-49


15 Ethernet

TCP Socket Close Request


Responsecode Meaning
0000 Normal end
0302 CPU Unit error; cannot execute.
2210 The specified socket is not been connected.
2607 Specified Socket Service Parameter Area is already being used foranother socket.

Note These response codes will be returned only on large, multilevel networks.
For details, refer to SECTION 6 Socket Services in the Ethernet Units Construction of Applications
Operation Manual (Cat. No. W421).

15-5-7 Socket/TCP Programming Example

TCP/IP Communications Programming Example


The following programming example illustrates transferring 100 bytes of databetween an Ethernet Unit
and a host computer using TCP/IP communications.

z System Configuration
The programming example uses the following system configuration. For the TCP connection, the
Ethernet Unit uses a passive open and the host computer uses an active open.

Host computer Ethernet Unit


PLC

IP address: 192.168.250.5 IP address: 192.168.250.1


Port number: 4096 Port number: 4096

z Data Flow
The data will flow between the CPU Unit, Ethernet Unit, and host computer as shown in the following
diagram.

Line Ethernet CPU Unit


Host computer (Ethernet) Unit
Request Switches and ex-
Sent to line. ecution bits turned ON
(see note).

Execution bits turned OFF


Processing in
host computer

Note Here, “execution bits” refer to W0.00 to W0.03, which are used in the ladder diagram to con-
trol execution of communications.

15-50 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

z Basic Operations
• W0.00 is turned ON to request opening a TCP socket from the Ethernet Unit.
• W0.01 is turned ON to request closing the TCP socket from the Ethernet Unit.
• W0.02 is turned ON to request sending data from the Ethernet Unit. Data (100 bytes) is sent
beginning at D00000.
• W0.03 is turned ON to request receiving data from the Ethernet Unit. The data that is received
(100 bytes) is stored beginning at D01000.
• One of the bits between W1.00 and W1.03 will turn ON if an error occurs. Refer to 15-7-5 Socket
Service Request Switches for information on errors.

z Program Memory Map


The send and receive data and bits (flags) used by the program are shown in the following diagram.

DM Area

15-5 Socket Services


15 00
D00000

Send data, 100 bytes (100 = 0064 Hex)

15
D00049

15-5-7 Socket/TCP Programming Example


15 00
D01000

Receive data, 100 bytes (100 = 0064 Hex)

D01049

WR Area
15 03 02 01 00

TCP
W0 Receive TCP TCP TCP
Bit Send Bit Close Bit Open Bit

TCP TCP TCP


W1 Receive TCP Send Close Open
Error Flag
Error Flag Error Flag Error Flag

TCP TCP TCP TCP


Receiving Sending Closing Opening
W2
Flag Flag Flag Flag

CP2E CPU Unit Software User’s Manual(W614) 15-51


15 Ethernet

Programming Example

W0.00
TCP Passive Open
@RSET When the TCP Open Bit (W0.00) turns ON, the TCP
W1.00 Open Error Flag (W1.00) is turned OFF and the TCP
@SET Opening Flag (W2.00) is turned ON to initialize
W2.00 processing.
W0.00 W2.00
MOV(021)
#1 When the TCP Opening Flag (W2.00) turns ON, the
D16008
following parameters are written to the parameter
MOV(021) area for socket number 1.
#1000 D16008: 0001 Hex = UDP/TCP socket No. 1
D16009 D16009: 1000 Hex = Local UDP/TCP port No. 4096
D16010 and D16011:
MOV(021)
#C0A8
C0A8 FA05 Hex =
D16010 Remote IP address 192.168.250.5
D16012: 0000 Hex = Any remote UDP/TCP port No.
MOV(021) D16016: 0000 Hex = No timeout time
#FA05
D16011

MOV(021)
#0
D16012

MOV(021)
#0
W0.00 W2.00 D16016
After the parameters have been set, the TCP Passive
SET
A571.01 Open Request Switch (A571.01) is turned ON and the
TCP Opening Flag (W2.00) is turned OFF.
RSET
W2.00
If the TCP Passive Open Request Switch (A571.01)
turns OFF while the TCP Opening Flag (W2.00) is OFF,
W0.00 W2.00 A571.01 the contents of the response code (D16017) in the
<>(305) SET Socket Service Parameter Area is checked, and if it is
D16017 W1.00 not 0000 Hex (normal end), the TCP Open Error Flag
#0 (W1.00) is turned ON.
W0.00 W2.00 A571.01 After the execution results have been checked, the
RSET TCP Open Bit (W0.00) is turned OFF.
W0.00
W0.01
TCP Close
@RSET When the TCP Close Bit (W0.01) turns ON, the TCP
W1.01 Close Error Flag (W1.01) is turned OFF and the TCP
@SET Closing Flag (W2.01) is turned ON to initialize
W0.01 W2.01
W2.01 processing.
MOV(021)
#1
W2.01 D16008
W0.01 When the TCP Closing Flag (W2.01) turns ON, the
SET following parameter is written to the parameter area for
A571.05 socket number 1.
D16008: 0001 Hex = UDP/TCP socket No. 1
RSET
W2.01
After the parameter has been set, the Close Request
W0.01 W2.01 A571.05
Switch (A571.05) is turned ON and the TCP Closing
<>(305) SET Flag (W2.01) is turned OFF.
D16017 W1.01
#0 If the Close Request Switch (A571.05) turns OFF
while the TCP Opening Flag (W2.01) is OFF, the
W0.01 W2.01 A571.05
contents of the response code (D16017) in the
RSET Socket Service Parameter Area is checked, and if it
W0.01 is not 0000 Hex (normal end), the TCP Close Error
Flag (W1.01) is turned ON.

Continued on next page. After the execution results have been checked, the
TCP Close Bit (W0.01) is turned OFF.

15-52 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

Continued from previous page.


W0.02 TCP Send
@RSET When the TCP Send Bit (W0.02) turns ON, the TCP Send Error
W1.02 Flag (W1.02) is turned OFF and the TCP Sending Flag (W2.02) is
@SET turned ON to initialize processing.
W2.02
W0.02 W2.02
MOV(021) When the TCP Sending Flag (W2.02) turns ON, the following
#1 parameters are written to the parameter area for socket number 1
D16008 D16008: 0001 Hex = UDP/TCP socket No. 1
MOV(021) D16013: 0064 Hex = No. of send/receive bytes is 100
#64 D16014 and D16015:
D16013 8200 0000 Hex =
MOV(021) Send/receive data address D00000
#8200
D16014

MOV(021)
#0
W0.02 W2.02 D16015

SET
After the parameters have been set, the Send Request Switch
A571.03 (A571.03) is turned ON and the TCP Sending Flag (W2.02) is

15-5 Socket Services


turned OFF.
RSET
W2.02

W0.02 W2.02 A571.03


<>(305) @SET If the Send Request Switch (A571.03) turns OFF while the TCP
D16017 W1.02 Sending Flag (W2.02) is OFF, the contents of the response code
#0 (D16017) in the Socket Service Pa-rameter Area is checked, and
W0.02 W2.02 A571.03 if it is not 0000 Hex (normal end), the TCP Send Error Flag
(W1.02) is turned ON.
RSET
W0.02 After the execution results have been checked, the TCP
W0.03
Send Bit (W0.02) is turned OFF.
@RSET
A567.13 W1.03

=(300) @SET 15
D16000 W2.03
&100
W0.03 W2.03 TCP Receive
MOV(021) When the TCP Receive Bit (W0.03) turns ON, the TCP Receive

15-5-7 Socket/TCP Programming Example


#1 Error Flag (W1.03) is turned OFF and the TCP Data
D16008
Received/Requested Flag (A567.13), and the Number of Bytes
MOV(021) Received at TCP Socket (D16000) are checked. If the data is stored
#64 in the buffer, the TCP Receiving Flag (W2.03) turns ON.When the
D16013
TCP Receiving Flag (W2.03) turns ON, the following parameters
MOV(021) are written to the parameter area for socket number 1.
#8200 D16008: 0001 Hex = UDP/TCP socket No. 1
D16014 D16013: 0064 Hex = No. of send/receive bytes is 100
MOV(021) D16014 and D16015:
#0 8203 E800 Hex =
D16015 Send/receive data address D01000
MOV(021) D16016: 0000 Hex = No timeout time.
#0
W0.03 W2.03 D16016

SET
A571.04

RSET
W2.03

W0.03 W2.03 A571.04


After the parameter has been set, the Receive Request Switch
<>(305) SET (A571.04) is turned ON and the TCP Receiving Flag (W2.03) is
D16017 W1.03 turned OFF.
#0

W0.03 W2.03 A571.04 If the Receive Request Switch (A571.04) turns OFF while the TCP
Receiving Flag (W2.03) is OFF, the contents of the response code
RSET
W0.03 (D16017) in the Socket Service Parameter Area is checked, and if it
is not 0000 Hex (normal end), the TCP Receive Error Flag (W1.03)
is turned ON.

After the execution results have been checked, the TCP Receive Bit
(W0.03) is turned OFF.

Note When using the above programming example, change the bit and word addresses as necessary to avoid
using the same areas used by other parts of the user program or the CPU Bus Unit.

CP2E CPU Unit Software User’s Manual(W614) 15-53


15 Ethernet

15-6 Automatic Clock Adjustment and


Specifying Servers by Host Name

15-6-1 Automatic Clock Adjustment Function

The built-in clock of the PLC connected to the Ethernet can be automatically adjusted, with the SNTP
server clock taken as the standard. Automatic adjustments through the entire system enable the vari-
ous records generated by production equipment to be managed according to clock information and
analyzed.
The PLC can acquire clock information from the SNTP server at a particular time or when a dedicated
bit turns ON, and it can refresh the internal clock information automatically.
SNTP server

Ethernet
Clock information

CP2E N……-type
CPU Unit

Note 1 An SNTP server is required to use this function.


2 SNTP server settings require specialized knowledge, so they should always be handled by the network
administrator.
3 When using the Internet, depending on the condition of the network it may not be possible to acquire the
clock information.

15-6-2 Specifying Servers by Host Name


SNTP servers can be specified by host name rather than by IP address by using of the DNS client func-
tion.
This enables automatic searches for IP addresses for purposes such as system checking, even when
the IP addresses for servers have been changed.
DNS server

IP address Ethernet
Host name

CP2E N……-type
CPU Unit

Note 1 A DNS server is required to specify servers by IP address.


2 The IP address is specified directly for the DNS server.

15-54 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-6 Automatic Clock Adjustment and Specifying Servers by Host Name


15-6-3 Procedure for Using the Automatic Clock Adjustment Function

1. Make the basic settings.


Refer to 15-3-3 Basic Settings.

2. With the CX-Programmer online, set the following items in the PLC Setup.
• SNTP server specification (required)
• Access to the SNTP server is enabled when writing clock information from
the SNTP server to the CPU Unit when the Automatic Clock Adjustment
Switch is turned from OFF to ON and at a set automatic adjustment time.
• Automatic clock adjustment setting

3. To perform automatic clock adjustment manually, turn the Automatic Clock


Adjustment Switch (A566.4) from OFF to ON.

4. Select Transfer to PLC from the Options Menu and click the Yes button.
The PLC Setup will be transferred to the CPU Unit. 15

15-6-3 Procedure for Using the Automatic Clock Adjustment Function


15-6-4 PLC Setup for DNS and Automatic clock Adjustment

DNS and Automatic Clock Adjustment

All these settings are in the Built-in Ethernet Tab. Click on the relative button can open the setup dialog.

Button name Settings


DNS Setting IP Address
Port No.
Retry Timer
Clock Auto Adjust- SNTP Server Setting
ment
Auto Adjustment
Designation Method
IP Address
Host Name
Port No.
Retry Timer
Time Lag Adjustment

CP2E CPU Unit Software User’s Manual(W614) 15-55


15 Ethernet

CX-Programmer Setup
z DNS Setting
Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab. Click the DNS
Setting button to display the DNS setup dialog.

Item Contents Default


IP Address Set the IP address for the DNS server. None
The DNS server is required when specifying the SNTP servers by
host name.
Port No. Set the port to be used for connecting to the DNS server. 0
This setting does not normally need to be changed. (Number 53 is used.)

Retry timer Set the time to elapse before retrying when a connection to the 0 (10 s)
DNS server fails.
This setting does not normally need to be changed.

z Clock Auto Adjustment


Move the cursor to the Settings and double click. Select the Built-in Ethernet Tab. Click the Clock
Auto Adjustment button to display the Clock Auto Adjustment setup dialog.

15-56 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-6 Automatic Clock Adjustment and Specifying Servers by Host Name


Item Contents Default
Obtain clock If this option is selected, the CPU Unit’s clock is set to the time at Not checked
data from SNTP the SNTP server’s clock.
server
Auto Adjust- Set the time at which the SNTP server is to be accessed to syn- 0:0:0
ment chronize the clocks.
When the time that is set here arrives, the SNTP server is
accessed and the CPU Unit clock is adjusted to match the SNTP
server clock.
The clock data from SNTP server is UTC (Universal Time Coordi-
nated), so it needs to be adjusted to the local time.
Designation Select whether the SNTP server used for automatic clock adjust- IP Address
Method ment is to be specified by IP address or by host domain name (i.e.,
by host name).
IP Address Set the IP address for the SNTP server that is to be used for auto- 0.0.0.0
matic clock adjustment.
This setting is enabled only when server specification by IP
address has been selected.
Host Name Set the host domain name (i.e., the host name) for the SNTP None
server that is to be used for automatic clock adjustment.
This setting is enabled only when server specification by host
name has been selected.
Port No. Set the port number for connecting to the SNTP server that is to 0
be used for automatic clock adjustment. (Number 123 is used.)
This setting does not normally need to be changed. 15
Retry Timer Retry within the setting time when a connection to the SNTP 0
server fails. An Ethernet server connection error will occur at the (10 s)

15-6-4 PLC Setup for DNS and Automatic clock Adjustment


end of the time.
Time Lag This sets in the CPU Unit’s clock data the time difference made up +0:0
Adjustment from the SNTP server’s clock data.
To use the clock data from the SNTP server just as it is, input 0.

CP2E CPU Unit Software User’s Manual(W614) 15-57


15 Ethernet

15-6-5 Auxiliary Area Allocations


The following table and descriptions cover the words and bits in the Auxiliary Area of PLC memory that
are related to the Automatic Clock Adjustment and Specifying Servers by Host Name function.

Service Status
Address Bit(s) Name Status Unit operation Access
A46 5 DNS Server Error ON ON when the following errors occur Read only
during DNS server operation:
• An illegal server IP address is set.
• A timeout occurs during communications
with the server.
OFF OFF when DNS server operation is
normal.
11 SNTP Server ON ON when the following errors occur during
Error SNTP server operation:
• An illegal server IP address is set.
• A timeout occurs during communications
with the server.
OFF OFF when SNTP server operation is normal.

Service Request
Address Bit(s) Name Status Unit operation Access
A566 4 Automatic Clock ON The automatic clock adjustment is executed Read/Write
Adjustment when this bit turns ON.
Switch
OFF Turned OFF by Unit after automatic clock
adjustment has been completed.

z Automatic Clock Adjustment Switch (Bit 4)


The automatic clock adjustment can be executed by turning this switch ON.
The SNTP server required for the automatic clock adjustment is set in the PLC Setup.
After the automatic clock adjustment has been completed, the Unit will automatically turn this switch
OFF. Until then, do not forcibly manipulate the switch.

15-58 CP2E CPU Unit Software User’s Manual(W614)


15 Ethernet

15-7 Status Allocations of Bulit-in


Ethernet Port
The following table and descriptions cover the words and bits in the Auxiliary Area of PLC memory that

15-7 Status Allocations of Bulit-in Ethernet Port


are related to the status of built-in Ethernet port.
Address Bit(s) Name Status Unit operation Access
A40 to A44 --- Ethernet Commu- --- When an error occurs in Ethernet communi- Read only
nication Error cation, the error information can be stored.
Information Refer to 6-1-11 Other Errors in the CP2E
CPU Unit Hardware User's Manual (Cat. No.
W613).
A45 14 Link Status (N20: ON Ethernet link is established. Read only
Ethernet port, OFF Ethernet link is terminated.
N30/40/60:
PORT1A)
15 Link Status ON Ethernet link is established.
(N30/40/60: OFF Ethernet link is terminated.
PORT1B)
A46 2 IP Address Set- ON ON if any of the following conditions apply to Read only
ting Error Flag the IP address.
• All bits in the host ID are 0 or 1.
• All bits in the network ID are 0 or 1. 15
• All bits in the subnet ID are 1.
• The IP address begins with 127 (0x7F)
OFF OFF when the IP address is normal.
3 IP Address Table ON ON if the IP address table information is
Error Flag incorrect.
OFF OFF when the IP address table is normal.
4 IP Router Table ON ON if the IP router table information is incor-
Error Flag rect.
OFF OFF when the IP address table is normal.
5 DNS Server Error ON ON when the following errors occur during
Flag DNS server operation:
• An illegal server IP address is set.
• A timeout occurs during communications
with the server.
OFF OFF when DNS server operation is normal.
6 Routing Table ON ON if the routing table information is incor-
Error Flag rect.
OFF OFF when the routing table is normal.
11 SNTP Server Error ON ON when the following errors occur during
SNTP server operation:
• An illegal server IP address or host name is
set.
• A timeout occurs during communications
with the server.
OFF OFF when SNTP server operation is normal.
14 Address Disagree- ON ON if the remote IP address is set to auto-
ment Flag matic generation but the local IP address host
number and FINS node address do not agree
OFF OFF under all other circumstances
15 Ethernet Commu- ON ON when Ethernet communication error
nication Error Flag occurs.
OFF OFF when Ethernet communication error has
been cleared by Ethernet communication
error clear flag.

CP2E CPU Unit Software User’s Manual(W614) 15-59


15 Ethernet

Address Bit(s) Name Status Unit operation Access


A47 0 FINS/TCP Con- ON Turned ON by the Unit when a connection is Read only
nection Flag 1 established.
OFF Turned OFF by the Unit when the connection
is terminated.
1 FINS/TCP Con- ON Turned ON by the Unit when a connection is
nection Flag 2 established.
OFF Turned OFF by the Unit when the connection
is terminated.
2 FINS/TCP Con- ON Turned ON by the Unit when a connection is
nection Flag 3 established.
OFF Turned OFF by the Unit when the connection
is terminated.
A500 11 Ethernet Commu- ON If this flag is set to ON, Ethernet communica- Read/write
nication Error tion error flag (A46.15) will be cleared (OFF).
Clear Flag OFF OFF after Ethernet communication error has
been cleared.

15-60 CP2E CPU Unit Software User’s Manual(W614)


Other Functions
This section describes PID temperature control, clock functions, DM backup functions,
security functions.

16-1 PID Temperature Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2


16-1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2
16-1-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3
16-1-3 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4
16-2 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7
16
16-3 DM Backup Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-9
16-3-1 Backing Up and Restoring DM Area Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-9
16-3-2 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-11
16-4 Security Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-13
16-4-1 Ladder Program Read Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-13
16-4-2 Protecting Program Execution Using the Lot Number . . . . . . . . . . . . . . . . . 16-15

CP2E CPU Unit Software User’s Manual(W614) 16-1


16 Other Functions

16-1 PID Temperature Control


PID temperature control can be used with any model of CP2E CPU Unit.

16-1-1 Overview
The CP2E CPU Unit supports PID instructions with the autotuning function. Ladder programs can be
written to perform PID temperature control.
• Temperature Input from Temperature Sensor Unit to words in the Input Area.
input:
• PID control: Execute using the PIDAT instruction in ladder program.
The PIDAT instruction is used in combination with the TPO instruction
(TIME-PROPORTIONAL OUTPUT) to perform time-proportional control.
• Control output: To connect an SSR, connect a 24-V power supply to the transistor output and
output voltage pulses.

Ladder program

PIDAT
S: Input word
S
C: First parameter word
C
D D: Output word

TPO
S S: Input word

C C: First parameter word

R R: Pulse output bit

Temperature Sensor Unit


Model with Thermocouple: CP1W-TS001/002/003
Model with Platinum Resistance Thermometer: CP1W-TS101/102

CP2E

PID

Time-proportional
transistor output
Temperature Sensor

SSR

Additional Information

The sampling cycle set for a PIDAT instruction is between 10 ms to 99.99 s in increments of
10 ms. The actual calculation cycle is determined by the relationship with cycle time. Refer to the
CP1E/CP2E CPU Unit Instructions Reference Manual (Cat. No. W483) for the PIDAT instruction.

16-2 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

16-1-2 Flow of Operation

1 Setting the Temperature


Sensor Unit
Set the temperature range with the rotary switch on
the front panel.

2 Wiring I/O
• Connect the temperature sensor to the Tempera-
ture Sensor Unit.
• Connect the SSR to the transistor output.

3 Setting PIDAT and TPO


instructions parameters
Set parameters with the MOV instruction or other
instructions.

4 Executing the PIDAT instruction


Execute the PIDAT instruction.

16-1 PID Temperature Control


5 Autotuning
Execute autotuning for the PID constants.

6 Starting PID control


Start PID control.

Inputting the Temperature Sensor’s PV to PIDAT Instructions 16


z Temperature Sensor Unit

16-1-2 Flow of Operation


• Setting the Temperature Range
Set the temperature range with the rotary switch on the front panel of the Temperature Sensor
Unit. If the rotary switch is set to 1 for a CP1W-TS001 Temperature Sensor Unit, the temperature
range is 0.0 to 500.0°C.
• Temperature Data Storage Format
Temperature data is automatically stored in words in the Input Area allocated to the Temperature
Sensor Unit as an Expansion Unit using four-digit hexadecimal.
Example: 100°C is stored as 0064 hex.
• When the range code is a decimal number to one decimal point, the value is multiplied by a
factor of 10 and converted to a hexadecimal number without a sign, then stored as binary
data.
Example: 500.0°C multiplied by 10 is 5000 decimal. This is converted to 1388 in hexadecimal
and stored.
• If the temperature is negative, it is stored as signed hexadecimal.
Example: -200°C is stored as FF38 hex.

z PIDAT Instruction
The PIDAT instruction treats the PV as unsigned hexadecimal data (0000 to FFFF hex). Signed data
cannot be used, so if the temperature range includes negative values, apply scaling with the APR
instruction.

CP2E CPU Unit Software User’s Manual(W614) 16-3


16 Other Functions

Autotuning Procedure

z Automatically Executing Autotuning When PIDAT Is Executed


To automatically autotune the PID constants, turn ON the AT Command Bit when the PIDAT instruc-
tion is executed.

1 Set the PID parameter in words C to C+10. Word C is specified by the second operand.
Example: Place the set value (SV) in C and place the input range in bits 08 to 11 of C+6. Turn
ON bit 15 of C+9 (AT Command Bit).

2 Turn ON the PIDAT instruction’s input condition.


The PIDAT instruction will execute autotuning. When it has finished, the AT Command Bit (bit 15
in C+9) will turn OFF. At the same time the proportional band (C+1), integral constant (C+2),
and derivative constant (C+3) calculated by autotuning will be stored and PID control will be
started.

z Executing Autotuning for Other Conditions When PIDAT Is Executed


Here, the AT Command Bit is left OFF when the PIDAT instruction is being executed. Later it is
turned ON by some other condition to start autotuning.

1 Set the PID parameter in words C to C+10. Word C is specified by the second operand.
Example: Place the set value (SV) in C, the proportional band in C+1, the integral constant in
C+2, the derivative constant in C+3, and the input range in bits 08 to 11 of C+6. Turn OFF bit 15
of C+9 (AT Command Bit).

2 Turn ON the PIDAT instruction’s input condition. PID control will be started with the specified
PID constants.

3 Turn ON bit 15 in C+9 (the AT Command Bit) while the input condition for the PID instruction is
ON. Autotuning will be performed. When it has finished, the AT Command Bit (bit 15 in C+9) will
turn OFF. The proportional band (C+1), integral constant (C+2), and derivative constant (C+3)
calculated by autotuning will be stored and PID control will be started with those PID constants.

16-1-3 Application Example

System Configuration

K thermocouple
Controlled device
Inputs connected to terminal Inputs connected to
blocks CIO 0 and CIO 1 terminal block CIO 2

CP2E CPU Unit with 30 I/O CP1W-TS001 Control


Points Temperature Sensor Unit device
(SSR) Heater
100.00 COM + -

Temperature Stored in CIO 2 in


input the Input Area
Transistor output terminals

• A K thermocouple is used for the temperature input. Use a CP1W-TS001 Temperature Sensor Unit
(thermocouple input).

16-4 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

• The Temperature Sensor Unit’s temperature input PV is stored in CIO 2.


• The control output is the transistor output used to control the heater through the SSR using time-pro-
portional control.
• The PIDAT sampling cycle is 1 second.
• Control cycle: 20 s
• When W0.00 turns ON, autotuning is immediately executed and PID control is started with the PID
constants calculated by autotuning.

Ladder Programming Example for an Input Range of -200 to 1300°C for a K


Thermocouple
The CP1W-TS001 Temperature Sensor Unit is used with an input type of K -200 to 1300°C (set the
rotary switch to 0). The decimal values -200 to 1300°C are converted to signed hexadecimal data (FF38
to 0514 hex) and stored in CIO 2 in the Input Area.

16-1 PID Temperature Control


However, the PIDAT instruction can only handle unsigned hexadecimal data as the PV. The value is
thus converted from the range FF38 to 0514 to the PIDAT instruction input range of 0000 to 1FFF hex
(0 to 8191) using the APR instruction.
Specify 16-bit signed data (bit 11: ON, bit 10: OFF)/Number
of coordinates in data table: 1 (bits 0 to 7: #00 hex)
C:D500 #0800
C+1:D501 -200 Minimum manipulated variable input: -200 decimal
W0.00 (#FF38 hex)
C+2:D502 #0000 Minimum value in PID input range: #0000 hex
APR
C+3:D503 +1300 Maximum manipulated variable input: 1300 decimal
C D500 (#0514 hex)
C+4:D504 #1FFF Maximum value in PID input range: #1FFF hex
S 2
PV
D D600 Scale PV to
within #0000 to
C:D100 &1966 Set value: 160˚C (set as calculated value: 1966) 16
#1FFF hex C+1:D101 &1 Proportional band: 0.1%
PIDAT C+2:D102 &1 Integral time: 0.1 s

16-1-3 Application Example


C+3:D103 &1 Derivative time: 0.1 s
S D600
C+4:D104 &100 Sampling period: 1 s
C D100
C+5:D105 #0002 Reverse operation (bit 00: OFF)/PID constants updated each
D D200 MV time a sample is taken while the input condition is ON (bit 01:
C+6:D106 #0595 ON)/2-PID parameter α = 0.65 (bits 04 to 15: #000 hex)
C+7:D107 #0000 Input/Output: 13 bits (bits 00 to 03, 08 to 11: #5 hex)/Integral
C+8:D108 and derivative constants: Time designation (bits 04 to 07: #9
TPO #0000
hex)/Manipulated variable limit control: No (bit 12: OFF)
C+9:D109 #8000
S D200 MV AT execution (bit 15: ON)/AT Calculation Gain = 1.00
C+10:D110 #0005 (bits 0 to 11: #000 hex)
C D300
C+11:D111
D 100.00 Pulse output Work Area Limit-cycle Hysteresis = 0.05% (approximately 0.8˚C)
~

C+40:D140
W1.00
When autotuning is completed, the content of D109 is automatically overwritten
by #0000 hex and the calculated PID constants are input to D101 to 103.
W1.00
Manipulated variable range: 13 bits (bits 0 to 3: #5 hex)/
RSET Input type: Manipulated variable (bits 4 to 7: #1 hex),
always read input (bits 8 to 11: #3 hex)/Output limit
100.00 disabled (bits 12 to 15: #0 hex)
C:D300 #0315
C+1:D301 &2000 Control cycle: 20.00 s
C+2:D302 &0 No upper output limit
C+3:D303 &0 No lower output limit
C+4:D304
~

Work Area
C+6:D306

CP2E CPU Unit Software User’s Manual(W614) 16-5


16 Other Functions

z Description
• When W0.00 turns ON, the work area in D111 to D140 is initialized (cleared) according to the
parameters set in D100 to D110. After the work area has been initialized, autotuning is started
and the PID constants are calculated from the results from changing the manipulated variable.
After autotuning has been completed, PID control is executed according to the calculated PID
constants set in D101 to D103. The manipulated variable is output to D200. The manipulated vari-
able in D200 is divided by the manipulated variable range using the TPO instruction. This value is
treated as the duty factor which is converted to a time-proportional output and output to
CIO100.00 as a pulse output.
• When W0.00 turns OFF, PID is stopped and CIO100.00 turns OFF.
• When W0.00 is ON, the Thermocouple’s PV (-200 to 1300) is scaled to the PIDAT instruction input
range (#0 to #1FFF hex). The set values must be input according to the scaled PV. For example, if
the PV is 160°C, it is set as [8191/(1300+200)] × (160+200) = 1966].

16-6 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

16-2 Clock
The clock can be used only with the CP2E N/S……-type CPU Unit.
The current data is stored in the following words in the Auxiliary Area.
Name Address Function
Clock data A351 to A354 The seconds, minutes, hour, day of month, month, year, and day of
week are stored each cycle.
A351.00 to A351.07 Seconds: 00 to 59 (BCD)
A351.08 to A351.15 Minutes: 00 to 59 (BCD)
A352.00 to A352.07 Hour: 00 to 23 (BCD)
A352.08 to A352.15 Day of the month: 01 to 31 (BCD)
A353.00 to A353.07 Month: 01 to 12 (BCD)
A353.08 to A353.15 Year: 00 to 99 (BCD)
A354.00 to A354.07 Day of the week:
00: Sunday, 01: Monday, 02: Tuesday, 03: Wednesday,
04: Thursday, 05: Friday, 06: Saturday

16-2 Clock
Additional Information

The clock cannot be used if a battery is not installed or the battery voltage is low.
When the clock stops, the clock data will be reset to 2001-01-01 01:01:01 Sunday.
16
z Related Auxiliary Area Bits and Words
Name Address Contents
Start-up Time A510 and A511 The time at which the power was turned ON
(day of month, hour, minutes, and seconds).
Power Interruption Time A512 and A513 The time at which the power was last interrupted
(day of month, hour, minutes, and seconds).
Power ON Clock Data 1 A720 to A722 Consecutive times at which the power was turned
Power ON Clock Data 2 A723 to A725 ON (year, month, day of month, hour, minutes, and
seconds). The times are progressively older from
Power ON Clock Data 3 A726 to A728 number 1 to number 10.
Power ON Clock Data 4 A729 to A731
Power ON Clock Data 5 A732 to A734
Power ON Clock Data 6 A735 to A737
Power ON Clock Data 7 A738 to A740
Power ON Clock Data 8 A741 to A743
Power ON Clock Data 9 A744 to A746
Power ON Clock Data 10 A747 to A749
Operation Start Time A515 to A517 The time that operation started (year, month, day
of month, hour, minutes, and seconds).
Operation End Time A518 to A520 The time that operation stopped (year, month, day
of month, hour, minutes, and seconds).

CP2E CPU Unit Software User’s Manual(W614) 16-7


16 Other Functions

z Time-related Instructions
Name Mnemonic Function
CALENDAR ADD CADD Adds time to the calendar data in the specified words.
CALENDAR SUBTRACT CSUB Subtracts time from the calendar data in the specified words.
CLOCK ADJUSTMENT DATE Changes the internal clock setting to the setting in the speci-
fied source words.

Precautions for Correct Use


The clock may stop if a battery is not installed or the battery voltage is low. If the clock stops, it
cannot be set during 3 seconds after the power is ON. Please set the clock 3 seconds after the
power is ON.
If set the clock during 3 seconds after the power is ON, the following error response will occur.
• DATE instruction: The clock cannot be set. Error flag (P_ER) is ON.
• When the clock is set with a FINS command (command code 0702), the response end code
will be 2108 (Cannot be set during clock initialization).

16-8 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

16-3 DM Backup Function


This section describes the function that saves specified words from the DM Area in the built-in Flash
Memory.

16-3-1 Backing Up and Restoring DM Area Data

Overview
The contents of the DM Area (D) can be saved when the user needs it. The contents of the specified
words in the DM Area data can be backed up from I/O memory to the built-in Flash Memory during
operation by turning ON a bit in the Auxiliary Area. The number of DM Area words to back up is speci-
fied in the Number of CH of DM for backup Box in the PLC Setup. If the Restore D0- from backup mem-
ory Check Box is selected in the PLC Setup, the backup data will automatically be restored to I/O
memory when the power is turned back ON so that data is not lost even if power is interrupted.

16-3 DM Backup Function


CP2E CPU Unit
A751.15 (DM Backup Save Start Bit) turned ON.

I/O Memory Built-in Flash


Memory
Data
DM Area (D) DM backup data
backed up.

D0
16
~

Specified number
of words Data
D (n-1)
restored.

16-3-1 Backing Up and Restoring DM Area Data


Specify the number of words
starting from D0 in the DM backup data is restored to the I/O memory when power supply is
Number of CH of DM for turned ON again if the Restore D0- from backup memory Check Box is
backup Box in the Startup selected in the Startup Data Read Area in the PLC Setup.
Data Read Area in PLC
Setup.

z Conditions for Executing Backup


Specified words starting from D0 in the I/O memory can be saved to the built-in Flash Memory by
turning ON A751.15. (These words are called the DM backup words and the data is called the DM
backup data.) A751.15 (DM Backup Save Start Bit) can be used in any operating mode (RUN, MON-
ITOR, or PROGRAM mode).

z Words that can be Backed Up


• E……-type CPU Units: D0 to D1499
• S……-type CPU Units: D0 to D6999
• N……-type CPU Units: D0 to D14999

CP2E CPU Unit Software User’s Manual(W614) 16-9


16 Other Functions

z Number of Words to Back Up


The number of words to back up starting from D0 is set in the Number of CH of DM for backup Box
in the Startup Data Read Area in the PLC Setup.

z Restoring DM Backup Data to the I/O Memory When Power is Turned ON


The DM backup data can be restored to the I/O memory when power is turned ON by selecting the
Restore D0- from backup memory Check Box in the Startup Data Read Area in the PLC Setup.
The DM backup data will be read from the backup memory even if the Clear retained memory area
(HR/DM/CNT) Check Box is selected in the PLC Setup.

z Related Auxiliary Area Bits


Name Address Description
DM Backup Save A751.15 The number of words in the DM Area specified in the Number of CH of
Start Bit DM for backup Box in the Startup Data Read Area in the PLC Setup
are saved from the I/O memory to the built-in Flash Memory when this
bit is turned ON.
This bit will not automatically turn OFF again if the bit turns ON. Design
the ladder program so that this bit is turned ON and OFF again using
upwardly differentiated bits.
If this bit is turned ON and OFF while the DM Backup Save Flag
(A751.14) is ON, it will be ignored and the data will not be backed up
again. To backup the data again, make sure that A751.14 is OFF and
then turn ON A751.15. A751.15 is turned OFF when the power supply
is turned ON.
DM Backup Save A751.14 This flag turns ON when A751.15 is turned ON to start the saving
Flag operation. This flag stays ON while data is being saved and turns OFF
when finished.
Use this flag to confirm when the DM backup operation has been com-
pleted.
The flag is turned OFF when the power supply is turned ON.
DM Backup A751.11 This flag turns ON if the DM backup data could not be restored cor-
Restore Failed rectly. If this flag turns ON, data will not be read from the built-in Flash
Flag Memory to the I/O memory.
For example, if power was interrupted while data was being backed up,
the DM Area data would not be backed up properly and the next time
power is turned ON, the DM backup data will not be restored. If this
happens, this flag will be turned ON.
If the number of the backed up DM area words is different from the
Number of CH of DM for backup in the PLC Setup, this flag will be
turned ON.
This flag turns OFF in the following cases:
• Data is successfully restored from the built-in Flash Memory to the
I/O memory when the power supply is turned ON.
• All memory is cleared.

16-10 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

16-3-2 Procedure
Perform the following procedure to save the DM data to the built-in Flash Memory during operation or
while stopped.

1 Check the Restore D0- from backup memory Check Box in the Startup Data Read Area of the
PLC Setup from the CX-Programmer.
Also, set the number of words to be backed up starting from D0 in the Number of CH of DM for
backup Box. Transfer the PLC Setup to the CPU Unit and turn ON the power supply.

16-3 DM Backup Function


16

16-3-2 Procedure
2 Turn ON A751.15 (DM Backup Save Start Bit) from the CX-Programmer, a Programmable Ter-
minal (PT), or a ladder program.
The specified number of words in the DM Area starting from D0 will be backed up to the built-in
Flash Memory.
• Using a Ladder Program

Execution condition A751.15


Execution Bit is turned ON to start backup.

DM Backup Save
Start Bit

One cycle
DM Backup Save ON
Start Bit
(A715.15)
OFF

DM Backup Save ON
Flag
(A751.14)
OFF

Backup started Backup finished

When the saving operation has been completed, A751.14 (DM Backup Save Flag) will turn OFF.

CP2E CPU Unit Software User’s Manual(W614) 16-11


16 Other Functions

Precautions for Safe Use


Power Interruptions during Backup
The BKUP indicator on the front of the CPU Unit will be lit when DM Area data is being saved to
the built-in Flash Memory.
Do not turn OFF the power supply to the PLC while the indicator is lit. If the power supply to the
PLC is turned OFF while the BKUP indicator is lit, data will not be backed up. In this case, the
DM Backup Restore Failed Flag (A751.11) will turn ON when the power supply is turned ON
again. Therefore, the backup data will not be restored to the DM Area. Transfer the data from the
CX-Programmer to the DM Area again.

Precautions for Correct Use


• To prevent operation from starting if the DM backup data is not restored correctly when the
power supply is turned ON, insert the following instructions into the ladder program to gener-
ate a fatal error.

A751.11
Generates a user-defined
FALS
fatal error
10
DM Backup Restore Failed Flag
#0000

• To ensure concurrency between DM backup data and the contents of the DM Area in the I/O
memory, use exclusive processing in the ladder program so that contents of the DM Area
words in the I/O memory that are set to be backed up are not changed during a backup
operation.

DM Backup Save Flag


A751.14 Programming to change the DM Area words that are set to be backed up will
contents of DM Area words not be changed during a backup operation to
that are set to be backed up ensure concurrency between DM backup data
and words in the DM Area in the I/O memory.

• Data can be written up to 100,000 times to the built-in Flash Memory. Data cannot be written
once this limit is exceeded. If writing fails, A315.15 (Backup Memory Error Flag) will turn ON.

Additional Information

Confirming Completion of DM Area Backup


If user programs or the parameter area is being saved to the backup memory using operations
from the CX-Programmer, the backup operation will not be executed immediately even if
A751.15 (DM Backup Save Start Bit) is turned ON. A751.14 (DM Backup Save Flag) will remain
ON during this time and turn OFF when the DM backup operation has been completed. You can
confirm the completion of DM backup by checking to see if the DM Backup Save Flag (A751.14)
has been turned OFF.

16-12 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

16-4 Security Functions


The Security function can be used with any model of CP2E CPU Unit.

16-4-1 Ladder Program Read Protection

Read Protection
With the CX-Programmer, it is possible to set read protection using a password for the whole ladder
program.
When the program is read-protected using a password, it is not possible to display or edit any of the lad-
der programs using the CX-Programmer unless the password is entered in the Disable Password Dia-
log Box from the CX-Programmer.
This enables improved security for PLC data in equipment.

16-4 Security Functions


z Read Protection Using Extended Passwords
Extend protection with UM read protection to ensure better protection for your design assets. Also, if
the password is incorrect five times in a row, a password cannot be entered for two hours.

z Setting Protection

1 Right-click the PLC in the project tree to open the Protection Tab Page of the PLC Proper-
ties. 16

16-4-1 Ladder Program Read Protection

2 Set any password.

3 Select Protection-Setting from the PLC Menu.

4 Confirm that the setting item is checked, then click the OK button.

CP2E CPU Unit Software User’s Manual(W614) 16-13


16 Other Functions

• Extend Password Protection


It is possible to use longer passwords for UM read protection. Click the Protection Tab in the PLC
Properties Dialog Box, select the Extend protection password Check Box, and enter the pass-
words.

The limits to the password text string lengths are 16 characters.

z Protection Release Procedure

1 Go online and select Protection -


Release Password from the PLC
menu.
The Release Read Protection Dia-
log Box will be displayed.

2 Enter the registered password.


If the password is incorrect, the
message shown on the right will be
displayed, and protection will not be
released.
If incorrect passwords are entered
for five consecutive attempts, the
CPU Unit does not accept any more
passwords for two hours.

16-14 CP2E CPU Unit Software User’s Manual(W614)


16 Other Functions

z Auxiliary Area Bits Related to Password Protection


Status after Startup
Bit
Name Description mode hold
address
change settings
UM Read Protection A99.00 Indicates whether or not the whole ladder pro- Hold Hold
Status grams are read-protected.
OFF: UM read protection is not set.
ON: UM read protection is set.

16-4-2 Protecting Program Execution Using the Lot Number

z Overview
The lot number is stored in words A310 and A311 of the CP2E CPU Unit’s Auxiliary Area. These
words generate a fatal error to prevent a user program from running on a PLC with a different pro-
duction lot number. In addition, by setting passwords, you can prohibit loading of programs, and

16-4 Security Functions


thereby prohibit copying of user programs. The lot number cannot be changed by the user.
• The upper digits of the lot number are stored in A311 and the lower digits are stored in A310, as
shown below.
Lot number (5 digits)

d d m y y

16
y y m m d d

A311 A310

16-4-2 Protecting Program Execution Using the Lot Number


• X, Y, and Z in the lot number are converted to 10, 11, and 12, respectively, in A310 and A311.

z Programming Example
(1) The following instructions will create a fatal error to prevent the program from being
executed when the lot number is not 23905.

A200.11 (First Cycle Flag)


ANDL(610)
A310
#00FFFFFF
D0

<> L(306) FALS(007)


D0 1
#050923 D100

CP2E CPU Unit Software User’s Manual(W614) 16-15


16 Other Functions

(2) The following instructions will create a fatal error to prevent the program from being
executed when the lot number does not end in 05.

A200.11 (First Cycle Flag)


ANDL(610)
A310
#00FF0000
D0

<> L(306) FALS(007)


D0 1
#50000 D100

(3) The following instructions will create a fatal error to prevent the program from being
executed when the lot number does not begin with 23Y.

A200.11 (First Cycle Flag)


ANDL(610)
A310
#0000FFFF
D0
<> L(306) FALS(007)
D0 1
#1123 D100

16-16 CP2E CPU Unit Software User’s Manual(W614)


Analog Input/Output Option Board
This section describes an overview of the Analog Option Board, describes its installa-
tion and setting methods, memory allocations, startup operation, refresh time, trouble-
shooting and how to use the Analog Option Board.

17-1 General Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2


17-2 Part Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
17-3 Installation and Setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4
17-3-1 Installation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4
17-3-2 Setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5
17-3-3 Removing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5
17-4 Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
17-4-1 CIO Area Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
17-4-2 Auxiliary Area Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
17-5 Analog Input Option Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8 17
17-5-1 Main Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8
17-5-2 Analog Input Signal Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8
17-5-3 Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9
17-6 Analog Output Option Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
17-6-1 Main Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
17-6-2 Analog Output Signal Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-12
17-6-3 Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-13
17-7 Analog I/O Option Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16
17-7-1 Main Specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16
17-7-2 Analog I/O Signal Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-17
17-7-3 Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19
17-8 Startup Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-22
17-9 Analog Option Board Refresh Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-23
17-10Trouble Shooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-24
17-11The Use of Analog Option Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-25
17-11-1 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-25
17-11-2 Program Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-26

CP2E CPU Unit Software User’s Manual(W614) 17-1


17 Analog Input/Output Option Board

17-1 General Specifications


CP1 series Analog Option Boards are non-isolated analog units which allow you to easily realize analog
input/output function for CP2E N……-type CPU Unit.
Voltage Input Current Input Voltage Output
0V~10V 0mA~20mA 0V~10V
Analog Option Board
(Resolution: (Resolution: (Resolution:
1/4000) 1/2000) 1/4000)
Analog I/O Option Board CP1W-MAB221 2CH 2CH
Analog Input Option Board CP1W-ADB21 2CH ---
Analog Output Option Board CP1W-DAB21V --- 2CH

17-2 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-2 Part Names

Error LED (red)

Analog I/O terminal

Terminal Arrangement

z CP1W-ADB21
VI1 II1 VI2 II2 COM

z CP1W-DAB21V
VO1 VO2 COM

z CP1W-MAB221

17-2 Part Names


VI1 II1 VI2 II2 COM VO1 VO2 COM

Note Two COM are connected in inner circuit.

LED pattern
LED Color Description Status Remark 17
ERR Red Fault condition indicator Flash A communication error with CPU Unit has occurred
at the unit.
Lit Other errors except the communication error.
Not lit Operation is normal.

CP2E CPU Unit Software User’s Manual(W614) 17-3


17 Analog Input/Output Option Board

17-3 Installation and Setting

17-3-1 Installation

The following processing explains how to install and remove an Analog Option Board.

Precautions for Correct Use


Always turn OFF the power supply to the CPU Unit and wait until all the operation indicators go
out before installing or removing the Analog Option Board.
Not doing so may result in an unexpected operation.

1 Press the up/down lock-levers on both sides of the Option Board slot cover at the same time to
unlock the cover, and then pull the cover out.

2 Check the alignment to make the corner cut of the Analog Option Board fit in the Option Board
slot, and firmly press the Analog Option Board in until it snaps into place.

Only one Analog Option Board can be installed.


If two Analog Option Boards are mounted on a CP2E N30/40/60 CPU Unit, an option board error
(non-fatal error) will occur. Both Analog Option Boards do not work (There is no DA output data, and AD
conversion data cannot be read from CIO area), and ERR LED will be lit.
Option board slot 1 Option board slot 2 Status after installa-
CPU Unit
(left) (right) tion
CP2E N30/N40/N60 CPU Unit { × OK
× { OK
{ { NG

{ : Analog Option Board installed


× : Analog Option Board not installed

17-4 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-3-2 Setting
To use the analog option board on CP2E N……-type CPU Unit, it is necessary to set the serial commu-
nication settings in the PLC Settings.
Connect the CX-Programmer to the CPU Unit, and then change the PLC Settings as follows.

Serial Port Tab Page


Parameter Setting

17-3 Installation and Setting


Communications Settings Select the Custom option, set the baud rate to 115200 and the format to 7,2,E.
Mode Select Host Link (default) or Host Link.
Unit Number Select 0.

Precautions for Correct Use


When the Analog Option Board is applied on the CP2E CPU Unit, it is necessary to set the baud
rate to 115,200 and the mode to Host Link.
However, except the settings mentioned above, ERR LED will be lit if the communications is 17
impossible between the CPU Unit and the Analog Option Board. Check and change the settings.

17-3-3 Removing 17-3-2 Setting

Always turn OFF the power supply to the CPU unit and wait until all the operation indicators go out.
Press the up/down lock-levers on both sides of the Analog Option Board at the same time to unlock the
Option Board, and then pull it out.

CP2E CPU Unit Software User’s Manual(W614) 17-5


17 Analog Input/Output Option Board

17-4 Memory Allocation

17-4-1 CIO Area Allocation

The memory allocation about analog conversion in the CIO area of PLC is shown as the following diagram.
The range of the CIO area is CIO80 to CIO89.
The details of allocated CIO channels are described in the following table.
Contents
Channel
CP1W-ADB21 CP1W-DAB21V CP1W-MAB221
CIO80 Analog Input 1 --- Analog Input 1
CIO81 Analog Input 2 --- Analog Input 2
CIO82 to CIO84 --- --- ---
CIO85 --- Analog Output 1 Analog Output 1
CIO86 --- Analog Output 2 Analog Output 2
CIO87 to CIO89 --- --- ---

17-4-2 Auxiliary Area Allocation

Analog Option Unit Status Area


Option board status area: A435 (initial value “0000H”)
Option board
CPU Unit AR bits Content Error Process
slot
CP2E Option board slot A435.14 I/O option board 0: Initial state or unit abnor-
N30/N40/N60 1 (left) run state mal state
CPU Unit Option board slot A435.15 1: Work normally
2 (right)
CP2E N14/N20 Option board slot A435.14
CPU Unit

Note The flag sets ON if Analog Option Board has already worked normally. Then A/D input data can be read and
D/A output data can be written.
Output off bit: A500.15
AR Bits Content Error Process
A500.15 Output Off Bit 0: Output effective
1: Analog option board DA output clear

Note This bit will also affect other PLC output channels.
Option board error bit: A315.13
AR Bits Content Error Process
A315.13 Option board error • Turn ON when two Analog Option Boards
bit are installed on CP2E N30/40/60 CPU
Unit.
• Cleared when the corresponding anomaly
is cleared.

17-6 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

Option board error detail information: A424


Option board
CPU Unit AR bits Content Error Process
slot
CP2E Option board slot A424.00 Option board error 0: Cleared at the timing when
N30/N40/N60 1 (left) detail information the cause is released.
CPU Unit Option board slot A424.01 1: An option board error
2 (right) occurs.
CP2E N14/N20 Option board slot A424.00
CPU Unit

Note When Analog Option Boards are installed in both option board slots, A424.00 and A424.01 are all set ON.

17-4 Memory Allocation


17

17-4-2 Auxiliary Area Allocation

CP2E CPU Unit Software User’s Manual(W614) 17-7


17 Analog Input/Output Option Board

17-5 Analog Input Option Board


Each CP1W-ADB21 Analog Input Option Board provides two analog inputs.
• The analog input signal ranges are 0 to 10 V (with a resolution 1/4,000) and 0 to 20 mA (with a reso-
lution 1/2,000).

17-5-1 Main Specifications


Specifications
Item
Voltage Input Current Input
Input signal range 0 V to 10 V 0 mA to 20 mA
Max. rated input 0 V to 15 V 0 mA to 30 mA
External input impedance 200 kΩ min. Approx. 250 Ω
Resolution 1/4000 (full scale) 1/2000 (full scale)
Overall accuracy 25°C ±0.5% (full scale) ±0.6% (full scale)
0 to 60°C ±1.0% (full scale) ±1.2% (full scale)
-20 to 0°C ±1.3% (full scale) ±1.5% (full scale)
A/D conversion data 0000 to 0FA0 hex 0000 to 07D0 hex
Averaging function Not supported
Conversion time Inner sample time 2ms/point
Refresh time refers to 17-9 Analog Option Board Refresh Time
Isolation method None
Current consumption 5 VDC: 20 mA max.

17-5-2 Analog Input Signal Ranges


Analog input data is digitally converted according to the input signal range as shown below.
Note When the input exceeds the specified range, the A/D conversion data will be fixed at either the lower limit or
upper limit.

z 0 to 10 V
The 0 to 10 V range corresponds to the hexadecimal values 0000 to 0FA0 (0 to 4000). The entire
data range is 0000 to 0FFF (0 to 4095).

Converted Data
Hexadecimal (Decimal)

0FFF(4095)
0FA0(4000)

0000(0)
0V 10V 10.24V

17-8 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

z 0 to 20 mA
The 0 to 20 mA range corresponds to the hexadecimal values 0000 to 07D0 (0 to 2000). The possi-
ble data range is 0000 to 0FFF (0 to 4095). But it is strongly suggested that the input current must
not exceed 30 mA.

Converted Data
Hexadecimal (Decimal)

07D0(2000)

0000(0)
0mA 20mA

17-5 Analog Input Option Board


Analog Input Terminal Arrangement

VI1 Voltage Input 1


II1 Current Input 1
VI2 Voltage Input 2
II2 Current Input 2
COM Input Common

Note When using current inputs, voltage input terminals must be short-circuited with current input terminals.
17
17-5-3 Wiring

17-5-3 Wiring
Internal Circuits

180 kΩ
VI1
56 kΩ 250 Ω
II1
Analog input 1
Internal circuits

to to
180 kΩ
VI2
56 kΩ 250 Ω
II2
Analog input 2
COM (−)
Analog ground

CP2E CPU Unit Software User’s Manual(W614) 17-9


17 Analog Input/Output Option Board

Applicable Cables and Terminal Wiring

z Applicable Cables
Solid wire or ferrules can be used.
• Recommended solid wire
Wire type Wire size
Solid Wire 0.2mm to 0.5mm2 (AWG24 to AWG20)
2

• Recommended ferrules
Manufacturer Model Applicable wire
Phoenix Contact AI-0.25-12 0.2mm2 (AWG24)

Note Do not connect bare stranded wires directly to terminals.

z Terminal Wiring
When wiring the analog I/O terminal block, treat either solid or stranded wires directly.

2-conductor shielded
twisted-pair cable

Release button

• To make the connection, press the release button in with a small flat blade screwdriver and push
the line in while the lock is released. Remove the screwdriver and lock it inside.
• To disconnect the wiring, press the release button in with a small flat blade screwdriver and pull
the line out while the lock is released.
Note 1 Ferrules without plastic sleeve cannot be used.
2 When using stranded wire, twist the core so that the barbed wires cannot protrude.
3 Do not solder-plate the end of cable.
The screwdriver shown below is recommended for wiring.
Model Manufacturer
SZS 0.4×2.5 Phoenix Contact

Side Front

0.4mm 2.5mm

17-10 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

Wiring for Analog Inputs


To prevent noise, 2-core shielded twisted-pair cable should be used.
2-core shielded 2-core shielded
+ twisted-pair cable V IN +
twisted-pair cable
V IN
Analog Analog Analog Analog
device with I IN Input device with I IN Input
voltage Option current Option
output − COM Board − COM Board
output
FG FG

Note 1 When an input is not being used, short the V IN, I IN and COM terminals.
2 Separate wiring from power lines (AC power supply lines, high-voltage lines, etc.)
3 When there is noise in the power supply line, install a noise filter on the input section and the power supply.

Precautions for Correct Use


When connecting the analog option board to an outside analog device, either ground the 0 V
side of the PLC’s external power supply or do not ground the PLC’s external power supply at all.
Otherwise the PLC’s external power supply may be shorted depending on the connection meth-
ods of the outside analog device. DO NOT ground the 24 V side of the PLC’s external power
supply, as shown in the following diagram.

17-5 Analog Input Option Board


Non-insulated DC power supply
24 V
Twisted-pair
cable

0V 0V
0V

FG CPU Unit + Analog Option Board Analog Device FG

17

17-5-3 Wiring

CP2E CPU Unit Software User’s Manual(W614) 17-11


17 Analog Input/Output Option Board

17-6 Analog Output Option Board


Each CP1W-DAB21V Analog Output Option Board provides two analog outputs.
• The analog output signal range is 0 to 10 V (with a resolution 1/4,000).

17-6-1 Main Specifications


Specifications
Item
Voltage Output Current Output
Output signal range 0 V to 10 V ---
External output allowable load 2 kΩ min. ---
resistance
External output impedance 0.5 Ω max. ---
Resolution 1/4,000 (full scale) ---
Overall accuracy 25°C ±0.5% (full scale) ---
0 to 60°C ±1.0% (full scale) ---
-20 to 0°C ±1.3% (full scale) ---
D/A conversion data 0000 to 0FA0 hex ---
Conversion time Inner conversion time 2ms/point
Refresh time refers to 17-9 Analog Option Board Refresh Time
Isolation method None
Current consumption 5 VDC: 60 mA max.

17-6-2 Analog Output Signal Ranges


The analog values depend on the output signal range, as shown in the following diagram.
Note When the output exceeds the specified range, the output signal will be fixed at either the lower limit or upper
limit.

z 0 to 10 V
The hexadecimal values 0000 to 0FA0 (0 to 4000) correspond to an analog voltage range of 0 to 10
V. The entire output range is 10 to 10.24 V.

10.24V
10V

FFFF Converted Data


0000(0)
Hexadecimal
0V 0FA0 0FFF (Decimal)
(4000) (4095)

17-12 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

Analog Output Terminal Arrangement

VO1 Voltage Output 1


VO2 Voltage Output 2
COM Output Common

17-6-3 Wiring

Internal Circuits

VO1
Analog output 1
Internal circuits

17-6 Analog Output Option Board


to to
VO2

Analog output 2

COM(−)

Analog ground

17
Applicable Cables and Terminal Wiring

z Applicable Cables

17-6-3 Wiring
Solid wire or ferrules can be used.
• Recommended solid wire
Wire type Wire size
Solid Wire 0.2mm2 to 0.5mm2 (AWG24 to AWG20)

• Recommended ferrules
Manufacturer Model Applicable wire
Phoenix Contact AI-0.25-12 0.2mm2 (AWG24)

Note Do not connect bare stranded wires directly to terminals.

CP2E CPU Unit Software User’s Manual(W614) 17-13


17 Analog Input/Output Option Board

z Terminal Wiring
When wiring the analog I/O terminal block, treat either solid or stranded wires directly.

2-conductor shielded
twisted-pair cable

Release button

• To make the connection, press the release button in with a small flat blade screwdriver and push
the line in while the lock is released. Remove the screwdriver and lock it inside.
• To disconnect the wiring, press the release button in with a small flat blade screwdriver and pull
the line out while the lock is released.
Note 1 Ferrules without plastic sleeve cannot be used.
2 When using stranded wire, twist the core so that the barbed wires cannot protrude.
3 Do not solder-plate the end of cable.
The screwdriver shown below is recommended for wiring.
Model Manufacturer
SZS 0.4×2.5 Phoenix Contact

Side Front

0.4mm 2.5mm

Wiring for Analog Outputs


To prevent noise, 2-core shielded twisted-pair cable should be used.
2-core shielded
twisted-pair cable
V OUT +
Analog Analog
output device with
option voltage
board COM − input

FG

Note 1 Separate wiring from power lines (AC power supply lines, high-voltage lines, etc.)
2 When there is noise in the power supply line, install a noise filter on the input section and the power supply.
3 When external power is supplied, or when the power is interrupted, there may be a pulse status analog
output of up to 1 ms. If this status is a problem, take the following measures.
• Turn ON the power to the CP2E N……-type CPU Unit, check the operation status, and then turn ON the
power at the load.
• Turn OFF the power to the load and then turn OFF the power to the CP2E N……-type CPU Unit.

17-14 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

Precautions for Correct Use


When connecting the analog option board to an outside analog device, either ground the 0 V
side of the PLC’s external power supply or do not ground the PLC’s external power supply at all.
Otherwise the PLC’s external power supply may be shorted depending on the connection meth-
ods of the outside analog device. DO NOT ground the 24 V side of the PLC’s external power
supply, as shown in the following diagram.

Non-insulated DC power supply


24 V
Twisted-pair
cable

0V 0V
0V

FG CPU Unit + Analog Option Board Analog Device FG

17-6 Analog Output Option Board


17

17-6-3 Wiring

CP2E CPU Unit Software User’s Manual(W614) 17-15


17 Analog Input/Output Option Board

17-7 Analog I/O Option Board


Each CP1W-MAB221 Analog I/O Option Board provides two analog inputs and two analog outputs.
• The analog input signal ranges are 0 to 10 V (with a resolution 1/4,000) and 0 to 20 mA (with a reso-
lution 1/2,000).
• The analog output signal ranges are 0 to 10 V (with a resolution 1/4,000).

17-7-1 Main Specifications


Specifications
Item
Voltage I/O Current I/O
Analog Input Sec- Input signal range 0 V to 10 V 0 mA to 20 mA
tion Max. rated input 0 V to 15 V 0 mA to 30 mA
External input impedance 200 kΩ min. Approx. 250 Ω
Resolution 1/4,000 (full scale) 1/2,000 (full scale)
Overall accuracy 25°C ±0.5% (full scale) ±0.6% (full scale)
0 to 60°C ±1.0% (full scale) ±1.2% (full scale)
-20 to 0°C ±1.3% (full scale) ±1.5% (full scale)
A/D conversion data 0000 to 0FA0 hex 0000 to 07D0 hex
Averaging function Not supported
Analog Output Output signal range 0 V to 10 V ---
Section External output allowable load 2 kΩ min. ---
resistance
External output impedance 0.5 Ω max. ---
Resolution 1/4,000 (full scale) ---
Overall accuracy 25°C ±0.5% (full scale) ---
0 to 60°C ±1.0% (full scale) ---
-20 to 0°C ±1.3% (full scale) ---
D/A conversion data 0000 to 0FA0 hex ---
Conversion time Inner conversion time 6ms (4CH total)
Refresh time refers to 17-9 Analog Option Board Refresh
Time
Isolation method None
Current consumption 5 VDC: 80 mA max.

17-16 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-7-2 Analog I/O Signal Ranges


The analog values depend on the I/O signal ranges, as shown in the following diagrams.
Note When the input exceeds the specified range, the A/D conversion data will be fixed at either the lower limit or
upper limit.
When the output exceeds the specified range, the output signal will be fixed at either the lower limit or upper
limit.

Analog Input Signal Ranges

z 0 to 10 V
The 0 to 10 V range corresponds to the hexadecimal values 0000 to 0FA0 (0 to 4000). The entire
data range is 0000 to 0FFF (0 to 4095).
Converted Data
Hexadecimal (Decimal)

0FFF(4095)
0FA0(4000)

17-7 Analog I/O Option Board


0000(0)
0V 10V 10.24V

z 0 to 20 mA
17
The 0 to 20 mA range corresponds to the hexadecimal values 0000 to 07D0 (0 to 2000). The possi-
ble data range is 0000 to 0FFF (0 to 4095). But it is strongly suggested that the input current mustn’t
exceed 30 mA.

17-7-2 Analog I/O Signal Ranges


Converted Data
Hexadecimal (Decimal)

07D0(2000)

0000(0)
0mA 20mA

CP2E CPU Unit Software User’s Manual(W614) 17-17


17 Analog Input/Output Option Board

Analog Ouput Signal Ranges

z 0 to 10 V
The hexadecimal values 0000 to 0FA0 (0 to 4000) correspond to an analog voltage range of 0 to 10
V. The entire output range is 10 to 10.24 V.

10.24V
10V

FFFF Converted Data


0000(0)
Hexadecimal
0V 0FA0 0FFF (Decimal)
(4000) (4095)

Analog I/O Terminal Arrangement

VI1 Voltage Input 1


II1 Current Input 1
VI2 Voltage Input 2
II2 Current Input 2
COM Analog I/O Common
VO1 Voltage Output 1
VO2 Voltage Output 2
COM Analog I/O Common

Note When using current inputs, voltage input terminals must be short-circuited with current input terminals.

17-18 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-7-3 Wiring

Internal Circuits

Analog input Analog output

180 kΩ
VI1 VO1
56 kΩ 250 Ω Analog output 1
II1
Analog input 1

Internal circuits
Internal circuits

to to
to to
180 kΩ VO2
VI2
56 kΩ 250 Ω Analog output 2
II2
Analog input 2
COM(−)
COM(−)
Analog ground Analog ground

17-7 Analog I/O Option Board


Applicable Cables and Terminal Wiring

z Applicable Cables
Solid wire or ferrules can be used.
• Recommended solid wire
Wire type Wire size
Solid Wire 0.2mm2 to 0.5mm2 (AWG24 to AWG20) 17
• Recommended ferrules

17-7-3 Wiring
Manufacturer Model Applicable wire
Phoenix Contact AI-0.25-12 0.2mm2 (AWG24)

Note Do not connect bare stranded wires directly to terminals.

z Terminal Wiring
When wiring the analog I/O terminal block, treat either solid or stranded wires directly.

2-conductor shielded
twisted-pair cable

Release button

CP2E CPU Unit Software User’s Manual(W614) 17-19


17 Analog Input/Output Option Board

• To make the connection, press the release button in with a small flat blade screwdriver and push
the line in while the lock is released. Remove the screwdriver and lock it inside.
• To disconnect the wiring, press the release button in with a small flat blade screwdriver and pull
the line out while the lock is released.
Note 1 Ferrules without plastic sleeve cannot be used.
2 When using stranded wire, twist the core so that the barbed wires cannot protrude.
3 Do not solder-plate the end of cable.
The screwdriver shown below is recommended for wiring.
Model Manufacturer
SZS 0.4×2.5 Phoenix Contact

Side Front

0.4mm 2.5mm

Wiring for Analog I/O


To prevent noise, 2-core shielded twisted-pair cable should be used.

z Wiring for Analog Inputs


2-core shielded 2-core shielded
+ twisted-pair cable V IN +
twisted-pair cable
V IN
Analog Analog Analog Analog
device with I IN I/O device with I IN I/O
voltage Option current Option
output − COM Board − COM Board
output
FG FG

z Wiring for Analog Outputs

2-core shielded
twisted-pair cable
V OUT +
Analog Analog
I/O device with
Option voltage
Board COM − input

FG

Note 1 When an input is not being used, short the V IN, I IN and COM terminals.
2 Separate wiring from power lines (AC power supply lines, high-voltage lines, etc.)
3 When there is noise in the power supply line, install a noise filter on the input section and the power supply.
4 When external power is supplied, or when the power is interrupted, there may be a pulse status analog
output of up to 1 ms. If this status is a problem, take the following measures.
• Turn ON the power to the CP2E N……-type CPU Unit, check the operation status, and then turn ON the
power at the load.
• Turn OFF the power to the load and then turn OFF the power to the CP2E N……-type CPU Unit.

17-20 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

Precautions for Correct Use


When connecting the analog option board to an outside analog device, either ground the 0 V
side of the PLC’s external power supply or do not ground the PLC’s external power supply at all.
Otherwise the PLC’s external power supply may be shorted depending on the connection meth-
ods of the outside analog device. DO NOT ground the 24 V side of the PLC’s external power
supply, as shown in the following diagram.

Non-insulated DC power supply


24 V
Twisted-pair
cable

0V 0V
0V

FG CPU Unit + Analog Option Board Analog Device FG

17-7 Analog I/O Option Board


17

17-7-3 Wiring

CP2E CPU Unit Software User’s Manual(W614) 17-21


17 Analog Input/Output Option Board

17-8 Startup Operation


After the power is turned ON, analog option board starts the initialization process. If the initialization fin-
ishes normally, the initialization completed flag in related status area (Refer to 17-4-2 Auxiliary Area
Allocation: A435) will be set. Therefore, status monitor content must be added in ladder. Only when the
initialization process has finished, user can use the A/D conversion data or write the output data.
The analog input data will be 0000 until the initial processing is completed.
It takes about 3 seconds from the CP2E CPU Unit running to the Analog Option Board initialization
completed.

17-22 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-9 Analog Option Board Refresh Time


The inner conversion time of the Analog Option Board is 2ms/point. The refresh time of data conversion
in the CPU Unit is shown as follows.
The refresh time differs in accordance with the cycle time.
Below are typical values for reference only.
Cycle time (ms)
Analog Option Board
1ms 10ms 20ms
CP1W-ADB21 16~40 20~60 20~100
CP1W-DAB21V 9~37 26~58 46~86
CP1W-MAB221(AD) 14~62 18~109 20~160
CP1W-MAB221(DA) 9~53 26~102 46~150

17-9 Analog Option Board Refresh Time


17

CP2E CPU Unit Software User’s Manual(W614) 17-23


17 Analog Input/Output Option Board

17-10Trouble Shooting

Trouble-shooting with Indicators

ERR Probably Auxiliary Area


Error Correction AD/DA function
Indicator Cause Allocations
Lit CPU Unit ser- Service from Check and cor- A435.14, AD/DA conversion will stop.
vice monitoring the CPU Unit rect the CPU A435.15 will be The analog input conver-
error was not com- Unit’s operat- OFF sion data stops refreshing
pleted within ing environ- and the analog output con-
the fixed inter- ment. Check version output becomes 0V.
val. serial commu-
nication setting.
Option board An error Restart the
error occurred in the CPU Unit.
Analog Option Replace the
Board. Analog Option
Board if the
error recurs.
Two Analog Install one Ana- A353.13 will be
Option Boards log Option ON
are installed. Board only.
Flashing Communica- The communi- Check if PLC is A435.15 will be AD/DA conversion will stop.
tion error cation between running nor- OFF The analog input conver-
PLC is out of mally. sion data stops refreshing
service and the analog output con-
version output becomes 0V.
If the communication recov-
ers from error, the AD/DA
conversion will start again.

17-24 CP2E CPU Unit Software User’s Manual(W614)


17 Analog Input/Output Option Board

17-11The Use of Analog Option Board

17-11-1 Procedure

Mount the Analog Option Board into the option port.


Mount the Analog Option
Board

Connect to the analog input/output device.


Connection with the analog
input/output device

Set communication protocol in PLC Settings to Host Link, 115200bps, 7,2,E.


Connection with the analog
input/output device

Turn the power of the CPU Unit OFF and ON again.


Restart the CPU Unit

17-11 The Use of Analog Option Board


Wait until the Analog Option Board finishes initialization and works normally.
Make the ladder program

Read the analog input data/write the analog output data.


AD/DA convert

Note 1 If PLC communication protocol setting is error, the option board will always try to link the PLC, and the
error LED will be lit.
2 Only when the initialization process has finished (A435.15 sets on), user can use the A/D conversion
data or write the D/A output data.
17

17-11-1 Procedure

CP2E CPU Unit Software User’s Manual(W614) 17-25


17 Analog Input/Output Option Board

17-11-2 Program Example


Use the analog option board to carry out 2CH AD inputs and 1CH DA output at the same time.
The ranges of AD/DA are as follows:
Analog input1: 0~10V
Analog input2: 0~20mA
Analog output1: 0~10V

System composing: CP2E-N……D…-… + CP1W-MAB221


A435.15 sets on if the analog option board works normally.

Execution
condition A435.15
MOV(021)
80
D0 ← Reads analog input 1’s converted value to D0.
Execution
condition A435.15
MOV(021)
81
D1 ← Reads analog input 2’s converted value to D1.

Execution
condition A435.15
MOV(021)
D2
85 ← The content of D2 is written to the analog
output 1.

17-26 CP2E CPU Unit Software User’s Manual(W614)


Programming Device Operations
This section describes the use of the CX-Programmer to create a ladder programs to
operate the CP2E, transfer the program to the CP2E, and debug the program. It also
describes other basic functions of the CX-Programmer.

18-1 Programming Devices Usable with the CP2E. . . . . . . . . . . . . . . . . . . . . . . 18-2


18-2 Overview of CX-Programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3
18-2-1 CX-Programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-3
18-2-2 CX-Programmer Flow from Startup to Operation . . . . . . . . . . . . . . . . . . . . . . 18-3
18-2-3 Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-6
18-3 Creating a Ladder Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7
18-3-1 Inputting a Ladder Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-7
18-3-2 Saving and Reading Ladder Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-14
18-3-3 Editing Ladder Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-16
18-4 Connecting Online to the CP2E and Transferring the Program . . . . . . . 18-18
18-4-1 Connecting Online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-18
18-4-2 Changing Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-19
18-4-3 Transferring a Ladder Program and the PLC Setup . . . . . . . . . . . . . . . . . . . 18-20 18
18-4-4 Starting Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-21
18-5 Online Monitoring and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-23
18-5-1 Monitoring Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-23
18-5-2 Force-set/Reset Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-25
18-5-3 Online Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18-26

CP2E CPU Unit Software User’s Manual(W614) 18-1


18 Programming Device Operations

18-1 Programming Devices Usable with


the CP2E
Refer to Section 4 Programming Device in the CP2E CPU Unit Hardware User’s Manual (Cat. No.
W613) for the connection method with a CP2E CPU Unit.

Precautions for Correct Use


• When using the full version of CX-Programmer provided in CX-One, refer to the CX-Program-
mer Operation Manual (Cat. No. W446).
• A Programing Console cannot be used for the CP2E. Use the CX-Programmer.

18-2 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

18-2 Overview of CX-Programmer

18-2-1 CX-Programmer

The CX-Programmer is a programming application for creating the ladder programs that are executed in
a CP2E CPU Unit.
In addition to ladder program creation, the CX-Programmer also has functions that are needed to set up
and operate the CP2E, including functions for debugging ladder programs, displaying addresses and
present values, monitoring, setting the connected PLC, programming, and monitoring.
The CX-Programmer can be installed foom CX-One installer. Refer to CX-One FA Integrated Tool
Package Setup Manual (Cat. No. W463) for details.
For details on the operation of the CX-Programmer, refer to the CX-Programmer Online Help.

18-2-2 CX-Programmer Flow from Startup to Operation


The flow of using the CX-Programmer from startup through starting PLC operation is shown below.

1 Start CX-Programmer Select Start - Programs - OMRON - CX-One - CX-Programmer -


CX-Programmer.

2 Create new project Select CP2E or CP2E-N in the Change PLC Dialog Box.

18-2 Overview of CX-Programmer


3 Create program Example: Press the C Key to input a NC input condition.

4 Save program Select File - Save As.

5 Connect online to the CP2E Select PLC - Work Online.

18
6 Change operating mode Select PLC - Operating mode - Program.

18-2-1 CX-Programmer

Select PLC - Transfer - Transfer [PC  PLC].


7 Transfer program/PLC system
settings

8 Restart the CP2E Once turn OFF the power supply to the CP2E CPU Unit, then turn
ON again.

9 Start operation
CP2E CPU Unit operation will start.

CP2E CPU Unit Software User’s Manual(W614) 18-3


18 Programming Device Operations

Start CX-Programmer
Select Start - Programs - OMRON - CX-One - CX-Programmer.
The CX-Programmer will start.
The title display will appear, followed by the Main Window.

Names and Functions of Parts of the Main Window


This section describes the names and functions of each part of the Main Window of the CX-Programmer.
For details on the functions and operation of CX-Programmer, refer to the CX-Programmer Online Help.

z Main Window
(1)
(2)
(3)

(4)

(5)
(7)

(6)

(8)
(9)

(10)

18-4 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

(1)Title Bar
Displays the name of the project.
(2)Main Menu
Displays the menus from which commands are selected.
(3)Toolbar
Displays the icons for executing commands.
(4)Project Tree and (6) Project Workspace
Used to manage programs and settings.
(5)Sections
Allow ladder programming to be split up into a number of parts.
(7)Ladder Section Window
A window that is used to create and edit ladder programs.
(8)I/O Comment Bar
Displays the name, address, value, and I/O comment of the symbol selected with the cursor.
(9)Output Window
Displays messages, such as search results and errors.
(10)Status Bar
Displays information such as the PLC name, online/offline status, and position of the active cell.

z Ladder Section Window


(1)
(2)

18-2 Overview of CX-Programmer


(4)

(3)
(4)

(1)Rung Number
18
(2)Program Address
Operation
18-2-2 CX-Programmer Flow from Startup to

(3)Rung Header
If a rung is incomplete, a red line will be displayed on the right side of the rung header.
(4)Bus Bar

CP2E CPU Unit Software User’s Manual(W614) 18-5


18 Programming Device Operations

18-2-3 Help
The CX-Programmer Help describes all the operations of CX-Programmer. It provides an introduction
to the various windows and panes and describes basic operations, ladder program creation, and moni-
toring. It also describes each of the instructions, including operand notation and contents.

Accessing CX-Programmer Help


Press the F1 Key from the CX-Programmer.
The Help Window will be displayed.

Accessing the CX-Programmer Instruction Reference


For an explanation of an instruction used in ladder programming, refer to the CX-Programmer Instruc-
tion Reference.

z Displaying the Instruction Reference from the Main Menu of the


CX-Programmer
Select Instruction Reference - CP2E from the Help Menu.
The CX-Programmer Instruction Reference Window will be displayed.

z Displaying the Instruction Reference while Creating a Ladder Program


While creating an instruction in a ladder program in Smart Input Mode, press the F1 Key to display
the Instruction Reference page for the instruction being edited.

Accessing the CP2E I/O Memory Reference


To check the CP2E I/O memory address map from the CX-Programmer, select I/O Memory Reference
from the Help Menu.

18-6 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

18-3 Creating a Ladder Program


This section describes the use of CX-Programmer to create a ladder program.

18-3-1 Inputting a Ladder Program


This section shows how to input a ladder program for an example application using the CX-Programmer
commands.

Creating a New Project


To use the CX-Programmer, the first step is to create a new project. To create a new project, we must
specify the PLC type and CPU Unit model for which the ladder program and data to be created will be
used.

1 Select New from the File Menu.The


Change PLC Dialog Box will be dis-
played.

18-3 Creating a Ladder Program


2 The CP2E will already be selected
as the Device Type.

18
18-3-1 Inputting a Ladder Program

CP2E CPU Unit Software User’s Manual(W614) 18-7


18 Programming Device Operations

3 Click the Settings Button.


The PLC Type Settings Dialog Box
will be displayed.

4 Select a CPU Unit model in the CPU


Type box, and then click the OK But-
ton. The PLC Type Settings Dialog
Box will close.

5 Confirm that “USB” is displayed as


the network type, and then click the
OK Button.
The Change PLC Dialog Box will
close, and the Main Window will be
displayed for a new project.

Additional Information

If “USB” is not displayed for the network type, refer to CX-Programmer Ver.9. … Operation Man-
ual (Cat. No. W446), and check that the USB driver has been installed correctly.

18-8 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Entering NO and NC Input Conditions


• For a NO input condition using the LD instruction, press the L or C Key and select LD. For an OR
input condition, press the O or W Key and select OR.
• For a NC input condition, press the L or / Key, and then select LD NOT. For an OR NOT input condi-
tion, press O or X and select OR NOT.
• Press the Enter Key, and then enter the address.

z Inputting a NO Input Condition

1 Press either the L or C Key. “LD


0.00” will be displayed.

2 Press the Enter Key.


“Bit (1/1)” will be displayed and

18-3 Creating a Ladder Program


“0.00” will be displayed in reverse
video.

3 If the address is not CIO 0.00, input


the correct address from the key-
board. For example, input “0.02.”

To select an Auxiliary Area bit*,


press the Down Cursor Key to move
the cursor to the Auxiliary Area List, 18
press the Enter Key, and then select
a bit from the list.
18-3-1 Inputting a Ladder Program

* Condition Flag or previously regis-


tered Auxiliary Area bit.

4 Press the Enter Key.


This completes inputting the LD
instruction.

CP2E CPU Unit Software User’s Manual(W614) 18-9


18 Programming Device Operations

Additional Information

• The following instruction variations can be input.


• Upward differentiation (@)
• Downward differentiation (%)
• Immediate refreshing (!)
Example: Immediate refreshing (!) specified.

The symbols indicating these instruction variations will be added to the beginning of the instruc-
tion whenever they are input regardless of whether the cursor is before (example: |LD), in the
middle (example:L|D), or at the end (example: LD|) of the instruction.
• After an instruction has been entered, the variation can be changed as follows.
• @: Upward differentiation
• %: Downward differentiation
• !: Immediate refreshing
• Shift + 0: No differentiation

Inputting an OUTPUT Instruction


• To input an OUTPUT instruction, press the O Key and select OUT.
• To input an OUTPUT NOT instruction, press the O or Q Key, and then select OUT NOT.
• Press the Enter Key, and then enter the address.

z Input Example

1 Press the O Key.


“OUT 100.00” will be displayed.

2 Press the Enter Key.


An OUTPUT instruction will be dis-
played with “100.00” in reverse
video.

18-10 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

3 For an address other than CIO


100.00, input the address from the
keyboard. Here, “100.02” has been
input.

4 Press the Enter Key.


This completes inputting the OUT-
PUT instruction.

Inputting Instructions
A mnemonic can be entered directly as a character string.
When you enter the first letter, a list of candidate mnemonics will be displayed. Use the Up Cursor and
Down Cursor Keys to move up and down through this list, and then press the Enter Key to make a
selection. Then, input the operands.

z Example: TIM Instruction

1 Press the T Key.


A list of instructions beginning with T
will be displayed.

18-3 Creating a Ladder Program


2 Press the Enter Key.
“Timer number (1/2)” will be dis- 18
played, and “0” will be displayed in
reverse video. 18-3-1 Inputting a Ladder Program

3 Input the timer number.


For example, input “3” and then
press the Enter Key.

4 Input the timer set value.


For example, input “#10.”

CP2E CPU Unit Software User’s Manual(W614) 18-11


18 Programming Device Operations

5 Press the Enter Key.


This completes inputting the TIM
instruction.

Copying Rungs Using the Automatic Address Increment Function


When rungs are copied and then pasted, it is possible to automatically increment the addresses by the
specified number when pasting the rungs.
Example: When the following rung is copied, the bit addresses can be incremented by +16, and the
word address can be incremented by +10 when pasting the rung.

1 Select the above rung and then select Address Increment Copy from the Edit Menu.
The following dialog box will be displayed.

2 In the Offset Area set the Bit Field to 16 and the CH Field to 10 for this example.
Click the Paste Button.
As shown below, the addresses are automatically incremented and the rung is pasted as the
next rung.

18-12 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Addresses are
automatically incremented
when the rung is pasted.

· Bits:
Example: Incrementing by +16 Bits (One Word)
Example: CIO 0.00 is incremented to CIO 1.00.
· Words:
Example: Incrementing by +10 Words
Example: D100 is incremented to D110.

z Automatic Creation of Symbol Names and I/O Comments


If there are symbol names or I/O comments in the rung that was copied, executing the Address
Increment Copy Command will automatically create symbol names and I/O comments.
• Automatic Symbol Name Creation

Example: Example:
The symbol name Sensor02 is automatically The symbol name LAMP_Blue_1 is automatically
created from the symbol name Sensor01. created from the symbol name LAMP_Blue.
Automatically
incremented.

Example:
The symbol name ALARM_1 is automatically

18-3 Creating a Ladder Program


created from the symbol name ALARM.

• Automatic I/O Comment Creation

Any number at the end of When there are no numbers in the I/O
an I/O comment is comment, sequential numbers starting
incremented by 1. from 1 will be added after an underbar.

Automatically incremented.

18
18-3-1 Inputting a Ladder Program

• Automatic Creation Rules


By default, automatic creation is governed by the following rules.
Target Automatic creation rule Description
Symbol names Increment the numbers The symbol name is searched for a number starting from the
found from tail. end, and any number that is found is incremented by 1.
If no number is found, an underbar and a sequential number
starting from 1 are appended.
I/O comments Increment the numbers The I/O comment is searched for a number starting from the
found from tail. end, and any number that is found is incremented by 1.
If no number is found, an underbar and a sequential number
starting from 1 are appended.

CP2E CPU Unit Software User’s Manual(W614) 18-13


18 Programming Device Operations

Other rules may also be applicable.


Click the Advanced Button to select options. The options are enabled when the Paste Button is
clicked.

Target Automatic creation rule Description


Symbol names Increment the numbers found The symbol name is searched for a number starting from
from head. the beginning, and any number that is found is incre-
mented by 1.
If no number is found, an underbar and a sequential
number starting from 1 are appended.
Assign a new number to the And underbar and sequential number, starting from 1,
end of the symbol name. are appended to the end of the symbol name.
I/O comments Increment the numbers found The I/O comment is searched for a number starting from
from head. the beginning, and any number that is found is incre-
mented by 1.
If no number is found, an underbar and a sequential
number starting from 1 are appended.
Assign a new number to the An underbar and a sequential number starting from 1
end of the I/O comment. are appended to the end of the I/O comment.
Attach same I/O comment. The same I/O comment is used for the copy.

18-3-2 Saving and Reading Ladder Programs


Always save the ladder program that you have created. This section describes how to check, save, and
read a ladder program.

Checking a Ladder Program for Errors


You can check for errors in a program by compiling it.

1 Select Compile All PLC Programs


from the Program Menu.

Compiling will start. Once compiling


has been completed, the results of
the program check will be displayed
in the Output Window.

18-14 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

2 If an error was found, double-click


the error message displayed in the
Output Window.
The cursor will move to the location
of the error. Correct the ladder pro-
gram as required.
Note When there is more than one error,
press the Shift + J keys to search
for errors in order.

Saving a Ladder Program


Once created, a ladder program must be saved. Ladder programs are saved in projects.

1 Select Save As from the File Menu.


The Save CX-Programmer File Dia-
log Box will be displayed.

2 Specify the save location, input the


file name, and then click the Save

18-3 Creating a Ladder Program


Button.
The CX-Programmer project file will
be saved.

18
18-3-2 Saving and Reading Ladder Programs

CP2E CPU Unit Software User’s Manual(W614) 18-15


18 Programming Device Operations

18-3-3 Editing Ladder Programs


A ladder program can be edited in the CX-Programmer. Also, I/O comments and rung comments can
be input.

Inputting and Editing I/O Comments

z Inputting an I/O Comment with the Ladder Editor


In Smart Input Mode, an I/O comment can be input after an operand has been input using the Com-
ment Dialog Box.

Note The Comment Dialog Box shown above is displayed only when the Show with comment dialog Option is
selected on the Options - Diagrams Dialog Box. The Options - Diagrams Dialog Box is accessed by select-
ing Options from the Tools Menu.

z Inputting by Editing I/O Comments


Multiple I/O comments can be input or changed from an address list.

1 Select Edit I/O Comment from the


Edit Menu.

The I/O Comment Editing Window


will be displayed.

2 Input I/O comments or double-click


the address for which the I/O com-
ments are to be changed. Inputting
the I/O comment will be enabled, so
input the I/O comment.

18-16 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Inputting Rung Comments


Comments can be added to rungs in the program.

1 Double-click the header of the rung


to which a comment is to be
attached.
The Rung Properties Dialog Box will
be displayed.

2 Input a comment into the Comment


Field on the General Tab Page.

18-3 Creating a Ladder Program


3 Close the Rung Properties Dialog
Box.
The input rung comment will be dis-
played in the ladder program.

18
18-3-3 Editing Ladder Programs

CP2E CPU Unit Software User’s Manual(W614) 18-17


18 Programming Device Operations

18-4 Connecting Online to the CP2E and


Transferring the Program
This section describes how to make an online connection between the CX-Programmer and the CP2E,
and then transfer a ladder program to the CP2E.

18-4-1 Connecting Online


To enable transferring programs from the CX-Programmer to the CP2E, it is first necessary to place the
CX-Programmer online with the CP2E.
Online is the state in which communications is possible between the computer and the CP2E.

CX-Programmer

Go online and then transfer the program.

CP2E

1 Open the project containing the program to be transferred from the CX-Programmer.

2 Select Work Online from the PLC


Menu of the CX-Programmer.
A dialog box to confirm going online
will be displayed.

3 Click the Yes Button.

18-18 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Once the online connection has


been established, the color of the
Ladder Section Window will change
to light gray.

Additional Information

Refer to Section 4 Programming Device in the CP2E CPU Unit Hardware User’s Manual (Cat.
No. W613) for the connection method with the CP2E.

18-4 Connecting Online to the CP2E and Transferring the Program


If it is not possible to establish an online connection, check the PLC type setting and the commu-
nications settings. To check them, double-click New PLC1 [CP2E] Offline in the project tree. For
details on these settings, refer to Creating a New Project in 18-3-1 Inputting a Ladder Program.

18-4-2 Changing Operating Modes


The operating mode can be changed to PROGRAM mode.
The procedure for changing to PROGRAM mode is given below.

1 Select Operating Mode - Program


from the PLC Menu.
A dialog box to confirm changing the
operating mode will be displayed.

18
2 Click the Yes Button.
The operating mode will be changed.
18-4-2 Changing Operating Modes

The operating mode is displayed in


the project tree.

CP2E CPU Unit Software User’s Manual(W614) 18-19


18 Programming Device Operations

Additional Information

Change to PROGRAM mode before transferring the PLC Setup and ladder program.

18-4-3 Transferring a Ladder Program and the PLC Setup


A ladder program created with the CX-Programmer can be transferred to the CP2E.

1 Change to PROGRAM mode, select Operating Mode - Program from the PLC Menu, and then
click the Yes Button.

2 Select Transfer - Transfer [PCPLC]


from the PLC Menu. The Download
Options Dialog Box will be displayed.

3 Click the OK Button.


A dialog box to confirm the transfer
will be displayed.
To transfer the PLC Setup, select the
Settings Check Box.

18-20 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Additional Information

For details on the transfer options, refer to the CX-Programmer Online Help.

4 Click the Yes Button.

5 Click the OK Button.


This completes transferring the lad-
der program.

18-4 Connecting Online to the CP2E and Transferring the Program


18-4-4 Starting Operation
To start operation, turn ON the power or change the operating mode to RUN mode.

Precautions for Correct Use


To start operation when the power is turned ON, set the operation mode at startup in the PLC
Setup to MONITOR or RUN mode.

Use the following procedure to change the operating mode to RUN mode. To perform trial operation for 18
debugging or adjustments, change the operating mode to MONITOR mode.
18-4-4 Starting Operation

Precautions for Safe Use


Always confirm the safety of the controlled system before changing to MONITOR or RUN mode.

CP2E CPU Unit Software User’s Manual(W614) 18-21


18 Programming Device Operations

1 Select Operating Mode - Run from


the PLC Menu.
A dialog box to confirm changing the
operating mode will be displayed.

2 Click the Yes Button.


The CP2E will change to RUN
mode, and operation will start.

Additional Information

PROGRAM mode cannot be changed to MONITOR or RUN mode when the user program, PLC
Setup settings and DM area data in the CPU Units are being backed up. Change the operating
mode after the backup is completed.

18-22 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

18-5 Online Monitoring and Debugging


This section describes how to use CX-Programmer to monitor and debug a ladder program.

18-5-1 Monitoring Status

Displaying Execution Status


It is possible to display the execution status of a ladder program. This enables checking the execution of
the ladder program.
Change the CP2E’s operating mode to MONITOR mode to display the execution status.
The execution status of the ladder program will be displayed.

18-5 Online Monitoring and Debugging


Displaying the Execution Status for More than One Location
The Ladder Section Window can be split. This enables displaying multiple locations within a ladder pro-
gram so that you can check them at the same time.
1

18
18-5-1 Monitoring Status

CP2E CPU Unit Software User’s Manual(W614) 18-23


18 Programming Device Operations

z Window Frames
You can drag the frames in the window to display different views of the program in the Ladder Sec-
tion Window. The window can be split into up to four sections.

Monitoring Specified Addresses


You can specify addresses to check bit status and word contents.

1 While online, select Window - Watch Window from the View Menu.

2 Input an address.
The bit status or word contents will
be displayed. For BOOL data, 0 indi-
cates OFF.

Additional Information

• When entering an address, place a period between the word address and bit number. For
example, to input the address of bit 04 in CIO 0, input “0.04.”
• An address can be input by dragging it from the Ladder Section Window and dropping it into
the Watch Window. By dragging and dropping the header of a rung, all of the addresses on
that rung can be input.

18-24 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

18-5-2 Force-set/Reset Bits


Input bits can be controlled from CX-Programmer regardless of input status from the input devices. This
is used to establish input and output conditions when performing trial operation, or to see the effect of
establishing conditions when debugging.

Bits that can be Force-set/Reset

18-5 Online Monitoring and Debugging


• I/O bits
• Word Area bits (W)
• Timer Completion Flags
• Holding Area Bits (H)
• Counter Completion Flags

Precautions for Safe Use


Always check the safety of the system before force-setting or force-resetting a bit and before
releasing forced status.

18
Force-setting 18-5-2 Force-set/Reset Bits

Force-setting a bit.

1 Set the CP2E operating mode to either MONITOR or PROGRAM mode.

2 Move the cursor to an input condi-


tion for the input bit that is to be
force-set.

CP2E CPU Unit Software User’s Manual(W614) 18-25


18 Programming Device Operations

3 Right-click and select Force - On.

The input bit will be force-set. A


symbol indicating the force-set sta-
tus will be displayed at the input con-
dition.

Additional Information

• Select On to turn ON a bit and Off to turn OFF a bit.


• To cancel forced status, select Cancel.

18-5-3 Online Editing

About Online Editing


A ladder program running on the CP2E can be edited online.
This can be done while the CP2E is in MONITOR mode or PROGRAM mode.
Using the CX-Programmer, it is possible to either change part of a ladder program running on the CP2E , or
make an addition to the program.
Online editing is used to make minor changes to the ladder program without actually stopping the oper-
ation of the CP2E.

Precautions for Correct Use


• When a ladder program has been changed using online editing, the cycle time may increase
by one or more cycles, or it may not be possible to read an input signal.
• Major changes, such as moving a rung, copying, inserting, or deleting, should be done offline
and then the program should be transferred to the CP2E again.
• After completing online editing, the results of editing are backed up to backup memory, result-
ing in a longer cycle time. While this is being done, the BKUP indicator will be lit, and the
CX-Programmer will indicate the progress.
• An increase of one cycle will be 3.5ms maximum daring online editing and 8% of cycle time
during back up.
• Do not turn OFF the power supply to the CPU Unit after online editing, until the backup to the
backup memory is completed (the BKUP indicator is OFF).

18-26 CP2E CPU Unit Software User’s Manual(W614)


18 Programming Device Operations

Online Editing Procedure

1 Change the CP2E’s operating mode to MONITOR or PROGRAM mode.

2 Click the header of the rung to be edited.

3 Select Online Edit - Begin from the


PLC Menu.
The gray color will be cleared from
the Ladder Section Window to indi-
cate that the ladder program can be
edited.

4 Edit the ladder program.

5 Select Online Edit - Send

18-5 Online Monitoring and Debugging


Changes from the PLC Menu.
The edited rung will be transferred
to the CP2E.

18
18-5-3 Online Editing

CP2E CPU Unit Software User’s Manual(W614) 18-27


18 Programming Device Operations

18-28 CP2E CPU Unit Software User’s Manual(W614)


pp

Appendices

A-1 Instruction Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2


A-1-1 Sequence Input Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
A-1-2 Sequence Output Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
A-1-3 Sequence Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-5
A-1-4 Timer and Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-7
A-1-5 Comparison Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-10
A-1-6 Data Movement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-12
A-1-7 Data Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-15
A-1-8 Increment/Decrement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-18
A-1-9 Symbol Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-19
A-1-10 Conversion Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-24
A-1-11 Logic Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-28
A-1-12 Special Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-29
A-1-13 Floating-point Math Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-29
A-1-14 Table Data Processing Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-32
A-1-15 Data Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-33
A-1-16 Subroutine Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-37
A-1-17 Interrupt Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-38
A-1-18 High-speed Counter/Pulse Output Instructions . . . . . . . . . . . . . . . . . . . . . . . A-39
A-1-19 Step Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-50
A-1-20 Basic I/O Unit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-50
A-1-21 Serial Communications Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-54
A-1-23 Clock Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-56
App

A-1-24 Failure Diagnosis Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-57


A-1-25 Other Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-57
A-2 Auxiliary Area Allocations by Address . . . . . . . . . . . . . . . . . . . . . . . . . . . A-58
A-2-1 Read-only Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-58
A-2-2 Read/Write Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-82
A-3 Response Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-99
A-3-1 I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-99
A-3-2 Interrupt Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-101
A-3-3 Serial PLC Link Response Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . A-102
A-3-4 Pulse Output Start Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-103
A-3-5 Pulse Output Change Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-103
A-4 PLC Operation for Power Interruptions . . . . . . . . . . . . . . . . . . . . . . . . . . A-104
A-5 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-107
A-6 Ethernet Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-109
A-6-1 TCP Status Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-109
A-6-2 Ethernet Network Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-110
A-6-3 Buffer Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-110

CP2E CPU Unit Software User’s Manual(W614) A-1


Appendices

A-1 Instruction Functions


The CP2E CPU Units support the following instructions.
Refer to the CP1E/CP2E CPU Unit Instructions Reference Manual (Cat. No. W483) for details.

A-1-1 Sequence Input Instructions


Instruction Mnemonic Variations Symbol/Operand Function
LOAD LD @/%/!/!@/!% Bus bar Indicates a logical start and creates an ON/OFF execution condi-
tion based on the ON/OFF status of the specified operand bit.

Starting point
of block

LOAD NOT LD NOT @/%/!/!@/!% Bus bar Indicates a logical start and creates an ON/OFF execution condi-
tion based on the reverse of the ON/OFF status of the specified
operand bit.

Starting point
of block

AND AND @/%/!/!@/!% Symbol Takes a logical AND of the status of the specified operand bit and
the current execution condition.

AND NOT AND NOT @/%/!/!@/!% Symbol Reverses the status of the specified operand bit and takes a logi-
cal AND with the current execution condition.

OR OR @/%/!/!@/!% Bus bar Takes a logical OR of the ON/OFF status of the specified operand
bit and the current execution condition.

OR NOT OR NOT @/%/!/!@/!% Bus bar Reverses the status of the specified bit and takes a logical OR
with the current execution condition.

AND LOAD AND LD --- Takes a logical AND between logic blocks.
Logic block Logic block

LD
to Logic block A

LD
to Logic block B

AND LD Serial connection between


logic block A and logic block B.

OR LOAD OR LD --- Takes a logical OR between logic blocks.


Logic block

LD
to Logic block A
Logic block

LD
to Logic block B

OR LD Parallel connection between


logic block A and logic block B.

A-2 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


NOT NOT --- Reverses the execution condition.
CONDITION UP --- UP(521) turns ON the execution condition for one cycle when the
UP(521)
ON execution condition goes from OFF to ON.
CONDITION DOWN --- DOWN(522) turns ON the execution condition for one cycle when
DOWN(522)
OFF the execution condition goes from ON to OFF.
LOAD BIT LD TST --- LD TST(350) is used in the program like LD; the execution condi-
TST(350)
TEST tion is ON when the specified bit in the specified word is ON, and
S OFF when the bit is OFF.
N
S: Source word
N: Bit number

LOAD BIT LD TSTN --- LD TSTN(351) is used in the program like LD NOT; the execution
TEST NOT TSTN(351) condition is OFF when the specified bit in the specified word is
S ON, and ON when the bit is OFF.
N
S: Source word
N: Bit number
AND BIT TEST AND TST --- AND TST(350) is used in the program like AND; the execution
AND TST(350)
condition is ON when the specified bit in the specified word is ON,
S
and OFF when the bit is OFF.
N
S: Source word
N: Bit number

AND BIT TEST AND TSTN --- AND TSTN(351) is used in the program like AND NOT; the execu-
AND TSTN(351)
NOT tion condition is OFF when the specified bit in the specified word is
S ON, and ON when the bit is OFF.
N
S: Source word
N: Bit number
OR BIT TEST OR TST --- OR TST(350) is used in the program like OR; the execution condi-
TST(350)
tion is ON when the specified bit in the specified word is ON, and
S OFF when the bit is OFF.
N
S: Source word
N: Bit number
OR BIT TEST OR TSTN --- OR TSTN(351) is used in the program like OR NOT; the execution
TSTN(351)
NOT condition is OFF when the specified bit in the specified word is
S ON, and ON when the bit is OFF.
N
S: Source word

A-1 Instruction Functions


N: Bit number

A-1-2 Sequence Output Instructions


Instruction Mnemonic Variations Symbol/Operand Function
OUTPUT OUT ! Outputs the result (execution condition) of the logical processing
to the specified bit.
App
OUTPUT NOT OUT NOT ! Reverses the result (execution condition) of the logical processing,
and outputs it to the specified bit.
A-1-2 Sequence Output

KEEP KEEP ! S (Set) Operates as a latching relay.


KEEP(011)
R (Reset)
B Set
Instructions

B: Bit

Reset

S execution
condition

R execution
condition

Status of B

CP2E CPU Unit Software User’s Manual(W614) A-3


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DIFFERENTI- DIFU ! DIFU(013) turns the designated bit ON for one cycle when the
DIFU(013)
ATE UP execution condition goes from OFF to ON (rising edge).
B
Execution
B: Bit condition

Status of B

One cycle

DIFFERENTI- DIFD ! DIFD(014) turns the designated bit ON for one cycle when the
DIFD(014)
ATE DOWN execution condition goes from ON to OFF (falling edge).
B
Execution
B: Bit condition

Status of B

One cycle

SET SET @/%/!/!@/!% SET turns the operand bit ON when the execution condition is ON.
SET
B Execution
condition of SET
B: Bit
Status of B

RESET RSET @/%/!/!@/!% RSET turns the operand bit OFF when the execution condition is ON.
RSET
B Execution
condition of RSET
B: Bit
Status of B

MULTIPLE BIT SETA @ SETA(530) turns ON the specified number of consecutive bits.
SETA(530)
SET
D
N1
N2 bits are set
N2 to 1 (ON).
D: Beginning word
N1: Beginning bit
N2: Number of bits

MULTIPLE BIT RSTA @ RSTA(531) turns OFF the specified number of consecutive bits.
RSTA(531)
RESET
D
N1
N2 N2 bits are
reset to 0
D: Beginning word (OFF).
N1: Beginning bit
N2: Number of bits

SINGLE BIT SETB @/!/!@ SETB(532) turns ON the specified bit in the specified word when
SETB(532)
SET the execution condition is ON.
D
Unlike the SET instruction, SETB(532) can be used to reset a bit
N in a DM word.
D: Word address
N: Bit number

SINGLE BIT RSTB @/!/!@ RSTB(533) turns OFF the specified bit in the specified word when
RESET RSTB(533) the execution condition is ON.
D
Unlike the RSET instruction, RSTB(533) can be used to reset a bit
N in a DM word.
D: Word address
N: Bit number

A-4 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-3 Sequence Control Instructions


Instruction Mnemonic Variations Symbol/Operand Function
END END --- Indicates the end of a program.
END(001)

NO OPERA- NOP --- --- This instruction has no function. (No processing is performed for
TION NOP(000).)
INTERLOCK IL --- Interlocks all outputs between IL(002) and ILC(003) when the exe-
IL(002)
cution condition for IL(002) is OFF. IL(002) and ILC(003) are nor-
mally used in pairs.

Execution Execution
condition ON condition OFF
Execution
condition

Normal Outputs
Interlocked section execution
of the program interlocked.

INTERLOCK ILC --- All outputs between IL(002) and ILC(003) are interlocked when
ILC(003)
CLEAR the execution condition for IL(002) is OFF. IL(002) and ILC(003)
are normally used in pairs.
MULTI-INTER- MILH --- When the execution condition for MILH(517) is OFF, the outputs
MILH (517)
LOCK DIFFER- for all instructions between that MILH(517) instruction and the next
ENTIATION N MILC(519) instruction are interlocked. MILH(517) and MILC(519)
HOLD D are used as a pair.
N: Interlock number MILH(517)/MILC(519) interlocks can be nested (e.g., MILH(517)-
D: Interlock Status Bit MILH(517)-MILC(519)-MILC(519)).
If there is a differentiated instruction (DIFU, DIFD, or instruction
with a @ or % prefix) between MILH(517) and the corresponding
MILC(519), that instruction will be executed after the interlock is
cleared if the differentiation condition of the instruction was estab-
lished.
MULTI-INTER- MILR --- When the execution condition for MILR(518) is OFF, the outputs
MILR (518)
LOCK DIFFER- for all instructions between that MILR(518) instruction and the next
ENTIATION N MILC(519) instruction are interlocked.MILR(518) and MILC(519)

A-1 Instruction Functions


RELEASE D are used as a pair.
N: Interlock number MILR(518)/MILC(519) interlocks can be nested (e.g., MILR(518)-
D: Interlock Status Bit MILR(518)-MILC(519)-MILC(519)).
If there is a differentiated instruction (DIFU, DIFD, or instruction
with a @ or % prefix) between MILR(518) and the corresponding
MILC(519), that instruction will not be executed after the interlock
is cleared even if the differentiation condition of the instruction was
established.
MULTI-INTER- MILC --- Clears an interlock started by an MILH(517) or MILR(518) with the
MILC (519)
LOCK CLEAR same interlock number.
N
All outputs between MILH(517)/MILR(518) and the corresponding
App
N: Interlock number MILC(519) with the same interlock number are interlocked when
the execution condition for MILH(517)/MILR(518) is OFF.
JUMP JMP --- When the execution condition for JMP(004) is OFF, program exe-
JMP(004)
cution jumps directly to the first JME(005) in the program with the
A-1-3 Sequence Control

N same jump number. JMP(004) and JME(005) are used in pairs.


N: Interlock number Execution condition
Instructions

Instructions in
this section
are not
executed and
Instruc- Instructions out-put status
tions jumped is maintained.
ex- The instruction
ecuted execution time
for these
instructions is
eliminated.

CP2E CPU Unit Software User’s Manual(W614) A-5


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


CONDITIONAL CJP --- The operation of CJP(510) is the basically the opposite of
CJP(510)
JUMP JMP(004). When the execution condition for CJP(510) is ON, pro-
N gram execution jumps directly to the first JME(005) in the program
with the same jump number. CJP(510) and JME(005) are used in
N: Interlock number
pairs.

Execution condition
Instructions in
this section are
not executed
and out-put
Instruc- status is
tions Instructions
jumped maintained.
ex- The instruction
ecuted execution time
for these
instructions is
eliminated.

JUMP END JME --- Indicates the destination of a jump instruction.


JME(005)
N

N: Interlock number

FOR-NEXT FOR --- The instructions between FOR(512) and NEXT(513) are repeated
FOR(512)
LOOPS a specified number of times. FOR(512) and NEXT(513) are used
N in pairs.
N: Number of loops

Repeated N times

Repeated program section

BREAK LOOP BREAK --- Programmed in a FOR-NEXT loop to cancel the execution of the
BREAK(514)
loop for a given execution condition. The remaining instructions in
the loop are processed as NOP(000) instructions.

N repetitions Condition a ON

Repetitions
forced to
end.

Processed as
NOP(000).

FOR-NEXT NEXT --- The instructions between FOR(512) and NEXT(513) are repeated
NEXT(513)
LOOPS a specified number of times. FOR(512) and NEXT(513) are used
in pairs.

A-6 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-4 Timer and Counter Instructions


Instruction Mnemonic Variations Symbol/Operand Function
HUNDRED-MS TIM --- TIM/TIMX(550) operates a decrementing timer with units of 0.1-s.
TIM
TIMER (BCD) The setting range for the set value (SV) is 0 to 999.9 s for
N TIM(BCD) and 0 to 6,553.5 s for TIMX(Binary).
S
ON
N: Timer number Timer input OFF
S: Set value
SV
Timer PV
TIMX --- 0
TIMX(550)
(Binary)
N
Completion ON
S Flag OFF

N: Timer number Timer Input Turned OFF before Completion Flag


S: Set value Turns ON
ON
Timer input
OFF

SV
Timer PV
0

Completion ON
Flag OFF

TEN-MS TIMH --- TIMH(015)/TIMHX(551) operates a decrementing timer with units


TIMH(015)
TIMER (BCD) of 10-ms. The setting range for the set value (SV) is 0 to 99.99 s
N for TIMH(BCD) and 0 to 655.35 s for TIMHX(Binary).
S
ON
N: Timer number Timer input OFF
S: Set value

Timer PV SV
TIMHX ---
TIMHX(551) 0
(Binary)
N
Completion ON
Flag OFF
S
N: Timer number
S: Set value Timer Input Turned OFF before Completion Flag Turns
ON
ON
Timer input OFF

A-1 Instruction Functions


Timer PV SV
0

Completion ON
Flag OFF

ONE-MS TMHH --- TMHH(540)/TMHHX(552) operates a decrementing timer with


TMHH(540)
TIMER (BCD) units of 1-ms. The setting range for the set value (SV) is 0 to 9.999 s
N for TMHH(BCD) and 0 to 65.535 s for TMHHX(Binary).
S The timing charts for TMHH(540) and TMHHX(552) are the same
N: Timer number as those given above for TIMH(015).
S: Set value
Timer input ON
App
TMHHX --- OFF
TMHHX(552) SV
(BCD)
N Timer PV 0
S Completion ON
Flag
A-1-4 Timer and Counter

OFF
N: Timer number
S: Set value
Timer Input Turned OFF before Completion
Flag Turns ON
Instructions

Timer input ON
OFF
SV
Timer PV 0

Completion ON
Flag OFF

CP2E CPU Unit Software User’s Manual(W614) A-7


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


ACCUMULA- TTIM --- TTIM(087)/TTIMX(555) operates an incrementing timer with units
Timer TTIM(087)
TIVE TIMER (BCD) input of 0.1-s. The setting range for the set value (SV) is 0 to 999.9 s for
N TTIM(BCD) and 0 to 6,553.5 s for TTIMX(Binary).
S
ON
Reset Timer input OFF
input
N: Timer number Timer PV SV
S: Set value
Timing
TTIMX --- resumes.
Timer TTIMX(555)
(Binary) input
PV
maintained.
N 0
S
Completion ON
Reset Flag OFF
input

N: Timer number Reset input ON


OFF
S: Set value

LONG TIMER TIML --- TIML(542)/TIMLX(553) operates a decrementing timer with units
(BCD) TIML(542) of 0.1-s that can time up to approx. 115 days for TIML(BCD) and
D1 49,710 days for TIMLX(Binary).

D2 Timer input ON
OFF
S
SV
D1: Completion Flag Timer PV
D2: PV word
S: SV word
0
TIMLX ---
TIMLX(553) Completion Flag ON
(Binary) (Bit 00 of D1) OFF
D1
D2
S
D1: Completion Flag
D2: PV word
S: SV word

COUNTER CNT --- Count CNT/CNTX(546) operates a decrementing counter. The setting
CNT
(BCD) input range for the set value (SV) is 0 to 9,999 for CNT(BCD) and 0 to
N 65,535 for CNTX(Binary).
S
ON
Reset
input Count input OFF
N: Counter number ON
S: Set value Reset input
OFF
CNTX ---
Count CNTX(546) SV
(Binary) input Counter PV
N
S 0
Reset ON
input Completion
Flag OFF
N: Counter number
S: Set value

A-8 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


REVERSIBLE CNTR --- CNTR(012)/CNTRX(548) operates a reversible counter.
Increment CNTR(012)
COUNTER (BCD) input
Decrement N
input
Reset S Increment input
input

N: Counter number Decrement input


S: Set value

Counter PV
CNTRX --- 0
Increment CNTRX(548)
(Binary) input
Decrement N
input SV
Counter PV
Reset S
input
+1
0
N: Counter number
S: Set value
ON
Completion Flag
OFF

SV 1
Counter PV

ON
Completion Flag
OFF

RESET CNR @ CNR(545)/CNRX(547) resets the timers or counters within the


TIMER/ (BCD) CNR(545) specified range of timer or counter numbers. Sets the set value
COUNTER (SV) to the maximum of #9999 for CNR(BCD) and #FFFF for
N1 CNRX(Binary).
N2

N1: 1st number in range


N2: Last number in range

CNRX @
(Binary) CNRX(547)
N1

A-1 Instruction Functions


N2

N1: 1st number in range


N2: Last number in range

App
A-1-4 Timer and Counter
Instructions

CP2E CPU Unit Software User’s Manual(W614) A-9


Appendices

A-1-5 Comparison Instructions


Instruction Mnemonic Variations Symbol/Operand Function
Symbol Com- LD, AND, OR + --- Input comparison instructions compare two values (constants
LD
parison =, <>, <, <=, >, and/or the contents of specified words) and create an ON execu-
(Unsigned) >= Symbol and option tion condition when the comparison condition is true.
Symbol Com- LD, AND, OR + --- S1 Input comparison instructions are available to compare signed or
parison (Dou- =, <>, <, <=, >, unsigned data of one-word or double length data.
S2
ble-word, >= + L
LD ON execution condition when
unsigned) comparison result is true.
Symbol Com- LD, AND, OR + --- <
AND
parison =, <>, <, <=, >,
(Signed) >= +S Symbol and option

Symbol Com- LD, AND, OR + --- S1


ON execution
parison (Dou- =, <>, <, <=, >, condition when
S2
ble-word, >= +SL AND comparison result
is true.
signed)
<
OR

Symbol and option

S1
S2 OR

One-word
S1: Comparison data 1
S2: Comparison data 2
Double length
S1: 1st word of comparison data 1
S2: 1st word of comparison data 2
<

ON execution condition when


comparison result is true.

Time Compari- LD, AND, OR + --- LD (LOAD):


Time comparison instructions compare two BCD time values and
son = DT, <> DT, create an ON execution condition when the comparison condition
< DT, <= DT, Symbol is true.
> DT, >= DT C There are three types of time comparison instructions, LD (LOAD),
S1 AND, and OR. Time values (year, month, day, hour, minute, and
second) can be masked/unmasked in the comparison so it is easy
S2
to create calendar timer functions.
C: Control Word
AND:
Bits 00 to 05 of C specify whether or not the time data will be
Symbol masked for the comparison. Bits 00 to 05 mask the seconds,
minutes, hours, day, month, and year, respectively. If all 6 val-
C
ues are masked, the instruction will not be executed, the execu-
S1 tion condition will be OFF, and the Error Flag will be turned ON.
S2
15 8 7 6 5 4 3 2 1 0
C 0 0 0 0 0 0 0 0 0 0
OR:
Masks seconds data when ON.
Symbol Masks minutes data when ON.
Masks hours data when ON.
C Masks day data when ON.
Masks month data when ON.
S1 Masks year data when ON.

S2

C: Control word
S1: 1st word of present time
S2: 1st word of comparison time

UNSIGNED CMP ! Compares two unsigned binary values (constants and/or the con-
COMPARE CMP(020) tents of specified words) and outputs the result to the Arithmetic
S1 Flags in the Auxiliary Area.

S2 Unsigned binary
comparison

S1: Comparison data 1


S2: Comparison data 2

Arithmetic Flags
(>, >=, =, <=, <, <>)

A-10 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DOUBLE CMPL --- Compares two double unsigned binary values (constants and/or
UNSIGNED CMPL(060) the contents of specified words) and outputs the result to the Arith-
COMPARE S1 metic Flags in the Auxiliary Area.

S2 Unsigned binary
comparison
S1: Comparison data 1 S1+1 S2+1
S2: Comparison data 2
Arithmetic Flags
(>, >=, =, <=, <, <>)

SIGNED CPS ! Compares two signed binary values (constants and/or the con-
BINARY COM- CPS(114) tents of specified words) and outputs the result to the Arithmetic
PARE S1 Flags in the Auxiliary Area.

S2 Signed binary
comparison

S1: Comparison data 1


S2: Comparison data 2
Arithmetic Flags
(>, >=, =, <=, <, <>)

DOUBLE CPSL --- Compares two double signed binary values (constants and/or the
SIGNED CPSL(115) contents of specified words) and outputs the result to the Arith-
BINARY COM- S1 metic Flags in the Auxiliary Area.
PARE
S2 Signed binary
comparison
S1: Comparison data 1 S1+1 S2+1
S2: Comparison data 2
Arithmetic Flags
(>, >=, =, <=, <, <>)

TABLE COM- TCMP @ Compares the source data to the contents of 16 words and turns
PARE TCMP(085) ON the corresponding bit in the result word when the contents are
S equal.

T Comparison R
1: Data
R are equal.
0: Data
aren't equal.
S: Source data
T: 1st word of table
R: Result word

T: First word of table

A-1 Instruction Functions


T Comparison data 0
T+1 Comparison data 1
to to
T+15 Comparison data 15

UNSIGNED BCMP @ Compares the source data to 16 ranges (defined by 16 lower limits
BLOCK COM- BCMP(068) and 16 upper limits) and turns ON the corresponding bit in the
PARE S result word when the source data is within the range.

T Ranges
1: In range
0: Not in range
R
App
Lower limit Upper limit R
S: Source data T to T+1 0
T: 1st word of table
R: Result word T+2 1
Source data to T+3
A-1-5 Comparison Instructions

T+28 to T+29 14
T+30 to T+31 15
B: First word of block

B Lower limit value 0


B+1 Upper limit value 0
B+2 Lower limit value 1
B+3 Upper limit value 1
to to
B+30 Lower limit value 15
B+31 Upper limit value 15

CP2E CPU Unit Software User’s Manual(W614) A-11


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


AREA RANGE ZCP --- Compares the 16-bit unsigned binary value in CD (word contents
COMPARE ZCP(088) or constant) to the range defined by LL and UL and outputs the
CD results to the Arithmetic Flags in the Auxiliary Area.

LL
UL

CD: Comparison data (1 word)


LL: Lower limit of range
UL: Upper limit of range

DOUBLE ZCPL --- Compares the 32-bit unsigned binary value in CD and CD+1 (word
AREA RANGE ZCPL(116) contents or constant) to the range defined by LL and UL and out-
COMPARE CD puts the results to the Arithmetic Flags in the Auxiliary Area.

LL
UL

CD: Comparison data (2 words)


LL: Lower limit of range
UL: Upper limit of range

A-1-6 Data Movement Instructions


Instruction Mnemonic Variations Symbol/Operand Function
MOVE MOV @/!/!@ Transfers a word of data to the specified word.
MOV(021)

S Source word

D
S: Source
D: Destination
Bit status not
changed.
Destination word

DOUBLE MOVL @ Transfers two words of data to the specified words.


MOVE MOVL(498)
S S+1
S
D
S: 1st source word Bit status not
D: 1st destination word changed.
D D+1

MOVE NOT MVN @ Transfers the complement of a word of data to the specified word.
MVN(022)

S Source word

D
S: Source
D: Destination Bit status
inverted.

Destination word

A-12 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


MOVE BIT MOVB @ Transfers the specified bit.
MOVB(082)

S
C
D
S: Source word or data
C: Control word
D: Destination word

C: Control Word
15 8 7 0
C m n

Source bit: 00 to 0F
(0 to 15 decimal)

Destination bit: 00 to 0F
(0 to 15 decimal)

MOVE DIGIT MOVD @ Transfers the specified digit or digits. (Each digit is made up of 4
MOVD(083) bits.)
S 15 12 11 8 7 4 3 0
C C 0 l n m
n
D
m
S: Source word or data S
C: Control word
D: Destination word
l
D

C: Control Word

15 12 11 8 7 4 3 0
C 0 n m

First digit in S (m): 0 to 3

Number of digits (n): 0 to 3


0: 1 digit
1: 2 digits
First digit in D ( ): 0 to 3 2: 3 digits
3: 4 digits
Always 0.

A-1 Instruction Functions


MULTIPLE BIT XFRB @ Transfers the specified number of consecutive bits.
TRANSFER XFRB(062)

C
S
D
C: Control word
S: 1st source word
D: 1st destination word App
C: Control Word

15 8 7 4 3 0
C n m
A-1-6 Data Movement Instructions

First bit in S ( ): 0 to F
(0 to 15)
First bit in D (m): 0 to F
(0 to 15)
Number of bits (n): 00 to FF
(0 to 255)

CP2E CPU Unit Software User’s Manual(W614) A-13


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


BLOCK XFER @ Transfers the specified number of consecutive words.
TRANSFER XFER(070)
N
S N words
to to
D S+(N−1) D+(N−1)

N: Number of words
S: 1st source word N: Number of Words
D: 1st destination word The possible range for N is 0000 to FFFF (0 to 65,535 decimal).

15 0
S

to

S+(N-1)
15 0
D

to
D+(N-1)

BLOCK SET BSET @ Copies the same word to a range of consecutive words.
BSET(071)
Source word Destination words
S
St
St
E

S: Source word
St: Starting word
E: End word
E

DATA XCHG @ Exchanges the contents of the two specified words.


EXCHANGE XCHG(073)
E1 E1 E2

E2

E1: 1st exchange word


E2: Second exchange word

SINGLE DIST @ Transfers the source word to a destination word calculated by add-
WORD DIS- DIST(080) ing an offset value to the base address.
TRIBUTE S
S Bs Of
Bs
Of

S: Source word
Bs: Destination base address
Of: Offset
Bs+n

DATA COL- COLL @ Transfers the source word (calculated by adding an offset value to
LECT COLL(081) the base address) to the destination word.
Bs
Bs Of
Of
D

Bs: Source base address Bs+n


Of: Offset
D: Destination word

MOVE TO MOVR @ Sets the PLC memory address of the specified word, bit, or
REGISTER MOVR(560) timer/counter Completion Flag in the specified Index Register.
S
Internal I/O memory address of S
D
S: Source (desired word or bit)
D: Destination (Index Register)

Index Register

A-14 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


MOVE TIMER/ MOVRW @ Sets the PLC memory address of the specified timer or counter's
COUNTER PV MOVRW(561) PV in the specified Index Register.
TO REGISTER S
Internal I/O memory address of S
D
S: Source (desired TC number)
D: Destination (Index Register) Timer/counter PV only

Index Register

A-1-7 Data Shift Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SHIFT REGIS- SFT --- Data Operates a shift register.
TER input SFT(010)
E St+1, St+2 St
Shift St
input
Reset E
input Lost Status of data
input for each
St: Starting word shift input
E: End word

REVERSIBLE SFTR @ Creates a shift register that shifts data to either the right or the left.
SHIFT REGIS- SFTR(084)
TER C
St E St Data input
E Shift
direc-
E St tion
Data
C: Control word input
St: Starting word
E: End word C: Control Word

15 14 13 12
Shift direction
1 (ON): Left
0 (OFF): Right
Data input
Shift input
Reset

A-1 Instruction Functions


WORD SHIFT WSFT @ Shifts data between St and E in word units.
WSFT(016)
S E St
St Lost

S: Source word
St: Starting word
E: End word

ARITHMETIC ASL @ Shifts the contents of Wd one bit to the left.


SHIFT LEFT ASL(025)
App
Wd: 100CH
Wd 15 0
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
Wd: Word
0
A-1-7 Data Shift Instructions

CY
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0

DOUBLE ASLL @ Shifts the contents of Wd and Wd +1 one bit to the left.
SHIFT LEFT ASLL(570)
Wd Wd Wd

Wd: Word

CP2E CPU Unit Software User’s Manual(W614) A-15


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


ARITHMETIC ASR @ Shifts the contents of Wd one bit to the right.
SHIFT RIGHT ASR(026)
Wd: 100CH
Wd 15 0
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
Wd: Word
0
CY
0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1

DOUBLE ASRL @ Shifts the contents of Wd and Wd +1 one bit to the right.
SHIFT RIGHT ASRL(571)

Wd Wd Wd

Wd: Word

ROTATE LEFT ROL @ Shifts all Wd bits one bit to the left including the Carry Flag (CY).
ROL(027)
Wd

Wd: Word

DOUBLE ROLL @ Shifts all Wd and Wd +1 bits one bit to the left including the Carry
ROTATE LEFT ROLL(572) Flag (CY).
Wd Wd+1 Wd

Wd: Word

ROTATE ROR @ Shifts all Wd bits one bit to the right including the Carry Flag (CY).
RIGHT ROR(028)
Wd
Wd
Wd: Word

DOUBLE RORL @ Shifts all Wd and Wd +1 bits one bit to the right including the Carry
ROTATE RORL(573) Flag (CY).
RIGHT Wd Wd+1 Wd

Wd: Word

ONE DIGIT SLD @ Shifts data by one digit (4 bits) to the left.
SHIFT LEFT SLD(074)
E S t
St
Lost
E

St: Starting word


E: End word

ONE DIGIT SRD @ Shifts data by one digit (4 bits) to the right.
SHIFT RIGHT SRD(075)
E S t
St
Lost
E
St: Starting word
E: End word

A-16 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SHIFT N-BITS NASL @ Shifts the specified 16 bits(NASL) or 32 bits(NSLL) of word data to
LEFT NASL(580) the left by the specified number of bits.
D
C

D: Shift word Shift n-bits


C: Control word

DOUBLE NSLL @
SHIFT N-BITS NSLL(582)
Contents of
LEFT D "a" or "0"
Lost shifted in
C
N bits
D: Shift word
C: Control word C: Control word
• NASL

15 12 11 8 7 0
C
0

No. of bits to shift: 00 to 10 Hex

Always 0.
Data shifted into register
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

• NSLL

15 12 11 8 7 0
C
0

No. of bits to shift: 00 to 20 Hex

Always 0.
Data shifted into register
0 Hex: 0 shifted in

A-1 Instruction Functions


8 Hex: Contents of rightmost bit shifted in

App
A-1-7 Data Shift Instructions

CP2E CPU Unit Software User’s Manual(W614) A-17


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SHIFT N-BITS NASR @ Shifts the specified 16 bits(NASR) or 32 bits(NSRL) of word data
RIGHT NASR(581) to the right by the specified number of bits.
D
C

D: Shift word Contents of


C: Control word "a" or "0"
shifted in Lost
DOUBLE NSRL @
SHIFT N-BITS NSRL(583) N bits
RIGHT D
C: Control word
C • NASR
D: Shift word 15 12 11 8 7 0
C: Control word
C
0

No. of bits to shift: 00 to 10 Hex

Always 0.
Data shifted into register
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

• NSRL
15 12 11 8 7 0
C
0

No. of bits to shift: 00 to 20 Hex

Always 0.
Data shifted into register
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

A-1-8 Increment/Decrement Instructions


Instruction Mnemonic Variations Symbol/Operand Function
INCREMENT ++ @ Increments the 4-digit hexadecimal content of the specified word
BINARY ++(590) by 1.
Wd
Wd Wd
Wd: Word

DOUBLE ++L @ Increments the 8-digit hexadecimal content of the specified words
INCREMENT ++L(591) by 1.
BINARY Wd
Wd+1 Wd Wd+1 Wd
Wd: Word

DECREMENT −− @ Decrements the 4-digit hexadecimal content of the specified word


BINARY − − (592) by 1.
Wd
Wd Wd
Wd: Word

DOUBLE DEC- − −L @ Decrements the 8-digit hexadecimal content of the specified


REMENT − − L(593) words by 1.
BINARY Wd
Wd+1 Wd Wd+1 Wd
Wd: 1st word

INCREMENT ++B @ Increments the 4-digit BCD content of the specified word by 1.
BCD ++B(594)

Wd Wd Wd

Wd: Word

A-18 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DOUBLE ++BL @ Increments the 8-digit BCD content of the specified words by 1.
INCREMENT ++BL(595)
BCD Wd Wd+1 Wd Wd+1 Wd

Wd: 1st word

DECREMENT − −B @ Decrements the 4-digit BCD content of the specified word by 1.


BCD − − B(596)
Wd Wd −1 Wd

Wd: Word

DOUBLE DEC- − −BL @ Decrements the 8-digit BCD content of the specified words by 1.
REMENT BCD − − BL(597)
Wd Wd+1 Wd Wd+1 Wd

Wd: 1st word

A-1-9 Symbol Math Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SIGNED + @ Adds 4-digit (single-word) hexadecimal data and/or constants.
BINARY ADD +(400)
WITHOUT Au Au (Signed binary)
CARRY
Ad Ad (Signed binary)
+
R
CY will turn
Au: Augend word ON when CY R (Signed binary)
Ad: Addend word there is a
R: Result word carry.

DOUBLE +L @ Adds 8-digit (double-word) hexadecimal data and/or constants.


SIGNED +L(401)
BINARY ADD Au+1 Au (Signed binary)
Au
WITHOUT
Ad + Ad+1 Ad (Signed binary)
CARRY
CY will
R turn ON
when there CY R+1 R (Signed binary)
Au: 1st augend word is a carry.

A-1 Instruction Functions


Ad: 1st addend word
R: 1st result word

SIGNED +C @ Adds 4-digit (single-word) hexadecimal data and/or constants with


BINARY ADD +C(402) the Carry Flag (CY).
WITH CARRY Au
Au (Signed binary)
Ad
R Ad (Signed binary)

Au: Augend word + CY


Ad: Addend word
R: Result word CY will turn
ON when
App
CY R (Signed binary)
there is a
carry.

DOUBLE +CL @ Adds 8-digit (double-word) hexadecimal data and/or constants


SIGNED +CL(403) with the Carry Flag (CY).
A-1-9 Symbol Math Instructions

BINARY ADD Au
WITH CARRY Au+1 Au (Signed binary)
Ad
Ad+1 Ad (Signed binary)
R
+ CY
Au: 1st augend word
CY will
Ad: 1st addend word
turn ON
R: 1st result word when there CY R+1 R (Signed binary)
is a carry.

CP2E CPU Unit Software User’s Manual(W614) A-19


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


BCD ADD +B @ Adds 4-digit (single-word) BCD data and/or constants.
WITHOUT +B(404)
CARRY Au Au (BCD)

Ad Ad (BCD)
+
R
CY will turn
Au: Augend word ON when CY R (BCD)
Ad: Addend word there is a
carry.
R: Result word

DOUBLE BCD +BL @ Adds 8-digit (double-word) BCD data and/or constants.
ADD WITH- +BL(405)
OUT CARRY Au Au+1 Au (BCD)

Ad Ad+1 Ad (BCD)
+
R
CY will turn
Au: 1st augend word ON when CY R+1 R (BCD)
Ad: 1st addend word there is a
carry.
R: 1st result word

BCD ADD +BC @ Adds 4-digit (single-word) BCD data and/or constants with the
WITH CARRY +BC(406) Carry Flag (CY).
Au
Au (BCD)
Ad
R Ad (BCD)

Au: Augend word + CY


Ad: Addend word
CY will turn
R: Result word ON when
there is a CY R (BCD)
carry.

DOUBLE BCD +BCL @ Adds 8-digit (double-word) BCD data and/or constants with the
ADD WITH +BCL(407) Carry Flag (CY).
CARRY Au
Au+1 Au (BCD)
Ad
R Ad+1 Ad (BCD)

Au: 1st augend word + CY


Ad: 1st addend word
R: 1st result word
CY will turn
ON when CY R+1 R (BCD)
there is a
carry.

SIGNED − @ Subtracts 4-digit (single-word) hexadecimal data and/or constants.


BINARY SUB- − (410)
TRACT WITH- Mi Mi (Signed binary)
OUT CARRY
Su − Su (Signed binary)
R
CY will turn
Mi: Minuend word ON when CY R (Signed binary)
Su: Subtrahend word there is a
R: Result word borrow.

DOUBLE −L @ Subtracts 8-digit (double-word) hexadecimal data and/or con-


SIGNED −L(411) stants.
BINARY SUB- Mi
TRACT WITH- Mi+1 Mi (Signed binary)
OUT CARRY Su
− Su+1 Su (Signed binary)
R
CY will turn
Mi: Minuend word ON when
CY R+1 R (Signed binary)
Su: Subtrahend word there is a
R: Result word borrow.

A-20 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SIGNED −C @ Subtracts 4-digit (single-word) hexadecimal data and/or constants
BINARY SUB- −C(412) with the Carry Flag (CY).
TRACT WITH Mi
CARRY Mi (Signed binary)
Su
R Su (Signed binary)

− CY
Mi: Minuend word
Su: Subtrahend word
R: Result word CY will turn
ON when CY R (Signed binary)
there is a
borrow.

DOUBLE − CL @ Subtracts 8-digit (double-word) hexadecimal data and/or con-


SIGNED −CL(413) stants with the Carry Flag (CY).
BINARY WITH Mi
CARRY Mi+1 Mi (Signed binary)
Su
Su+1 Su (Signed binary)
R
Mi: Minuend word − CY
Su: Subtrahend word CY will turn
R: Result word ON when
there is a CY R+1 R (Signed binary)
borrow.

BCD SUB- −B @ Subtracts 4-digit (single-word) BCD data and/or constants.


TRACT WITH- −B(414)
OUT CARRY Mi Mi (BCD)

Su − Su (BCD)
R
CY will turn ON
Mi: Minuend word when there is a CY R (BCD)
Su: Subtrahend word carry.
R: Result word

DOUBLE BCD − BL @ Subtracts 8-digit (double-word) BCD data and/or constants.


SUBTRACT −BL(415)
WITHOUT Mi Mi +1 Mi (BCD)
CARRY
Su − Su+1 Su (BCD)
R
CY will turn
ON when CY R+1 R (BCD)
Mi: 1st minuend word
Su: 1st subtrahend word there is a

A-1 Instruction Functions


borrow.
R: 1st result word

BCD SUB- − BC @ Subtracts 4-digit (single-word) BCD data and/or constants with the
TRACT WITH −BC(416) Carry Flag (CY).
CARRY Mi
Mi (BCD)
Su
R Su (BCD)

Mi: Minuend word


− CY
Su: Subtrahend word
R: Result word CY will turn
ON when CY R (BCD)
App
there is a
borrow.

DOUBLE BCD − BCL @ Subtracts 8-digit (double-word) BCD data and/or constants with
SUBTRACT −BCL(417) the Carry Flag (CY).
WITH CARRY
A-1-9 Symbol Math Instructions

Mi
Mi +1 Mi (BCD)
Su
R Su+1 Su (BCD)

Mi: 1st minuend word − CY


Su: 1st subtrahend word
R: 1st result word
CY will turn
ON when CY R+1 R (BCD)
there is a
borrow.

CP2E CPU Unit Software User’s Manual(W614) A-21


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SIGNED * @ Multiplies 4-digit signed hexadecimal data and/or constants.
BINARY MUL- *(420)
TIPLY Md Md (Signed binary)

Mr × (Signed binary)
Mr
R
Md: Multiplicand word R +1 R (Signed binary)
Mr: Multiplier word
R: Result word

DOUBLE *L @ Multiplies 8-digit signed hexadecimal data and/or constants.


SIGNED *L(421)
BINARY MUL- Md Md + 1 Md (Signed binary)
TIPLY
Mr
× Mr + 1 Mr (Signed binary)
R
Md: 1st multiplicand word
R+3 R+2 R+1 R (Signed binary)
Mr: 1st multiplier word
R: 1st result word

UNSIGNED *U @ Multiplies 4-digit unsigned hexadecimal data and/or constants.


BINARY MUL- *U(422)
TIPLY Md Md (Unsigned binary)

Mr × Mr (Unsigned binary)
R
R+1 R (Unsigned binary)
Md: Multiplicand word
Mr: Multiplier word
R: Result word

DOUBLE *UL @ Multiplies 8-digit unsigned hexadecimal data and/or constants.


UNSIGNED *UL(423)
BINARY MUL- Md Md + 1 Md (Unsigned binary)
TIPLY
Mr × Mr + 1 Mr (Unsigned binary)
R
R+3 R+2 R+1 R (Unsigned binary)
Md: 1st multiplicand word
Mr: 1st multiplier word
R: 1st result word

BCD MULTI- *B @ Multiplies 4-digit (single-word) BCD data and/or constants.


PLY *B(424)
Md (BCD)
Md
Mr × Mr (BCD)
R

Md: Multiplicand word R +1 R (BCD)


Mr: Multiplier word
R: Result word

DOUBLE BCD *BL @ Multiplies 8-digit (double-word) BCD data and/or constants.
MULTIPLY *BL(425)
Md Md + 1 Md (BCD)

Mr
× Mr + 1 Mr (BCD)
R

Md: 1st multiplicand word R+3 R+2 R+1 R (BCD)


Mr: 1st multiplier word
R: 1st result word

SIGNED / @ Divides 4-digit (single-word) signed hexadecimal data and/or con-


BINARY /(430) stants.
DIVIDE Dd
Dd (Signed binary)
Dr
R ÷ Dr (Signed binary)

Dd: Dividend word


Dr: Divisor word R +1 R (Signed binary)
R: Result word
Remainder Quotient

A-22 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DOUBLE /L @ Divides 8-digit (double-word) signed hexadecimal data and/or con-
SIGNED /L(431) stants.
BINARY Dd
DIVIDE Dd + 1 Dd (Signed binary)
Dr
R ÷ Dr + 1 Dr (Signed binary)
Dd: 1st dividend word
Dr: 1st divisor word
R: 1st result word R+3 R+2 R+1 R (Signed binary)

Remainder Quotient

UNSIGNED /U @ Function:Divides 4-digit (single-word) unsigned hexadecimal data


BINARY /U(432) and/or constants.
DIVIDE Dd
Dr Dd (Unsigned binary)

R ÷ Dr (Unsigned binary)
Dd: Dividend word
Dr: Divisor word R+1 R (Unsigned binary)
R: Result word
Remainder Quotient
DOUBLE /UL @ Function:Divides 8-digit (double-word) unsigned hexadecimal data
UNSIGNED /UL(433) and/or constants.
BINARY Dd
DIVIDE Dd + 1 Dd (Unsigned binary)
Dr
R ÷ Dr + 1 Dr (Unsigned binary)

Dd: 1st dividend word


Dr: 1st divisor word R+3 R+2 R+1 R (Unsigned binary)
R: 1st result word
Remainder Quotient
BCD DIVIDE /B @ Divides 4-digit (single-word) BCD data and/or constants.
/B(434)
Dd (BCD)
Dd
Dr ÷ (BCD)
Dr
R
R +1 R (BCD)
Dd: Dividend word
Dr: Divisor word Remainder Quotient
R: Result word

A-1 Instruction Functions


DOUBLE BCD /BL @ Divides 8-digit (double-word) BCD data and/or constants.
DIVIDE /BL(435)
Dd Dd + 1 Dd (BCD)

Dr
÷ Dr + 1 Dr (BCD)
R

Dd: 1st dividend word


R+3 R+2 R+1 R (BCD)
Dr: 1st divisor word
R: 1st result word Remainder Quotient
App
A-1-9 Symbol Math Instructions

CP2E CPU Unit Software User’s Manual(W614) A-23


Appendices

A-1-10 Conversion Instructions


Instruction Mnemonic Variations Symbol/Operand Function
BCD-TO-BINA BIN @ Converts BCD data to binary data.
RY BIN(023)
S (BCD) R (BIN)
R
S: Source word
R: Result word

DOUBLE BINL @ Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary)
BCD-TO-DOU- BINL(058) data.
BLE BINARY S
(BCD) R (BIN)
R
(BCD) R+1 (BIN)
S: 1st source word
R: 1st result word

BINARY-TO- BCD @ Converts a word of binary data to a word of BCD data.


BCD BCD(024)
S (BIN) R (BCD)

R
S: Source word
R: Result word

DOUBLE BCDL @ Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD
BINARY-TO- BCDL(059) data.
DOUBLE BCD S
(BIN) R (BCD)
R
(BIN) R+1 (BCD)
S: 1st source word
R: 1st result word

2'S COMPLE- NEG @ Calculates the 2's complement of a word of hexadecimal data.
MENT NEG(160)
2's complement
S (Complement + 1)
R (S) (R)

S: Source word
R: Result word

A-24 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DATA MLPX @ Reads the numerical value in the specified digit (or byte) in the
DECODER MLPX(076) source word, turns ON the corresponding bit in the result word (or
S 16-word range), and turns OFF all other bits in the result word (or
16-word range).
C
R 4-to-16 bit conversion
C
S: Source word
C: Control word l=1 (Convert 2 digits.)
R: 1st result word
n=2 (Start with second digit.)

4-to-16 bit decoding


(Bit m of R is turned ON.)

R
R+1

8-to-256 bit conversion


C
l=1 (Convert 2 bytes.)

n=1 (Start with first byte.)

8-to-256 bit decoding


(Bit m of R to R+15 is turned ON.)

R+1

R+14
R+15
R+16
R+17
Two 16-word ranges
are used when l
specifies 2 bytes.
R+30
R+31

C: Control Word
• 4-to-16 bit decoder

15 12 11 8 7 4 3 0
C 0 l n

Specifies the first digit/byte


to be converted

A-1 Instruction Functions


0 to 3 (digit 0 to 3)

Number of digits/bytes to be converted


0 to 3 (1 to 4 digits)
Always 0.
Conversion process
0: 4-to-16 bits (digit to word)

• 8-to-256 bit conversion

15 12 11 8 7 4 3 0
C 1 l n
App
Specifies the first digit/byte
to be converted
0 or 1 (byte 0 or 1)

Number of digits/bytes to be converted


A-1-10 Conversion Instructions

0 or 1 (1 or 2 bytes)

Always 0.

Conversion process
1: 8-to-256 bits (byte to 16-word range)

CP2E CPU Unit Software User’s Manual(W614) A-25


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DATA DMPX @ FInds the location of the first or last ON bit within the source word
ENCODER DMPX(077) (or 16-word range), and writes that value to the specified digit (or
S byte) in the result word.

R 16-to-4 bit conversion C


FInds leftmost bit
C (Highest bit address)

S: 1st source word l=1 (Convert


R: Result word 2 words.)
C: Control word

16-to-4 bit decoding


(Location of leftmost Leftmost bit Rightmost bit
bit (m) is writ-ten to R.)

n=2 (Start with digit 2.)

256-to-8 bit conversion C

l=0 (Convert one 16-word range.)

Leftmost bit

Finds leftmost bit


(Highest bit address)

256-to-8 bit decoding


(The location of the leftmost bit in the
16-word range (m) is written to R.)
n=1 (Start with byte 1.)

C: Control Word
• 16-to-4 bit conversion

15 12 11 8 7 4 3 0
C 0 l n

Specifies the first digit/byte


to receive converted data.
0 to 3 (digit 0 to 3)

Number of digits/bytes to be converted


0 to 3 (1 to 4 digits)
Bit to encode
0: Leftmost bit (highest bit address)
1: Rightmost bit (lowest bit address)

Conversion process
0: 16-to-4 bits (word to digit)

• 256-to-8 bit conversion

15 12 11 8 7 4 3 0
C 1 l n

Specifies the first digit/byte


to receive converted data.
0 or 1 (byte 0 or 1)
Number of digits/bytes to be converted
0 or 1 (1 or 2bytes)
Bit to encode
0: Leftmost bit (highest bit address)
1: Rightmost bit (lowest bit address)
Conversion process
1: 256-to-8 bits (16-word range to byte)

A-26 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


ASCII CON- ASC @ Converts 4-bit hexadecimal digits in the source word into their
VERT ASC(086) 8-bit ASCII equivalents.
S Di
Di First digit to convert
D

S: Source word
Di: Digit designator
D: 1st destination word
Number of
digits (n+1)

Left (1) Right (0)

DI: Digit Designator

Digit number: 3 2 1 0

Specifies the first digit in S to be converted (0 to 3).

Number of digits to be converted (0 to 3)


0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits
First byte of D to be used.
0: Rightmost byte
1: Leftmost byte
Parity 0: None
1: Even
2: Odd

ASCII TO HEX HEX @ Converts up to 4 bytes of ASCII data in the source word to their
HEX(162) hexadecimal equivalents and writes these digits in the specified
S destination word.

Di C: 0021
D Di
First byte to convert
S: 1st source word
Di: Digit designator Left (1) Right (0)

A-1 Instruction Functions


D: Destination word

Number of digits (n+1)

First digit to write

DI: Digit Designator

Digit number: 3 2 1 0
App

Specifies the first digit in D to receive converted


data (0 to 3).
Number of bytes to be converted (0 to 3)
0: 1 digit
A-1-10 Conversion Instructions

1: 2 digits
2: 3 digits
3: 4 digits

First byte of S to be converted.


0: Rightmost byte
1: Leftmost byte

Parity 0: None
1: Even
2: Odd

CP2E CPU Unit Software User’s Manual(W614) A-27


Appendices

A-1-11 Logic Instructions


Instruction Mnemonic Variations Symbol/Operand Function
LOGICAL AND ANDW @ Takes the logical AND of corresponding bits in single words of
ANDW(034) word data and/or constants.
I1 I1. I2 →R
I2
I1 I2 R
R 1 1 1
I1: Input 1
I2: Input 2
1 0 0
R: Result word 0 1 0
0 0 0

DOUBLE ANDL @ Takes the logical AND of corresponding bits in double words of
ANDL(610) word data and/or constants.
LOGICAL AND
I1
(I1, I1+1). (I2, I2+1) → (R, R+1)
I2
I1, I1+1 I2, I2+1 R, R+1
R
1 1 1
I1: Input 1
I2: Input 2 1 0 0
R: Result word
0 1 0
0 0 0

LOGICAL OR ORW @ Takes the logical OR of corresponding bits in single words of word
ORW(035) data and/or constants.
I1
I1 + I2 →R
I2
I1 I2 R
R
1 1 1
I1: Input 1
I2: Input 2 1 0 1
R: Result word
0 1 1
0 0 0

DOUBLE ORWL @ Takes the logical OR of corresponding bits in double words of


ORWL(611) word data and/or constants.
LOGICAL OR
I1
(I1, I1+1) + (I2, I2+1) → (R, R+1)
I2
I1, I1+1 I2, I2+1 R, R+1
R
1 1 1
I1: Input 1
I2: Input 2 1 0 1
R: Result word 0 1 1
0 0 0

EXCLUSIVE XORW @ Takes the logical exclusive OR of corresponding bits in single


OR XORW(036) words of word data and/or constants.
I1 I1. I2 + I1.I2 →R
I2
I1 I2 R
R 1 1 0
I1: Input 1
I2: Input 2
1 0 1
R: Result word 0 1 1
0 0 0

DOUBLE XORL @ Takes the logical exclusive OR of corresponding bits in double


EXCLUSIVE XORL(612) words of word data and/or constants.
OR I1 (I1, I1+1). (I2, I2+1) + (I1, I1+1). (I2, I2+1) → (R, R+1)
I2
I1, I1+1 I2, I2+1 R, R+1
R
1 1 0
I1: Input 1
I2: Input 2
1 0 1
R: Result word 0 1 1
0 0 0

A-28 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


COMPLE- COM @ Turns OFF all ON bits and turns ON all OFF bits in Wd.
MENT COM(029)

Wd Wd → Wd: 1 → 0 and 0 → 1

Wd: Word

DOUBLE COML @ Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1.
COMPLE- COML(614)
MENT Wd (Wd+1, Wd) → (Wd+1, Wd)

Wd: Word

A-1-12 Special Math Instructions


Instruction Mnemonic Variations Symbol/Operand Function
ARITHMETIC APR @ Calculates the sine, cosine, or a linear extrapolation of the source
PROCESS APR(069) data.
C The linear extrapolation function allows any relationship between
S X and Y to be approximated with line segments.

R
C: Control word
S: Source data
R: Result word

BIT COUNTER BCNT @ Counts the total number of ON bits in the specified word(s).
BCNT(067)

N N words
S Counts the number of
to ON bits.
R
S+(N − 1) Binary
result
N: Number of words
S: 1st source word
R: Result word R

N: Number of words
The number of words must be 0001 to FFFF (1 to 65,535 words).

A-1 Instruction Functions


A-1-13 Floating-point Math Instructions
Instruction Mnemonic Variations Symbol/Operand Function
FLOATING TO FIX @ Converts a 32-bit floating-point value to 16-bit signed binary data
16-BIT FIX(450) and places the result in the specified result word.
S Floating-point data
S+1 S (32 bits)
R
App
S: 1st source word
R: Result word Signed binary data
R (16 bits)

FLOATING TO FIXL @ Converts a 32-bit floating-point value to 32-bit signed binary data
32-BIT FIXL(451) and places the result in the specified result words.
A-1-12 Special Math Instructions

S Floating-point data
S+1 S (32 bits)
R
S: 1st source word
R: 1st result word Signed binary data
R+1 R (32 bits)

16-BIT TO FLT @ Converts a 16-bit signed binary value to 32-bit floating-point data
FLOATING FLT(452) and places the result in the specified result words.
S Signed binary data
S (16 bits)
R
S: Source word
R: 1st result word Floating-point data
R+1 R (32 bits)

CP2E CPU Unit Software User’s Manual(W614) A-29


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


32-BIT TO FLTL @ Converts a 32-bit signed binary value to 32-bit floating-point data
FLOATING FLTL(453) and places the result in the specified result words.
S Signed binary data
S+1 S (32 bits)
R

S: 1st source word


R: 1st result word Floating-point data
R+1 R (32 bits)

FLOATING- +F @ Adds two 32-bit floating-point numbers and places the result in the
POINT ADD +F(454) specified result words.
Au Augend (floating-point
Au+1 Au data, 32 bits)
Ad
R Addend (floating-point

Au: 1st augend word


+ Ad+1 Ad data, 32 bits)

AD: 1st addend word


R: 1st result word Result (floating-point
R+1 R data, 32 bits)

FLOATING- −F @ Subtracts one 32-bit floating-point number from another and


POINT −F(455) places the result in the specified result words.
SUBTRACT Mi Minuend
Mi+1 Mi (floating-point data,
Su 32 bits)

R Subtrahend
− Su+1 Su (floating-point
data, 32 bits)
Mi: 1st Minuend word
Su: 1st Subtrahend word
R: 1st result word Result (floating-point
R+1 R data, 32 bits)

FLOATING- *F @ Multiplies two 32-bit floating-point numbers and places the result
POINT *F(456) in the specified result words.
MULTIPLY Md Multiplicand
Md+1 Md (floating-point
Mr data, 32 bits)

R
× Mr+1 Mr
Multiplier
(floating-point data,
32 bits)
Md: 1st Multiplicand word
Mr: 1st Multiplier word
R: 1st result word Result (floating-point
R+1 R data, 32 bits)

FLOATING- /F @ Divides one 32-bit floating-point number by another and places


POINT DIVIDE /F(457) the result in the specified result words.
Dd Dividend
Dd+1 Dd (floating-point data,
Dr 32 bits)

R Divisor
÷ Dr+1 Dr (floating-point data,
32 bits)
Dd: 1st Dividend word
Dr: 1st Divisor word
R: 1st result word Result
R+1 R (floating-point data,
32 bits)

A-30 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


FLOATING LD, AND, or OR --- Compares the specified single-precision data (32 bits) or con-
Using LD:
SYMBOL + stants and creates an ON execution condition if the comparison
COMPARISON Symbol, option result is true.
=F, <>F, <F,
<=F, >F, or >=F S1 LD connection ON execution condition when
S2 comparison result is true.
<F
Using AND: S1

Symbol, option S2

S1 ON execution condition when


AND connection comparison result is true.
S2

Using OR: <F


S1
Symbol, option
S2
S1
S2 OR connection

S1: Comparison data 1


S2: Comparison data 2

<F
S1
ON execution condition when
S2
comparison result is true.

FLOATING- FSTR @ Converts the specified single-precision floating-point data (32-bit


POINT TO FSTR(448) decimal-point or exponential format) to text string data (ASCII) and
ASCII S outputs the result to the destination word.
C: First Control Word
C
D 0 hex: Decimal format
1 hex: Scientific notation
Total characters
S: 1st source word
C: Control word Data format 2 to 18 hex (2 to 24 characters, see note)
D: Destination word
Fractional digits 0 to 7 hex (see note)

A-1 Instruction Functions


Note There are limits on the total number of characters and the
number of fractional digits.
ASCII TO FVAL @ Converts the specified text string (ASCII) representation of sin-
FLOATING- FVAL(449) gle-precision floating-point data (decimal-point or exponential for-
POINT S mat) to 32-bit single-precision floating-point data and outputs the
result to the destination words.
D
S: Source word
D: 1st destination word

App
A-1-13 Floating-point Math
Instructions

CP2E CPU Unit Software User’s Manual(W614) A-31


Appendices

A-1-14 Table Data Processing Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SWAP BYTES SWAP @ Switches the leftmost and rightmost bytes in all of the words in the
SWAP(637) range.
N Byte position is swapped.
R1
N: Number of words
R1: 1st word in range R1

FIND MAXI- MAX @ Finds the maximum value in the range.


MAX(182)
MUM
C PC memory
address
R1
C W
D W words
C: First control word
R1: First word in range R1+(W–1) Max.
D: Destination word value

FIND MINI- MIN @ Finds the minimum value in the range.


MIN(183)
MUM
C PC memory
address
R1 R1
C W
D
W words
C: First control word
R1: First word in range Min. value
D: Destination word R1+(W–1)

FRAME FCS @ Calculates the FCS value for the specified range and outputs the
CHECKSUM FCS(180) result in ASCII.
C
R1 R1
D W (Table length)

C: First control word


R1: First word in range
D: First destination word ASCII conversion
Calculation
FCS value

C: First control word


15 0
C

W: Number of words/bytes in range


&1 to &65535 (decimal) or
#0001 to #FFFF (hex)
15 14 13 12 11 0
C+1 00 0000 0000 0000

0
Starting byte (Valid only when bit 13 is 1.)
0: Leftmost byte
1: Rightmost byte

Calculation units
0: Words
1: Bytes
0

A-32 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-15 Data Control Instructions


Instruction Mnemonic Variations Symbol/Operand Function
PID CON- PIDAT --- Executes PID control according to the specified parameters. The
TROL WITH PIDAT(191) PID constants can be auto-tuned with PIDAT(191).
AUTOTUNING S C: First Parameter Word
C 15 0
D C Set value (SV)
C+1 Proportional band (P)
S: Input word C+2 Integral constant (Tik)
C: 1st parameter word
D: Output word C+3 Derivative constant (Tdk)
C+4 Sampling period(τ)

15 8 7 4 3 2 1 0
C+5 0

Forward/reverse
designation
PID constant update
timing designation
Manipulated variable
output setting
2-PID parameter(α)

15 14 13 12 11 8 7 4 3 0
C+6 0 0 0

Output range

Integral and derivative unit

Input range

Manipulated variable output limit control

15 0
C+7 Manipulated variable output lower limit
C+8 Manipulated variable output upper limit

15 14 13 12 0
C+9 0 0 0

A-1 Instruction Functions


AT Calculation Gain

AT Command Bit

15 0
C+10 Limit-cycle Hysteresis

C+11
Work area
(30 words: Cannot be used by user.)
C+40 App
A-1-15 Data Control Instructions

CP2E CPU Unit Software User’s Manual(W614) A-33


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


TIME-PRO- TPO --- Inputs the duty ratio or manipulated variable from the specified
PORTIONAL TPO (685) word, converts the duty ratio to a time-proportional output based
OUTPUT S on the specified parameters, and outputs the result from the spec-
ified output.
C
C: First Parameter Word
R
Bits 04 to 07 of C specify the input type, i.e., whether the input
S: Input word word contains an input duty ratio or manipulated variable. (Set
C: 1st parameter word
these bits to 0 hex to specify a input duty ratio or to 1 hex to
R: Pulse output bit
specify a manipulated variable.)
The following diagram shows the locations of the parameter
data.

15 12 11 8 7 4 3 0
C

Manipulated variable
range
Input type

Input read timing

Output limit function

15 0
C+1 Control period

C+2 Output lower limit

C+3 Output upper limit

C+4
Work area
C+5 (3 words, cannot be used by user)
C+6

R: Pulse Output Bit


Specifies the destination output bit for the pulse output.
Normally, specify an output bit allocated to a Transistor Output
Unit and connect a solid state relay to the Transistor Output
Unit.
SCALING SCL @ Converts unsigned binary data into unsigned BCD data according
SCL(194) to the specified linear function.
S Scaling is performed
R (unsigned BCD) according to the linear
P1 function defined by points
A and B.
R
Point B P (BCD)
S: Source word Converted
P1 + 1 (BIN) value
P1: 1st parameter word Point A
R: Result word P1 + 2 (BCD)
Converted
P1 + 3 (BIN)
value
S (unsigned binary)

P1: First Parameter Word

15 0
P1

Scaled value for point A (Ar)


0000 to 9999 (4-digit BCD)
15 0
P1+1

Unscaled value for point A (As)


0000 to FFFF (binary)
15 0
P1+2

Scaled value for point B (Br)


0000 to 9999 (4-digit BCD)
15 0
P1+3

Unscaled value for point B (Bs)


0000 to FFFF (binary)

A-34 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SCALING 2 SCL2 @ Converts signed binary data into signed BCD data according to
SCL2(486) the specified linear function. An offset can be input in defining the
S linear function.

P1 Positive Offset Negative Offset


R (signed BCD) R (signed BCD)
R
S: Source word
P1: 1st parameter word
ΔY
R: Result word
ΔY
Offset ΔX
ΔX

S (signed binary) S (signed


Offset binary)

Offset of 0000
P1 Offset (Signed binary) R (signed BCD)
P1 + 1 ΔY (Signed binary)
P1 + 2 ΔX (Signed BCD)

ΔY
Offset = 0000 hex
ΔX
S (signed
binary)

P1: First Parameter Word

15 0
P1

Offset of linear function


8000 to 7FFF (signed binary)
15 0
P1+1

8000 to 7FFF (signed binary)


15 0

A-1 Instruction Functions


P1+2

0000 to 9999 (BCD)

Note P1 to P1+2 must be in the same area.

App
A-1-15 Data Control Instructions

CP2E CPU Unit Software User’s Manual(W614) A-35


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SCALING 3 SCL3 @ Converts signed BCD data into signed binary data according to
SCL3(487) the specified linear function. An offset can be input in defining the
S linear function.

P1 Positive Offset Negative Offset

R R (signed binary) R (signed binary)


Max conversion
S: Source word Max.
P1: 1st parameter word conver-
R: Result word sion
ΔY ΔY

ΔX ΔX
Offset Offset S (signed BCD)
Min.
conver- S (signed BCD)
sion Min. conversion

Offset of 0000
R (signed binary)

Max.
conver-
sion
ΔY

ΔX
S (signed BCD)
Min. conversion

P1: First Parameter Word

15 0
P1

Offset of linear function


8000 to 7FFF (signed binary)
15 0
P1+1

ΔX
0001 to 9999 (BCD)
15 0
P1+2

ΔY
8000 to 7FFF (signed binary)
15 0
P1+3

Maximum conversion
8000 to 7FFF (signed binary)
15 0
P1+4

Minimum conversion
8000 to 7FFF (signed binary)

Note P1 to P1+4 must be in the same area.

A-36 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


AVERAGE AVG --- Calculates the average value of an input word for the specified
AVG(195) number of cycles.
S S: Source word
N
R
S: Source word
N: Number of cycles N: Number of cycles
R: Result word

R+1 Pointer
Average Valid Flag
Average
R+2

R+3

N values

R+N+1

A-1-16 Subroutine Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SUBROUTINE SBS @ Calls the subroutine with the specified subroutine number and
CALL SBS(091) executes that program.
N
Execution condition ON
N: Subroutine number

Main program

A-1 Instruction Functions


Subroutine
program
(SBN(092) to
RET(093))

Program end

SUBROUTINE SBN --- Indicates the beginning of the subroutine program with the speci-
ENTRY SBN(092) fied subroutine number.
App

N
N: Subroutine number
or
A-1-16 Subroutine Instructions

Subroutine region

SUBROUTINE RET --- Indicates the end of a subroutine program.


RETURN RET(093)

CP2E CPU Unit Software User’s Manual(W614) A-37


Appendices

A-1-17 Interrupt Control Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SET INTER- MSKS @ Sets up interrupt processing for I/O interrupts or scheduled inter-
RUPT MASK MSKS(690) rupts. Both I/O interrupt tasks and scheduled interrupt tasks are
N masked (disabled) when the PC is first turned on. MSKS(690) can
be used to unmask or mask I/O interrupts and set the time inter-
C vals for scheduled interrupts.
N: Interrupt number
C: Control data
I/O Mask (1) or unmask (0)
interrupt interrupt inputs 2 to 9.
(IN8 and IN9 can only be
used in CP2E-N20/30/40/
60D-.)

Time interval
Scheduled
interrupt Set scheduled interrupt
time interval.

CLEAR CLI @ Clears or retains recorded interrupt inputs for I/O interrupts or sets
INTERRUPT
CLI(691) the time to the first scheduled interrupt for scheduled interrupts.
N N = 102 to 109 (108 and 109 can only be used in CP2E-N20/30/40/
C 60D-.)

N: Interrupt number Interrupt Interrupt


input n input n
C: Control data

Internal Internal
status status
Recorded interrupt cleared Recorded interrupt retained
N=4
MSKS(690)
Execution of scheduled
interrupt task.

Time to first
scheduled interrupt
DISABLE DI @ Disables execution of all interrupt tasks.
INTERRUPTS DI(693)

ENABLE EI --- Enables execution of all interrupt tasks that were disabled with
INTERRUPTS EI(694) DI(693).

DI

Disables execution of all


interrupt tasks.

EI

Enables execution of all


disabled interrupt tasks.

A-38 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-18 High-speed Counter/Pulse Output Instructions


Instruction Mnemonic Variations Symbol/Operand Function
MODE CON- INI @ INI(880) can be used to execute the following operations
TROL INI(880)
• To start or stop comparison of a high-speed counter's PV to the
P comparison table registered with CTBL(882).
C • To change the PV of the high-speed counter.
NV • To change the PV of the pulse output (origin fixed at 0).
P: Port specifier • To stop pulse output.
C: Control data
NV: First word with new PV INI instruction executed

New origin Present origin


Pulse output
PV

Example: Setting the Present Position as the Origin

Execution condition
@INI
#0000 C1: Port specifier (example for pulse output 0)
#0002 C2: Control data (example for changing PV)
D100 S:First word with new PV

15 0
D100 #0 0 0 0
D101 #0 0 0 0

P: Port Specifier

0000 hex Pulse output 0


0001 hex Pulse output 1
0002 hex Pulse output 2*
0003 hex Pulse output 3*
0010 hex High-speed counter 0
0011 hex High-speed counter 1
0012 hex High-speed counter 2
0013 hex High-speed counter 3

A-1 Instruction Functions


0014 hex High-speed counter 4
0015 hex High-speed counter 5
1000 hex PWM(891) output 0

* Can only be used in CP2E-N30/40/60D…-….


C: Control Data

0000 hex Starts comparison.


0001 hex Stops comparison.
0002 hex Changes the PV.
App
0003 hex Stops pulse output.

NV: First Word with New PV


If C is 0002 hex (i.e., when changing a PV), NV and NV+1 con-
A-1-18 High-speed Counter/Pulse

tain the new PV. Any values in NV and NV+1 are ignored when
C is not 0002 hex.
Output Instructions

15 0
NV Lower word of new PV
NV+1 Upper word of new PV

For Pulse Output or High-speed Counter Input:


0000 0000 to FFFF FFFF hex

For Interrupt Input in Counter Mode:


0000 0000 to 0000 FFFF hex

CP2E CPU Unit Software User’s Manual(W614) A-39


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


HIGH-SPEED PRV @ Reads the High-speed counter PV and pulse output PV.
COUNTER PV PRV(881)
P: Port Specifier
READ P
C 0000 hex Pulse output 0

D 0001 hex Pulse output 1

P: Port specifier 0002 hex Pulse output 2*


C: Control data
0003 hex Pulse output 3*
D: First destination word
0010 hex High-speed counter 0
0011 hex High-speed counter 1
0012 hex High-speed counter 2
0013 hex High-speed counter 3
0014 hex High-speed counter 4
0015 hex High-speed counter 5
1000 hex PWM(891) output 0

* Can only be used in CP2E-N30/40/60D…-….


C: Control Data

0000 hex Reads the PV.


0001 hex Reads status.
0002 hex Reads range comparison results.
P = 0000 or 0001: Reads the output fre-
quency of pulse output 0 or pulse output 1.
C = 0003 hex
P = 0010: Reads the frequency of
00 3 hex high-speed counter input 0.
C = 0013 hex: 10-ms sampling method
C = 0023 hex: 100-ms sampling method
C = 0033 hex: 1-s sampling method

D: First Destination Word

15 0
D Lower word of PV
D+1 Upper word of PV

2-word PV
Pulse output PV, high-speed counter input PV,
high-speed counter input frequency for high-speed counter input 0

15 0
D PV

1-word PV
Status, range comparison results

A-40 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


REGISTER CTBL @ Registers a comparison table and performs comparisons for a PV
CTBL(882)
COMPARISON of high-speed counter 0 to 5. An interrupt task between 0 to 15 will
TABLE P be executed when an execution condition is turned ON.
C Rotary Encoder
TB Built-in input

P: Port specifier
C: Control data
TB: First comparison table word

Present value Present value matches set target value

Time

Interrupt task
Cyclic tasks
(ladder programs) Interrupt occurs Ladder diagram

END

END
I/O refresh

P: Port specifier

0000 hex High-speed counter 0


0001 hex High-speed counter 1
0002 hex High-speed counter 2
0003 hex High-speed counter 3
0004 hex High-speed counter 4
0005 hex High-speed counter 5

C: Control data

Registers a target value comparison table


0000 hex
and starts comparison.

A-1 Instruction Functions


Registers a range comparison table and
0001 hex
performs one comparison.
Registers a target value comparison table.
0002 hex
Comparison is started with INI(880).
Registers a range comparison table. Com-
0003 hex
parison is started with INI(880).

TB: First comparison table word


TB is the first word of the comparison table. The structure of the
comparison table depends on the type of comparison being per-
formed.
App
• For target value comparison, the length of the comparison table
is determined by the number of target values specified in TB.
The table can be between 4 and 19 words long, as shown
below.
15 0
A-1-18 High-speed Counter/Pulse

TB Number of target values 0001 to 6 hex (1 to 6 target values)

TB+1 Lower word of target value 1


00000000 to FFFFFFFF hex
Output Instructions

TB+2 Upper word of target value 1


TB+3 Interrupt task number for target value 1

TB+16 Lower word of target value 6


00000000 to FFFFFFFF hex
TB+17 Upper word of target value 6
TB+18 Interrupt task number for target value 6

Interrupt Task Number


15 14 12 11 87 4 3 0
0 0 0 0

Interrupt task number


Direction 00 to 0F hex (0 to 15)
OFF: Incrementing,
ON: Decrementing

CP2E CPU Unit Software User’s Manual(W614) A-41


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


REGISTER CTBL @ • For range comparison, the comparison table always contains
CTBL(882)
COMPARISON six ranges. The table is 30 words long, as shown below. If it is
TABLE P not necessary to set six ranges, set the interrupt task number to
C FFFF hex for all unused ranges.
TB 15 0
TB Lower word of range 1 lower limit
0000 0000 to FFFF FFFF hex (See note.)
P: Port specifier TB+1 Upper word of range 1 lower limit
C: Control data
TB: First comparison table word TB+2 Lower word of range 1 upper limit
0000 0000 to FFFF FFFF hex (See note.)
TB+3 Upper word of range 1 upper limit
Range 1 interrupt task number

TB+25 Lower word of range 6 lower limit


0000 0000 to FFFF FFFF hex (See note.)
TB+26 Upper word of range 6 lower limit
TB+27 Lower word of range 6 upper limit
0000 0000 to FFFF FFFF hex (See note.)
TB+28 Upper word of range 6 upper limit
TB+29 Range 6 interrupt task number

Interrupt task number


0000 to 000F hex: Interrupt task number 0 to 15
AAAA hex: Do not execute interrupt task.
FFFF hex: Ignore the settings for this range.

Note Always set the upper limit greater than or equal to the lower
limit for any one range.
SPEED OUT- SPED @ Sets the output pulse frequency for a specific port and starts pulse
SPED(855)
PUT output without acceleration or deceleration.
P
Pulse frequency
M
F
P: Port specifier
M: Output mode
F: First pulse frequency word
Target frequency

Time

SPED(885) executed.

P: Port specifier

0000 hex Pulse output 0


0001 hex Pulse output 1
0002 hex Pulse output 2*
0003 hex Pulse output 3*

* Can only be used in CP2E-N30/40/60D…-….


M: Output mode

15 12 11 87 4 3 0
M

Mode
0 hex: Continuous
1 hex: Independent
Direction
0 hex: CW
1 hex: CCW
Pulse output method
1 hex: Pulse + direction

Always 0 hex.

F: First pulse frequency word

15 0
F Lower word of target frequency 0 to 100000 Hz
(0000 0000 to 0001 86A0 hex)
F+1 Upper word of target frequency

The value of F and F+1 sets the pulse frequency in Hz.

A-42 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


SET PULSES PULS @ Sets the number of output pulses.Actual output of the pulses is
PULS(886) started later in the program using SPED(885) or ACC(888) in
P independent mode.
T P: Port specifier
N
0000 hex Pulse output 0
P: Port specifier
T: Pulse type
0001 hex Pulse output 1
N: Number of pulses 0002 hex Pulse output 2*
0003 hex Pulse output 3*

* Can only be used in CP2E-N30/40/60D…-….


T: Pulse type

0000 hex Relative


0001 hex Absolute

N: Number of pulses
15 0
N Lower word with number of pulses
N+1 Upper word with number of pulses

Relative pulse output:


0 to 2, 147, 483, 647, (0000 0000 to 7FFF FFFF hex)
Absolute pulse output:
-2, 147, 483, 648 to 2, 147, 483, 647, (8000 0000 to 7FFF FFFF hex)

App A-1 Instruction Functions


A-1-18 High-speed Counter/Pulse
Output Instructions

CP2E CPU Unit Software User’s Manual(W614) A-43


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


PULSE OUT- PLS2 @ Performs trapezoidal positioning control as the following time
PLS2(887)
PUT chart. Sets the target frequency, starting frequency, acceleration
P and deceleration rate and direction.
M
Target frequency Acceleration
S Deceleration rate
rate
F
P: Port specifier Specified number
M: Output mode of pulses
Starting frequency
S: First word of settings table
F: First word of starting frequency
P: Port Specifier

0000 hex Pulse output 0


0001 hex Pulse output 1
0002 hex Pulse output 2*
0003 hex Pulse output 3*

* Can only be used in CP2E-N30/40/60D…-….


M: Output Mode
15 12 11 87 4 3 0
M

Relative/absolute specifier
0 hex: Relative pulses
1 hex: Absolute pulses
Direction
0 hex: CW
1 hex: CCW
Pulse output method
1 hex: Pulse + direction

Always 0 hex.

S: First Word of Settings Table


15 0
S1 Acceleration rate
1 to 65535 Hz (#0001 to FFFF)
S1+1 Deceleration rate
Specify the increase or decrease in the
frequency per pulse control period (4 ms).

S1+2 Lower word with target frequency 1 to 100,000 Hz


(0000 0000 to 0001 86A0 hex)
S1+3 Upperword with target frequency

Specify the frequency after acceleration/deceleration in Hz.

S1+4 Lower word with number of output pulses


S1+5 Upper word with number of output pulses

Relative pulse output: 0 to 2, 147, 483, 647


(0000 0000 to 7FFF FFFF hex)
Absolute pulse output: -2, 147, 483, 648 to 2, 147, 483, 647
(8000 0000 to 7FFF FFFF hex)

PULSE OUT- PLS2 @ F: First Word of Starting Frequency


PLS2(887)
PUT The starting frequency is given in F and F+1.
P
15 0
M
F Lower word with starting frequency 0 to 100000 Hz
S (0000 0000 to 0001 86A0 hex)
F+1 Upper word with starting frequency
F
Specify the starting frequency in Hz.
P: Port specifier
M: Output mode
S: First word of settings table
F: First word of starting frequency

A-44 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


ACCELERA- ACC @ Outputs pulses to the specified output port at the specified fre-
TION CON-
ACC(888) quency using the specified acceleration and deceleration rate.
TROL P
M Acceleration
Target frequency and
S deceleration
rate
P: Port specifier
M: Output mode
S: First word of settings table
Pulse output started Pulse output stopped

P: Port Specifier

0000 hex Pulse output 0


0001 hex Pulse output 1
0002 hex Pulse output 2*
0003 hex Pulse output 3*

* Can only be used in CP2E-N30/40/60D…-….


M: Output Mode

15 12 11 87 4 3 0
M

Mode
0 hex: Continuous mode
1 hex: Independent mode
Direction
0 hex: CW
1 hex: CCW
Pulse output method
1 hex: Pulse + direction

Always 0 hex.

S: First Word of Settings Table

15 0
S Acceleration/deceleration rate 1 to 65535 Hz (#0001 to FFFF)
Specify the increase or decrease in the
frequency per pulse control period (4 ms).

S+1 Lower word with target frequency 0 to 100000 Hz


(0000 0000 to 0001 86A0 hex)
S+2 Upper word with target frequency

A-1 Instruction Functions


Specify the frequency after acceleration or deceleration in Hz.

App
A-1-18 High-speed Counter/Pulse
Output Instructions

CP2E CPU Unit Software User’s Manual(W614) A-45


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


ORIGIN ORG @ Performs an origin search or origin return operation.
SEARCH ORG(889)
1
Origin Proximity
P Input Signal 0

C Origin Input
Signal
1

0
Pulse frequency
Origin search high speed Origin search deceleration rate
P: Port specifier
C: Control data Origin search
acceleration rate
Deceleration point Origin search low speed

Origin search
initial speed

Time
Start Decelerate from high to low speed Stop

Execution of ORG Indicated by the Origin Indicated by the


Proximity Input Signal Origin Input Signal

(Example for reversal mode 1


and method 0 (described later))

The following parameters must be set in the PLC Setup before


ORG(889) can be executed.

Origin search Origin return


• Origin Search Function • Origin Search/Return Initial
Enable/Disable Speed
• Origin Search Operating • Origin Return Target
Mode Speed
• Origin Search Operation • Origin Return Acceleration
Setting Rate
• Origin Detection Method • Origin Return Deceleration
• Origin Search Direction Rate
Setting
• Origin Search/Return Initial
Speed
• Origin Search High Speed
• Origin Search Proximity
Speed
• Origin Compensation
• Origin Search Accelera-
tion Rate
• Origin Search Deceleration
Rate
• Limit Input Signal Type
• Origin Proximity Input Sig-
nal Type
• Origin Input Signal Type
• Positioning Monitor Time

P: Port Specifier

0000 hex Pulse output 0


0001 hex Pulse output 1
0002 hex Pulse output 2*
0003 hex Pulse output 3*

* Can only be used in CP2E-N30/40/60D…-….


C: Control Data

15 12 11 87 4 3 0
C

Always 0 hex.
Always 0 hex.

Pulse output method


1 hex: Pulse + direction

Mode
0 hex: Origin search
1 hex: Origin return

A-46 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


PULSE WITH PWM @ Outputs pulses with the specified duty factor from the specified
VARIABLE PWM(891) port.
DUTY FACTOR P
F
D

P: Port specifier
F: Frequency
D: Duty factor
Built-in output

PWM output

100% Period is determined


by frequency
15%

Duty factor:15%

50%

Duty factor:50%

P: Port Specifier

PWM output 0 (duty factor: in increments of


1000 hex
1%, frequency 0.1 Hz)
PWM output 0 (duty factor: in increments of
1100 hex
1%, frequency 1 Hz)

F: Frequency
F specifies the frequency of the PWM output between 2.0 and
6,553.5 Hz (0.1 Hz units, 0014 to FFFF hex), or between 2 and
32,000 Hz (2 Hz units, 0002 to 7D00 hex).
D: Duty Factor
0.0% to 100.0% (0.1% units, 0000 to 03E8 hex)
D specifies the duty factor of the PWM output, i.e., the percent-
age of time that the output is ON.

App A-1 Instruction Functions


A-1-18 High-speed Counter/Pulse
Output Instructions

CP2E CPU Unit Software User’s Manual(W614) A-47


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


INTERRUPT IFEED @ IFEED(892) uses an input interrupt as a trigger to switch from
FEEDING
IFEED(892) speed control to position control and move the specified number of
P pulses.
C
Pulse frequency
S

P: Port Specifier Input interrupt occurs


C: Control Data
Target
S: First word of settings table frequency Number of output pulses

Deceleration rate
Acceleration rate
Speed control Position control

Time

Execution of IFEED(892)

P: Port Specifier

0000 hex Pulse output 0


0001 hex Pulse output 2
0002 hex Pulse output 3*
0003 hex Pulse output 4*

* Can only be used in CP2E-N30/40/60D…-….


C: Control Data

15 12 11 8 7 4 3 0
C 0 hex 0 hex

Direction
0 hex: CW
1 hex: CCW

Pulse output method


1 hex: Pulse + direction outputs

S: First word of settings table


1 to 65,535 Hz/4 ms
S Acceleration Rate (0001 to FFFF hex)
S+1 Deceleration Rate 1 to 65,535 Hz/4 ms
(0001 to FFFF hex)
S+2 Lower word of target frequency 1 to 100,000 Hz
S+3 Upper word of target frequency (0000 0001 to 0001 86A0 hex)
S+4 Lower word with number of pulses Number of output pulses:
Upper word with number of pulses 0 to 2,147,483,647
S+5 (0000 0000 to 7FFF FFFF hex)

A-48 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


LINEAR ITPL @ ITPL(893) outputs a 2 to 4 axes linear interpolation to the specified
ITPL(893)
INTERPOLA- port.
TION C1
C1: Port Specifier
C2
S1 Linear interpolation 0 (Only can be used in
0030 hex
CP2E N……-type CPU Unit)
C1: Port Specifier
C2: Control Data Linear interpolation 0 (Only can be used in
S1: First word of settings table 0031 hex
CP2E N30/40/60D…-…)

C2: Control Data


15 12 11 8 7 4 3 0
C2

Relative/absolute specifier
pulses1 hex: Absolute pulses
Always 0 hex.
Pulse output method (See note 1.)
1 hex: Pulse + direction
Specify axis(See note 2,3,4,5.)
0 hex: 2-axes interpolation
1 hex: 3-axes interpolation
2 hex: 4-axes interpolation

Note 1 Use the same pulse output method when using pulse out-
puts 1.
2 2-axes interpolation use 0/1 axes in linear interpolation 0
and 2/3 axes in linear interpolation 1 during pulse output.
3 3-axes interpolation can only be executed in linear inter-
polation 0 and use 0/1/2 axes during pulse output.
4 4-axes interpolation can only be executed in linear inter-
polation 0 only and use 0/1/2/3 axes during pulse output.
5 CP2E N14/20 CPU Units cannot use 3-axes interpolation
or 4-axes interpolation.
S1: First word of settings table
15 0
S1 Acceleration rate 1 to 65535Hz
S1+1 Deceleration rate (0001 to FFFF Hex)
Specify the increase or decrease in the frequency per pulse control
period (4 ms) in Hz.
S1+2 Lower word with target frequency 1 to 100000Hz
S1+3 Upper word with target frequency (00000001 to 000186A0 Hex)
Specify the frequency after acceleration in Hz.

A-1 Instruction Functions


15 0
S1+4 Lower word with startup frequency
0 to 100000Hz
S1+5 Upper word with startup frequency (00000000 to 000186A0 Hex)
Specify the frequency during start-up in Hz.

S1+6 Target position0(L) -2147483648 to +2147483647


S1+7 Target position0(H) (80000000 to 7FFFFFFF Hex)
S1+8 Target position1(L) -2147483648 to +2147483647
S1+9 Target position1(H) (80000000 to 7FFFFFFF Hex)
S1+10 Target position2(L) -2147483648 to +2147483647
S1+11 Target position2(H) (80000000 to 7FFFFFFF Hex)
S1+12 Target position3(L)
App
-2147483648 to +2147483647
S1+13 Target position3(H) (80000000 to 7FFFFFFF Hex)
A-1-18 High-speed Counter/Pulse
Output Instructions

CP2E CPU Unit Software User’s Manual(W614) A-49


Appendices

A-1-19 Step Instructions


Instruction Mnemonic Variations Symbol/Operand Function
STEP DEFINE STEP --- When defining the beginning of a STEP(008) functions in following 2 ways, depending on its position
step, a control bit is specified as and whether or not a control bit has been specified.
follows: (1)Starts a specific step.
(2)Ends the step programming area (i.e., step execution).
STEP(008)
B

B: Bit

When defining the end of a step, a


control bit is not specified as fol-
lows:

STEP(008)

STEP START SNXT --- SNXT(009) is used in the following three ways:
SNXT(009)
(1)To start step programming execution.
B (2)To proceed to the next step control bit.
B: Bit (3)To end step programming execution.

A-1-20 Basic I/O Unit Instructions


Instruction Mnemonic Variations Symbol/Operand Function
I/O REFRESH IORF @ Refreshes the specified I/O words.
IORF(097)
CP1W Expansion Units,
St I/O bit area CP1W Expansion I/O Units
E St
I/O refreshing
St: Starting word
E: End word
E

7-SEGMENT SDEC @ Converts the hexadecimal contents of the designated digit(s) into
DECODER SDEC(078) 8-bit, 7-segment display code and places it into the upper or lower
S 8-bits of the specified destination words.

Di
Di
D Number of digits
First digit to convert
S: Source word
Di: Digit designator
D: 1st destination word

Rightmost 8 bits (0)

7-segment

Di: Digit designator

15 12 11 87 43 0
Di 0 1/0 m n

First digit of S to convert (0 to 3)


0: Digit 0 (bits 0 to 3 of S)
1: Digit 1 (bits 4 to 7 of S)
2: Digit 2 (bits 8 to 11 of S)
3: Digit 3 (bits 12 to 15 of S)
Number of digits to convert
0 to 3: 1 to 4 digits
First half of D to receive converted data
0: Rightmost 8 bits (1st half)
1: Leftmost 8 bits (2nd half)

Not used; set to 0.

A-50 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


DIGITAL DSW --- Reads the value set on an external digital switch (or thumbwheel
SWITCH DSW (210) switch) connected to an Input Unit or Output Unit and stores the
INPUT I 4-digit or 8-digit BCD data in the specified words.

O I: Input Word (Data Line D0 to D3 Inputs)


Specify the input word allocated to the Input Unit and connect
D
the digital switch’s D0 to D3 data lines to the Input Unit as shown
C1 in the following diagram.
C2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
I: Data input word (D0 to D3) I
O: Output word
D: 1st result word D3 D0
C1: Number of digits D2 D1
Leftmost 4 digits D1 D2 Rightmost
C2: System word
D0 D3 4 digits

O: Output Word (CS/RD Control Signal Outputs)


Specify the output word allocated to the Output Unit and con-
nect the digital switch’s control signals (CS and RD signals) to
the Output Unit as shown in the following diagram.

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

CS0
CS1
One Round Flag CS signals
CS2
RD0 Read signal CS3

C1: Number of Digits


Specifies the number of digits that will be read from the exter-
nal digital switch. Set C1 to 0000 hex to read 4 digits or 0001
hex to read 8 digits.
C2: System Word
Specifies a work word used by the instruction. This word can-
not be used in any other application.

15 0
C2

System word
(Cannot be accessed by the user.)

A-1 Instruction Functions


App
A-1-20 Basic I/O Unit Instructions

CP2E CPU Unit Software User’s Manual(W614) A-51


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


MATRIX INPUT MTR --- Inputs up to 64 signals from an 8 × 8 matrix connected to an Input
MTR (213) Unit and Output Unit (using 8 input points and 8 output points) and
I stores that 64-bit data in the 4 destination words.
I: Input Word
O
Specify the input word allocated to the Input Unit and connect
D
the 8 input signal lines to the Input Unit as shown in the following
C diagram.
I: Data input word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
O: Output word
I
D: 1st destination word
C: System word 0
1
2
3
4 Bits 00 to 07
5 correspond to
6 Input Unit inputs
7 0 to 7.

O: Output Word (Selection Signal Outputs)


Specify the output word allocated to the Output Unit and con-
nect the 8 selection signals to the Output Unit as shown in the
following diagram.

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

0
1
2
3
4 Bits 00 to 07
5 correspond
6 to Output Unit
7 outputs 0 to 7.

C: System Word
Specifies a work word used by the instruction. This word can-
not be used in any other application.

15 0
C

System word
(Cannot be accessed by the user.)

A-52 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Instruction Mnemonic Variations Symbol/Operand Function


7-SEGMENT 7SEG --- Converts the source data (either 4-digit or 8-digit BCD) to 7-seg-
DISPLAY OUT- 7SEG (214) ment display data, and outputs that data to the specified output
PUT S word.
O: Output Word (Data and Latch Outputs)
O
Specify the output word allocated to the Output Unit and con-
C nect the 7-segment display to the Output Unit as shown in the
D following diagram.
• Converting 4 digits
S: 1st source word
O: Output word 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
C: Control data
D: System word O

One Round Flag


LE3 D0
LE2 D1
Latch outputs 4-digit data
LE1 D2
LE0 D3 output

• Converting 8 digits

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

One Round
Flag LE3 D0
LE2 D1
Latch Leftmost
LE1 D2
outputs 4-digit data
LE0 D3
output
D0
D1
D2 Rightmost 4-digit
D3 data output

C: Control Data
The value of C indicates the number of digits of source data
and the logic for the Input and Output Units, as shown in the fol-
lowing table. (The logic refers to the transistor output’s NPN or
PNP logic.)

Display’s data
Source data Display’s latch input logic C
input logic
4 digits (S) Same as Out- Same as Output Unit 0000
put Unit
Different from Output Unit 0001

A-1 Instruction Functions


Different from Same as Output Unit 0002
Output Unit
Different from Output Unit 0003
8 digits (S, S+1) Same as Out- Same as Output Unit 0004
put Unit
Different from Output Unit 0005
Different from Same as Output Unit 0006
Output Unit
Different from Output Unit 0007

D: System Word
Specifies a work word used by the instruction. This word can-
App
not be used in any other application.

15 0
D
A-1-20 Basic I/O Unit Instructions

System word
(Cannot be accessed by the user.)

CP2E CPU Unit Software User’s Manual(W614) A-53


Appendices

A-1-21 Serial Communications Instructions


Instruction Mnemonic Variations Symbol/Operand Function
TRANSMIT TXD @ Outputs the specified number of bytes of data without conversion
TXD(236) from the RS-232C port or RS-485 port built into the CPU Unit or
the serial Option Board according to the start code and end code
S
specified for no-protocol mode in the PLC Setup.
C C: Control word
N
15 12 11 8 7 4 3 0
S: 1st source word C
C: Control word
N: Number of bytes Byte order
0000 to 0100 hex 0: Most significant bytes first
(0 to 256 decimal) 1: Least significant bytes first
RS and ER signal control
0: No RS and ER signal control
1: RS signal control
Always 0
2: ER signal control
3: RS and ER signal control
Serial port specifier
1: Built-in RS-232C port/Serial option port 1
2: Built-in RS485 port/Serial option port 2
3: Serial option port 1 (EX)

RECEIVE RXD @ Reads the specified number of bytes of data starting with the
RXD(235) specified first word from the RS-232C port or RS-485 port built
into the CPU Unit or the serial Option Board according to the start
D
code and end code specified for no-protocol mode in the PLC
C Setup.
N C: Control Word

D: 1st destination word 15 12 11 8 7 4 3 0


C: Control word C
N: Number of bytes to store
0000 to 0100 hex Byte order
(0 to 256 decimal) 0 Hex: Most significant byte
to least significant byte
1 Hex: Lest significant byte
Always 0 to most significant byte
CS and DR signal monitoring
0: No CS and DR signal monitoring
1: CS signal monitoring
2: DR signal monitoring
3: CS and DR signal monitoring
Serial port specifier
1: Built-in RS-232C port/Serial option port 1
2: Built-in RS485 port/Serial option port 2
3: Serial option port 1 (EX)

A-54 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-22 Network Instructions


Instruction Mnemonic Variations Symbol/Operand Function
NETWORD SEND @ Sends data to a node in the Ethernet network.
SEND(090)
SEND
S Local node Destination node

D Number
C of words
to trans-
S: First source word (local node) mission
D: First destination word (remote node)
C: First control word

NETWORD RECV @ Requests data to be transmitted from a node in the Ethernet net-
RECV(098)
RECEIVE work and receives the data.
S
Local node Source node (remote node)
D
C Number of
words to
S: First source word (remote node) receive
D: First destination word (local node)
C: First control word

DELIVER CMND @ Sends an FINS command and receives the response.


CMND(490)
COMMAND
S Local node Destination node

D
C Command
Command
data Interpret
S: First command word (n bytes)
D: First response word
C: First control word

Response

Response Execute
data
(m bytes)

A-1 Instruction Functions


App
A-1-22 Network Instructions

CP2E CPU Unit Software User’s Manual(W614) A-55


Appendices

A-1-23 Clock Instructions


Instruction Mnemonic Variations Symbol/Operand Function
CALENDAR CADD @ Adds time to the calendar data in the specified words.
ADD CADD(730)
15 8 7 0
C C Seconds
Minutes
T C+1 Day Hour
R C+2 Year Month

C: 1st calendar word +


T: 1st time word 15 8 7 0
R: 1st result word T Minutes Seconds
T+1 Hours

15 8 7 0
R Minutes Seconds
R+1 Day Hour
R+2 Year Month

CALENDAR CSUB @ Subtracts time from the calendar data in the specified words.
SUBTRACT CSUB(731)
15 8 7 0
C C Seconds
Minutes
T C+1 Day Hour
R C+2 Year Month

C: 1st calendar word
T: 1st time word 15 8 7 0
R: 1st result word T Minutes Seconds
T+1 Hours

15 8 7 0
R Minutes Seconds
R+1 Day Hour
R+2 Year Month

CLOCK DATE @ Changes the internal clock setting to the setting in the specified
DATE(735) source words.
ADJUSTMENT
S
CPU Unit
S: 1st source word

Internal clock

Minutes Seconds
New
setting Day Hour
Year Month
00 Day of week

A-56 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-1-24 Failure Diagnosis Instructions


Instruction Mnemonic Variations Symbol/Operand Function
FAILURE FAL @ Generates or clears user-defined non-fatal errors. Non-fatal errors
ALARM FAL(006) do not stop PC operation.
N Also generates non-fatal errors with the system.
S FAL Error Flag ON
Corresponding Executed
N: FAL number FAL Execution of FAL Number Flag ON
S: 1st message word N FAL(006) Error code written to A400
or error generates a Error code and time
0000
code to generate non-fatal error written to Error Log Area
with FAL ERR Indicator flashes
number N.

SEVERE FALS --- Generates user-defined fatal errors.


FALS(007)
FAILURE Fatal errors stop PC operation.
ALARM N Also generates fatal errors with the system.
S
FALS Error Flag ON
Error code written to A400
N: FALS number Execution of Error code and time/date
S: 1st message word FALS(007) written to Error Log Area
or error code to generate generates a
fatal error ERR Indicator lit
with FALS
number N.

A-1-25 Other Instructions


Instruction Mnemonic Variations Symbol/Operand Function
SET CARRY STC @ Sets the Carry Flag (CY).
STC(040)

CLEAR CLC @ Turns OFF the Carry Flag (CY).


CARRY CLC(041)

EXTEND WDT @ Extends the maximum cycle time, but only for the cycle in which
WDT(094) this instruction is executed.
MAXIMUM
CYCLE TIME T

A-1 Instruction Functions


T: Timer setting

App
A-1-24 Failure Diagnosis
Instructions

CP2E CPU Unit Software User’s Manual(W614) A-57


Appendices

A-2 Auxiliary Area Allocations by


Address
The following table lists the data provided in the Auxiliary Area in order of the addresses of the data.

A-2-1 Read-only Words


Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A0 --- 10-ms Incrementing This word contains the system timer Retained Cleared Every 10 ms
Free Running Timer used after the power is turned ON. after power is
A value of 0000 hex is set when the turned ON
power is turned ON and this value is
automatically incremented by 1 every
10 ms. The value returns to 0000 hex
after reaching FFFF hex (655,350 ms),
and then continues to be automatically
incremented by 1 every 10 ms.
Note The timer will continue to be
incremented when the operating
mode is switched to RUN mode.
Example: The interval can be counted
between processing A and processing
B without requiring timer instructions.
This is achieved by calculating the
difference between the value in A0 for
processing A and the value in A0 for
processing B. The interval is counted in
10 ms units.
A1 --- 100-ms Incrementing This word contains the system timer Retained Cleared Every 100 ms
Free Running Timer used after the power is turned ON. after power is
A value of 0000 hex is set when the turned ON
power is turned ON and this value is
automatically incremented by 1 every
100 ms. The value returns to 0000 hex
after reaching FFFF hex (6,553,500
ms), and then continues to be
automatically incremented by 1 every
100 ms.
Note The timer will continue to be
incremented when the operating
mode is switched to RUN mode.
Example: The interval can be counted
between processing A and processing
B without requiring timer instructions.
This is achieved by calculating the
difference between the value in A0 for
processing A and the value in A0 for
processing B. The interval is counted in
100 ms units.
A40 to --- Ethernet When an error has occurred, the error For details of the Retained Retained Refreshed
A44 Communication Error code, error contents, and error's time error code and the when error
Log and date are stored in the Error Log error contents, refer occurs.
Area. Information on the most recent to 6-1-11 Other Error
errors can be stored. in the CP2E CPU
Each error record occupies 5 words. Unit Hardware User's
Manual (Cat. No.
A40: Error code (bits 0 to 15) W613).
A41: Error contents (bits 0 to 15)
A42: Minutes (upper byte), Seconds
(lower byte)
A43: Day of month (upper byte), Hours
(lower byte)
A44: Year (upper byte), Month (lower
byte)

A-58 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A45 14 Ethernet Link Status Ethernet port of N14/20 CPU unit and ON: Ethernet link is --- Cleared Refreshed
Flag (N14/20 Ethernet port A of N30/40/60 CPU unit will be established when the
port, N30/40/60 ON when the Ethernet link is OFF: Ethernet link is Ethernet link
Ethernet PORT1A) established. terminated status is
changed.
15 Ethernet Link Status Port B of N30/40/60 CPU unit will be
Flag (N30/40/60 ON when the Ethernet link is
Ethernet PORT1B) established.
A46 02 IP Address Setting ON when the IP address meets the ON: Error --- Cleared Refreshed
Erro Flag following conditions: OFF: Normal when error
• All bits of the host ID are 0 or 1 occurs

• All bits of the net ID are 0 or 1


• All bits of the subnet ID are 1
• IP address starts with 127 (0x7F)
03 IP Address Table Error ON when the IP address table is ON: Error --- Cleared
Flag abnormal. OFF: Normal
04 IP Router Table Error ON when the IP router table is ON: Error --- Cleared
Flag abnormal. OFF: Normal
05 DNS Server Error Flag ON when DNS server meets the ON: Error --- Cleared
following conditions: OFF: Normal
• The IP address of the server is
invalid
• Time-out occurs in server communi-
cation
06 Routing Table Error ON when the routing table setting is ON: Error --- Cleared
Flag abnormal. OFF: Normal
11 SNTP Server Error ON when SNTP server meets the ON: Error --- Cleared

A-2 Auxiliary Area Allocations by Address


Flag following conditions: OFF: Normal
• The IP address of the server or the
host name is invalid
• Time-out occurs in servecr commu-
nication
14 Address Disagreement ON when meets the following ON: Disagree --- Cleared
Flag conditions: OFF: Agree
• IP address conversion method is set
to Automatic
• Host ID of your IP address and the
FINS node address do not match
A47 00 FINS/TCP Connection ON when FINS/TCP connection is ON: Connection --- Cleared When
Establish Flag (No.1) established. Established connection
OFF: Connection state changes
01 FINS/TCP Connection
Establish Flag (No.2) Disconnected

02 FINS/TCP Connection
App
Establish Flag (No.3)
A-2-1 Read-only Words

CP2E CPU Unit Software User’s Manual(W614) A-59


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A50 04 Serial Port 1 (EX) ON when a communication error has ON: Error Retained Cleared Refreshed
Communication Error occurred at the Serial Port 1 (EX). OFF: Normal when error
Flag occurs
05 Serial Port 1 (EX) ON when the Serial Port 1 (EX) is able ON: Able-to-send Retained Cleared Written after
Send Ready Flag to send data in no-protocol mode. OFF: Unable-to-send transmission.
(No-protocol Mode)
06 Serial Port 1 (EX) ON when the Serial Port 1 (EX) has ON: Reception Retained Cleared Written after
Reception Completed completed the reception in no-protocol completed transmission.
Flag (No-protocol mode. OFF: Reception not
Mode) • When the number of bytes was completed
specified: ON when the specified
number of bytes is received.
• When the end code was specified:
ON when the end code is received or
256 bytes are received.
07 Serial Port 1 (EX) • ON when a data overflow occurred ON: Overflow Retained Cleared Written after
Reception Overflow during reception through the Serial OFF: No overflow transmission.
Flag (No-protocol Port 1 (EX) in no-protocol mode.
Mode) • When the number of bytes was
specified: ON when more data is
received after the reception was
completed but before RXD was exe-
cuted.
• When the end code was specified:
ON when more data is received after
the end code was received but
before RXD was executed.
• ON when 257 bytes are received
before the end code.
A51 00 to Serial Port 1(EX) The corresponding bit will be ON when ON: Communicating Retained Cleared Refreshed
07 Polled Unit the Serial Port 1(EX) is communicating OFF: Not when there is a
Communications Flags with Serial PLC Link mode. communicating normal
Bits 0 to 7 correspond to Units 0 to 7. response to
the token.
00 to Serial Port 1(EX) Indicates (in binary) the number of Retained Cleared Refreshed
15 Reception Counter bytes of data received when the serial when data is
(No-protocol mode port 1(EX) is in no-protocol mode. received.
only)
A52 --- Pulse Lower four Contain the number of pulses output Cleared Cleared • Refreshed
Output 2 digits from the corresponding pulse output each cycle
PV port. during the
A53 Upper four
PV range: 8000 0000 to 7FFF FFFF overseeing
digits
hex (-2,147,483,648 to 2,147,483,647) processes.
A54 --- Pulse Lower four When pulses are being output in the
• Refreshed
Output 3 digits CW direction, the PV is incremented by when the INI
PV
A55 Upper four 1 for each pulse. instruction is
digits When pulses are being output in the executed
CCW direction, the PV is decremented (PV
by 1 for each pulse. change).
PV after overflow: 7FFF FFFF hex
PV after underflow: 8000 0000 hex
Note If the coordinate system is rela-
tive coordinates (undefined ori-
gin), the PV will be cleared to 0
when a pulse output starts, i.e.
when a pulse output instruction
(SPED, ACC, PLS2, ITPL or
IFEED) is executed.

A-60 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A56 00 Pulse Output 2 This flag will be ON when pulses are ON: Accelerating or --- Cleared Refreshed
Accel/Decel Flag being output from pulse output 2 decelerating each cycle
according to an ORG, ACC, PLS2, OFF: Constant speed during the
ITPL or IFEED instruction and the overseeing
output frequency is being changed in processes.
steps (accelerating or decelerating).
01 Pulse Output 2 This flag indicates when an overflow or ON: Overflow or --- Cleared • Refreshed
Overflow/Underflow underflow has occurred in the pulse underflow when the PV
Flag output 2 PV. OFF: Normal is changed
by the INI
instruction.
• Refreshed
when an
overflow or
underflow
occurs.
02 Pulse Output 2 Output ON when the number of output pulses ON: Setting made --- Cleared • Refreshed
Amount Set Flag for pulse output 2 has been set with the OFF: No setting when the
PULS instruction. PULS
instruction is
executed.
• Refreshed
when pulse
output stops.
03 Pulse Output 2 Output ON when the number of output pulses ON: Output --- Cleared Refreshed at
Completed Flag set with the PULS, PLS2, ITPL or completed the start or
IFEED instruction has been output OFF: Output not completion of
through pulse output 2. completed pulse output.

04 Pulse Output 2 Output ON when pulses are being output from ON: Outputting --- Cleared Refreshed
In-progress Flag pulse output 2. pulses when pulse

A-2 Auxiliary Area Allocations by Address


OFF: Stopped output starts or
stops.
05 Pulse Output 2 ON when the origin has not been ON: Origin not ON ON Refreshed
No-origin Flag determined for pulse output 2 and goes established each cycle
OFF when the origin has been OFF: Origin during the
determined. established overseeing
processes.
06 Pulse Output 2 ON when the pulse output 2 PV ON: Stopped at origin --- Cleared Refreshed
At-origin Flag matches the origin (0). OFF: Not stopped at each cycle
origin during the
overseeing
processes.
07 Pulse Output 2 Output ON when an error occurred while out ON: Stop error --- Cleared • Refreshed A438
Stopped Error Flag putting pulses in the pulse output 2 occurred when origin
origin search function. OFF: No error search
The Pulse Output 2 Output Stop Error starts.
code will be written to A438. • Refreshed
App
when a
pulse output
stop error
occurs.
A-2-1 Read-only Words

08 Pulse Output 2 ON between Input Interrupt - ON: Feeding Cleared Cleared • Refreshed
Interrupt Feeding Flag decelerating to stop when Interrupt OFF: Not feeding when feed-
Feeding function (IFEED instruction) is ing is com-
executing. pleted.
• Refreshed
when inter-
rupt feeding
is executing.
09 Pulse Output 2 ON if an overflow or underflow error ON: Overflow or Cleared Cleared Refreshed
Interrupt Feeding Error occurs during input interrupt or underflow when interrupt
Flag specified number of pulse output, when OFF: Normal feeding is
Interrupt Feeding function (IFEED executing.
instruction) is executing.

CP2E CPU Unit Software User’s Manual(W614) A-61


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A57 00 Pulse Output 3 This flag will be ON when pulses are ON: Accelerating or --- Cleared Refreshed
Accel/Decel Flag being output from pulse output 3 decelerating each cycle
according to an ORG, ACC, PLS2, OFF: Constant speed during the
ITPL or IFEED instruction and the overseeing
output frequency is being changed in processes.
steps (accelerating or decelerating).
01 Pulse Output 3 This flag indicates when an overflow or ON: Overflow or --- Cleared • Refreshed
Overflow/Underflow underflow has occurred in the pulse underflow when the PV
Flag output 3 PV. OFF: Normal is changed
by the INI
instruction.
• Refreshed
when an
overflow or
underflow
occurs.
02 Pulse Output 3 Output ON when the number of output pulses ON: Setting made --- Cleared • Refreshed
Amount Set Flag for pulse output 3 has been set with the OFF: No setting when the
PULS instruction. PULS
instruction is
executed.
• Refreshed
when pulse
output stops.
03 Pulse Output 3 Output ON when the number of output pulses ON: Output --- Cleared Refreshed at
Completed Flag set with the PULS, PLS2, ITPL or completed the start or
IFEED instruction has been output OFF: Output not completion of
through pulse output3. completed pulse output.

04 Pulse Output 3 Output ON when pulses are being output from ON: Outputting --- Cleared Refreshed
In-progress Flag pulse output 3. pulses when pulse
OFF: Stopped output starts or
stops.
05 Pulse Output 3 ON when the origin has not been ON: Origin not ON ON Refreshed
No-origin Flag determined for pulse output 3 and goes established each cycle
OFF when the origin has been OFF: Origin during the
determined. established overseeing
processes.
06 Pulse Output 3 ON when the pulse output 3 PV ON: Stopped at origin --- Cleared Refreshed
At-origin Flag matches the origin (0). OFF: Not stopped at each cycle
origin during the
overseeing
processes.
07 Pulse Output 3 Output ON when an error occurred while out ON: Stop error --- Cleared • Refreshed A439
Stopped Error Flag putting pulses in the pulse output 3 occurred when origin
origin search function. OFF: No error search
The Pulse Output 3 Output Stop Error starts.
code will be written to A439. • Refreshed
when a
pulse output
stop error
occurs.
08 Pulse Output 3 ON between Input Interrupt - ON: Feeding Cleared Cleared • Refreshed
Interrupt Feeding Flag decelerating to stop when Interrupt OFF: Not feeding when feed-
Feeding function (IFEED instrnction) is ing is com-
executing. pleted.
• Refreshed
when inter-
rupt feeding
is executing.
09 Pulse Output 3 ON if an overflow or unlerflow error ON: Overflow or Cleared Cleared Refreshed
Interrupt Feeding Error occurrs during input interrupt or underflow when interrupt
Flag specified number of pulse output, when OFF: Normal feeding is
Interrupt Feeding function (IFEED executing.
instrnction) is executing.

A-62 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A99 00 UM Read Protection Indicates whether all of the ladder ON: UM read- Retained Retained When
Status programs in the PLC are protected. protection is
read-protected. OFF: UM not set or cleared
read-protected
A100 --- Error Log Area When an error has occurred, the error Error code Retained Retained Refreshed A500.14
to A199 code, error contents, and error's time Error contents: when error A300
and date are stored in the Error Log Address of Aux. Area occurs. A400
Area. Information on the 20 most word with details or
recent errors can be stored. 0000 hex if there is
Each error record occupies 5 words; no related word.
the function of these 5 words is as Seconds: 00 to 59,
follows: BCD
First word: Error code (bits 0 to 15)
First word + 1: Error contents (bits 0 to Minutes: 00 to 59,
15) BCD
First word + 2: Minutes (upper byte), Hours: 00 to 23, BCD
Seconds (lower byte) Day of month: 01 to
First word + 3: Day of month (upper 31, BCD
byte), Hours (lower byte)
First word + 4: Year (upper byte), Month: 01 to 12, BCD
Month (lower byte) Year: 00 to 99, BCD
Note 1 Errors generated by FAL(006)
and FALS(007) will also be
stored in this Error Log.
2 The Error Log Area can be
reset from the CX-Program-
mer.
3 If the Error Log Area is full (20
records) and another error
occurs, the oldest record in
A100 to A104 will be cleared,

A-2 Auxiliary Area Allocations by Address


the other 19 records are
shifted down, and the new
record is stored in A195 to
A199.
4 In an E……-type CPU Unit, the
data will be for 1:01.01 on Sun-
day January 1, 2001.
A200 11 First Cycle Flag ON for one cycle after PLC operation ON for the first cycle ON Cleared ---
begins (after the mode is switched from
PROGRAM to RUN or MONITOR, for
example).
12 Step Flag ON for one cycle when step execution ON for the first cycle Cleared Cleared ---
is started with STEP. This flag can be after execution of
used for initialization processing at the STEP.
beginning of a step.
14 Task Started Flag When a task switches from WAIT or INI ON: ON for first cycle Cleared Cleared ---
to RUN status, this flag will be turned (including
App
ON within the task for one cycle only. transitions from
Note The only difference between this WAIT and IN)
flag and A200.15 is that this flag OFF: Other
also turns ON when the task
switches from WAIT to RUN sta-
A-2-1 Read-only Words

tus.
15 First Task Startup Flag ON when a task is executed for the first ON: First execution Cleared Cleared ---
time. This flag can be used to check OFF: Not executable
whether the current task is being or not being
executed for the first time so that executed for the
initialization processing can be first time.
performed if necessary.

CP2E CPU Unit Software User’s Manual(W614) A-63


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A202 00 to Communications Port ON when a communication instruction ON: Network --- Cleared • Refreshed
07 Enabled Flags (SEND, RECV, or CMND) can be communication when com-
executed with the corresponding port is not being munications
number. executed finished.
Each bit corresponds to a OFF: Network • Refreshed
communication port number. communication when
Bits 00 to 07 correspond to is being instruction is
communications ports 0 to 7. executed executed.

15 Network ON when a communication instruction ON: Communication ---


Communications Port (SEND, RECV, or CMND) can be port available
Allocation Enabled executed with the automatic allocation OFF: Communication
Flag function. port not
available
A203 --- Network A response code is stored when a Except 0000: --- Cleared Refreshed
to A210 Communications network communication instruction Error code when
Completion Codes (SEND, RECV, or CMND) is executed. instruction is
0000: executed.
Each word corresponds to a port
number. Normal condition

Words A203 to A210 correspond to


communications ports 0 to 7.
A214 00 to First Cycle Flags after Each flag will turn ON for just one cycle ON: First cycle after --- Cleared Refreshed
07 Network when a communications instruction is communications when commu-
Communications executed using automatic finish only nications fin-
Finished communication port allocations. Each OFF: Other status ished.
bit 00 to 07 corresponds to
communication port 0 to 7.
A215 00 to First Cycle Flags after Each flag will turn ON for just one cycle ON: First cycle after --- Cleared Refreshed
07 Network when a communications instruction is communications when commu-
Communications Error executed using automatic error only nications fin-
communication port allocations and an OFF: Other status ished.
error occurs at the end of
communication.
Each bit 00 to 07 corresponds to
communication port 0 to 7.
If the flag is 1 (ON), please identify the
cause of error refer to the network
communication response code (A203
to A210).
A216 --- Network The communication response code is --- Cleared Refreshed
to A217 Communications stored and automatically set to any when
Completion Code channel address of the auxiliary relay instruction is
Storage Address when a communications instruction is executed.
executed using automatic
communication port allocations.
A218 --- Used Communications Stores the communications port 0000 to 0007 hex: --- Cleared Refreshed
Port Numbers numbers used when a communications Communications port when
instruction is executed using automatic 0 to 7 instruction is
communication port allocations. executed
A219 00 to Network ON when an error occurred during ON: Error occurred --- Cleared Refreshed
07 Communications Error execution of a network instruction OFF: Normal when
Flags (SEND, RECV, CMND, or PMCR). condition instruction is
Bits 00 to 07 correspond to executed
communications ports 0 to 7.
A262 --- Maximum Cycle Time These words contain the maximum 0 to FFFFFFFF: Cleared Cleared Refreshed
to A263 cycle time since the start of PLC 0 to 429,496,729.5 when updating
operation. The cycle time is recorded in ms the maximum
32-bit binary. The upper digits are in (0.1-ms units) cycle time.
A263 and the lower digits are in A262.
A264 --- Present Cycle Time These words contain the present cycle 0 to FFFFFFFF: Cleared Cleared Refreshed
to A265 time. The cycle time is recorded in 0 to 429,496,729.5 ms each cycle
32-bit binary. The upper digits are in (0.1-ms units) during the
A265 and the lower digits are in A264. overseeing
processes.

A-64 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A270 --- High-speed Counter 0 Contains the PV of high-speed counter Cleared Cleared • Refreshed
to A271 PV 0. A271 contains the upper 4 digits and each cycle
A270 contains the lower 4 digits. during the
overseeing
processes.
• Refreshed
when PRV
instruction is
executed to
read the PV.
• Refreshed
when INI
instruction is
executed.
A272 --- High-speed Counter 1 Contains the PV of high-speed counter Cleared Cleared • Refreshed
to A273 PV 1. A273 contains the upper 4 digits and each cycle
A272 contains the lower 4 digits. during the
overseeing
processes.
• Refreshed
when PRV
instruction is
executed to
read the PV.
• Refreshed
when INI
instruction is
executed.
A274 00 High-speed Counter 0 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle

A-2 Auxiliary Area Allocations by Address


Condition Met Flag high-speed counter 0 is being operated during the
in range-comparison mode. overseeing
01 High-speed Counter 0
processes.
Range 2 Comparison
Condition Met Flag • Refreshed
when PRV
02 High-speed Counter 0
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 0 results of
Range 4 Comparison range com-
Condition Met Flag parison.
04 High-speed Counter 0 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 0
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 0 This flag indicates whether a ON: Being executed --- Cleared Refreshed
App
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 0. comparison
operation
starts or stops.
A-2-1 Read-only Words

09 High-speed Counter 0 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 0 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.

CP2E CPU Unit Software User’s Manual(W614) A-65


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A274 10 High-speed Counter 0 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter 0 is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A275 00 High-speed Counter 1 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle
Condition Met Flag high-speed counter 1 is being operated during the
in range-comparison mode for upper overseeing
01 High-speed Counter 1
and lower limits. processes.
Range 2 Comparison
Condition Met Flag • Refreshed
when PRV
02 High-speed Counter 1
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 1 results of
Range 4 Comparison range com-
Condition Met Flag parison.
04 High-speed Counter 1 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 1
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 1 This flag indicates whether a ON: Being executed --- Cleared Refreshed
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 1. comparison
operation
starts or stops.
09 High-speed Counter 1 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 1 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.
10 High-speed Counter 1 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter 1 is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A276 --- Pulse Lower four Contain the number of pulses output Cleared Cleared • Refreshed
Output 0 digits from the corresponding pulse output each cycle
PV port. during the
A277 Upper four
PV range: 8000 0000 to 7FFF FFFF overseeing
digits
hex processes.
A278 --- Pulse Lower four
(-2,147,483,648 to 2,147,483,647) • Refreshed
Output 1 digits
when the INI
PV
A279 Upper four When pulses are being output in the instruction is
digits CW direction, the PV is incremented by executed
1 for each pulse. (PV
When pulses are being output in the change).
CCW direction, the PV is decremented
by 1 for each pulse.
PV after overflow: 7FFF FFFF hex
PV after underflow: 8000 0000 hex
Note If the coordinate system is rela-
tive coordinates (undefined ori-
gin), the PV will be cleared to 0
when a pulse output starts, i.e.
when a pulse output instruction
(SPED, ACC, PLS2, ITPL or
IFEED) is executed.

A-66 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A280 00 Pulse Output 0 This flag will be ON when pulses are ON: Accelerating or --- Cleared Refreshed
Accel/Decel Flag being output from pulse output 0 decelerating each cycle
according to an ORG, ACC, PLS2, OFF: Constant speed during the
ITPL or IFEED instruction and the overseeing
output frequency is being changed in processes.
steps (accelerating or decelerating).
01 Pulse Output 0 This flag indicates when an overflow or ON: Overflow or --- Cleared • Refreshed
Overflow/Underflow underflow has occurred in the pulse underflow when the PV
Flag output 0 PV. OFF: Normal is changed
by the INI
instruction.
• Refreshed
when an
overflow or
underflow
occurs.
02 Pulse Output 0 ON when the number of output pulses ON: Setting made --- Cleared • Refreshed
Output Amount Set for pulse output 0 has been set with the OFF: No setting when the
Flag PULS instruction. PULS
instruction is
executed.
• Refreshed
when pulse
output stops.
03 Pulse Output 0 ON when the number of output pulses ON: Output --- Cleared Refreshed at
Output Completed set with the PULS, PLS2, ITPL or completed the start or
Flag IFEED instruction has been output OFF: Output not completion of
through pulse output 0. completed pulse output.

04 Pulse Output 0 ON when pulses are being output from ON: Outputting --- Cleared Refreshed
Output In-progress pulse output 0. pulses when pulse

A-2 Auxiliary Area Allocations by Address


Flag OFF: Stopped output starts or
stops.
05 Pulse Output 0 ON when the origin has not been ON: Origin not ON ON Refreshed
No-origin Flag determined for pulse output 0 and goes established each cycle
OFF when the origin has been OFF: Origin during the
determined. established overseeing
processes.
06 Pulse Output 0 ON when the pulse output 0 PV ON: Stopped at origin --- Cleared Refreshed
At-origin Flag matches the origin (0). OFF: Not stopped at each cycle
origin during the
overseeing
processes.
07 Pulse Output 0 ON when an error occurred while ON: Stop error --- Cleared • Refreshed A444
Output Stopped Error outputting pulses in the pulse output 0 occurred when origin
Flag origin search function. OFF: No error search
The Pulse Output 0 Output Stop Error starts.
code will be written to A444. • Refreshed
App
when a
pulse output
stop error
occurs.
A-2-1 Read-only Words

08 Pulse Output 0 ON between Input Interrupt - ON: Feeding Cleared Cleared • Refreshed
Interrupt Feeding Flag decelerating to stop when Interrupt OFF: Not feeding when feed-
Feeding function (IFEED instruction) is ing is com-
executing. pleted.
• Refreshed
when inter-
rupt feeding
is executing.
09 Pulse Output 0 ON if an overflow or underflow error ON: Overflow or Cleared Cleared Refreshed
Interrupt Feeding Error occurs during input interrupt or underflow when interrupt
Flag specified number of pulse output, when OFF: Normal feeding is
Interrupt Feeding function (IFEED executing.
instruction) is executing.

CP2E CPU Unit Software User’s Manual(W614) A-67


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A281 00 Pulse Output 1 This flag will be ON when pulses are ON: Accelerating or --- Cleared Refreshed
Accel/Decel Flag being output from pulse output 1 decelerating each cycle
according to an ORG, ACC, PLS2, OFF: Constant speed during the
ITPL or IFEED instruction and the overseeing
output frequency is being changed in processes.
steps (accelerating or decelerating).
01 Pulse Output 1 This flag indicates when an overflow or ON: Overflow or --- Cleared • Refreshed
Overflow/Underflow underflow has occurred in the pulse underflow when the PV
Flag output 1 PV. OFF: Normal is changed
by the INI
instruction.
• Refreshed
when an
overflow or
underflow
occurs.
02 Pulse Output 1 ON when the number of output pulses ON: Setting made --- Cleared • Refreshed
Output Amount Set for pulse output 1 has been set with the OFF: No setting when the
Flag PULS instruction. PULS
instruction is
executed.
• Refreshed
when pulse
output stops.
03 Pulse Output 1 ON when the number of output pulses ON: Output --- Cleared Refreshed at
Output Completed set with the PULS, PLS2, ITPL or completed the start or
Flag IFEED instruction has been output OFF: Output not completion of
through pulse output 1. completed pulse output.

04 Pulse Output 1 ON when pulses are being output from ON: Outputting --- Cleared Refreshed
Output In-progress pulse output 1. pulses when pulse
Flag OFF: Stopped output starts or
stops.
05 Pulse Output 1 ON when the origin has not been ON: Origin not ON ON Refreshed
No-origin Flag determined for pulse output 1 and goes established each cycle
OFF when the origin has been OFF: Origin during the
determined. established overseeing
processes.
06 Pulse Output 1 ON when the pulse output 1 PV ON: Stopped at origin --- Cleared Refreshed
At-origin Flag matches the origin (0). OFF: Not stopped at each cycle
origin during the
overseeing
processes.
07 Pulse Output 1 ON when an error occurred while ON: Stop error --- Cleared • Refreshed A445
Output Stopped Error outputting pulses in the pulse output 1 occurred when origin
Flag origin search function. OFF: No error search
The Pulse Output 1 Output Stop Error starts.
code will be written to A445. • Refreshed
when a
pulse output
stop error
occurs.
08 Pulse Output 1 ON between Input Interrupt - ON: Feeding Cleared Cleared • Refreshed
Interrupt Feeding Flag decelerating to stop when Interrupt OFF: Not feeding when feed-
Feeding function (IFEED instruction) is ing is com-
executing. pleted.
• Refreshed
when inter-
rupt feeding
is executing.
09 Pulse Output 1 ON if an overflow or underflow error ON: Overflow or Cleared Cleared Refreshed
Interrupt Feeding Error occurs during input interrupt or underflow when interrupt
Flag specified number of pulse output, when OFF: Normal feeding is
Interrupt Feeding function (IFEED executing.
instruction) is executing.
A283 00 PWM Output 0 ON when pulses are being output from ON: Outputting Cleared Cleared Refreshed
Output In-progress PWM output 0. pulses when pulse
Flag OFF: Stopped output starts or
stops.

A-68 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A294 Task Number when This word contains the task number of Cyclic tasks: 0000 Cleared Cleared When program A298/
Program Stopped the task that was being executed when Interrupt tasks: 8000 error occurs. A299
program execution was stopped to 800F (task 0 to 15)
because of a program error.
Note A298 and A299 contain the pro-
gram address where program
execution was stopped.
A295 08 Instruction Processing This flag and the Error Flag (ER) will be ON: Error Flag ON Cleared Cleared When program A294,
Error Flag turned ON when an instruction OFF: Error Flag OFF error occurs. A298/
processing error has occurred and the A299
PLC Setup has been set to stop PLC
operation for an instruction error. CPU Setup
Unit operation will stop and the (Operatio
ERR/ALM indicator will light when this n when
flag goes ON. instruction
Note The task number where the error error has
occurred will be stored in A294 occurred)
and the program address will be
stored in A298 and A299.
09 Indirect DM BCD Error This flag and the Access Error Flag ON: Not BCD Cleared Cleared When program A294,
Flag (AER) will be turned ON when an OFF: Normal error occurs. A298/
indirect DM BCD error has occurred A299
and the PLC Setup has been set to PLC
stop operation an indirect DM BCD Setup
error. (This error occurs when the (Operatio
content of an indirectly addressed DM n when
word is not BCD although BCD mode instruction
has been selected.) CPU Unit error has
operation will stop and the ERR/ALM occurred)
indicator will light when this flag goes
ON.

A-2 Auxiliary Area Allocations by Address


Note The task number where the error
occurred will be stored in A294
and the program address will be
stored in A298 and A299.
10 Illegal Access Error This flag and the Access Error Flag ON: Illegal access Cleared Cleared When program A294,
Flag (AER) will be turned ON when an occurred error occurs. A298/
illegal access error has occurred and OFF: Normal A299
the PLC Setup has been set to stop condition PLC
operation an illegal access error. (This Setup
error occurs when a region of memory (Operatio
is accessed illegally.) CPU Unit n when
operation will stop and the ERR/ALM instruction
indicator will light when this flag goes error has
ON. occurred)
The following operations are
considered illegal access:
• Reading/writing the system area
App
• Indirect DM BCD error (in BCD
mode)
Note The task number where the error
occurred will be stored in A294
and the program address will be
A-2-1 Read-only Words

stored in A298 and A299.


11 No END Error Flag ON when there isn’t an END instruction ON: No END Cleared Cleared When program A294,
in each program within a task. OFF: Normal error occurs. A298/
CPU Unit operation will stop and the condition A299
ERR/ALM indicator will light when this
flag goes ON.
Note The task number where the error
occurred will be stored in A294
and the program address will be
stored in A298 and A299.

CP2E CPU Unit Software User’s Manual(W614) A-69


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A295 12 Task Error Flag ON when a task error has occurred. A ON: Error Cleared Cleared When program A294,
task error will occur when there is no OFF: Normal error occurs. A298/
program allocated to the task. A299
Note The task number where the error
occurred will be stored in A294
and the program address will be
stored in A298 and A299.
13 Differentiation The allowed value for Differentiation ON: Error Cleared Cleared When program A294,
Overflow Error Flag Flags which correspond to OFF: Normal error occurs. A298/
differentiation instructions has been A299
exceeded. CPU Unit operation will stop
and the ERR/ALM indicator will light
when this flag goes ON.
Note The task number where the error
occurred will be stored in A294
and the program address will be
stored in A298 and A299.
14 Illegal Instruction Error ON when a program that cannot be ON: Error Cleared Cleared When program A294,
Flag executed has been stored. CPU Unit OFF: Normal error occurs. A298/
operation will stop and the ERR/ALM A299
indicator will light when this flag goes
ON.
15 UM Overflow Error ON when the last address in UM (User ON: Error Cleared Cleared When program A294,
Flag Memory) has been exceeded. CPU OFF: Normal error occurs. A298/
Unit operation will stop and the A299
ERR/ALM indicator will light when this
flag goes ON.
A297 --- Program Stop Error This word contains FFFF hex when the FFFF hex: Stop in the Retained Cleared When program A295,
Identification stop position is in the program except program error occurs. A297/
information the function block. Except FFFF hex: A298
This word contains the data other than Stop in the function
FFFF hex when the stop position is in block
the function block.
A298 --- Program Address These words contain the program Lower digits of the Cleared Cleared When program A294
Where Program address of the instruction where program address error occurs.
Stopped program execution was stopped due to
(Lower digits) a program error.
A299 --- Program Address Note A294 contains the task number of Upper digits of the
Where Program the task where program execu- program address
Stopped tion was stopped.
(Upper digits)
A300 --- Error Log Pointer When an error occurs, the Error Log 00 to 14 hex Retained Retained Refreshed A500.14
Pointer is incremented by 1 to indicate when error
the location where the next error record occurs.
will be recorded as an offset from the
beginning of the Error Log Area (A100
to A199).
Note 1 The Error Log Pointer can be
cleared to 00 by turning
A500.14 (the Error Log Reset
Bit) ON.
2 When the Error Log Pointer
has reached 14 hex (20 deci-
mal), the next record is stored
in A195 to A199 when the next
error occurs.
A310 --- Manufacturing Lot The manufacturing lot number is stored Examples: Retained Retained Fixed value
Number, Lower Digits in 6 digits hexadecimal. X, Y, and Z in Lot number 01805
the lot number are converted to 10, 11, A310 = 0801, A311 =
A311 --- Manufacturing Lot
and 12, respectively. 0005
Number, Upper Digits
Lot number 30Y05
A310 =1130, A311 =
0005

A-70 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A313 --- Error Contents for An error content is registered when a For details of the Cleared Cleared Refreshed A315.10
Ethernet Errors built-in Ethernet error or Ethernet error contents, refer when a
setting table error occurs. to 6-1-10 Non-fatal non-fatal error
Errors in the CP2E occurs.
CPU Unit Hardware
User's Manual (Cat.
No. W613).
A315 10 Built-in Etherent ON when an error occurs in the ON: Error Cleared Cleared Refreshed A313
Contents/Setup Error connection/setting of FINS/TCP, SNTP OFF: Normal when a A402.00
Flag and DNS server. non-fatal error
occurs.
11 Logic Error in Setting ON when an error occurs in the routing ON: Error Cleared Cleared Refreshed A402.00
Tables table, IP address table and IP router OFF: Normal when a
table. non-fatal error
The error code is stored in A313. occurs.

13 Option Board Error ON when the Option Board is removed ON: Error Cleared Cleared Refreshed A402.00,
Flag while the power is being supplied. OFF: Normal when a A424
ON when two Analog Option Boards non-fatal error
are mounted. occurs.

CPU Unit operation will continue and


the ERR/ALM indicator will flash.
Note OFF when the error has been
cleared.
15 Backup Memory Error ON when writing to the built-in Flash ON: Error Cleared Cleared Refreshed A402.00
Flag Memory fails. CPU Unit operation will OFF: Normal when a
continue and the ERR/ALM indicator non-fatal error
will flash. occurs.
Note OFF when the error has been
cleared.

A-2 Auxiliary Area Allocations by Address


A316 --- High-speed Counter 2 Contains the PV of high-speed counter Cleared Cleared • Refreshed
to A317 PV 2. each cycle
A317 contains the upper 4 digits and during the
A316 contains the lower 4 digits. overseeing
processes.
• Refreshed
when PRV
instruction is
executed to
read PV.
• Refreshed
when INI
instruction is
executed.
A318 to --- High-speed Counter 3 Contains the PV of high-speed counter Cleared Cleared • Refreshed
A319 PV 3. each cycle
A319 contains the upper 4 digits and during the
overseeing
App
A318 contains the lower 4 digits.
processes.
• Refreshed
when PRV
instruction is
A-2-1 Read-only Words

executed to
read PV.
• Refreshed
when INI
instruction is
executed.

CP2E CPU Unit Software User’s Manual(W614) A-71


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A320 00 High-speed Counter 2 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle
Condition Met Flag high-speed counter 2 is being operated during the
in range-comparison mode for upper overseeing
01 High-speed Counter 2
and lower limits. processes.
Range 2 Comparison
Condition Met Flag • Refreshed
when PRV
02 High-speed Counter 2
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 2 results of
Range 4 Comparison range com-
Condition Met Flag parison.
04 High-speed Counter 2 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 2
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 2 This flag indicates whether a ON: Being executed --- Cleared Refreshed
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 2. comparison
operation
starts or stops.
09 High-speed Counter 2 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 2 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.
10 High-speed Counter 2 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter 2 is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A321 00 High-speed Counter 3 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle
Condition Met Flag high-speed counter 3 is being operated during the
in range-comparison mode for upper overseeing
01 High-speed Counter 3
and lower limits. processes.
Range 2 Comparison
Condition Met Flag • Refreshed
when PRV
02 High-speed Counter 3
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 3 results of
Range 4 Comparison range com-
Condition Met Flag parison.
04 High-speed Counter 3 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 3
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 3 This flag indicates whether a ON: Being executed --- Cleared Refreshed
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 3. comparison
operation
starts or stops.

A-72 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A321 09 High-speed Counter 3 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 3 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.
10 High-speed Counter 3 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A322 High-speed Counter 4 Contains the PV of high-speed counter Cleared Cleared • Refreshed
to A323 PV 4. each cycle
A323 contains the upper four digits and during the
A322 contains the lower four digits. overseeing
processes.
• Refreshed
when PRV
instruction is
executed to
read PV.
• Refreshed
when INI
instruction is
executed.
A324 to High-speed Counter 5 Contains the PV of high-speed counter Cleared Cleared • Refreshed
A325 PV 5. each cycle

A-2 Auxiliary Area Allocations by Address


A325 contains the upper 4 digits and during the
A324 contains the lower 4 digits. overseeing
processes.
• Refreshed
when PRV
instruction is
executed to
read PV.
• Refreshed
when INI
instruction is
executed.
A326 00 High-speed Counter 4 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle
Condition Met Flag high-speed counter 4 is being operated during the
in range-comparison mode for upper overseeing
01 High-speed Counter 4
and lower limits. processes.
Range 2 Comparison
Condition Met Flag • Refreshed
App
when PRV
02 High-speed Counter 4
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 4 results of
A-2-1 Read-only Words

Range 4 Comparison range com-


Condition Met Flag parison.
04 High-speed Counter 4 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 4
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 4 This flag indicates whether a ON: Being executed --- Cleared Refreshed
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 4. comparison
operation
starts or stops.

CP2E CPU Unit Software User’s Manual(W614) A-73


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A326 09 High-speed Counter 4 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 4 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.
10 High-speed Counter 4 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A327 00 High-speed Counter 5 These flags indicate whether the PV is ON: PV in range Cleared Cleared • Refreshed
Range 1 Comparison within the specified ranges when OFF: PV not in range each cycle
Condition Met Flag high-speed counter 5 is being operated during the
in range-comparison mode. overseeing
01 High-speed Counter 5
processes.
Range 2 Comparison
Condition Met Flag • Refreshed
when PRV
02 High-speed Counter 5
instruction is
Range 3 Comparison
executed to
Condition Met Flag
read the
03 High-speed Counter 5 results of
Range 4 Comparison range com-
Condition Met Flag parison.
04 High-speed Counter 5 • Refreshed
Range 5 Comparison when range
Condition Met Flag comparison
table is reg-
05 High-speed Counter 5
istered.
Range 6 Comparison
Condition Met Flag
08 High-speed Counter 5 This flag indicates whether a ON: Being executed --- Cleared Refreshed
Comparison comparison operation is being OFF: Stopped when
In-progress Flag executed for high-speed counter 5. comparison
operation
starts or stops.
09 High-speed Counter 5 This flag indicates when an overflow or ON: Overflow or Cleared Cleared • Refreshed
Overflow/Underflow underflow has occurred in the underflow when an
Flag high-speed counter 5 PV. (Used with OFF: Normal overflow or
the linear mode counting range only.) underflow
occurs.
• Refreshed
when PV is
changed.
10 High-speed Counter 5 This flag indicates whether the ON: Incrementing --- Cleared Setting used
Count Direction high-speed counter is currently being OFF: Decrementing for high-speed
incremented or decremented. The counter, valid
counter PV for the current cycle is during counter
compared with the PV in last cycle to operation.
determine the direction.
A339 to --- Maximum These words contain the maximum --- Cleared • Written at A295.13
A340 Differentiation Flag value of the differentiation flag the start of
Number numbers being used by differentiation operation.
instructions. • Written at
the time of
online edit-
ing.

A-74 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A351 to Calendar/Clock Area These words contain the CPU Unit’s Retained Retained Written every
A354 internal clock data in BCD. The clock cycle
can be set from the CX-Programmer,
with the DATE instruction, or with a
FINS command (CLOCK WRITE,
0702).
A351.00 to A351.07:
Seconds (00 to 59)(BCD)
A351.08 to A351.15:
Minutes (00 to 59)(BCD)
A352.00 to A352.07:
Hours (00 to 23)(BCD)
A352.08 to A352.15:
Day of the month (01 to 31)(BCD)
A353.00 to A353.07:
Month (01 to 12)(BCD)
A353.08 to A353.15:
Year (00 to 99)(BCD)
A354.00 to A354.07:
Day of the week (00 to 06)(BCD)
00: Sunday
01: Monday
02: Tuesday
03: Wednesday
04: Thursday
05: Friday

A-2 Auxiliary Area Allocations by Address


06: Saturday
Note In an E……-type CPU Unit or
when time alignment cannot be
executed with an N/S……-type
CPU Unit, the data will be for
1:01.01 on Sunday January 1,
2001.
A360 01 to Executed FAL Number The flag corresponding to the specified ON: That FAL Retained Cleared Refreshed A402.15
to A391 15 Flags FAL number will be turned ON when executed when error
FAL is executed. Bits A360.01 to OFF: That FAL not occurs.
A391.15 correspond to FAL numbers executed
001 to 511.
Note The flag will be turned OFF when
the error is cleared.

App
A-2-1 Read-only Words

CP2E CPU Unit Software User’s Manual(W614) A-75


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A392 04 Serial Port 1/ ON when an error has occurred at the ON: Error Retained Cleared Refreshed
Built-in RS-232C Port serial port 1 or built-in RS-232C port. OFF: Normal when error
Error Flag (Not valid in NT Link mode.) occurs.
05 Serial Port 1/ ON when the serial port 1 or built-in ON: Able-to-send Retained Cleared Written after
Built-in RS-232C Port RS-232C port is able to send data in OFF: Unable-to-send transmission
Send Ready Flag no-protocol mode.
(No-protocol mode)
06 Serial Port 1/ ON when the serial port 1 or built-in ON: Reception Retained Cleared Written after
Built-in RS-232C Port RS-232C port has completed the completed reception
Reception Completed reception in no-protocol mode. OFF: Reception not
Flag (No-protocol • When the number of bytes was completed
mode) specified: ON when the specified
number of bytes is received.
• When the end code was specified:
ON when the end code is received or
256 bytes are received.
07 Serial Port 1/ ON when a data overflow occurred ON: Overflow Retained Cleared Refreshed
Built-in RS-232C Port during reception through the serial port OFF: No overflow when error
Reception Overflow 1 or built-in RS-232C port in occurs.
Flag (No-protocol no-protocol mode.
mode) • When the number of bytes was
specified: ON when more data is
received after the reception was
completed but before RXD was exe-
cuted.
• When the end code was specified:
ON when more data is received after
the end code was received but
before RXD was executed.
ON when 257 bytes are received
before the end code.
12 Serial Port 2/ ON when a communications error has ON: Error Retained Cleared Refreshed
Built-in RS-485 Port occurred at the serial port 2 or built-in OFF: No error when error
Communications Error RS-485 port. (Not valid in NT Link occurs.
Flag (CP2E N30/40/60 mode.)
or S……-type CPU Unit
only)
13 Serial Port 2/ ON when the serial port 2 or built-in ON: Able-to-send Retained Cleared Written after
Built-in RS-485 Port RS-485 port is able to send data in OFF: Unable-to-send transmission
Send Ready Flag no-protocol mode.
(No-protocol Mode)
(CP2E N30/40/60 or
S……-type CPU Unit
only)
14 Serial Port 2/ ON when the serial port 2 or built-in ON: Reception Retained Cleared Written after
Built-in RS-485 Port RS-485 port has completed the completed reception
Reception Completed reception in no-protocol mode. OFF: Reception not
Flag (No-protocol • When the number of bytes was completed
mode) (CP2E specified: ON when the specified
N30/40/60 or number of bytes is received.
S……-type CPU Unit
only) • When the end code was specified:
ON when the end code is received or
256 bytes are received.
15 Serial Port 2/ ON when a data overflow occurred ON: Reception Retained Cleared Refreshed
Built-in RS-485 Port during reception through serial port 2 completed when error
Reception Overflow or built-in RS-485 port in no-protocol OFF: Reception not occurs.
Flag (No-protocol mode. completed
mode) (CP2E • When the number of bytes was
N30/40/60 or specified: ON when more data is
S……-type CPU Unit received after the reception was
only) completed but before RXD was exe-
cuted.
• When the end code was specified:
ON when more data is received after
the end code was received but
before RXD was executed.
ON when 257 bytes are received
before the end code.

A-76 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A393 00 to Serial Port 1/ The corresponding bit will be ON when ON: Communicating Retained Cleared Refreshed
07 Built-in RS-232C Port the serial port 1 or built-in RS-232C OFF: Not when there is a
Polled Unit port is communicating with NT Link communicating normal
Communications Flags mode or Serial PLC Link mode. response to
Bits 0 to 7 correspond to Units 0 to 7. the token.

00 to Serial Port 1/ Indicates (in binary) the number of Retained Cleared Refreshed
15 Built-in RS-232C Port bytes of data received when the serial when data is
Reception Counter port 1 or built-in RS-232C port is in received.
(No-protocol Mode) no-protocol mode.
A394 00 to Serial Port 2/ The corresponding bit will be ON when ON: Communicating Retained Cleared Refreshed
07 Built-in RS-485 Port the serial port 2 or built-in RS-485 port OFF: Not when there is a
Polled Unit is communicating with NT link mode or communicating normal
Communications Flags Serial PLC Link made. response to
(CP2E N30/40/60 or Bits 0 to 7 correspond to Units 0 to 7. the token.
S……-type CPU Unit
only)
00 to Serial Port 2/ Indicates (in binary) the number of Retained Cleared Refreshed
15 Built-in RS-485 Port bytes of data received when the serial when data is
Reception Counter port 2 or built-in RS-485 port is in received.
(No-protocol Mode) no-protocol mode.
(CP2E N30/40/60 or
S……-type CPU Unit
only)
A395 08 Clock Stop Flag • ON if Clock stop working. ON: Clock stops Retained Cleared Refreshed
• Cleared when Clock set. OFF: Clock is running when power is
ON.
A400 --- Error code When a non-fatal error (user-defined Cleared Cleared Refreshed
FALS or system error) or a fatal error when error
(user-defined FALS or system error) occurs.
occurs, the 4-digit hexadecimal error

A-2 Auxiliary Area Allocations by Address


code is written to this word.
Note When two or more errors occur
simultaneously, the highest error
code will be recorded.
A401 04 Built-in Ethernet Stop ON when the built-in Ethernet stops. ON: Error Retained Cleared Refreshed
Error Flag The ERR/ALM indicator on front of the OFF: Normal when error
CPU unit will light. occurs.
06 FALS Error Flag ON when a fatal error is generated by ON: FALS executed Cleared Cleared Refreshed A400
(fatal error) the FALS instruction. The CPU Unit will OFF: FALS not when error
stop operating and the ERR/ALM executed occurs.
indicator will light.
The corresponding error code will be
written to A400. Error codes C101 to
C2FF correspond to FALS numbers
001 to 511.
Note This flag will be turned OFF when
the FALS errors are cleared.
App
08 Cycle Time Too Long ON if the cycle time exceeds the ON: Cycle time over Cleared Cleared Refreshed PLC
Flag maximum cycle time set in the PLC max. when the cycle Setup
(fatal error) Setup (the cycle time monitoring time). OFF: Cycle time time exceeds (Cycle
CPU Unit operation will stop and the under max. maximum. time
A-2-1 Read-only Words

ERR/ALM indicator on the front of the monitorin


CPU Unit will light. g time)
Note This flag will be turned OFF when
the error is cleared.

CP2E CPU Unit Software User’s Manual(W614) A-77


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A401 09 Program Error Flag ON when program contents are ON: Error Cleared Cleared Refreshed A294,
(fatal error) incorrect. CPU Unit operation will stop OFF: Normal when error A295,
and the ERR/ALM indicator on the front occurs. A298 and
of the CPU Unit will light. The task A299
number where the error occurred will
be stored in A294 and the program
address will be stored in A298 and
A299. The type of program error that
occurred will be stored in A295.08 to
A295.15. Refer to the description of
A295 for more details on program
errors.
11 Too Many I/O Points ON when the number of Expansion ON: Error Cleared Cleared Refreshed A407
Flag Units and Expansion I/O Units exceeds OFF: Normal when error
(fatal error) the limit, when the number of words occurs.
allocated to these Units exceeds the
limit, are mounted.
CPU Unit operation will stop and the
ERR/ALM indicator on the front of the
CPU Unit will light.
14 I/O Bus Error Flag ON in the following cases: ON: Error Cleared Cleared Refreshed A404
(fatal error) • When an error occurs in a data OFF: Normal when error
transfer between the CPU Unit and occurs.
an Expansion Unit or Expansion I/O
Unit. If this happens, 0A0A hex will
be output to A404.
CPU Unit operation will stop and the
ERR/ALM indicator on the front of the
CPU Unit will light.
15 Memory Error Flag ON when an error occurred in memory. ON: Error Cleared Cleared Refreshed A403.00
(fatal error) OFF: Normal when error to
CPU Unit operation will stop and the occurs. A403.08,
ERR/ALM indicator on the front of the A403.09
CPU Unit will light. The location where
the error occurred is indicated in
A403.00 to A403.14.
This flag will be turned OFF when the
error is cleared.

A-78 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A402 00 Other Non-Fatal Error ON when a non-fatal error that is not ON: Other non-fatal Cleared Cleared Refreshed A315
Flag defined for A402.01 to A402.15 occurs. error when error
Detailed information is output to the OFF: No other occurs.
bits of A315. non-fatal error
04 Battery Error Flag ON if the CPU Unit’s battery is ON: Error Cleared Cleared Refreshed PLC
(non-fatal error) disconnected or its voltage is low and OFF: Normal when error Setup
the Detect Battery Error setting has occurs. (Detect
been set in the PLC Setup. Battery
The CPU Unit will continue operating Error)
and the ERR/ALM indicator on the front
of the CPU Unit will flash.
• This flag can be used to control an
external warning light or other indica-
tor to indicate that the battery needs
to be replaced.
• This flag will be turned OFF when
the error is cleared.
10 PLC Setup Error Flag ON when there is a setting error in the ON: Error Cleared Cleared Refreshed
(non-fatal error) PLC Setup. The CPU Unit will continue OFF: Normal when error
operating and the ERR/ALM indicator occurs.
on the front of the CPU Unit will flash.
Note This flag will be turned OFF when
the error is cleared.
15 FAL Error Flag ON when a non-fatal error is generated ON: FAL error Cleared Cleared Refreshed A360 to
(non-fatal error) by executing FAL. The CPU Unit will occurred when error A391,
continue operating and the ERR/ALM OFF: FAL not occurs. A400
indicator on the front of the CPU Unit executed
will flash.
The bit in A360 to A391 that

A-2 Auxiliary Area Allocations by Address


corresponds to the FAL number
specified in FALS will be turned ON
and the corresponding error code will
be written to A400. Error codes 4101 to
42FF correspond to FAL numbers 001
to 2FF (0 to 511).
Note This flag will be turned OFF when
the error is cleared.
A403 00 to Memory Error Location When a memory error occurs, the ON: Error Cleared Cleared Refreshed A401.15
14 Memory Error Flag (A401.15) is turned OFF: Normal when error
ON and one of the following flags is occurs.
turned ON to indicate the memory area
where the error occurred
A403.00: Ladder program
A403.04: PLC Setup
A403.07: Routing table
A403.11: IP address table
App
A403.12: IP router table
A403.14: I/O memory
When a memory error occurs, the CPU
Unit will continue operating and the
A-2-1 Read-only Words

ERR/ALM indicator on the front of the


CPU Unit will flash.
Note The corresponding flag will be
turned OFF when the error is
cleared.
A404 I/O Bus Error Details Contains information on I/O bus errors. 0A0A hex: Expansion Cleared Cleared Refreshed A401.14
The CPU Unit will stop operating and Unit error when error is
the ERR/ALM indicator on the front of detected.
the CPU Unit will light.
Note A401.14 (I/O Bus Error Flag) will
turn ON.
A407 13 to Too Many I/O Points, The 3-digit binary value of these bits 010: Too many Cleared Cleared Refreshed A401.11
15 Cause indicates the cause of the Too Many Expansion Unit and when error
I/O Points Error. Expansion I/O Unit occurs.
words

CP2E CPU Unit Software User’s Manual(W614) A-79


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A424 00 to Error Option Board The bit corresponding to the option slot ON: Error Cleared Cleared Refreshed A353.13
15 Flags turns ON when an error occurs in an OFF: Normal when error
Option Board (A315.13 will be ON). occurs.
Bit 00: Option slot 1 (Left)
Bit 01: Option slot 2 (Right)
A435 14 I/O Option Board Run Turn ON when the I/O Option Board ON: In initial Cleared Cleared When I/O
State Flag works normally. Turn OFF when the processing or option board
(Option 1/Left) I/O Option Board is in initial processing error occurred. state changes.
or an error occurs. OFF: Normal
15 I/O Option Board Run
State Flag
(Option 2/Right)
A436 00 to Expansion Unit and ON when an error occurs in a ON: Error Retained Cleared
02 Expansion I/O Unit CP-series Expansion Unit or OFF: Normal
Error Flags Expansion I/O Unit.
A436.00: 1st Unit
A436.01: 2nd Unit
A436.02: 3rd Unit
A436.03: 4th Unit
A436.04: 5th Unit
A436.05: 6th Unit
Note CP1W-TS002/TS003/TS102/
AD041/AD042/DA041/DA042/
MAD42/MAD44/32ER/32ET/32E
T1 are each counted as two
Units.
A437 --- Number of Connected Stores the number of Expansion Units 0000 to 0006 hex Retained Cleared Retained when
Units and Expansion I/O Units connected as error occurs.
a hexadecimal number.
Note This information is invalid only
when a Too Many I/O Points error
has occurred.
CP1W-TS002/TS003/TS102/
AD041/AD042/DA041/DA042/
MAD42/MAD44/32ER/32ET/32ET
1 are each counted as two Units.
A438 --- Pulse Output 2 Stop If a Pulse Output Stop Error occurs for Retained Cleared Retained when
Error Code pulse output 2, the error code is written error occurs.
to this word.
A439 --- Pulse Output 3 Stop If a Pulse Output Stop Error occurs for Retained Cleared Retained when
Error Code pulse output 3, the error code is written error occurs.
to this word.
A440 --- Max. Interrupt Task Contains the Maximum Interrupt Task 0000 to FFFF hex Cleared Cleared Written after
Processing Time Processing Time in units of 0.1 ms. the interrupt
Note This value is cleared when PLC task with the
operation begins. max.
processing
time is
executed.
A441 --- Interrupt Task with Contains the task number of the 8000 to 800F hex Cleared Cleared Written after
Max. Processing Time interrupt task with the maximum the interrupt
processing time. Hexadecimal values task with the
8000 to 800F correspond to task max.
numbers 00 to 0F. Bit 15 is turned ON processing
when an interrupt has occurred. time is
Note This value is cleared when PLC executed.
operation begins.
A442 --- Total Interrupt Task Contains the Total Interrupt Task Pro- 0000 to FFFF hex Cleared Cleared Each cycle A440
Processing Time One cessing Time in one cycle in units of
Cycle 0.1ms.Sets when the value is bigger
than the last one once a cycle by com-
mon processing.
Note This value is cleared when PLC
operation begins. The value is
unstable for CPU Unit version 1.0
or earlier.

A-80 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A444 --- Pulse Output 0 If a Pulse Output Stop Error occurs for Retained Cleared • Refreshed
Stop Error Code pulse output 0, the error code is written when origin
to this word. search
starts.
• Refreshed
when a
pulse output
stop error
occurs.
A445 --- Pulse Output 1 If a Pulse Output Stop Error occurs for Retained Cleared • Refreshed
Stop Error Code pulse output 1, the error code is written when origin
to this word. search
starts.
• Refreshed
when a
pulse output
stop error
occurs.

A-2 Auxiliary Area Allocations by Address


App
A-2-1 Read-only Words

CP2E CPU Unit Software User’s Manual(W614) A-81


Appendices

A-2-2 Read/Write Words


Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A500 11 Ethernet Communica- Turn this bit ON to clear Ethernet com- Retained Cleared ---
tion Error Clear Flag munication error.
After clearing, the system automati-
cally returns to OFF.
12 IOM Hold Bit Turn ON this bit to preserve the status ON: Retained Retained Cleared ---
of the I/O Memory when shifting from OFF: Not retained
PROGRAM to RUN or MONITOR
mode or vice versa.
13 Forced Status Hold Turn ON this bit to preserve the status ON: Retained Retained Cleared ---
Bit of bits that have been force-set or OFF: Not retained
force-reset when shifting from PRO-
GRAM to MONITOR mode or vice
versa. Always use this bit together with
the IOM Hold Bit (A500.12), i.e., turn
them ON at the same time.
14 Error Log Reset Bit Turn this bit ON to reset the Error Log OFF to ON: Clear Retained Cleared --- A100 to
Pointer (A300) to 00. A199,
A300
Note 1 The contents of the Error Log
Area itself (A100 to A199) are
not cleared.
2 This bit is automatically reset
to 0 after the Error Log Pointer
is reset.
15 Output OFF Bit Turn this bit ON to turn OFF all outputs ON: All output OFF Retained Retained ---
from the CPU Unit, CP-series Expan- OFF: Normal opera-
sion Units, and CP-series Expansion tion
I/O Units. The INH indicator on the
front of the CPU Unit will light while
this bit is ON.
A508 09 Differentiate Monitor ON when the differentiate monitor con- ON: Monitor condi- Retained Cleared Refreshed
Completed Flag dition has been established during tion established when differen-
execution of differentiation monitoring. OFF: Not yet estab- tiate monitor
lished condition is
Note This flag will be cleared to 0
executed.
when differentiation monitoring
starts.
A510 --- Startup Time These words contain the time at which See Function col- Retained See Refreshed
to the power was turned ON. The con- umn. Function when power is
A511 tents are updated every time that the column. turned ON.
power is turned ON. The data is stored
in BCD.
A510.00 to A510.07: Second (00 to
59)
A510.08 to A510.15: Minute (00 to 59)
A511.00 to A511.07: Hour (00 to 23)
A511.08 to A511.15: Day of month (01
to 31)

Note In an E……-type CPU Unit or


when time alignment cannot be
executed with an N/S……-type
CPU Unit, the data will be for
1:01.01 on Sunday January 1,
2001.

A-82 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A512 --- Power Interruption These words contain the time at which See Function col- Retained Retained Written at
to Time the power was interrupted. The con- umn. power
A513 tents are updated every time that the interruption.
power is interrupted. The data is
stored in BCD.
A512.00 to A512.07: Second (00 to
59)
A512.08 to A512.15: Minute (00 to 59)
A513.00 to A513.07: Hour (00 to 23)
A513.08 to A513.15: Day of month (01
to 31)

Note 1 These words are not cleared


at startup.
2 In an E……-type CPU Unit or
when time alignment cannot
be executed with an
N/S……-type CPU Unit, the
data will be for 1:01.01 on
Sunday January 1, 2001.
A514 --- Number of Power Contains the number of times that 0000 to FFFF hex Retained Retained Refreshed
Interruptions power has been interrupted since the when power is
power was first turned ON. The data is turned ON.
stored in binary. To reset this value,
overwrite the current value with 0000.
A515 --- Operation Start Time The time that operation started as a See Function col- Retained Retained See Function
to result of changing the operating mode umn. column.
A517 to RUN or MONITOR mode is stored
here in BCD.
A515.00 to A515.07: Seconds (00 to
59)

A-2 Auxiliary Area Allocations by Address


A515.08 to A515.15: Minutes (00 to
59)
A516.00 to A516.07: Hour (00 to 23)
A516.08 to A516.15: Day of month (01
to 31)
A517.00 to A517.07: Month (01 to 12)
A517.08 to A517.15: Year (00 to 99)

Note 1 The previous start time is


stored after turning ON the
power supply until operation is
started.
2 In an E……-type CPU Unit or
when time alignment cannot
be executed with an
N/S……-type CPU Unit, the
data will be for 1:01.01 on
Sunday January 1, 2001.
App
A-2-2 Read/Write Words

CP2E CPU Unit Software User’s Manual(W614) A-83


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A518 --- Operation End Time The time that operation stopped as a See Function col- Retained Retained See Function
to result of changing the operating mode umn. column.
A520 to PROGRAM mode is stored here in
BCD.
A518.00 to A518.07: Seconds (00 to
59)
A518.08 to A518.15: Minutes (00 to
59)
A519.00 to A519.07: Hour (00 to 23)
A519.08 to A519.15: Day of month (01
to 31)
A520.00 to A520.07: Month (01 to 12)
A520.08 to A520.15: Year (00 to 99)

Note 1 If an error occurs in operation,


the time of the error will be
stored. If the operating mode
is then changed to
PROGRAM mode, the time
that PROGRAM mode was
entered will be stored.
2 In an E……-type CPU Unit or
when time alignment cannot
be executed with an
N/S……-type CPU Unit, the
data will be for 1:01.01 on
Sunday January 1, 2001.
A521 00 Serial Port 1 (EX) These flags indicate what kind of error Bits 00 and 01: Not Retained Cleared Refreshed
to Error Flags (CP2E has occurred at the serial port 1 (EX). used. when commu-
07 N……-type CPU Unit • They are automatically turned OFF Bit 02: ON for parity nication error
only) when the serial port 1 (EX) is error. occurs.
restarted. Bit 03: ON for fram-
• Only bit 5 (timeout error) is valid in ing error.
NT Link mode.
Bit 04: ON for over-
• Serial PLC Link Polling Unit: run error.
Bit 05: ON for timeout error.
Bit 05: ON for time-
Serial PLC Link Polled Unit:
out error.
Bit 02: ON for parity error.
Bit 03: ON for framing error. Bits 06 and 07: Not
Bit 04: ON for overrun error. used.
These bits can be cleared by the
CX-Programmer.
A526 00 Serial Port 1/ Turn ON this bit to restart the serial OFF to ON: Restart Retained Cleared ---
Built-in RS-232C Port port 1 or built-in RS-232C port.
Restart Bit
Note This bit is turned OFF automati-
cally when the restart processing
is completed.
01 Serial Port 2/ Turn ON this bit to restart the serial OFF to ON: Restart Retained Cleared ---
Bult-in RS-485 Port port 2 or built-in RS-485 port.
Restart Bit (CP2E
Note This bit is turned OFF automati-
N30/40/60 or
cally when the restart processing
S……-type CPU Unit is completed.
only)
02 Serial Port 1 (EX) Turn ON this bit to restart the serial OFF to ON: Restart Retained Cleared ---
Restart Bit (CP2E port 1 (EX).
N……-type CPU Unit
Note This bit is turned OFF automati-
only)
cally when the restart processing
is completed.

A-84 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A528 00 Serial Port 1/ These flags indicate what kind of error Bits 00 and 01: Not Retained Cleared Refreshed
to Built-in RS-232C Port has occurred at the serial port 1 or used. when commu-
07 Error Flags built-in RS-232C port. Bit 02: ON for parity nication error
• They are automatically turned OFF error. occurs.
when the serial port 1 or built-in Bit 03: ON for fram-
RS-232C port is restarted. ing error.
• Only bit 5 (timeout error) is valid in
Bit 04: ON for over-
NT Link mode.
run error.
• Serial PLC Link Polling Unit:
Bit 05: ON for time-
Bit 05: ON for timeout error.
out error.
Serial PLC Link Polled Unit:
Bit 02: ON for parity error. Bits 06 and 07: Not
Bit 03: ON for framing error. used.
Bit 04: ON for overrun error.
These bits can be cleared by the
CX-Programmer.
08 Serial Port 2/ These flags indicate what kind of error Bits 08 and 09: Not Retained Cleared Refreshed
to Bult-in RS-485 Port has occurred at the serial port 2 or used. when commu-
15 Error Flags (CP2E built-in RS-485 port. Bit 10: ON for parity nication error
N30/40/60 or • They are automatically turned OFF error. occurs.
S……-type CPU Unit when the serial port 2 or built-in
only) Bit 11: ON for fram-
RS-485 port is restarted. ing error.
• Only bit 5 (timeout error) is valid in
Bit 12: ON for over-
NT Link mode.
run error.
• Serial PLC Link Polling Unit:
Bit 13: ON for time-
Bit 13: ON for timeout error.
out error.
Serial PLC Link Polled Unit:
Bit 10: ON for parity error. Bits 14 and 15: Not
Bit 11: ON for framing error. used.
Bit 12: ON for overrun error.

A-2 Auxiliary Area Allocations by Address


These bits can be cleared by the
CX-Programmer.
A529 --- FAL/FALS Number for Set a dummy FAL/FALS number to 0001 to 01FF hex: Retained Cleared ---
System Error Simula- use to simulate the system error using FAL/FALS numbers
tion FAL or FALS. 1 to 511

Note When FAL or FALS is executed 0000 or 0200 to


and the number in A529 is the FFFF hex: No
same as the one specified in the FAL/FALS number
operand of the instruction, the for system error sim-
system error given in the oper- ulation. (No error will
and of the instruction will be gen- be generated.)
erated instead of a user-defined
error.
A531 00 High-speed Counter 0 When the reset method is set to OFF to ON: Reset Retained Cleared ---
Reset Bit Phase-Z signal + Software reset, the
corresponding high-speed counter's
01 High-speed Counter 1
PV will be reset if the phase-Z signal is
Reset Bit
received while this bit is ON.
App
02 High-speed Counter 2
When the reset method is set to Soft-
Reset Bit
ware reset, the corresponding
03 High-speed Counter 3 high-speed counter's PV will be reset
Reset Bit in the cycle when this bit turns ON.
04 High-speed Counter 4
Reset Bit
05 High-speed Counter 5
Reset Bit

CP2E CPU Unit Software User’s Manual(W614) A-85


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A540 00 Pulse Output 0 Reset The pulse output 0 PV (contained in OFF to ON: Cleared Retained Cleared --- A276 and
Bit A276 and A277) will be cleared when A277
this bit is turned ON.
08 Pulse Output 0 CW This is the CW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 0, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.
09 Pulse Output 0 CCW This is the CCW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 0, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.
10 Pulse Output 0 This is the positioning completed input --- Retained Cleared ---
Positioning signal used in the origin search for
pulse output 0. The input signal from
Completed Signal the servo driver is output to this bit
from the ladder program to enable
using the signal.
A541 00 Pulse Output 1 Reset The pulse output 1 PV (contained in OFF to ON: Cleared Retained Cleared --- A278 and
Bit A278 and A279) will be cleared when A279
this bit is turned ON.
08 Pulse Output 1 CW This is the CW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 1, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.
09 Pulse Output 1 CCW This is the CCW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 1, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.
10 Pulse Output 1 This is the positioning completed input --- Retained Cleared ---
Positioning signal used in the origin search for
Completed Signal pulse output 1. The input signal from
the servo driver is output to this bit
from the ladder program to enable
using the signal.

A542 00 Pulse Output 2 Reset The pulse output 2 PV (contained in OFF to ON: Cleared Retained Cleared --- A52 and
Bit A52 and A53) will be cleared when A53
this bit is turned ON.

08 Pulse Output 2 CW This is the CW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 2, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.

09 Pulse Output 2 CCW This is the CCW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 2, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder program
and output the result to this flag.

10 Pulse Output 2 This is the positioning completed input --- Retained Cleared ---
Positioning signal used in the origin search for
Completed Signal pulse output 2. The input signal from
the servo driver is output to this bit
from the ladder program to enable
using the signal.

A-86 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A543 00 Pulse Output 3 Reset The pulse output 3 PV (contained in OFF to ON: Cleared Retained Cleared --- A54 and
Bit A54 and A55) will be cleared when A55
this bit is turned ON.

08 Pulse Output 3 CW This is the CW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 3, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder
programand output the result to this
flag.

09 Pulse Output 3 CCW This is the CCW limit input signal for --- Retained Cleared ---
Limit Input Signal Flag pulse output 3, which is used in the
origin search. To use this signal, write
the input from the actual sensor as an
input condition in the ladder
programand output the result to this
flag.

10 Pulse Output 3 This is the positioning completed input --- Retained Cleared ---
Positioning signal used in the origin search for
Completed Signal pulse output 3. The input signal from
the servo driver is output to this bit
from the ladder program to enable
using the signal.

A566 02 Socket Force-close OFF Æ ON: Forced close of all socket OFF to ON: Forced --- Cleared ---
Switch is executed. close is executed
Automatically turns OFF when closing
is completed.

04 Automatic Clock At the rise of OFF to ON, clock OFF to ON: Clock --- Cleared ---
Information information is obtained from SNTP information is

A-2 Auxiliary Area Allocations by Address


Adjustment Switch server and the clock information is obtained
reflected.
Automatically turns OFF after
reflection.

App

CP2E CPU Unit Software User’s Manual(W614) A-87


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A567 00 Open Processing Flag Flag keeps ON during open ON: During open --- Cleared Refreshed at
for Socket No.1 processing of socket No.1. processing the start or
Finish open process, and then flag OFF: Open completion of
turns OFF. completed open process

01 Reception Flag keeps ON during reception ON: Receiving --- Cleared Refreshed at
Progressing Flag for processing of socket No.1. OFF: Reception the start or
Socker No.1 Finish reception process, and then completed completion of
flag turns OFF. reception
process

02 Transmission Flag keeps ON during transimission ON: Sending --- Cleared Refreshed at
Progressing Flag for processing of socket No.1. OFF: Transimission the start or
Socket No.1 Finish transmission process, and then completed completion of
flag turns OFF. transmission
process

03 Close Processing Flag keeps ON during close ON: During close --- Cleared Refreshed at
Flag for Socker No.1 processing of socket No.1. processing the start or
Finish clsoe process, and then flag OFF: Close completion of
turns OFF. completed close process

13 Data Received Flag keeps ON when data is received ON: Data reception --- Cleared • Refreshed
Present/Not Present from the other node on an open TCP completed after recep-
Flag for Socket No.1 socket. OFF: Waiting for tion
Flag turns OFF when the reception reception • Refreshed
request is executed. when
reception
process is
requested

14 Result Storage Error Flag keeps ON when any value other ON: Code other than --- Cleared Refreshed
Flag for Socket No.1 than normal end (0000 hex) is stored normal end is when socket
stored
in the end code of the parameter area request
of socket No.1. OFF: Normal end process is
Flag turns OFF when the next request completed
is received.

15 TCP/UDP Open Flag When open processing of socket No.1 ON: Close com- --- Cleared Refreshed
for Socket No.1 is completed, the flag turns ON. pleted when
When closing process is completed or OFF: Open open/close
while closing, the flag turns OFF. completed process is
When open processing ends completed
abnormally, the flag remains OFF.

A-88 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A568 00 Open Processing Flag Flag keeps ON during open ON: During open --- Cleared Refreshed at
for Socket No.2 processing of socket No.2. processing the start or
Finish open process, and then flag OFF: Open completion of
turns OFF. completed open process

01 Reception Flag keeps ON during reception ON: Receiving --- Cleared Refreshed at
Progressing Flag for processing of socket No.2. OFF: Reception the start or
Socker No.2 Finish reception process, and then completed completion of
flag turns OFF. reception
process

02 Transmission Flag keeps ON during transimission ON: Sending --- Cleared Refreshed at
Progressing Flag for processing of socket No.2. OFF: Transimission the start or
Socket No.2 Finish transmission process, and then completed completion of
flag turns OFF. transmission
process

03 Close Processing Flag keeps ON during close ON: During close --- Cleared Refreshed at
Flag for Socker No.2 processing of socket No.2. processing the start or
Finish clsoe process, and then flag OFF: Close completion of
turns OFF. completed close process

13 Data Received Flag keeps ON when data is received ON: Data reception --- Cleared • Refreshed
Present/Not Present from the other node on an open TCP completed after recep-
Flag for Socket No.2 socket. OFF: Waiting for tion
Flag turns OFF when the reception reception • Refreshed
request is executed. when
reception
process is
requested

14 Result Storage Error Flag keeps ON when any value other ON: Code other than --- Cleared Refreshed
Flag for Socket No.2 than normal end (0000 hex) is stored normal end is when socket
stored
in the end code of the parameter area request

A-2 Auxiliary Area Allocations by Address


of socket No.2. OFF: Normal end process is
Flag turns OFF when the next request completed
is received.

15 TCP/UDP Open Flag When open processing of socket No.2 ON: Close com- --- Cleared Refreshed
for Socket No.2 is completed, the flag turns ON. pleted when
When closing process is completed or OFF: Open open/close
while closing, the flag turns OFF. completed process is
When open processing ends completed
abnormally, the flag remains OFF.

App
A-2-2 Read/Write Words

CP2E CPU Unit Software User’s Manual(W614) A-89


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A569 00 Open Processing Flag Flag keeps ON during open ON: During open --- Cleared Refreshed at
for Socket No.3 processing of socket No.3. processing the start or
Finish open process, and then flag OFF: Open completion of
turns OFF. completed open process

01 Reception Flag keeps ON during reception ON: Receiving --- Cleared Refreshed at
Progressing Flag for processing of socket No.3. OFF: Reception the start or
Socker No.3 Finish reception process, and then completed completion of
flag turns OFF. reception
process

02 Transmission Flag keeps ON during transimission ON: Sending --- Cleared Refreshed at
Progressing Flag for processing of socket No.3. OFF: Transimission the start or
Socket No.3 Finish transmission process, and then completed completion of
flag turns OFF. transmission
process

03 Close Processing Flag keeps ON during close ON: During close --- Cleared Refreshed at
Flag for Socker No.3 processing of socket No.3. processing the start or
Finish clsoe process, and then flag OFF: Close completion of
turns OFF. completed close process

13 Data Received Flag keeps ON when data is received ON: Data reception --- Cleared • Refreshed
Present/Not Present from the other node on an open TCP completed after recep-
Flag for Socket No.3 socket. OFF: Waiting for tion
Flag turns OFF when the reception reception • Refreshed
request is executed. when
reception
process is
requested

14 Result Storage Error Flag keeps ON when any value other ON: Code other than --- Cleared Refreshed
Flag for Socket No.3 than normal end (0000 hex) is stored normal end is when socket
stored
in the end code of the parameter area request
of socket No.3. OFF: Normal end process is
Flag turns OFF when the next request completed
is received.

15 TCP/UDP Open Flag When open processing of socket No.3 ON: Close com- --- Cleared Refreshed
for Socket No.3 is completed, the flag turns ON. pleted when
When closing process is completed or OFF: Open open/close
while closing, the flag turns OFF. completed process is
When open processing ends completed
abnormally, the flag remains OFF.

A571 00 UDP Open Request When the flag changes from OFF to OFF to ON: UDP --- Cleared ---
Switch for Socket ON, UDP open processing is open
No.1 executed.
When open process is completed, the
flag automatically turns OFF.

01 TCP Passive Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP passive open processing is passive open
Socket No.1 executed.
When open process is completed, the
flag automatically turns OFF.

02 TCP Active Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP active open processing is active open
Socket No.1 executed.
When open process is completed, the
flag automatically turns OFF.

03 Send Request Switch When the flag changes from OFF to OFF to ON: Send --- Cleared ---
for Socket No.1 ON, transmission processing is
executed.
When transmission process is
completed, the flag automatically turns
OFF.

04 Receive Request When the flag changes from OFF to OFF to ON: Receive --- Cleared ---
Switch for Socket ON, reception processing is executed.
No.1 When reception process is completed,
the flag automatically turns OFF.

05 Close Request Switch When the flag changes from OFF to OFF to ON: Close --- Cleared ---
for Socket No.1 ON, close processing is executed.
When close process is completed, the
flag automatically turns OFF.

A-90 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A571 08 UDP Open Request When the flag changes from OFF to OFF to ON: UDP --- Cleared ---
Switch for Socket ON, UDP open processing is open
No.2 executed.
When open process is completed, the
flag automatically turns OFF.

09 TCP Passive Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP passive open processing is passive open
Socket No.2 executed.
When open process is completed, the
flag automatically turns OFF.

10 TCP Active Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP active open processing is active open
Socket No.2 executed.
When open process is completed, the
flag automatically turns OFF.

11 Send Request Switch When the flag changes from OFF to OFF to ON: Send --- Cleared ---
for Socket No.2 ON, transmission processing is
executed.
When transmission process is
completed, the flag automatically turns
OFF.

12 Receive Request When the flag changes from OFF to OFF to ON: Receive --- Cleared ---
Switch for Socket ON, reception processing is executed.
No.2 When reception process is completed,
the flag automatically turns OFF.

13 Close Request Switch When the flag changes from OFF to OFF to ON: Close --- Cleared ---
for Socket No.2 ON, close processing is executed.
When close process is completed, the
flag automatically turns OFF.

A-2 Auxiliary Area Allocations by Address


A572 00 UDP Open Request When the flag changes from OFF to OFF to ON: UDP --- Cleared ---
Switch for Socket ON, UDP open processing is open
No.3 executed.
When open process is completed, the
flag automatically turns OFF.

01 TCP Passive Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP passive open processing is passive open
Socket No.3 executed.
When open process is completed, the
flag automatically turns OFF.

02 TCP Active Open When the flag changes from OFF to OFF to ON: TCP --- Cleared ---
Request Switch for ON, TCP active open processing is active open
Socket No.3 executed.
When open process is completed, the
flag automatically turns OFF.

03 Send Request Switch When the flag changes from OFF to OFF to ON: Send --- Cleared ---
for Socket No.3 ON, transmission processing is
App
executed.
When transmission process is
completed, the flag automatically turns
OFF.
A-2-2 Read/Write Words

04 Receive Request When the flag changes from OFF to OFF to ON: Receive --- Cleared ---
Switch for Socket ON, reception processing is executed.
No.3 When reception process is completed,
the flag automatically turns OFF.

05 Close Request Switch When the flag changes from OFF to OFF to ON: Close --- Cleared ---
for Socket No.3 ON, close processing is executed.
When close process is completed, the
flag automatically turns OFF.

A580 00 FB Communications Automatically stores the number of 0 to F hex Set the Cleared Written at the
to Instruction Retries retries of FB communication PLC start of
03 Count instruction settings in the PLC Setup. Settings operation.

A581 --- FB Communications Automatically stores the FB 0001 to FFFF hex Set the Cleared Written at the
Instruction Response communication instruction response (unit 0.1 s: 0.1 to PLC start of
Monitoring Time monitoring time settings in the PLC 6553.5 s) Settings operation.
Setup. 0000 Hex: 2 s

CP2E CPU Unit Software User’s Manual(W614) A-91


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change

A583 00 I/O Memory Backup The flag will be ON when the I/O ON: I/O memory Retained Retained Refreshed A403.14
Error Flag memory is not held at power ON. backup error when the
It will still be ON until the memory area occurred power is
is cleared or the flag is turned OFF OFF: Normal turned ON.
manually.

A616 00 Serial Port 1 (EX) Display the present communication Parity Retained See Refreshed
Communication settings of the serial port 1 (EX). 0: Even Function when power is
Settings Reflect the PLC Setup when power is column. turned ON.
1: Odd
turned ON.
01 Parity Retained See Refreshed
0: Yes Function when power is
column. turned ON.
1: No
02 Stop bit Retained See Refreshed
0: 2 bits Function when power is
column. turned ON.
1: 1 bit
03 Data length Retained See Refreshed
0: 7 bits Function when power is
column. turned ON.
1: 8 bits
04 Start bit Retained See Refreshed
0: 1 bit (fixed) Function when power is
column. turned ON.
08 Communication Retained See Refreshed
to speed Function when power is
11 0 hex: Default (9600) column. turned ON.
3 hex: 1200
4 hex: 2400
5 hex: 4800
6 hex: 9600
7 hex: 19200
8 hex: 38400
9 hex: 57600
A hex: 115200
12 Communication Retained See Refreshed
to mode Function when power is
15 0 hex: Default (Host column. turned ON.
Link)
3 hex: Non-protocol
5 hex: Host Link
7 hex: Serial PLC
Link (Slave)
8 hex: Serial PLC
Link (Master)
9 hex: Modbus-RTU
Easy Master

A-92 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A617 00 Serial Port 1/ Display the present communication Parity Retained See Refreshed
Built-in RS232C Port settings of the serial port 1 or built-in 0: Even Function when power is
Communication Set- RS232C port. Reflect the PLC Setup column. turned ON.
tings when power is turned ON. 1: Odd
01 Parity Retained See Refreshed
0: Yes Function when power is
column. turned ON.
1: No
02 Stop bit Retained See Refreshed
0: 2 bits Function when power is
column. turned ON.
1: 1 bit
03 Data length Retained See Refreshed
0: 7 bits Function when power is
column. turned ON.
1: 8 bits
04 Start bit Retained See Refreshed
0: 1 bit (fixed) Function when power is
column. turned ON.
08 Communication Retained See Refreshed
to speed Function when power is
11 0 hex: Default (9600) column. turned ON.
3 hex: 1200
4 hex: 2400
5 hex: 4800
6 hex: 9600
7 hex: 19200
8 hex: 38400
9 hex: 57600

A-2 Auxiliary Area Allocations by Address


A hex: 115200
12 Communication Retained See Refreshed
to mode Function when power is
15 0 hex: Default (Host column. turned ON.
Link)
2 hex: NT link (1: N)
3 hex: Non-protocol
5 hex: Host Link
7 hex: Serial PLC
Link (Slave)
8 hex: Serial PLC
Link (Master)
9 hex: Modbus-RTU
Easy Master
D hex: Modbus-RTU
Slave
App
A618 00 Serial Port 2/ Display the present communication Parity Retained See Refreshed
Built-in RS-485 Port settings of the serial port 2 or built-in 0: Even Function when power is
Communication Set- RS-485 port. Reflect the PLC Setup column. turned ON.
tings when power is turned ON. 1: Odd
A-2-2 Read/Write Words

01 Parity Retained See Refreshed


0: Yes Function when power is
column. turned ON.
1: No
02 Stop bit Retained See Refreshed
0: 2 bits Function when power is
column. turned ON.
1: 1 bit
03 Data length Retained See Refreshed
0: 7 bits Function when power is
column. turned ON.
1: 8 bits
04 Start bit Retained See Refreshed
0: 1 bit (fixed) Function when power is
column. turned ON.

CP2E CPU Unit Software User’s Manual(W614) A-93


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A618 08 Serial Port 2 Built-in Display the present communication Communication Retained See Refreshed
to RS-485 Port Commu- settings of the serial port 2 or Built-in speed Function when power is
11 nication Settings RS-485 Port. Reflect the PLC Setup column. turned ON.
0 hex: Default (9600)
when power is turned ON.
3 hex: 1200
4 hex: 2400
5 hex: 4800
6 hex: 9600
7 hex: 19200
8 hex: 38400
9 hex: 57600
A hex: 115200
12 Communication Retained See Refreshed
to mode Function when power is
15 0 hex: Default (Host column. turned ON.
Link)
2 hex: NT link(1: N)
3 hex: Non-protocol
5 hex: Host Link
7 hex: Serial PLC
Link (Slave)
8 hex: Serial PLC
Link (Master)
9 hex: Modbus-RTU
Easy Master
D hex: Modbus-RTU
Slave
A638 00 Serial Port 1(EX) Turn ON this bit to send a command Turned ON: Execu- Retained Cleared --- DM Area
Modbus-RTU Easy and receive a response for the serial tion started words for
Master Execution port 1(EX) using the Modbus-RTU ON: Execution in serial
Flag (CP2E easy master function. progress. port
N……-type CPU Unit 1(EX)
Note This bit will be turned OFF auto- OFF: Not executed Mod-
only) or execution
matically by the system when bus-RTU
communications have been com- completed.
Easy
pleted. Master:
D1400 to
D1499
01 Serial Port 1(EX) ON when one command has been ON: Execution nor- Retained Cleared Written after
Modbus-RTU Easy sent and the response received for the mal. reception.
Master Normal End serial port 1(EX) using the Mod- OFF: Execution error
Flag (CP2E bus-RTU easy master function. or still in
N……-type CPU Unit progress.
only)
02 Serial Port 1(EX) ON when an error has occurred in ON: Execution error. Retained Cleared Written when D1452
Modbus-RTU Easy communications for the serial port OFF: Execution error ends.
Master Error End Flag 1(EX) using the Modbus-RTU easy normal or still
(CP2E N……-type master function. in progress.
CPU Unit only) The error code is output to D1452 in
the DM fixed allocation words for Mod-
bus-RTU Easy Master.

A-94 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A640 00 Serial Port 1/ Turn ON this bit to send a command Turned ON: Execu- Retained Cleared --- DM Area
Built-in RS-232C Port and receive a response for the serial tion started words for
Modbus-RTU Easy port 1 or built-in RS-232C port using serial
ON: Execution in
Master Execution Bit the Modbus-RTU easy master func- port 1 or
progress.
tion. built-in
OFF: Not executed RS-232C
Note This bit will be turned OFF auto- or execution
port Mod-
matically by the system when completed.
bus-RTU
communications have been com- Easy
pleted. Master:
D1200 to
D1299
01 Serial Port 1/ ON when one command has been ON: Execution nor- Retained Cleared Written after
Built-in RS-232C Port sent and the response received for mal. reception.
Modbus-RTU Easy the serial port 1 or built-in RS-232C OFF: Execution error
Master Normal End port using the Modbus-RTU easy or still in
Flag master function. progress.
02 Serial Port 1/ ON when an error has occurred in ON: Execution error. Retained Cleared Written when D1252
Built-in RS-232C Port communications for the serial port 1 or OFF: Execution error ends.
Modbus-RTU Easy built-in RS-232C port using the Mod- normal or still
Master Error End Flag bus-RTU easy master function. in progress.
The error code is output to D1252 in
the DM fixed allocation words for Mod-
bus-RTU Easy Master.
A641 00 Serial Port 2/ Turn ON this bit to send a command Turned ON: Execu- Retained Cleared --- DM Area
Built-in RS-485 Port and receive a response for the serial tion started words for
Modbus-RTU Master port 2 or built-in RS-485 port using the serial
ON: Execution in
Execution Bit (CP2E Modbus-RTU easy master function. port 2 or
progress.
N30/40/60 or built-in
S……-type CPU Unit Note This bit will be turned OFF auto- OFF: Not executed RS-485
only) matically by the system when or execution
port Mod-
communications have been com- completed.
bus-RTU
pleted.

A-2 Auxiliary Area Allocations by Address


Easy
Master:
D1300 to
D1399
01 Serial Port 2/ ON when one command has been ON: Execution nor- Retained Cleared Written after
Built-in RS-485 Port sent and the response received for the mal. reception.
Modbus-RTU Master serial port 2 or built-in RS-485 port OFF: Execution error
Execution Normal using the Modbus-RTU easy master or still in
Flag (CP2E function. progress.
N30/40/60 or
S……-type CPU Unit
only)
02 Serial Port 2/ ON when an error has occurred in ON: Execution error. Retained Cleared Written when D1352
Built-in RS-485 Port communications for the serial port 2 or OFF: Execution error ends.
Modbus-RTU Master built-in RS-485 port using the Mod- normal or still
Execution Error Flag bus-RTU easy master function. in progress.
(CP2E N30/40/60 The error code is output to D1352 in
or S……-type CPU the DM fixed allocation words for Mod-
Unit only) bus-RTU Easy Master.
App
A720 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 1 the power was turned ON one time power is
A722 before the startup time stored in words turned ON.
A510 to A511.
A720.00 to A720.07: Seconds (00 to
A-2-2 Read/Write Words

59)
A720.08 to A720.15: Minutes (00 to
59)
A721.00 to A721.07: Hour (00 to 23)
A721.08 to A721.15: Day of month (01
to 31)
A722.00 to A722.07: Month (01 to 12)
A722.08 to A722.15: Year (00 to 99)

Note In an E……-type CPU Unit or


when time alignment cannot be
executed with an N/S……-type
CPU Unit, the data will be for
1:01.01 on Sunday January 1,
2001.

CP2E CPU Unit Software User’s Manual(W614) A-95


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A723 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 2 the power was turned ON two times power is
A725 before the startup time stored in words turned ON.
A510 to A511.
A723.00 to A723.07: Seconds (00 to
59)
A723.08 to A723.15: Minutes (00 to
59)
A724.00 to A724.07: Hour (00 to 23)
A724.08 to A724.15: Day of month (01
to 31)
A725.00 to A725.07: Month (01 to 12)
A725.08 to A725.15: Year (00 to 99)
A726 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 3 the power was turned ON three times power is
A728 before the startup time stored in words turned ON.
A510 to A511.
A726.00 to A726.07: Seconds (00 to
59)
A726.08 to A726.15: Minutes (00 to
59)
A727.00 to A727.07: Hour (00 to 23)
A727.08 to A727.15: Day of month (01
to 31)
A728.00 to A728.07: Month (01 to 12)
A728.08 to A728.15: Year (00 to 99)
A729 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 4 the power was turned ON four times power is
A731 before the startup time stored in words turned ON.
A510 to A511.
A729.00 to A729.07: Seconds (00 to
59)
A729.08 to A729.15: Minutes (00 to
59)
A730.00 to A730.07: Hour (00 to 23)
A730.08 to A730.15: Day of month (01
to 31)
A731.00 to A731.07: Month (01 to 12)
A731.08 to A731.15: Year (00 to 99)
A732 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 5 the power was turned ON five times power is
A734 before the startup time stored in words turned ON.
A510 to A511.
A732.00 to A732.07: Seconds (00 to
59)
A732.08 to A732.15: Minutes (00 to
59)
A733.00 to A733.07: Hour (00 to 23)
A733.08 to A733.15: Day of month (01
to 31)
A734.00 to A734.07: Month (01 to 12)
A734.08 to A734.15: Year (00 to 99)
A735 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 6 the power was turned ON six times power is
A737 before the startup time stored in words turned ON.
A510 to A511.
A735.00 to A735.07: Seconds (00 to
59)
A735.08 to A735.15: Minutes (00 to
59)
A736.00 to A736.07: Hour (00 to 23)
A736.08 to A736.15: Day of month (01
to 31)
A737.00 to A737.07: Month (01 to 12)
A737.08 to A737.15: Year (00 to 99)

A-96 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A738 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 7 the power was turned ON seven times power is
A740 before the startup time stored in words turned ON.
A510 to A511.
A738.00 to A738.07: Seconds (00 to
59)
A738.08 to A738.15: Minutes (00 to
59)
A739.00 to A739.07: Hour (00 to 23)
A739.08 to A739.15: Day of month (01
to 31)
A740.00 to A740.07: Month (01 to 12)
A740.08 to A740.15: Year (00 to 99)
A741 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 8 the power was turned ON eight times power is
A743 before the startup time stored in words turned ON.
A510 to A511.
A741.00 to A741.07: Seconds (00 to
59)
A741.08 to A741.15: Minutes (00 to
59)
A742.00 to A742.07: Hour (00 to 23)
A742.08 to A742.15: Day of month (01
to 31)
A743.00 to A743.07: Month (01 to 12)
A743.08 to A743.15: Year (00 to 99)
A744 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 9 the power was turned ON nine times power is
A746 before the startup time stored in words turned ON.
A510 to A511.

A-2 Auxiliary Area Allocations by Address


A744.00 to A744.07: Seconds (00 to
59)
A744.08 to A744.15: Minutes (00 to
59)
A745.00 to A745.07: Hour (00 to 23)
A745.08 to A745.15: Day of month (01
to 31)
A746.00 to A746.07: Month (01 to 12)
A746.08 to A746.15: Year (00 to 99)
A747 Power ON Clock Data These words contain the time at which See at left. Retained Retained Written when
to 10 the power was turned ON ten times power is
A749 before the startup time stored in words turned ON.
A510 to A511.
A747.00 to A747.07: Seconds (00 to
59)
A747.08 to A747.15: Minutes (00 to
59)
A748.00 to A748.07: Hour (00 to 23)
A748.08 to A748.15: Day of month (01
App
to 31)
A749.00 to A749.07: Month (01 to 12)
A749.08 to A749.15: Year (00 to 99)
A-2-2 Read/Write Words

CP2E CPU Unit Software User’s Manual(W614) A-97


Appendices

Address Status
Related
after Status at Write
Name Function Settings flags,
Words Bits mode startup timing
settings
change
A751 11 DM Backup Restore ON when DM backup data could not ON: Restore failed Retained Cleared Written when
Failed Flag be restored normally. If this flag turns OFF: Execution fail to restore.
ON, data will not be restored from the normal
built-in Flash Memory to RAM.
14 DM Backup Save Flag ON when A751.15 is turned ON to ON: Saving Retained Cleared Written when
start the saving operation. This flag OFF: Not saving save starts
stays ON while data is being saved
and turns OFF when finished.
15 DM Backup Save Saving the specified words from the ON: Start saving. Retained Cleared ---
Start Bit DM Area in RAM to the built-in Flash OFF: Execution
Memory is started when this bit is normal or still
turned ON. in progress.
This bit will not turn OFF automatically
even when saving the data has been
completed.
If this bit is turned ON and OFF while
the DM Backup Save Flag (A751.14)
is ON, it will be ignored and the data
will not be backed up again.

Note Select the Restore D0- from


backup memory Check Box and
set the number of DM Area
words to back up in the Number
of CH of DM for backup Box in
the PLC Setup before using this
bit.

A-98 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-3 Response Performance

A-3-1 I/O Response Time

The I/O response time is the time it takes from when an input turns ON, the data is recognized by the
CPU Unit, and the ladder programs are executed, up to the time for the result to be output to an output
terminal.
The length of the I/O response time depends on the following conditions.
• Timing of Input Bit turning ON.
• The cycle time

z Minimum I/O Response Time


The I/O response time is shortest when data is retrieved immediately before I/O refresh of the CPU Unit.
The minimum I/O response time is calculated as follows:
Minimum I/O response time = Input ON delay + Cycle time + Output ON delay

Note The input and output ON delays depend on the type of terminals used on the CPU Unit or the model number
of the Unit being used.

:I/O refresh

Inputs:

Input ON delay
(Status read to
the CPU Unit.):
Cycle time Cycle time
Instruction Instruction

A-3 Response Performance


execution execution
Output ON delay
Outputs:

Minimum I/O
Response Time

z Maximum I/O Response Time


The I/O response time is longest when data is retrieved immediately after I/O refresh period of the
CPU Unit.
App
The maximum I/O response time is calculated as follows:
Maximum I/O response time = Input ON delay + (Cycle time × 2) + Output ON delay
A-3-1 I/O Response Time

:I/O refresh

Inputs:

Input ON delay

(Status read to
the CPU Unit.):
Cycle time Cycle time
Instruction Instruction Instruction
execution execution execution
Output ON delay
Outputs:

Maximum I/O Response Time

CP2E CPU Unit Software User’s Manual(W614) A-99


Appendices

z Calculation Example
Conditions:
Input ON delay: 1 ms (normal input 0.08 to 0.11 with input constant set to 0 ms)
Output ON delay: 0.1 ms (transistor output)
Cycle time: 20 ms
Minimum I/O response time = 1 ms + 20 ms + 0.1 ms = 21.1 ms
Maximum I/O response time = 1 ms + (20 ms × 2) + 0.1 ms = 41.1 ms

Input Constant Setting


Input constant setting can be set in the PLC Setup.
Increasing the input constants slowers the input response time and reduces the effects of chattering
and noise. Decreasing the input constants fasters the input response time and allows reception of
shorter input pulses (but the pulse width must be longer than the cycle time).

Input response time


Input response time
Pulses shorter than the input
response time are not received
Inputs Inputs

I/O refresh I/O refresh

CPU Unit CPU Unit

z PLC Setup
Name Description Setting Default
Input Constant Settings Input Constants 00 hex: 8 ms 00 hex (8 ms)
10 hex: No filter (0 ms)
12 hex: 1 ms
13 hex: 2 ms
14 hex: 4 ms
15 hex: 8 ms
16 hex: 16 ms
17 hex: 32 ms

Note The input constants of CP1W-40EDR/EDT/EDT1 are always 16ms regardless of the settings.

A-100 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-3-2 Interrupt Response Time

z Interrupt Response Time for Input Interrupt Tasks


The interrupt response time for input interrupt tasks is the time taken from when a built-in input has
turned ON (or OFF) until the input interrupt task has actually been executed.
The length of the interrupt response time for input interrupt tasks depends on the total of the hard-
ware interrupt response time and software interrupt response time.
Item Interrupt response time Counter 0~5 interrupts
Hardware interrupt Upward differentiation: 50 µs −
response time Downward differentiation: 50 µs −
Software interrupt response Minimum: 23 µs + Wait time* Minimum: 40 µs + Wait time*
time

* The wait time occurs when there is competition with other interrupts. As a guideline, the wait time will be 0 to
3 ms.

Note Input interrupt tasks can be executed during execution of the user program, I/O refresh, peripheral servicing,
or overseeing. (Even if an instruction is being executed, execution of the instruction will be stopped to exe-
cute the interrupt task.)
The interrupt response time is not affected by the above processing operations during which the interrupt
inputs turns ON.
Input interrupts, however, are not executed during execution of other interrupt tasks even if the input interrupt
conditions are satisfied. Instead, the input interrupts are executed after the current interrupt task has com-
pleted execution and the software interrupt response time has elapsed.

The interrupt response time of input interrupt tasks is calculated as follows:


Interrupt response time = Input ON delay + Software interrupt response time

Inputs:

A-3 Response Performance


Input ON delay
Ready to acknowledge
(Interrupt signal next interrupt signal
acknowledged.): Software interrupt response time

Interrupt task
execution:
Interrupt response Ladder program Return time
time for input execution time from input
interrupt task interrupt task
Cyclic task execution (main
program):
App
The time from when execution of the input interrupt task is completed until
execution of the cyclic task is resumed is 11 μs.
A-3-2 Interrupt Response Time

CP2E CPU Unit Software User’s Manual(W614) A-101


Appendices

z Interrupt Response Time for Scheduled Interrupt Tasks


The interrupt response time for scheduled interrupt tasks is the time taken from after the scheduled
time specified by the MSKS instruction has elapsed until the interrupt task has actually been exe-
cuted.
The length of the interrupt response time for scheduled interrupt tasks is 0.1 ms max.
There is also an error of 10 µs in the time to the first scheduled interrupt (1.0 ms min.).
Note Scheduled interrupt tasks can be executed during execution of the ladder program (even while an instruction
is being executed by stopping the execution of an instruction), I/O refresh, peripheral servicing, or overseeing.
The processing operation in which the scheduled interrupt occurs does not affect the interrupt processing
time.
Scheduled interrupts, however, are not executed during execution of other interrupt tasks even if the interrupt
conditions are satisfied. Instead, the interrupts are executed in order of priority after the current interrupt task
has completed execution and the software interrupt response time has elapsed.As a guideline, the wait time
will be 0 to 3ms.

Scheduled interrupt time

Internal timer:

Software interrupt response time


Scheduled
interrupt task:

Precautions for Correct Use


The scheduled task will not be executed while the CPU Unit suspends operation for online editing.

A-3-3 Serial PLC Link Response Performance


The response times for CPU Units connected via a Serial PLC Link (polling unit to polled unit or polled
unit to polling unit) can be calculated as shown below.
Note A PT cannot be used in the Serial PLC Link.

• Maximum I/O response time (not including hardware delay) =


Polling unit cycle time + Communications cycle time + Polled unit cycle time + 4 ms
• Minimum I/O response time (not including hardware delay) =
Polled unit communications time + 0.8 ms

Number of participat- The number of polled units to which links have been established within the
ing polled unit nodes maximum unit number set in the polling unit.
Number of non- The number of polled units not participating in the links within the maximum unit
participating polled number set in the polling unit.
unit nodes
Communications cycle Polled unit communications time × Number of participating polled unit nodes +
time (ms) 10 × Number of non-participating polled unit nodes + 20 × Number of polled unit
nodes
Polled unit • Communications time set to Standard:
communications 0.4 + 0.286 × [(No. of polled units + 1) × No. of link words × 2 + 12]
time (ms) • Communications time set to Fast:
0.4 + 0.0955 × [(No. of polled units + 1) × No. of link words × 2 + 12]

A-102 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-3-4 Pulse Output Start Time


The pulse output start time is the time required from executing a pulse output instruction until pulses are
output externally.
This time depends on the pulse output instruction that is used and operation that is performed.

Instruction
execution Start time

Pulse output

Pulse output instruction Start time


SPED: continuous Minimum: 500µs + Wait time*
SPED: independent
ACC: continuous
ACC: independent, trapezoidal
ACC: independent, triangular
PLS2: trapezoidal
PLS2: triangular
IFEED: interrupt feeding
ITPL: linear interpolation
* The wait time occurs when there is competition with other interrupts. As a guideline, the wait time will be 0 to 3 ms.

A-3-5 Pulse Output Change Response Time


The pulse output change response time is the time for any change made by executing an instruction
during pulse output to actually affect the pulse output operation.
Pulse output instruction Change response time

A-3 Response Performance


INI: immediate stop Minimum: 100µs + Wait time*1 + 1 pulse output time
SPED: immediate stop
ACC: deceleration stop 1 control cycle (4 ms) minimum, 2 control cycles (8
PLS2: deceleration stop ms) maximum*2
SPED: speed change
ACC: speed change
PLS2: target position change in reverse direction
PLS2: target position change in same direction at
App
same speed
PLS2: target position change in same direction at
different speed
A-3-4 Pulse Output Start Time

*1 The wait time occurs when there is competition with other interrupts. As a guideline, the wait time will be 0 to
3 ms.
*2 When the frequency of pulse output is lower than 250Hz, 1 control cycle will be equal to the time of pulse output.
Example: The change response time of 100Hz pulse output is above 1 control cycle (10ms) and below 2 control
cycles (20ms).

CP2E CPU Unit Software User’s Manual(W614) A-103


Appendices

A-4 PLC Operation for Power


Interruptions

Overview of Operation for Power Interruptions

z Power Supply Voltage Drop


If the power supply voltage falls below the specified value (85% of rated voltage) while the CPU Unit
is in RUN or MONITOR mode, operation will be stopped and all outputs will be turned OFF.

z Detection of Momentary Power Interruptions


The system will continue to run if the momentary power interruption lasts less than 10 ms (2ms for
DC power supply). If power is interruped for longer than 10 ms (2ms for DC power supply), a
momentary power interruption will be detected or undetected. If the momentary power interruption is
detected, the CPU Unit will be stopped and outputs will be turned OFF.

Below 85% of rated voltage

10ms
Time
0 0 to 10 ms max.
(0 to 2ms max. for
DC power supply)
Momentary power
interruption not detected
Operation continues
Supply
voltage 10 ms min.
(2ms min. for DC power supply)

Supply
voltage
Operation will continue or stop
depending on whether a
momentary power interruption
is detected.

z Automatic Recovery
Operation is automatically restarted when the power supply voltage is restored.

A-104 CP2E CPU Unit Software User’s Manual(W614)


Appendices

Power OFF Timing Chart


Operation always stopped at this point
Power supply
voltage: 85%
Holding time for 5 V internal
power supply after power OFF
detection: 1 ms
Power OFF detection

Power OFF Detection Time


AC: 10ms
Power OFF DC: 2ms
detected signal

Program execution
Cyclic task or interrupt task Stop
status

CPU Unit reset signal

Power OFF Detection Time: The time from when the power supply voltage drops to 85% or less the rated voltage until the
power interruption is detected.
Power Holding Time: The maximum amount of time (fixed at 1 ms) that 5 V will be held internally after power shuts
OFF.

z Description of Operation
The power interruption will be detected if the 100 to 240 VAC power supply falls below 85% of the

A-4 PLC Operation for Power Interruptions


minimum rated voltage for the power OFF detection time (10 ms minimum for AC power supply and
2ms minimum for DC power supply, not fixed).
The CPU reset signal will turn ON and the CPU Unit will be reset immediately.

Instruction Execution for Power Interruptions


The power OFF detection time of CP2E CPU Units is 10 ms minimum for AC power supply and 2ms
minimum for DC power supply. If the power interruption is detected when operating in RUN or MONI-
TOR mode, the instruction currently being executed will be stopped and then the CPU Unit will be reset.

Malfunction Countermeasures App


If only a couple of Expansion I/O Units or Expansion Units are connected to the CPU Unit resulting in a
light power supply circuit load and a small current consumption, the time required by the CPU Unit to
detect a power interruption will be longer. For this reason, inputs may be incorrectly identified as being
OFF if external power supply used for an input turns OFF before the power interruption is detected. If
A-3-5 Pulse Output Change

an external NC contact input is used or the ladder program counts the number of ON to OFF transitions,
a malfunction may occur if the external power supply turns OFF.
Response Time

CP2E CPU Unit Software User’s Manual(W614) A-105


Appendices

Power supply Power OFF detected


voltage: 85%

Power OFF Power OFF detection time


detected singal AC: 10 ms min.
DC: 2 ms min.

Program execution
status Cyclic task or interrupt task

CPU reset signal

External power supply


input

Input signal to CP2E


If the external power supply input turns
OFF before the power interruption is
detected, the CPU Unit will read the
input as being OFF

The following diagram shows an example countermeasure for this situation.


• Wiring

Emergency stop input

100 VAC

External power
supply input
L1 L2 COM 0.00 0.01

CP2E

• Ladder Program

External power supply


Emergency input (Enables
stop input Emergency stop emergency stop output.) Emergency
release input 0.01 stop output
0.00

Emergency
stop output

A-106 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-5 Memory Map

PLC Memory Addresses

PLC memory addresses are set in Index Registers (IR00 to IR15) to indirectly address I/O memory.
Normally, use the MOVE TO REGISTER (MOVR(560)) and MOVE TIMER/COUNTER PV TO REGIS-
TER (MOVRW(561)) instructions to set PLC memory addresses into the Index Registers.
Some instructions, such as FIND MAXIMUM (MAX(182)), and FIND MINIMUM (MIN(183)), output the
results of processing to an Index Register to indicate an PLC memory address.
There are also instructions for which Index Registers can be directly designated to use the PLC mem-
ory addresses stored in them by other instructions. These instructions include DOUBLE MOVE
(MOVL(498)), some symbol comparison instructions (=L, <>L, <L, >L, <=L, and >=L), DOUBLE COM-
PARE (CMPL(060)), DOUBLE INCREMENT BINARY (++L(591)), DOUBLE DECREMENT BINARY
(––L(593)), DOUBLE SIGNED BINARY ADD WITHOUT CARRY (+L(401)), DOUBLE SIGNED BINARY
SUBTRACT WITHOUT CARRY (–L(411)).
The PLC memory addresses all are continuous and the user must be aware of the order and bound-
aries of the memory areas. As reference, the PLC memory addresses are provided in a table at the end
of this appendix.
Note Directly setting PLC memory addresses in the program should be avoided whenever possible. If PLC mem-
ory addresses are set in the program, the program will be less compatible with new CPU Unit models or CPU
Units for which changes have been made to the layout of the memory.

Memory Configuration
There are two classifications of the RAM memory in a CP-series CPU Unit.
Parameter Areas: These areas contain CPU Unit system setting data, such as the PLC Setup, CPU
Bus Unit Setups, etc. An illegal access error will occur if an attempt is made to access any of the
parameter areas from an instruction in the user program.
I/O Memory Areas: These are the areas that can be specified as operands in the instructions in user

A-5 Memory Map


programs.

App

CP2E CPU Unit Software User’s Manual(W614) A-107


Appendices

Memory Map
PLC memory address
Classification User addresses Area
(hex)
I/O memory 0 to 0174F --- Reserved for system
areas 01750 to 0176F T00 to T31 Timer Completion Flags
01770 to 0178F C00 to C31 Counter Completion Flags
01790 to 017BF --- Reserved for system
017C0 to 0197F A0 to A447 Read-only Auxiliary Area
01980 to 01B7F A448 to A959 Read/Write Auxiliary Area
01B80 to 01CA1 CIO 0 to 289 CIO Area
01CA2 to 01CBF --- Reserved for system
01CC0 to 01D3F H0 to H127 Holding Area
01D40 to 022BF --- Reserved for system
022C0 to 0233F W0 to W127 Work Area
02340 to 0253F T000 to T511 Timer PVs
02540 to 0273F C000 to C511 Counter PVs
E……-type CPU Unit: E……-type CPU Unit: DM Area
02740 to 0373F D0 to D4095
S……-type CPU Unit: S……-type CPU Unit:
02740 to 0473F D0 to D8191
N……-type CPU Unit: N……-type CPU Unit:
02740 to 0673F D0 to D16383
E……-type CPU Unit: --- Reserved for system
03740 to 0673F
S……-type CPU Unit:
04740 to 0673F
Note Do not access areas reserved for the system.

A-108 CP2E CPU Unit Software User’s Manual(W614)


Appendices

A-6 Ethernet Functions

A-6-1 TCP Status Transitions

CLOSED
ACTIVE OPEN
snd SYN
Passive OPEN CLOSE

LISTEN
CLOSE
rcv SYN
SEND
snd SYN, ACK
snd SYN

SYN rcv SYN SYN


RECEIVED SENT
snd ACK

rcv ACK of SYN rcv SYN, ACK


snd ACK
CLOSE
snd FIN ESTABLISHED

CLOSE rcv FIN


snd FIN snd ACK
CLOSED
FIN WAIT
WAIT-1
rcv FIN
snd ACK CLOSE
rcv ACK of FIN snd FIN

FIN WAIT-2 CLOSING LAST-ACK

A-6 Ethernet Functions


rcv ACK of FIN rcv ACK of FIN
rcv FIN
snd ACK
Timeout=2MSL
TIME WAIT CLOSED

Number Status Meaning


00000000 CLOSED Connection closed.
App

00000001 LISTEN Waiting for connection.


00000002 SYN SENT SYN sent in active status.
00000003 SYN RECEIVED SYN received and sent.
A-6-1 TCP Status Transitions

00000004 ESTABLISHED Already established.


00000005 CLOSE WAIT FIN received and waiting for completion.
00000006 FIN WAIT 1 Completed and FIN sent.
00000007 CLOSING Completed and exchanged FIN. Awaiting ACK.
00000008 LAST ACK FIN sent and completed. Awaiting ACK.
00000009 FIN WAIT 2 Completed and ACK received. Awaiting FIN.
0000000A TIME WAIT After closing, pauses twice the maximum segment life (2MSL).

CP2E CPU Unit Software User’s Manual(W614) A-109


Appendices

A-6-2 Ethernet Network Parameters

Parameter Value Description


Hold timer 18 s The hold timer is used for active open processing of TCP sockets.
An ETIMEDOUT error will occur if connection is not completed within
18 s.
Resend timer 3s The resend timer is used to monitor completion of reception of arrival
confirmations when transferring data via socket services. If the timer
setting is exceeded before arrival confirmation is received, data is
resent. Resends are performed through the 12th timeout (3 s).
An ETIMEDOUT error will occur after the 12th timeout.
2MSL timer 120 s The 2MSL timer starts at the TCP socket that first closes the socket
and will run for 120 s in the TIME_WAIT status.
ARP timer 20 min/5 s If a complete ARP table entry (with an Ethernet address) is not
referred to for 20 minutes, it is removed from the table.
An incomplete ARP table entry (no response yet returned to the ARP
request) is removed from the table after 5 seconds.
Window size 2,144 bytes The initial value of the maximum capacity used to control the conver-
gence of TCP sockets. Actually, the node negotiates with the remote
node and uses the smaller of the values for the two nodes. The win-
dow size will fluctuate with the available space in the TCP reception
buffers of the remote node when processing communications.
Segment size 536 bytes TCP data is separated into 536-byte units.
(MSS)
TTL (Time to Live) 30 times Decreases 1 each time to comnunicate through the IP roater.

A-6-3 Buffer Configuration

Socket recepiton
buffer
(3×4096 bytes)
IP packet input
FINS packet input
buffer
buffer
(8×608 bytes))
(18,432 bytes)
Ethernet FINS event buffer FINS/TCP
(IN + Out: 8×1024 Communications
Event recepiton buffer controller
bytes) (4×4096 bytes)
IP packet output
buffer
(4×1600 bytes)
Socket send
buffer
(3×1024 bytes)

A-110 CP2E CPU Unit Software User’s Manual(W614)


Index
Symbols Closing Flag ...............................................................15-40
*D(Specifying indirect addresses CMND(490) instruction ..............................................15-17
in BCD Mode)..................................................4-19, 5-12 commands
@D(Specifying indirect addresses FINS commands...................................................15-27
in Binary Mode)...............................................4-19, 5-12 Communications settings .............................. 7-5, 7-9, 7-13
Condition Flags .....................................................5-4, 5-25
Numerics Connecting the Servo Drive and external sensors.......12-8
1:N NT Links .......................................................14-5, 14-7 Constants.....................................................................4-23
CONTROLLER DATA READ ......................................15-25
A Conversion field .........................................................15-20
Absolute coordinates ................................................. 12-16 Counter Area..................................................................5-4
Absolute positioning................................................... 12-16 Resetting or maintaining.........................................5-16
ACC instruction ...............................................12-14, 12-20 Types ......................................................................5-15
Access Error Flag(P_AER) .......................................... 5-25 Counter Completion Flags .............................................5-4
addresses Counter PVs...................................................................5-4
memory map ....................................................... A-107 Counting ranges.........................................................11-10
Allocated words CPU Unit
CPU Unit .................................................................. 6-3 I/O allocation ............................................................6-3
Expansion I/O Unit ................................................... 6-4 Internal memory .......................................................2-2
Allocating functions to built-in input terminals ................ 8-6 Memory areas and stored data ................................2-3
Allocating functions to built-in output terminals.............. 8-8 Operating modes......................................................3-3
Allocations for Expansion I/O Units................................ 6-4 Operation..................................................................3-2
Allocations for Expansion Units ..................................... 6-6 CTBL instruction ........................................................11-20
Always OFF Flag(P_Off) .............................................. 5-25 CX-Programmer
Always ON Flag(P_On)................................................ 5-25 connecting to PLC
Analog I/O Option Board............................................ 17-16 from personal computer.................................15-4
Analog Input Option Board........................................... 17-8 through multiple segments ............................15-4
Analog Output Option Board...................................... 17-12 using wireless LAN ........................................15-4
Auto Adjust Time Tab ................................................. 15-56 within same segment.....................................15-4
Auto allocated FINS node field .................................. 15-21 Ethernet Unit Setup..............................................15-11
automatic ..................................................................... 15-6 Help ........................................................................18-6
automatic clock adjustment...............................15-6, 15-54 Cycle time ......................................................................3-2
Automatic I/O comment creation................................ 18-13 I/O response time .................................................. A-99
Automatic symbol name creation ............................... 18-13 Interrupt response time ....................................... A-101
Auxiliary Area........................................................5-4, 5-23 Cycle time response performance .............................. A-99
Cyclic refreshing ..........................................................4-22
B
D
Backing up memory ....................................................... 3-5
Backup ......................................................................... 5-12 Data formats ................................................................4-20
Backup area ............................................................. 3-5 Data Memory Area................................................5-3, 5-11
Backup memory ....................................................3-6, 16-9 Data Received Flag...........................................15-6, 15-40
Bit addresses ................................................................. 5-5 Data refresh method ..................................................14-30
bits Data Registers .............................................................5-21
status of UDP/TCP sockets.................................. 15-39 Defining origin position...............................................12-30
Broadcast field ........................................................... 15-13 Operating mode....................................................12-35
Built-in EEPROM .......................... 2-2, 2-3, 3-6, 5-12, 16-9 Operation pattern .................................................12-40
Built-in RAM ............................................................2-2, 2-3 Origin return .........................................................12-42
Built-in RS-232C Port..................................................... 7-5 Origin search operation setting ............................12-38
PLC Setup ............................................................12-31
C Differential phase input (4×).........................................11-8
C Mode command.............................................14-6, 14-39 DM Area
Carry Flag(P_CY) ........................................................ 5-25 allocations ............................................................15-42
CIO Area .................................................................5-2, 5-7 DM backup function .....................................................16-9
Allocation.................................................................. 6-2 DNS client ..................................................................15-54
Circular (Ring) mode(high-speed counter)................. 11-11 DNS client function ......................................................15-6
clock DNS server .......................................................15-6, 15-54
automatic adjustment ..................................15-6, 15-54 E
Clock function .............................................................. 16-7
Clock Pulses .........................................................5-4, 5-27 echo response packet ................................................15-15
Close Request Switch................................................ 15-41 End code(No-protocol communications) ....................14-10

CP2E CPU Unit Software User’s Manual(W614) Index-1


Equals Flag(P_EQ) ..................................................... 5-25 CPU Unit.................................................................. 6-3
Error Flag(P_ER)......................................................... 5-25 Expansion I/O Unit................................................... 6-4
Ethernet communications Expansion Unit......................................................... 6-6
addresses I/O allocations
reading from Unit ........................................ 15-25 DM Area............................................................... 15-42
exchanging data between PLCs ............................ 15-5 I/O memory............................................................. 3-3, 5-2
Ethernet Unit Setup ................................................... 15-11 addresses ............................................................ A-107
Ethernet Units I/O memory Areas ................................................... 5-6
resetting ............................................................... 15-24 Initializing method .................................................... 3-7
Execute process settings .............................................. 7-3 I/O refresh ..................................................................... 3-2
I/O refresh timing......................................................... 4-22
F I/O response time ........................................................ A-99
FINS command ................................................ 14-6, 14-39 Immediate refresh ....................................................... 4-22
FINS communications Increment pulse input .................................................. 11-8
commands ........................................................... 15-24 Index Registers............................................................ 4-26
overview............................................................... 15-17 index registers ............................................................. 5-17
response codes ................................................... 15-23 Indirect addressing ...................................................... 5-12
responses ............................................................ 15-24 INI instruction ........................................ 11-21, 12-14, 13-4
TCP/IP ................................................................... 15-4 Input constant................................................................ 7-4
UDP/IP................................................................... 15-4 Input constant setting ................................................ A-100
FINS/TCP .................................................................... 15-4 Input interrupts ............................................................ 10-5
FINS/TCP Mode field ................................................ 15-21 Functions allocation ............................................... 10-5
FINS/TCP Port field................................................... 15-21 PLC Setup ............................................................. 10-4
FINS/UDP......................................................... 15-4, 15-18 Writing the ladder program .................................... 10-5
FINS/UDP Port field .................................................. 15-20 Input-differentiated instructions ................................... 4-17
flags instruction functions....................................................... A-2
Closing Flag......................................................... 15-40 Instructions
Data Received Flag .................................... 15-6, 15-40 Basic understanding .............................................. 4-14
Opening Flag ....................................................... 15-40 Execution conditions.............................................. 4-16
Receiving Flag ..................................................... 15-40 Operands ............................................................... 4-15
Results Storage Error Flag .................................. 15-40 Specifying addresses............................................. 4-18
Sending Flag ....................................................... 15-40 Variations ............................................................... 4-16
TCP/UDP Open Flag ........................................... 15-40 Internal memory ............................................................ 2-2
Forced set/reset ....................... 17-12, 17-16, 17-17, 18-25 interrupt feeding ........................................................ 12-23
Functions allocation Interrupt input settings................................................. 7-17
Selecting functions in the PLC Setup ...................... 8-4 Interrupt response time ............................................. A-101
Specifying method ................................................... 8-4 Interrupt task ............................................................. 10-11
Interrupt task priority and order of execution ............. 10-13
G Interrupt task with maximum processing time
Global symbols.............................................................. 4-6 (A441CH)................................................................ 10-13
Greater Than Flag(P_GT) ........................................... 5-25 Interrupts
Greater Than or Equals Flag(P_GE)........................... 5-26 Input interrupts....................................................... 10-3
Precautions.......................................................... 10-13
H Scheduled interrupts............................................ 10-10
High-speed counter interrupts .......................... 11-2, 11-14 Types ..................................................................... 10-2
Application example............................................. 11-26 Interrupts functions
Functions allocation ............................................... 11-4 Interrupt response time........................................ A-101
PLC Setup .................................................. 11-3, 11-16 IORF instruction(I/O refresh) ....................................... 4-22
Related Auxiliary Area ......................................... 11-25 IP Address field ........................ 15-13, 15-21, 15-56, 15-57
Specifications ........................................................ 11-7 IP Address Table field................................................ 15-20
Writing the ladder program ......................... 11-6, 11-16 IP ADDRESS TABLE READ...................................... 15-31
High-speed counter settings........................................ 7-16 IP communications
High-speed counters IP addresses
Counting ranges .................................................. 11-10 reading from Units....................................... 15-25
Frequency measurement..................................... 11-13 reading tables ............................................. 15-31
Pulse input methods .............................................. 11-8 IP router tables
Reading the present value................................... 11-12 reading ........................................................ 15-32
Reset method ...................................................... 11-11 IP Router Table field .................................................. 15-13
Holding Area........................................................... 5-3, 5-9 IP ROUTER TABLE READ ........................................ 15-32
Host Link .......................................................... 14-6, 14-39
Host Link command.......................................... 14-6, 14-39 J
Host name field ......................................................... 15-57 Jogging...................................................................... 12-20
Application example............................................. 12-20
I
I/O allocation ................................................................. 6-2

Index-2 CP2E CPU Unit Software User’s Manual(W614)


K P_CY(Carry Flag) ........................................................5-25
keep-alive field ........................................................... 15-21 P_EQ(Equals Flag) ......................................................5-25
P_ER(Error Flag) .........................................................5-25
L P_GE(Greater Than or Equals Flag) ...........................5-26
Ladder program P_GT(Greater Than Flag)............................................5-25
Editing .................................................................. 18-16 P_LE(Less than or Equals Flag) ..................................5-26
Input ....................................................................... 18-7 P_LT(Less Than Flag)..................................................5-26
Saving and reading .............................................. 18-14 P_N(Negative Flag)......................................................5-26
Transferring .......................................................... 18-18 P_NE(Not Equal Flag) .................................................5-26
Writing .................................................................... 18-7 P_OF(Overflow Flag) ...................................................5-26
Less Than Flag(P_LT).................................................. 5-26 P_Off(Always OFF Flag) ..............................................5-25
Less than or Equals Flag(P_LE) .................................. 5-26 P_On(Always ON Flag)................................................5-25
Linear mode(high-speed counter).............................. 11-10 P_UF(Underflow Flag) .................................................5-26
Local symbols ................................................................ 4-6 Peripheral servicing .......................................................3-2
Phase-Z signal + software reset ................................11-11
M PID temperature control...............................................16-2
main response code................................................... 15-23 PIDAT instruction..........................................................16-3
Maximum interrupt task processing time(A440CH) ... 10-13 PING ..........................................................................15-15
Memory areas and stored data...................................... 2-3 echo test...............................................................15-15
Modbus-RTU Easy Master........................................... 14-5 PLC Setup......................................................................7-2
DM fixed allocation words ...........................5-12, 14-15 Base Settings ............................. 7-18, 7-19, 7-21, 7-22
Error codes........................................................... 14-16 Communications settings ........................ 7-5, 7-9, 7-13
Programming examples ....................................... 14-18 Execute process settings .........................................7-3
Related Auxiliary Area.......................................... 14-16 High-speed counter settings...................................7-16
mode settings Input constant...........................................................7-4
reading from Unit.................................................. 15-25 Interrupt input settings............................................7-17
Monitor mode ................................................................. 3-3 Origin return settings.....................................7-21, 7-24
Monitoring and debugging ......................................... 18-23 Origin search settings7-18, 7-19, 7-20, 7-21, 7-22, 7-23
Forced set/reset ................................................... 18-25 Settings ....................................................................7-3
Monitoring status.................................................. 18-23 Startup data read setting..........................................7-3
Online editing ....................................................... 18-26 Startup mode setting ................................................7-3
MRES......................................................................... 15-23 Timing and interrupt settings ....................................7-4
MSKS instruction ..............................................10-6, 10-11 PLS2 instruction..............................................12-14, 12-16
Port No. field ...................................................15-56, 15-57
N port numbers
Negative Flag(P_N) ..................................................... 5-26 UDP port
No. field ...................................................................... 15-21 reading from Unit .........................................15-25
Non-differentiated instructions ..................................... 4-16 Positioning control......................................................12-16
No-protocol communications ............................14-5, 14-10 Positioning control (independent mode).....................12-66
PLC Setup ............................................................ 14-11 Precautions
Related Auxiliary Area.......................................... 14-12 Ladder programming precautions ..........................4-35
Not Equal Flag(P_NE) ................................................. 5-26 Precautions for using interrupts............................10-13
Number of connected Units ........................................... 6-3 Special program sections .......................................4-35
Program capacity ...........................................................4-3
O Program mode ...............................................................3-3
Online editing ....................................................17-9, 18-26 Program-free communications with PTs ......................14-7
Opening Flag ............................................................. 15-40 PLC Setup and PT system settings........................14-8
Operands ..................................................................... 4-15 Programmer device......................................................18-3
Operating mode at startup ............................................. 7-3 Programming .................................................................4-2
Operating modes PRV instruction ................................... 11-12, 12-14, 12-44
Changing method ..................................................... 3-3 Pulse + Direction input .................................................11-9
Operating modes and operation............................... 3-4 Pulse input methods ....................................................11-8
The retaining of I/O memory when changing ........... 3-4 Pulse output change response time.......................... A-103
Operation for power interruptions.............................. A-104 Pulse output Start Time ............................................ A-103
Timing Chart........................................................ A-105 Pulse outputs ...............................................................12-3
ORG instruction .................................. 12-14, 12-34, 12-42 Application example .............................................12-46
Origin return settings ....................... 7-19, 7-21, 7-22, 7-24 Changing the present value of the pulse output...12-43
Origin search settings ...................... 7-18, 7-20, 7-21, 7-23 Defining origin position .........................................12-30
OUT instruction ...............................................12-14, 12-34 Functions allocation.......................................12-4, 12-6
Output interrupts .......................................................... 10-2 Jogging.................................................................12-20
Overflow Flag(P_OF) ................................................... 5-26 Output pattern ......................................................12-64
PLC Setup ..............................................................12-5
P Positioning control ................................................12-16
P_AER(Access Error Flag) .......................................... 5-25 Positioning control (independent mode) ...............12-66
Precautions when using pulse outputs.................12-59

CP2E CPU Unit Software User’s Manual(W614) Index-3


Reading the pulse output present value .............. 12-44 sockets
Related Auxiliary Area ......................................... 12-45 status ................................................................... 15-39
Specifications ...................................................... 12-15 TCP sockets
Speed control (continuous mode)........................ 12-64 status ...............................................15-42, A-109
Triangular control ................................................. 12-67 Software reset ........................................................... 11-12
Writing the ladder program .................................. 12-14 Specifying addresses .................................................. 4-18
PWM instruction .......................................................... 13-4 Specifying offsets for addresses.................................. 4-32
PWM outputs............................................................... 13-2 SPED instruction ............................................ 12-14, 12-20
Speed control (continuous mode) ............................. 12-64
Q ST language ................................................................ 4-12
Quick-response inputs................................................... 9-2 Startup data read setting ............................................... 7-3
Functions allocation ................................................. 9-4 Step ladder program sections ..................................... 4-36
PLC Setup ............................................................... 9-3 Sub-net Mask field..................................................... 15-13
Writing the ladder program ...................................... 9-4 subnet masks
reading from Unit ................................................. 15-25
R sub-response code.................................................... 15-23
Range comparison ......................................... 11-14, 11-19 Subroutines .......................................................... 4-2, 4-35
Read protection ......................................................... 16-13 switches
Receive Request Switch ........................................... 15-41 Socket Service Request Switches ....................... 15-40
Receiving Flag........................................................... 15-40 Switching from speed control (continuous mode)
RECV(098) instruction............................................... 15-17 to positioning (independent mode) ......................... 12-71
Relative coordinates .................................................. 12-16 Symbols
Relative positioning ................................................... 12-16 Global symbols ........................................................ 4-6
RESET ...................................................................... 15-24 Local symbols .......................................................... 4-6
response codes
FINS commands .................................................. 15-23 T
Results Storage Error Flag........................................ 15-40 Target value comparison ................................ 11-14, 11-17
Retry timer field ......................................................... 15-56 Tasks ...................................................................... 4-2, 4-6
Run mode...................................................................... 3-3 TCP Active Open Request Switch............................. 15-41
TCP communications
S sockets
Scheduled interrupts ................................................. 10-10 status .......................................................... A-109
Writing the ladder program .................................. 10-11 TCP Passive Open Request Switch .......................... 15-41
Sections.................................................................. 4-2, 4-6 TCP/IP................................................................ 15-4, 15-6
Security function........................................................ 16-13 TCP/UDP Open Flag................................................. 15-40
Self-diagnosis................................................................ 3-2 Timer Area..................................................................... 5-3
Send Request Switch ................................................ 15-41 PV refresh method................................................. 5-14
SEND(090) instruction............................................... 15-17 Resetting or maintaining ........................................ 5-14
Sending Flag ............................................................. 15-40 Types ..................................................................... 5-13
Serial communications timers......................................................................... A-110
Connecting the host computer............................. 14-39 Timing and interrupt settings ......................................... 7-4
Modbus-RTU Easy Master ....................... 14-12, 14-14 Triangular control....................................................... 12-67
No-protocol communications
with general components .................................. 14-10 U
Program-free communications with PTs................ 14-7 UDP Open Request Switch ....................................... 15-41
Serial PLC Links .................................................. 14-27 UDP/IP ............................................................... 15-4, 15-6
Types of communication ........................................ 14-5 UDP/TCP sockets
Serial Option Port .......................................................... 7-9 status bits............................................................. 15-39
Serial PLC Link response performance..................... A-102 Underflow Flag(P_UF)................................................. 5-26
Serial PLC Links............................................... 14-5, 14-27 Up/Down pulse input ................................................... 11-8
Allocated words ................................................... 14-33 Use IP address to protect field .................................. 15-21
Data refresh method ............................................ 14-30
Example application ............................................ 14-37 V
PLC Setup ........................................................... 14-28 Variable-duty-factor pulse outputs(PWM outputs) ....... 13-2
Related Auxiliary Area ......................................... 14-34 Variations..................................................................... 4-16
Server specification type field.................................... 15-57
servers W
specifying............................................................. 15-54 Word address ................................................................ 5-5
Setup Tab .................................................................. 15-19 Work Area .............................................................. 5-3, 5-8
SNTP server.............................................................. 15-54
socket services............................................... 15-36, 15-38
Parameter Areas.................................................. 15-43
Socket Service Request Switches ....................... 15-40
TCP/IP ................................................................... 15-6
UDP/IP................................................................... 15-6

Index-4 CP2E CPU Unit Software User’s Manual(W614)


Revision History
A manual revision code appears as a suffix to the catalog number on the front cover of the manual.

Cat. No. W614-E1-01

Revision code

Revision code Date Revised content


01 September 2019 Original production

CP2E CPU Unit Software User’s Manual(W614) Revision-1


Revision-2 CP2E CPU Unit Software User’s Manual(W614)
OMRON Corporation Industrial Automation Company Authorized Distributor:
Kyoto, JAPAN
Contact: www.ia.omron.com
Regional Headquarters
OMRON EUROPE B.V. OMRON ELECTRONICS LLC
Wegalaan 67-69, 2132 JD Hoofddorp 2895 Greenspoint Parkway, Suite 200
The Netherlands Hoffman Estates, IL 60169 U.S.A.
Tel: (31)2356-81-300/Fax: (31)2356-81-388 Tel: (1) 847-843-7900/Fax: (1) 847-843-7787

OMRON ASIA PACIFIC PTE. LTD. OMRON (CHINA) CO., LTD. © OMRON Corporation 2019 All Rights Reserved.
No. 438A Alexandra Road # 05-05/08 (Lobby 2), Room 2211, Bank of China Tower, In the interest of product improvement,
Alexandra Technopark, 200 Yin Cheng Zhong Road, specifications are subject to change without notice.
Singapore 119967 PuDong New Area, Shanghai, 200120, China
Tel: (65) 6835-3011/Fax: (65) 6835-2711 Tel: (86) 21-5037-2222/Fax: (86) 21-5037-2200 Cat. No. W614-E1-01 0919

You might also like