Top Banner
1 CP1E CPU Unit Software User’s Manual(W480) Introduction Thank you for purchasing a SYSMAC CP-series CP1E Programmable Controller. This manual contains information required to use the CP1E. Read this manual completely and be sure you understand the contents before attempting to use the CP1E. 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 Definition of the CP Series The CP Series is centered around the CP1H, CP1L, and CP1E 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. I/O words are allocated in the same way as for the CPM1A/CPM2A PLCs, i.e., using fixed areas for inputs and outputs. Intended Audience Applicable Products CS Series CS1-H CPU Units CS1H-CPUH CS1G-CPUH CS1 CPU Units CS1H-CPU(-V1) CS1G-CPU(-V1) CS1D CPU Units CS1D CPU Units for Duplex-CPU System CS1D-CPUH CS1D CPU Units for Single-CPU System CS1D-CPUS CS1D Process CPU Units CS1D-CPUP CS-series Basic I/O Units CS-series Special I/O Units CS-series CPU Bus Units CS-series Power Supply Units Note: Products specifically for the CS1D Series are required to use CS1D CS/CJ/CP Series CJ Series CJ1-H CPU Units CJ1H-CPUH CJ1G-CPUH CJ1G-CPUP (Loop CPU Unit) CJ1M CPU Unit CJ1M-CPU CJ1 CPU Unit CJ1G-CPU CJ-series Basic I/O Units CJ-series Special I/O Units CJ-series CPU Bus Units CJ-series Power Supply Units CP Series CP1H CPU Units CP1H-X- CP1H-XA- CP1H-Y- CJ-series Special I/O Units CJ-series CPU Bus Units CP1L CPU Units CP1L-L10D- CP1L-L14D- CP1L-L20D- CP1L-M30D- CP1L-M40D- CP1L-M60D- CPM1A-series Expansion I/O Units CPM1A-series Expansion Units CP1E CPU Units CP1E-ED-A CP1E-ND-A CP-series Expansion I/O Units* CP-series Expansion Units* * Expansion I/O Units and Expansion Units cannot be connected to CP1E CPU Units with 20 I/O Points.
400
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CP1E CPU Unit Software Users Manual

1CP1E CPU Unit Software User’s Manual(W480)

Introduction

Thank you for purchasing a SYSMAC CP-series CP1E Programmable Controller.

This manual contains information required to use the CP1E. Read this manual completely and be sureyou understand the contents before attempting to use the CP1E.

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

Definition of the CP SeriesThe CP Series is centered around the CP1H, CP1L, and CP1E CPU Units and is designed with thesame basic architecture as the CS and CJ Series.

Always use CP-series Expansion Units and CP-series Expansion I/O Units when expanding I/Ocapacity. I/O words are allocated in the same way as for the CPM1A/CPM2A PLCs, i.e., using fixedareas for inputs and outputs.

Intended Audience

Applicable Products

CS Series

CS1-H CPU Units

CS1H-CPUHCS1G-CPUH

CS1 CPU Units

CS1H-CPU(-V1)CS1G-CPU(-V1)

CS1D CPU Units

CS1D CPU Units for

Duplex-CPU System

CS1D-CPUH

CS1D CPU Units for

Single-CPU System

CS1D-CPUS

CS1D Process CPU Units

CS1D-CPUP

CS-series Basic I/O Units

CS-series Special I/O Units

CS-series CPU Bus Units

CS-series Power Supply UnitsNote: Products specifically for the CS1D Series are required to use CS1D

CS/CJ/CP Series

CJ Series

CJ1-H CPU Units

CJ1H-CPUHCJ1G-CPUHCJ1G-CPUP(Loop CPU Unit)

CJ1M CPU Unit

CJ1M-CPU

CJ1 CPU Unit

CJ1G-CPU

CJ-series Basic I/O Units

CJ-series Special I/O Units

CJ-series CPU Bus Units

CJ-series Power Supply Units

CP Series

CP1H CPU Units

CP1H-X-CP1H-XA-CP1H-Y-

CJ-series Special I/O Units

CJ-series CPU Bus Units

CP1L CPU Units

CP1L-L10D-CP1L-L14D-CP1L-L20D-CP1L-M30D-CP1L-M40D-CP1L-M60D-

CPM1A-series Expansion I/O Units

CPM1A-series Expansion Units

CP1E CPU Units

CP1E-ED-ACP1E-ND-A

CP-series Expansion I/O Units*

CP-series Expansion Units*

* Expansion I/O Units and Expansion Units cannot be connected to CP1E CPU Units with 20 I/O Points.

Page 2: CP1E CPU Unit Software Users Manual

2 CP1E CPU Unit Software User’s Manual(W480)

CP1E CPU Unit Manuals

Information on the CP1E CPU Units is provided in the following manuals.

Refer to the appropriate manual for the information that is required.

Mounting and Setting Hardware1

2

3

4

5

6

7

Wiring

Connecting Online to the PLC

Software Setup

Creating the Program

Checking and Debugging Operation

Maintenance and Troubleshooting

CP1E Hardware User’s Manual(Cat. No. W479)

CP1E Software User’s Manual(Cat. No. W480)

This Manual

· Wiring methods for the power supply· Wiring methods between external I/O devices and Expansion I/O Units or Expansion Units

Connecting Cables for CX-Programmer for ULC Support Software

Error codes and remedies if a problem occurs

Procedures for connecting the CX-Programmer for ULC Support Software

Software setting methods for the CPU Units (PLC Setup)

· Checking I/O wiring, setting the Auxiliary Area settings, and performing trial operation

· Monitoring and debugging with the CX-Programmer

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

· 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

CP1E Instructions Reference Manual(Cat. No. W483)

Detailed information on programming instructions

Page 3: CP1E CPU Unit Software Users Manual

3CP1E CPU Unit Software User’s Manual(W480)

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

Manual Configuration

CP1E Software User’s Manual (Cat. No. W480) (This Manual)

Section Contents

Section 1 Overview and SYSMAC Features

This section gives an overview of the CP1E, describes its features and application procedures, and describes the features of SYSMAC PLCs.

Section 2 CPU Unit Memory This section describes the internal memory in a CP1E CPU Unit.

Section 3 CPU Unit Operation This section describes the operation of a CP1E CPU Unit.

Section 4 Initial Settings for CPU Unit

This section describes the initial settings required for a CP1E CPU Unit.

Section 5 Programming Concepts This section provides basic information on designing ladder programs for the CP1E.

Section 6 I/O Memory This section describes the I/O memory areas in a CP1E CPU Unit.

Section 7 File Operations File operations cannot be used with the CP1E.

Section 8 I/O Allocation This section describes I/O allocation in a CP1E CPU Unit.

Section 9 PLC Setup This section describes the PLC Setup of a CP1E CPU Unit.

Section 10 Overview and Allocation of Built-in Functions

This section lists the built-in functions and describes the overall applica-tion flow and the allocation of the functions.

Section 11 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 12 Interrupts This section describes the interrupts that can be used with CP1E PLCs, including input interrupts and scheduled interrupts.

Section 13 High-speed Counters This section describes the high-speed counter inputs, high-speed counter interrupts, and the frequency measurement function.

Section 14 Pulse Outputs This section describes positioning functions such as trapezoidal control, jogging, and origin searches.

Section 15 PWM Outputs This section describes the variable-duty-factor (PWM) pulse outputs.

Section 16 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, and host computer.

Section 17 Built-in Functions This section describes PID temperature control, analog adjusters, the minimum cycle time, clock functions, memory management, security functions, debugging, and other functions.

Section 18 Operating the Program-ming Device

This section describes basic functions of the CX-Programmer for CP1E, such as using the CX-Programmer for CP1E to write ladder programs to control the CP1E, to transfer the programs to the CP1E, and to debug the programs.

Section 19 CPU Unit Cycle Time This section describes the cycle time of a CP1E CPU Unit.

Appendices The appendices provide lists of programming instructions, the Auxiliary Area, instruction execution times, sample ladder programming, and a comparison with the CP1L.

Page 4: CP1E CPU Unit Software Users Manual

4 CP1E CPU Unit Software User’s Manual(W480)

CP1E Hardware User’s Manual (Cat. No. W479)

Section Contents

Section 1 Overview and Specifica-tions

This section gives an overview of the CP1E, describes its features, and provides its specifications.

Section 2 Basic System Configura-tion and Devices

This section describes the basic system configuration and Unit models.

Section 3 Part Names and Functions This section provides the names and the parts of the CPU Unit, Expan-sion I/O Units, and Expansion Units in a CP1E PLC and describes CP1E functions.

Section 4 Programming Device This section describes the features of the CX-Programmer for CP1E used for programming and debugging PLCs, as well as how to connect the PLC with the Programming Device.

Section 5 Installation and Wiring This section describes how to install and wire CP1E Units.

Section 6 Troubleshooting This section describes how to troubleshoot problems that may occur with a CP1E PLC, including the error indications provided by the CP1E Units.

Section 7 Maintenance and Inspec-tion

This section describes periodic inspections, the service life of the Bat-tery, and how to replace the Battery.

Section 8 Backup Operations The easy backup function and the PLC Backup Tool cannot be used with the CP1E.

Section 9 Using Expansion Units and Expansion I/O Units

This section describes application methods for Expansion Units.

Appendices The appendices provide information on model numbers, dimensions, wiring diagrams, and wiring serial communications.

Page 5: CP1E CPU Unit Software Users Manual

5CP1E CPU Unit Software User’s Manual(W480)

Manual Structure

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

Special information in this manual is classified as follows:

Page Structure and Icons

Special Information

5 - 3

5 Installation and wiring

CP1E CPU Unit Hardware User’s Manual(W479)

5

5-2 Installation

5-2-1 Installation Location

DIN Track Installation

1

2Release

DIN Track mounting pins

3

DIN Track

DIN Track mounting pins

Precautions for Correct Use

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

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.

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

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

5-2 Installatio

n5-2-1 Installation Location

Level 1 headingLevel 2 headingLevel 3 headingLevel 2 heading

Step in a procedure

Manual name

Special Information (See below.)

Level 3 heading

Page tab

Gives the current headings.

Indicates a step in a procedure.

Gives the number of the section.

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

Icons are used to indicate precautions and additional information.

Precautions for Safe UsePrecautions on what to do and what not to do to ensure using the product safely.

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

Additional InformationAdditional information to increase understanding or make operation easier.

References to the location of more detailed or related information.

Page 6: CP1E CPU Unit Software Users Manual

6 CP1E CPU Unit Software User’s Manual(W480)

Sections in this Manual

1

2

3

4

5

6

7

Overview andSYSMAC Features

Internal Memory inthe CPU Unit

CPU Unit Operation

CPU UnitInitialization

UnderstandingProgramming

I/O Memory

File Operations

9 PLC Setup

8 I/O Allocation

10

11

12

13 High-speed Counters

Overview of Built-in Functionsand Allocations

Quick-response Inputs

Interrupts

14

15

16

17 Other Functions

18

Pulse Outputs

PWM Outputs

SerialCommunications

1 10

2 11

3 12

4 13

5 14

6 15

7 16

8 17

9 18

Page 7: CP1E CPU Unit Software Users Manual

7CP1E CPU Unit Software User’s Manual(W480)

CONTENTS

Introduction............................................................................................................... 1

CP1E CPU Unit Manuals .......................................................................................... 2

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

Safety Precautions ................................................................................................. 16

Precautions for Safe Use ....................................................................................... 22

Operating Environment Precautions .................................................................... 25

Regulations and Standards ................................................................................... 26

Related Manuals ..................................................................................................... 28

Section 1 Overview and SYSMAC Features

1-1 CP1E Overview ........................................................................................................................ 1-21-1-1 Overview of Features.................................................................................................................. 1-21-1-2 Features...................................................................................................................................... 1-31-1-3 CP1E CPU Unit Types ................................................................................................................ 1-8

1-2 Basic Operating Procedure .................................................................................................... 1-9

1-3 SYSMAC PLC Operation and Programming Features ....................................................... 1-101-3-1 PLC Setup ................................................................................................................................ 1-101-3-2 Operating Mode at Startup: RUN Mode.................................................................................... 1-111-3-3 I/O Allocation and Notation....................................................................................................... 1-121-3-4 Specifying I/O Memory Addresses ........................................................................................... 1-131-3-5 CP1E Data: Normally Hexadecimal.......................................................................................... 1-141-3-6 Condition Flags......................................................................................................................... 1-151-3-7 Control Data that Sets the Instruction Function ........................................................................ 1-16

Section 2 Internal Memory in the CPU Unit

2-1 Internal Memory in the CPU Unit............................................................................................ 2-22-1-1 CPU Unit Memory Backup.......................................................................................................... 2-22-1-2 Memory Areas and Stored Data ................................................................................................. 2-42-1-3 Transferring Data from a Programming Device to the Internal Memory in the CPU Unit............ 2-5

Section 3 CPU Unit Operation

3-1 CPU Unit Operation ................................................................................................................. 3-23-1-1 Overview of CPU Unit Operation ................................................................................................ 3-23-1-2 CPU Unit Operating Modes ........................................................................................................ 3-33-1-3 Load OFF Function..................................................................................................................... 3-63-1-4 Operation for Power Interruptions............................................................................................... 3-7

3-2 Backing Up Memory .............................................................................................................. 3-103-2-1 CPU Unit Memory Configuration .............................................................................................. 3-103-2-2 Backing Up Ladder Programs and PLC Setup ......................................................................... 3-113-2-3 I/O Memory Backup during Power Interruptions....................................................................... 3-11

Page 8: CP1E CPU Unit Software Users Manual

8 CP1E CPU Unit Software User’s Manual(W480)

Section 4 CPU Unit Initialization

4-1 CPU Unit Initial Settings ......................................................................................................... 4-24-1-1 CPU Unit Initial Settings.............................................................................................................. 4-2

4-2 PLC Setup ................................................................................................................................ 4-44-2-1 PLC Setup Defaults..................................................................................................................... 4-4

Section 5 Understanding Programming

5-1 Programming ........................................................................................................................... 5-25-1-1 Programs..................................................................................................................................... 5-25-1-2 Program Capacity ....................................................................................................................... 5-35-1-3 Basics of Programming ............................................................................................................... 5-3

5-2 Tasks, Sections, and Symbols ............................................................................................... 5-75-2-1 Overview of Tasks ....................................................................................................................... 5-75-2-2 Overview of Sections .................................................................................................................. 5-75-2-3 Overview of Symbols .................................................................................................................. 5-7

5-3 Programming Instructions...................................................................................................... 5-95-3-1 Operands .................................................................................................................................... 5-95-3-2 Instruction Variations................................................................................................................. 5-105-3-3 Execution Conditions ................................................................................................................ 5-105-3-4 Specifying Data in Operands .................................................................................................... 5-135-3-5 Data Formats ............................................................................................................................ 5-145-3-6 I/O Refresh Timing.................................................................................................................... 5-16

5-4 Constants: &, #, +, -, and Numbers without Symbols ........................................................ 5-17

5-5 Specifying Offsets for Addresses ........................................................................................ 5-215-5-1 Overview ................................................................................................................................... 5-215-5-2 Application Examples for Address Offsets ................................................................................ 5-23

5-6 Checking Programs............................................................................................................... 5-255-6-1 Checking during Input Operations from the CX-Programmer ................................................... 5-255-6-2 Program Checks with the CX-Programmer for CP1E ............................................................... 5-255-6-3 Debugging with the Simulator ................................................................................................... 5-265-6-4 Program Execution Check......................................................................................................... 5-28

5-7 Ladder Programming Precautions....................................................................................... 5-315-7-1 Ladder Programming Precautions ............................................................................................ 5-315-7-2 Special Program Sections......................................................................................................... 5-35

Section 6 I/O Memory

6-1 Overview of I/O Memory Areas............................................................................................... 6-26-1-1 I/O Memory Areas....................................................................................................................... 6-26-1-2 I/O Memory Area Address Notation ............................................................................................ 6-56-1-3 I/O Memory Areas....................................................................................................................... 6-6

6-2 I/O Bits ..................................................................................................................................... 6-7

6-3 Work Area (W) .......................................................................................................................... 6-8

6-4 Holding Area (H) ...................................................................................................................... 6-9

6-5 Data Memory Area (D) ........................................................................................................... 6-11

6-6 TR Area (TR)........................................................................................................................... 6-13

6-7 Timer Area (T) ........................................................................................................................ 6-15

6-8 Counter Area (C) .................................................................................................................... 6-17

6-9 Auxiliary Area (A)................................................................................................................... 6-19

6-10 Condition Flags (P_).............................................................................................................. 6-21

Page 9: CP1E CPU Unit Software Users Manual

9CP1E CPU Unit Software User’s Manual(W480)

6-11 Clock Pulses (P_) .................................................................................................................. 6-23

Section 7 File Operations

Section 8 I/O Allocation

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

Section 9 PLC Setup

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

9-2 PLC Setup Settings ................................................................................................................. 9-39-2-1 Startup and CPU Unit Settings ................................................................................................... 9-39-2-2 Timing, Interrupt, and Peripheral Servicing Settings .................................................................. 9-49-2-3 Input Constant Settings .............................................................................................................. 9-59-2-4 Serial Port 1 Settings (Built-in RS-232C Port for N-type CPU Units).......................................... 9-59-2-5 Serial Port 2 (N-type CP1E CPU Unit with 30 or 40 I/O Points) ................................................. 9-89-2-6 Built-in Inputs............................................................................................................................ 9-129-2-7 Pulse Output 0 Settings............................................................................................................ 9-149-2-8 Pulse Output 1 Settings............................................................................................................ 9-16

Section 10 Overview of Built-in Functions and Allocations

10-1 Built-in Functions .................................................................................................................. 10-2

10-2 Overall Procedure for Using CP1E Built-in Functions ....................................................... 10-3

10-3 Allocations for Built-in Functions ........................................................................................ 10-410-3-1 Allocation of CPU Unit’s Built-in I/O Terminals ......................................................................... 10-410-3-2 Specifying the Functions to Use ............................................................................................... 10-510-3-3 Selecting Functions in the PLC Setup ...................................................................................... 10-510-3-4 Allocating Built-in Inputs ........................................................................................................... 10-610-3-5 Allocating Built-in Output Temrinals .......................................................................................... 10-9

Section 11 Quick-response Inputs

11-1 Quick-response Inputs.......................................................................................................... 11-211-1-1 Overview................................................................................................................................... 11-211-1-2 Flow of Processing ................................................................................................................... 11-3

Section 12 Interrupts

12-1 Interrupts................................................................................................................................ 12-212-1-1 CP1E Interrupts ........................................................................................................................ 12-2

12-2 Input Interrupts ...................................................................................................................... 12-312-2-1 Overview................................................................................................................................... 12-312-2-2 Flow of Operation ..................................................................................................................... 12-412-2-3 Application Example for Input Interrupts................................................................................... 12-8

12-3 Scheduled Interrupts........................................................................................................... 12-1112-3-1 Overview................................................................................................................................. 12-11

Page 10: CP1E CPU Unit Software Users Manual

10 CP1E CPU Unit Software User’s Manual(W480)

12-3-2 Flow of Operation.................................................................................................................... 12-12

12-4 Precautions for Using Interrupts........................................................................................ 12-1512-4-1 Interrupt Task Priority and Order of Execution ........................................................................ 12-1512-4-2 Auxiliary Area Words and Bits Related to Interrupts ............................................................... 12-1512-4-3 Duplicate Processing in Cyclic and Interrupt Tasks ................................................................ 12-15

Section 13 High-speed Counters

13-1 Overview and Flow of Processing ....................................................................................... 13-213-1-1 Overview ................................................................................................................................... 13-213-1-2 Flow of Processing.................................................................................................................... 13-313-1-3 Specifications............................................................................................................................ 13-8

13-2 High-speed Counter Inputs................................................................................................... 13-913-2-1 Pulse Input Method (Input Setting)............................................................................................ 13-913-2-2 Counting Modes: Linear Mode and Ring Mode....................................................................... 13-1013-2-3 Reset Methods........................................................................................................................ 13-1113-2-4 Reading the Present Value of a High-speed Counter ............................................................. 13-1213-2-5 High-speed Counter Frequency Measurement ....................................................................... 13-12

13-3 High-speed Counter Interrupts........................................................................................... 13-1413-3-1 Overview ................................................................................................................................. 13-1413-3-2 Target Value Comaprison and Range Comparison................................................................. 13-17

13-4 Auxiliary Area Bits and Words Used with High-speed Counters .................................... 13-25

13-5 Application Example of High-speed Counter Interrupt.................................................... 13-26

Section 14 Pulse Outputs

14-1 Overview and Flow of Processing ....................................................................................... 14-314-1-1 Overview ................................................................................................................................... 14-314-1-2 Flow of Processing.................................................................................................................... 14-414-1-3 Pulse Output Specifications ...................................................................................................... 14-8

14-2 Trapezoidal Control ............................................................................................................... 14-914-2-1 Determine the Pulse Output Port, Output Method, and Output Waveform ............................... 14-914-2-2 Relative Pulse Outputs and Absolute Pulse Outputs ................................................................ 14-914-2-3 Operations Affecting the Origin Status (Defined/Undefined Status) ....................................... 14-1114-2-4 Programming Example for Trapezoidal Control....................................................................... 14-11

14-3 Jogging................................................................................................................................. 14-1314-3-1 Determine the Pulse Output Port and Pulse Output Method .................................................. 14-1314-3-2 Pulse Waveform and Applicable Instructions .......................................................................... 14-1314-3-3 Programming Example for Jogging......................................................................................... 14-14

14-4 Performing Origin Searches ............................................................................................... 14-1614-4-1 Origin Searches ...................................................................................................................... 14-1614-4-2 Flow of Processing.................................................................................................................. 14-1714-4-3 Setting the Pulse Output Port and Pulse Output Method........................................................ 14-1714-4-4 Settings in PLC Setup............................................................................................................. 14-2014-4-5 Applicable Instructions ............................................................................................................ 14-2214-4-6 Details on the Origin Search Function .................................................................................... 14-2314-4-7 Origin Search Examples ......................................................................................................... 14-30

14-5 Returning to the Origin ....................................................................................................... 14-33

14-6 Changing/Reading the Pulse Output Present Value......................................................... 14-3414-6-1 Changing the Present Value of the Pulse Output.................................................................... 14-3414-6-2 Reading the Present Value of a Pulse Output......................................................................... 14-34

14-7 Auxiliary Area Bits and Words Used with Pulse Outputs ................................................ 14-36

14-8 Pulse Output Application Examples.................................................................................. 14-3714-8-1 Example 1: Cutting Long Material Using Fixed Feeding ......................................................... 14-3714-8-2 Example 2: Vertically Conveying PCBs (Multiple Progressive Positioning)............................. 14-40

Page 11: CP1E CPU Unit Software Users Manual

11CP1E CPU Unit Software User’s Manual(W480)

14-8-3 Example 3: Feeding Wrapping Material: Interrupt Feeding .................................................... 14-45

14-9 Precautions When Using Pulse Outputs........................................................................... 14-48

14-10Pulse Output Details ........................................................................................................... 14-5314-10-1 Continuous Mode (Speed Control) ......................................................................................... 14-5314-10-2 Independent Mode (Positioning) ............................................................................................. 14-55

Section 15 PWM Outputs

15-1 Variable-duty-factor Pulse Outputs (PWM Outputs)........................................................... 15-215-1-1 Overview................................................................................................................................... 15-2

Section 16 Serial Communications

16-1 Serial Communications......................................................................................................... 16-316-1-1 Types of CPU Units and Serial Ports ........................................................................................ 16-316-1-2 Overview of Serial Communications......................................................................................... 16-416-1-3 Built-in RS-232C Port for N-type CPU Units ............................................................................. 16-516-1-4 Optional Serial Communications Board for N-type CPU Units with 30 or 40 I/O Points ........... 16-6

16-2 Wiring for Serial Communications....................................................................................... 16-916-2-1 Recommended RS-232C Wiring Example ............................................................................... 16-916-2-2 Recommended RS-422A/485 Wiring Examples..................................................................... 16-1016-2-3 Converting the Built-in RS-232C Port to RS-422A/485 .......................................................... 16-1116-2-4 Reducing Electrical Noise for External Wiring ........................................................................ 16-14

16-3 Program-free Communications with Programmable Terminals ...................................... 16-1516-3-1 OVERVIEW............................................................................................................................. 16-1516-3-2 Flow of Processing ................................................................................................................. 16-1616-3-3 PLC Setup and PT System Menu........................................................................................... 16-1616-3-4 Wiring Examples for PTs ........................................................................................................ 16-17

16-4 No-protocol Communications with General Components............................................... 16-1916-4-1 Overview................................................................................................................................. 16-1916-4-2 Flow of Processing ................................................................................................................. 16-2016-4-3 PLC Setup .............................................................................................................................. 16-2016-4-4 Device Wiring Examples......................................................................................................... 16-2116-4-5 Related Auxiliary Area Bits and Words................................................................................... 16-23

16-5 Modbus-RTU Easy Master Function .................................................................................. 16-2416-5-1 Overview................................................................................................................................. 16-2416-5-2 Flow of Processing ................................................................................................................. 16-2416-5-3 DM Fixed Allocation Words for the Modbus-RTU Easy Master .............................................. 16-2516-5-4 Programming Examples ......................................................................................................... 16-27

16-6 Serial PLC Links .................................................................................................................. 16-3316-6-1 Overview................................................................................................................................. 16-3316-6-2 Flow of Processing ................................................................................................................. 16-3416-6-3 PLC Setup .............................................................................................................................. 16-3416-6-4 Wiring Example for PLCs........................................................................................................ 16-3516-6-5 Specifications.......................................................................................................................... 16-3716-6-6 Example Application ............................................................................................................... 16-42

16-7 Connecting the Host Computer (Not Including Support Software) ................................ 16-4416-7-1 Overview................................................................................................................................. 16-4416-7-2 Flow of Processing ................................................................................................................. 16-44

Section 17 Other Functions

17-1 PID Temperature Control ...................................................................................................... 17-217-1-1 Overview................................................................................................................................... 17-217-1-2 Application Procedure for PID Temperature Control................................................................. 17-3

Page 12: CP1E CPU Unit Software Users Manual

12 CP1E CPU Unit Software User’s Manual(W480)

17-1-3 Ladder Programming Example ................................................................................................. 17-4

17-2 Analog Adjusters ................................................................................................................... 17-717-2-1 Overview ................................................................................................................................... 17-717-2-2 Application Example.................................................................................................................. 17-7

17-3 Minimum Cycle Time ............................................................................................................. 17-817-3-1 Overview ................................................................................................................................... 17-817-3-2 Setting the Minimum Cycle Time in PLC Setup ........................................................................ 17-8

17-4 Clock ....................................................................................................................................... 17-917-4-1 Overview ................................................................................................................................... 17-9

17-5 Startup Settings and Maintenance ...............................................17-1117-5-1 Holding Settings for Operating Mode Changes and at Startup ............................................... 17-1117-5-2 Setting the Power OFF Detection Time................................................................................... 17-1317-5-3 Disabling Power Interruption Processing in the Program........................................................ 17-14

17-6 ............................................................................................................................................... 17-1517-6-1 ................................................................................................................................................ 17-15

17-7 Security Functions .............................................................................................................. 17-1617-7-1 Ladder Program Protection ..................................................................................................... 17-16

17-8 Debugging ....................................................................17-1917-8-1 Forced Set/Reset .................................................................................................................... 17-1917-8-2 Online Editing.......................................................................................................................... 17-1917-8-3 Storing the Stop Position at Errors.......................................................................................... 17-1917-8-4 Failure Alarm Instructions ....................................................................................................... 17-20

Section 19 CPU Unit Cycle Time

19-1 Monitoring the Cycle Time.................................................................................................... 19-219-1-1 Monitoring the Cycle Time ........................................................................................................ 19-2

19-2 Computing the Cycle Time ................................................................................................... 19-319-2-1 CPU Unit Operation Flowchart.................................................................................................. 19-319-2-2 Cycle Time Overview ................................................................................................................ 19-419-2-3 Functions Related to the Cycle Time ........................................................................................ 19-519-2-4 I/O Refresh Times for PLC Units............................................................................................... 19-719-2-5 Cycle Time Calculation Example .............................................................................................. 19-819-2-6 Increase in Cycle Time for Online Editing ................................................................................. 19-819-2-7 I/O Response Time ................................................................................................................... 19-919-2-8 Interrupt Response Time ........................................................................................................ 19-1119-2-9 Serial PLC Link Response Performance................................................................................. 19-1319-2-10 Pulse Output Start Time.......................................................................................................... 19-1319-2-11 Pulse Output Change Response Time.................................................................................... 19-14

Section A Appendices

A-1 Summary of Instructions ........................................................................................................A-2

A-2 .................................................................................................................................................A-12

A-3 CP1E CPU Unit Instruction Execution Times and Number of Steps ................................A-13

A-4 Ladder Programming Example ...................................................A-25A-4-1 Shutter Control System.............................................................................................................A-25

A-5 Comparison with the CP1L...................................................................................................A-29A-5-1 Differences between CP1E and CP1L ......................................................................................A-29

Page 13: CP1E CPU Unit Software Users Manual

13CP1E CPU Unit Software User’s Manual(W480)

Read and Understand this ManualPlease read and understand this manual before using the product. Please consult your OMRON representative if you have any questions or comments.

Warranty and Limitations of Liability

WARRANTY

OMRON’s exclusive warranty is that the products are free from defects in materials and workmanship for a period of one year (or other period if specified) from date of sale by OMRON.

OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, REGARDING NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR PARTICULAR PURPOSE OF THE PRODUCTS. ANY BUYER OR USER ACKNOWLEDGES THAT THE BUYER OR USER ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE. OMRON DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED.

LIMITATIONS OF LIABILITY

OMRON SHALL NOT BE RESPONSIBLE FOR SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED ON CONTRACT, WARRANTY, NEGLIGENCE, OR STRICT LIABILITY.

In no event shall the responsibility of OMRON for any act exceed the individual price of the product on which liability is asserted.

IN NO EVENT SHALL OMRON BE RESPONSIBLE FOR WARRANTY, REPAIR, OR OTHER CLAIMS 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 OR REPAIR.

Page 14: CP1E CPU Unit Software Users Manual

14 CP1E CPU Unit Software User’s Manual(W480)

Application Considerations

SUITABILITY FOR USE

OMRON shall not be responsible for conformity with any standards, codes, or regulations that apply to the combination of products in the customer’s application or use of the products.

At the customer’s request, OMRON will provide applicable third party certification documents identifying ratings and limitations of use that apply to the products. This information by itself is not sufficient for a complete determination of the suitability of the products in combination with the end product, machine, system, or other application or use.

The following are some examples of applications for which particular attention must be given. This is not intended to be an exhaustive list of all possible uses of the products, nor is it intended to imply that the uses listed may be suitable for the products:

• Outdoor use, uses involving potential chemical contamination or electrical interference, or conditions or uses not described in this manual.

• Nuclear energy control systems, combustion systems, railroad systems, aviation systems, medical equipment, amusement machines, vehicles, safety equipment, and installations subject to separate industry or government regulations.

• Systems, machines, and equipment that could present a risk to life or property.

Please know and observe all prohibitions of use applicable to the products.

NEVER USE THE PRODUCTS FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO ADDRESS THE RISKS, AND THAT THE OMRON PRODUCTS ARE PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.

PROGRAMMABLE PRODUCTS

OMRON shall not be responsible for the user’s programming of a programmable product, or any consequence thereof.

Page 15: CP1E CPU Unit Software Users Manual

15CP1E CPU Unit Software User’s Manual(W480)

Disclaimers

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 model numbers when published ratings or features are changed, or when significant construction changes are made. However, some specifications of the products may be changed without any notice. When in doubt, special model numbers may be assigned to fix or establish key specifications for your application on your request. Please consult with your OMRON representative at any time to confirm actual specifications of purchased products.

DIMENSIONS AND WEIGHTS

Dimensions and weights are nominal and are not to be used for manufacturing purposes, even when tolerances are shown.

PERFORMANCE DATA

Performance data given in this manual 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 users must correlate it to actual application requirements. Actual performance is subject to the OMRON Warranty and Limitations of Liability.

ERRORS AND OMISSIONS

The information in this manual has been carefully checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical, or proofreading errors, or omissions.

Page 16: CP1E CPU Unit Software Users Manual

16 CP1E CPU Unit Software User’s Manual(W480)

Safety Precautions

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

Definition of Precautionary Information

WARNING

Caution

Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Additionally, there may be severe property damage.

Indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury, or property damage.

Precautions for Safe UseIndicates precautions on what to do and what not to do to ensure using the product safely.

Precautions for Correct UseIndicates precautions on what to do and what not to do to ensure proper operation and performance.

Page 17: CP1E CPU Unit Software Users Manual

17CP1E CPU Unit Software User’s Manual(W480)

Symbols

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

The circle and slash symbol indicates operations that youmust not do. The specific operation is shown in the circleand explained in text.

The filled circle symbol indicates operations that youmust do. The specific operation is shown in the circle andexplained in text. This example shows a general precau-tion for something that you must do.

The triangle symbol indicates precautions (includingwarnings). The specific operation is shown in the triangleand explained in text. This example indicates a generalprecaution.

The triangle symbol indicates precautions (includingwarnings). The specific operation is shown in the triangleand explained in text. This example indicates a precau-tion for hot surfaces.

Page 18: CP1E CPU Unit Software Users Manual

18 CP1E CPU Unit Software User’s Manual(W480)

Do not attempt to take any Unit apart while the power is being supplied.

Doing so may result in electric shock.

Do not touch any of the terminals or terminal blocks while the power is being supplied. Doing so may result in electric shock.

Provide safety measures in external circuits (i.e., not in the Programmable Control-ler), including the following items, to ensure safety in the system if an abnormality occurs due to malfunction of the PLC or another external factor affecting the PLC operation. Not doing so may result in serious accidents.

• Emergency stop circuits, interlock circuits, limit circuits, and similar safety mea-sures must be provided in external control circuits.

• The PLC will turn OFF all outputs when its self-diagnosis function detects any error or when a severe failure alarm (FALS) instruction is executed. As a countermeasure for such errors, external safety measures must be provided to ensure safety in the system.

• The PLC outputs may remain ON or OFF due to deposition or burning of the output relays or destruction of the output transistors. As a countermeasure for such prob-lems, external safety measures must be provided to ensure safety in the system.

• When the 24-VDC output (service power supply to the PLC) is overloaded or short-circuited, the voltage may drop and result in the outputs being turned OFF. As a countermeasure for such problems, external safety measures must be provided to ensure safety in the system.

Fail-safe measures must be taken by the customer to ensure safety in the event of incorrect, missing, or abnormal signals caused by broken signal lines, momentary power interruptions, or other causes. Serious accidents may result from abnormal operation if proper measures are not provided.

Do not apply the voltage/current outside the specified range to this unit. It may cause a malfunction or fire.

Caution

Page 19: CP1E CPU Unit Software Users Manual

19CP1E CPU Unit Software User’s Manual(W480)

If the power supply is interrupted for longer than the backup time of the built-in capaci-tor, the following areas will be cleared to all zeros and the Auxiliary Area (A) will be cleared to its default values.

DM Area (D), Holding Area (H), Counter Completion Flags (C), and Counter Present Values (C)

For an N-type CPU Unit, the internal clock will also be cleared.

These areas are backed up by the capacitor that is built into the CPU Unit. The backup time of the capacitor built into the CP1E CPU Unit is 50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit at 25°C.

Create a system and write the ladder programs so that problems will not occur in the system if the data in these areas is cleared. Always mount a CP1W-BAT01 Battery (sold separately) in an N-type CPU Unit. (This Battery cannot be mounted in an E-type CPU Unit.)

Data may be lost and abnormal operation may occur if a power interruption lasts too long, possibly resulting in serious accidents.

The data in the user programs, parameter area, and the backed up words of the DM Area is backed up in built-in backup memory (EEPROM) and will not be lost even if the backup time of the built-in capacitor is exceeded.

The data backed up in the CP1E CPU Units and the backup methods are listed in the following table.

Holding Areas Data backup method

• DM Area (D)

• Holding Area (H)

• Counter Completion Flags/PVs (C)

• Auxiliary Area (A)

Backed up by built-in capacitor.

(Data is cleared or initialized in these areas if a power interruption lasts longer than the backup time of the built-in capacitor.)

• User programs

• Parameter Area (PLC Setup)

• Backed up words in DM Area

Backed up in built-in backup memory (EEPROM).

(Data is not cleared or initialized in these areas even if a power interruption lasts longer than the backup time of the built-in capacitor.)

Caution

25˚C 40˚C 60˚CAmbient temperature

50 hours

40 hours

25 hours20 hours

9 hours7 hours

CP1E-ECPU Unit

CP1E-NCPU Unit

Bac

kup

time

of b

uilt-

in c

apac

itor

Page 20: CP1E CPU Unit Software Users Manual

20 CP1E CPU Unit Software User’s Manual(W480)

Do not base external outputs from a ladder program on the status of data backed up in the DM Area (D), Holding Area (H), or Counter Area (C, including Completion Flags and Present Values) if the backup time of the built-in capacitor has been exceeded. Use one of the following methods to turn OFF all external outputs.

• Select the option in the PLC Setup to generate a memory error if I/O memory is corrupted. Or,

• Use the I/O Memory Corrupted Flag (A509.15) to turn ON the Output OFF Bit (A500.15).

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.

Tighten the screws on the terminal block of the AC power supply section to the torque specified in the user’s manual. The loose screws may result in burning or malfunction.

Do not touch the power supply section when power is being supplied or immediately after the power supply is turned OFF. The power supply section and I/O terminal blocks will be hot and you may be burned.

Pay careful attention to the polarities (+/-) when wiring the DC power supply. A wrong connection may cause malfunction of the system.

A509.15

I/O Memory Corrupted Flag

SET

A500.15

Turn ON the Output OFF Bit.

Page 21: CP1E CPU Unit Software Users Manual

21CP1E CPU Unit Software User’s Manual(W480)

When connecting the PLC to a computer or other peripheral device, either ground the 0-V side of the external power supply or do not ground the external power supply at all. Otherwise the external power supply may be shorted depending on the connec-tion methods of the peripheral device. DO NOT ground the 24 V-side of the external power supply, as shown in the following diagram.

24V

0V 0V 0V

FGFG FG

FG

Non-insulated DCpower supply

CPU Unit

USB cable or other communications cable

Peripheral device(e.g., personal computer)

Page 22: CP1E CPU Unit Software Users Manual

22 CP1E CPU Unit Software User’s Manual(W480)

Precautions for Safe Use

Observe the following precautions when using a CP-series PLC.

Power Supply• Always use the power supply voltages specified in the user’s manuals. An incorrect voltage may

result in malfunction or burning.

• Take appropriate measures to ensure that the specified power with the rated voltage and fre-quency is supplied. Be particularly careful in places where the power supply is unstable. An incor-rect power supply may result in malfunction.

• Double-check all wiring and switch settings before turning ON the power supply. Incorrect wiringmay result in burning.

• Always turn OFF the power supply to the PLC before attempting any of the following. Not turningOFF the power supply may result in malfunction or electric shock.

• Mounting or dismounting Expansion Units or Expansion I/O Units

• Mounting or dismounting Option Boards

• Setting rotary switches

• Connecting cables or wiring the system

• Connecting or disconnecting the connectors

Installation• Before touching a Unit, be sure to first touch a grounded metallic object in order to discharge any

static build-up. Not doing so may result in malfunction or damage.

• Be sure that the terminal blocks, connectors, Option Boards, and other items with locking devicesare properly locked into place. Improper locking may result in malfunction.

Wiring• Wire correctly according to specified procedures in this manual.

• AWG22-18 (0.32~0.82mm2)Always use the following size wire when connecting I/O terminals:

AWG22 to AWG18 (0.32 to 0.82 mm2).

• Install external breakers and take other safety measures against short-circuiting in external wiring.Insufficient safety measures against short-circuiting may result in burning.

• Always connect to a ground of 100 Ω or less when installing the Units. Not connecting to a groundof 100 Ω or less may result in electric shock.

• Leave the label attached to the top of the Unit when wiring to prevent the entry of foreign matter.Removing the label may result in malfunction if foreign matter enters the Unit.

• Remove the label after the completion of wiring to ensure proper heat dissipation. Leaving thelabel attached may result in malfunction.

• Use crimp terminals for wiring. Do not connect bare stranded wires directly to terminals. Connec-tion of bare stranded wires may result in burning.

• Do not apply voltages to the input terminals in excess of the rated input voltage. Excess voltagesmay result in burning.

• Do not apply voltages or connect loads to the output terminals in excess of the maximum switch-ing capacity. Excess voltage or loads may result in burning.

• Disconnect the functional ground terminal when performing withstand voltage tests. Not discon-necting the functional ground terminal may result in burning.

Page 23: CP1E CPU Unit Software Users Manual

23CP1E CPU Unit Software User’s Manual(W480)

• Be sure that all the PLC terminal screws and cable connector screws are tightened to the torquespecified in the relevant manuals. The tightening torque for the terminals on the CP1W-CIF11/CIF12 terminal block is 0.28 N·m Incorrect tightening torque may result in malfunction.

• Do not connect pin 6 (+5V) on the built-in RS-232C port on the CPU Unit or the RS-232C OptionBoard (CP1W-CIF01) mounted to the CPU Unit to any external device other than the NT-AL001 orCJ1W-CIF11 Conversion Adapter. The external device and the CPU Unit may be damaged.

• Do not pull on the cables or bend the cables beyond their natural limit. Doing either of these maybreak the cables.

• Do not place objects on top of the cables or other wiring lines. Doing so may break the cables.

Handling• Memory Status after Power Interrupts

A Battery cannot be installed in CP1E E-type CPU Units (basic models). The Battery is sold sepa-rately for CP1E N-type CPU Units (application models). Data in the following four areas will be cleared if power is interrupted for more than 50 hours (at25°C) for an E-type CPU Unit and for more than 40 hours (at 25°C) for an N-type CPU Unit.

• DM Area (D) (excluding backed up DM Area words)

• Holding Area (H)

• Counter PVs and Completion Flags (C)

• Auxiliary Area (A)

Consider the possibility of data being cleared due to power interrupts, and observe the following pre-cautions.

• Write the ladder programs to set any data required for operation when starting operation.

• Include programming to back up specified parts of the DM Area to built-in EEPROM during orafter operation. (This is called the DM backup function.)

• Refer to 3-2 Memory Backup in the CP1E Software User’s Manual (Cat. No. W480) for otherprocessing information.

• Check the ladder program for proper execution before actually running it on the Unit. Not checkingthe program may result in an unexpected operation.

• The ladder program and parameter area data in the CP1E CPU Units are backed up in the backupmemory. The BKUP indicator will light on the front of the CPU Unit when the backup operation isin progress. Do not turn OFF the power supply to the CPU Unit when the BKUP indicator is lit. Thedata will not be backed up if power is turned OFF.

P_First_Cycle

First Cycle Flag (A200.11)

Set any data required for operation at the start of operation using the MOV, XFER, or other instructions.

Execution condition

Example)

SET

A752.00

RST

A752.00

Backs up D0 to D499 to built-in EEPROM.

Page 24: CP1E CPU Unit Software Users Manual

24 CP1E CPU Unit Software User’s Manual(W480)

• Before replacing the battery, supply power to the CPU Unit for at least 30 minutes and then com-plete battery replacement within 40 hours (at 25 °C, N-type CPU Units only). Memory data may becorrupted if this precaution is not observed.

• Make sure that the required data for the DM Area, Holding Area, and other memory areas hasbeen transferred to a CPU Unit that has been replaced 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. Notdoing 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.

• When replacing parts, be sure to confirm that the rating of a new part is correct. Not doing so mayresult in malfunction or burning.

• Do not touch the Expansion I/O Unit Connecting Cable while the power is being supplied in orderto prevent malfunction due to static electricity.

• Do not turn OFF the power supply to the Unit while data is being transferred.

• When transporting or storing Units or Board, static electricity can destroy LSIs or ICs. Cover thePCBs with a conductive material and maintain the specified storage temperature.

• Do not touch circuit boards or the components mounted to them with your bare hands. There aresharp leads and other parts on the boards that may cause injury if handled improperly.

• Double-check the pin numbers when assembling and wiring the connectors.

• Never short-circuit the positive and negative terminals of a battery or charge, disassemble, heat,or incinerate the battery. Do not subject the battery to strong shocks or deform the battery byapplying pressure. Doing any of these may result in leakage, rupture, heat generation, or ignitionof the battery. Dispose of any battery that has been dropped on the floor or otherwise subjected toexcessive shock. Batteries that have been subjected to shock may leak if they are used.

• Dispose of the product and batteries according to local ordinances as they apply.

• UL standards require that only an experienced engineer can replace the battery. Make sure thatan experienced engineer is in charge of battery replacement. Follow the procedure for batteryreplacement given in this manual.

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, temporaryerrors may result in control system signals because the output terminals on DC Output Units andother 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 fromoutput 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 maintaintheir previous status when the PLC is switched from RUN or MONITOR mode to PROGRAMmode. 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.)

Page 25: CP1E CPU Unit Software Users Manual

25CP1E CPU Unit Software User’s Manual(W480)

Operating Environment Precautions

Follow the instructions in this manual to correctly perform installation.

Do not operate the control system in the following locations:• Locations subject to direct sunlight

• Locations subject to temperatures or humidity outside the range specified in the specifications

• Locations subject to condensation as the result of severe changes in temperature

• Locations subject to corrosive or flammable gases

• Locations subject to dust (especially iron dust) or salts

• Locations subject to exposure to water, oil, or chemicals

• Locations subject to shock or vibration

Take appropriate and sufficient countermeasures when installing systems in the following locations:• Locations subject to static electricity or other forms of noise

• Locations subject to strong electromagnetic fields

• Locations subject to possible exposure to radioactivity

• Locations close to power supplies

Page 26: CP1E CPU Unit Software Users Manual

26 CP1E CPU Unit Software User’s Manual(W480)

Regulations and Standards

• EMC Directives

• Low Voltage Directive

EMC DirectivesOMRON devices are electrical components that are designed to be built into equipment and manu-facturing systems. OMRON devices that comply with EMC Directives also conform to the relatedEMC standards (see note) so that they can be more easily built into other devices or the overallmachine. Whether the products conform to the standards in the system used by the customer, how-ever, must be checked by the customer.

EMC-related performance of the OMRON devices that comply with EC Directives will vary depend-ing on the configuration, wiring, and other conditions of the equipment or control panel on which theOMRON devices are installed. The customer must, therefore, perform the final check to confirm thatdevices and the overall machine conform to EMC standards.

Note The applicable EMC (Electromagnetic Compatibility) standard is EN61131-2.

Low Voltage DirectiveAlways ensure that devices operating at voltages of 50 to 1,000 V AC and 75 to 1,500 V DC meetthe required safety standards for the PLC (EN 61131-2).

Conformance to EC DirectivesThe CP1E PLCs comply with EC Directives. To ensure that the machine or device in which theCP1E PLC is used complies with EC Directives, the PLC must be installed as follows:

1 The CP-series PLC must be installed within a control panel.

2 CP-series PLCs complying with EC Directives also conform to EN61131-2. Radiated emissioncharacteristics (10-m regulations) may vary depending on the configuration of the control panelused, other devices connected to the control panel, wiring, and other conditions. You must there-fore confirm that the overall machine or equipment complies with EC Directives.

3 A SYSMAC CP-series PLC is a class A product (for an industrial environment). In residentialareas it may cause radio interference, in which case the user may be required to take adequatemeasures to reduce interference.

Conformance to EC Directives

Applicable Directives

Concepts

Page 27: CP1E CPU Unit Software Users Manual

27CP1E CPU Unit Software User’s Manual(W480)

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 trademarksof their respective companies.

Trademarks

Terminology and Notation

Term Description

PLC “Programmable Controller” is abbreviated as “PLC” in this manual.

“PC”, however, appears in some software displays in the meaning of “Programmable Controller.”

“PC” is not used as an abbreviation for “personal computer”, which is always written out.

E-type CPU Unit

A basic model of CPU Unit that support basic control applications using instructions such as basic, movement, arithmetic, and comparison instructions.

Basic models of CPU Units are called “E-type CPU Units” in this manual.

N-type CPU Unit

An application model of CPU Unit that supports connections to Programmable Termi-nals, inverters, and servo drives.

Application models of CPU Units are called “N-type CPU Units” in this manual.

Page 28: CP1E CPU Unit Software Users Manual

28 CP1E CPU Unit Software User’s Manual(W480)

Related Manuals

The following manuals are related to the CP1E. Use them together with this manual.

Manual name Cat. No. Model numbers Application Contents

SYSMAC CP Series CP1E CPU Unit Soft-ware User’s Manual

W480(this manual)

CP1E-E D -ACP1E-N D -A

To learn the software specifications of the CP1E

Describes the following information for CP1E PLCs.

• CPU Unit operation

• Internal memory

• Programming

• Settings

• CPU Unit built-in functions

• Interrupts

• High-speed counter inputs

• Pulse outputs

• Serial communications

• Other functions

Use this manual together with the CP1E CPU Unit Hardware User’s Manual (Cat. No. W479) and Instructions Reference Manual (Cat. No. W483).

SYSMAC CP Series CP1E CPU Unit Hard-ware User’s Manual

W479 CP1E-E D -A

CP1E-N D -A

To learn the hard-ware specifications of the CP1E PLCs

Describes the following information for CP1E PLCs.

• Overview and features

• Basic system configuration

• Part names and functions

• Installation and settings

• Troubleshooting

Use this manual together with the CP1E CPU Unit Software User’s Manual (Cat. No. W480) and Instructions Reference Manual (Cat. No. W483).

SYSMAC CP Series CP1E CPU Unit Instruc-tions Reference Manual

W483 CP1E-E D -A

CP1E-N D -A

To learn program-ming instructions in detail

Describes each programming instruction in detail.

When programming, use this manual together with the CP1E CPU Unit Software User’s Man-ual (Cat. No. W480).

CS/CJ/CP/NSJ Series Communications Com-mands Reference Man-ual

W342 CS1G/H-CPU H

CS1G/H-CPU -V1

CS1D-CPU H

CS1D-CPU S

CS1W-SCU -V1

CS1W-SCB -V1

CJ1G/H-CPU H

CJ1G-CPU P

CJ1M-CPU

CJ1G-CPU

CJ1W-SCU -V1

To learn communica-tions commands for CS/CJ/CP/NSJ-series Controllers in detail

Describes

1) C-mode commands and

2) FINS commands in detail.

Read this manual for details on C-mode and FINS commands addressed to CPU Units.

Note This manual describes commands addressed to CPU Units. Itdoes not cover commands addressed to other Units or ports (e.g.,serial communications ports on CPU Units, communications portson Serial Communications Units/Boards, and other Communica-tions Units).

Page 29: CP1E CPU Unit Software Users Manual

1-1CP1E CPU Unit Software User’s Manual(W480)

1

This section gives an overview of the CP1E and describes its features and procedures,as well as the features of SYSMAC.

1-1 CP1E Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21-1-1 Overview of Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

1-1-2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

1-1-3 CP1E CPU Unit Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-8

1-2 Basic Operating Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9

1-3 SYSMAC PLC Operation and Programming Features . . . . . . . . . . . . . . . . 1-101-3-1 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10

1-3-2 Operating Mode at Startup: RUN Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-111-3-3 I/O Allocation and Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12

1-3-4 Specifying I/O Memory Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13

1-3-5 CP1E Data: Normally Hexadecimal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-141-3-6 Condition Flags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15

1-3-7 Control Data that Sets the Instruction Function . . . . . . . . . . . . . . . . . . . . . . . 1-16

Overview and SYSMAC Features

Page 30: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-2 CP1E CPU Unit Software User’s Manual(W480)

1-1 CP1E Overview

The SYSMAC CP1E Programmable Controller is a package-type PLC made by OMRON that isdesigned for easy application. The CP1E includes E-type CPU Units (basic models) for standard con-trol operations using basic, movement, arithmetic, and comparison instructions, and N-type CPU Units(application models) that supports connections to Programmable Terminals, Inverters, and ServoDrives.

• Programming, setting, and monitoring with CX-Programmer for CP1E.

• Easy connection with computers using commercially available USB cables.

• Expansion I/O Units can be connected to increase the I/O capacity of a CPU Unit (for CPU Units with30 or 40 I/O points).

• Expansion Units can be connected to add analog I/O or temperature inputs to a CPU Unit with 30 or40 I/O points.

• Quick-response inputs.

• Input interrupts.

• Complete high-speed counter functionality.

• Versatile pulse control for N-type CPU Units.

• Execution of origin searches and origin returns using instructions for N-type CPU Units.

• PWM outputs for N-type CPU Units.

• Changing settings with the analog adjusters.

• Built-in RS-232C port on N-type CPU Units.

• A Serial Option Board can be added to N-type CPU Units with 30 or 40 I/O points.

1-1-1 Overview of Features

Commercially available USB cable

One RS-232C port One RS-422A/485 port

CX-Programmer for CPIE

USB port

CP1E CPU Unit (An N-type CPU Unit with 40 I/O Points is shown here.)

Power supply and input terminals

Expansion Units (Can be mounted to CPU Units with 30 or 40 I/O points.)

Analog adjuster

Built-in RS-232C port

Option Board

Output terminal block

IN CH

CH

OUT

00 01 02 03

08 09 10 11

04 05 06 07

00 01 02 03 04 05 06 07CH

CH EXP

COM 01 03 05 07 09 11NC 00 02 04 06 08 10

NC 00 01 02 04 05 07NC COM COM COM 03 COM 06

IN CH

CH

OUT

00 01 02 03

08 09 10 11

04 05 06 07

00 01 02 03 04 05 06 07CH

CH EXP

COM 01 03 05 07 09 11NC 00 02 04 06 08 10

NC 00 01 02 04 05 07NC COM COM COM 03 COM 06

IN CH

CH

OUT

00 01 02 03

08 09 10 11

04 05 06 07

00 01 02 03 04 05 06 07CH

CH EXP

COM 01 03 05 07 09 11NC 00 02 04 06 08 10

NC 00 01 02 04 05 07NC COM COM COM 03 COM 06

Peripheral USB port

CP1W-BAT01 Battery (sold separately) (Can be mounted only to N-type CPU Units.)

One slot for an Option Board

RS-232C Option Board CP1W-CIF01

RS-422A/485 Option Board CP1W-CIF11/12

(Note) The following Option Boards cannot be used.·CP1W-DAM01 LCD Option Board·CP1W-CIF41 Ethernet Option Board

Page 31: CP1E CPU Unit Software Users Manual

1-3

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-1 CP

1E O

verview

1

1-1-2 Features

The CX-Programmer for CP1E is used as the Programming Device for the CP1E.

The CX-Programmer for CP1E is connected using a commercially available USB cable between thecomputer’s USB port and the built-in peripheral USB port of the CP1E.

A total of up to three of the following Expansion I/O Units can be connected to a CPU Unit with 30 or 40I/O points. (The total of three Units must also include Expansion Units.)

24-input/16-output Unit, 32-output Unit, 12-input/8-output Unit, 16-output Unit, 8-input Unit, or 8-out-put Unit

With a CPU Unit with 30 or 40 I/O points, a total of up to three of the following Expansion Units can beconnected. (The total of three Units must also include Expansion I/O Units.)

Analog I/O Unit, Analog Input Unit, Analog Output Unit, Temperature Sensor Units, CompoBus/S I/OLink Unit

By setting a built-in input to quick-response operation, inputs with signal widths as small as 50 µs canbe read with certainty regardless of the cycle time.

Up to six quick-response inputs can be used.

Note The user setting in the PLC Setup determines if each input is a quick-response input, normal input, interruptinput, or high-speed counter input.

1-1-2 Features

Programming, Setting, and Monitoring with the CX-Programmer for CP1E

Easy Connection with Computers Using Commercially Available USB Cables

With CPU Units with 30 or 40 I/O Points, Add I/O by Connecting Expansion I/O Units

With CPU Units with 30 or 40 I/O Points, Add Analog I/O or Temperature Inputs by Connecting Expansion Units

Quick-response Inputs

Can read ON signals shorter than the cycle time.

Photomicrosensor or other device

Quick-response input

Built-in input Cycle timeI/O refresh

Cycle timeCan read ON signals shorter than this time.

Page 32: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-4 CP1E CPU Unit Software User’s Manual(W480)

An interrupt task can be started when a built-in input turns ON or turns OFF (supported only in directmode). Up to six interrupt inputs can be used.

Note The user setting in the PLC Setup determines if each input is a quick-response input, normal input, interruptinput, or high-speed counter input.

A high-speed counter input can be used by connecting a rotary encoder to a built-in input. A CP1E CPUUnit is equipped with more than one high-speed counter input, making it possible to control devices formultiple axes with a single PLC.

Note The user setting in the PLC Setup determines if each input is a quick-response input, normalinput, interrupt input, or high-speed counter input

• High-speed counters can be used for high-speed processing, using either target value comparison orrange comparison with the counter’s PV to create interrupts.

An interrupt task can be started when the count reaches a specified value or falls within a specifiedrange.

• High-speed counter input frequency (speed) can be measured.The input pulse frequency can be measured using the PRV instruction (counter 0 only).

Input Interrupts

Complete High-speed Counter Functionality

END

Interrupt occurs

Built-in input

Interrupt input

Interrupt task

Ladder program

Encoder

Built-in Inputs(Functions can be assigned.)

High-speed Counter Inputs

E-type CPU Units:Increment pulse inputs: 10kHz × 6countersUp/down pulse inputs: 10kHz × 2countersPulse + direction inputs: 10kHz × 2countersDifferential phase inputs (4×): 5kHz × 2countersN-type CPU Units:Increment pulse inputs: 100kHz × 2 counters, 10kHz × 4countersUp/down pulse inputs: 100kHz × 1 counter, 10kHz × 1counterPulse + direction inputs: 100kHz × 2countersDifferential phase inputs (4×): 50kHz × 1 counter, 5kHz × 1counter

Page 33: CP1E CPU Unit Software Users Manual

1-5

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-1 CP

1E O

verview

1

1-1-2 Features

Fixed duty ratio pulse outputs can be output from the CPU Unit’s built-in outputs and used to performpositioning or speed control with a servomotor or a stepping motor that accepts pulse inputs.

Two pulse outputs at 100 kHz are provided as standard features.

Note The instruction used to control each output determines whether it is used as a normal output, pulse output,or PWM output.

• Positioning is possible with Trapezoidal Acceleration and DecelerationTrapezoidal acceleration and deceleration can be used for positioning using the PULSE OUTPUT(PLS2) instruction.

• Jogging Can Be PerformedJogging can be performed by executing the SPED or ACC instruction.

• Origin Searches and Origin Returns Can Be Performed Using the ORIGIN SEARCH InstructionAn accurate origin search combining all I/O signals can be executed with a single instruction. It isalso possible to move directly to an established origin using the ORIGIN SEARCH (ORG) instruction.

Lighting and power control can be performed by outputting variable duty ratio pulse (PWM) output sig-nals from the CPU Unit’s built-in outputs

Versatile Pulse Control for N-type CPU Units

PWM Outputs for N-type CPU Units

Stepping MotorServomotor

16 Built-in Outputs (Functions can be assigned.) (See note.)

Two pulse outputs100 kHz

Page 34: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-6 CP1E CPU Unit Software User’s Manual(W480)

.

Changing Settings Using Analog AdjusterBy adjusting the analog adjuster with a Phillips screwdriver, the value in the Auxiliary Area (A642)can be changed to any value between 0 and 255. All CPU Units are equipped with two analogadjusters. This makes it easy to change set values, such as those for timers and counters, without aProgramming Device.

Changing Settings Using External Analog Setting InputsNot provided.

The N-type CPU Units have one built-in RS-232C port as a standard feature.

Analog Settings

Built-in RS-232C Port for N-type CPU Units

Phillips screwdriver

Analog adjuster

Ladder program

CNTXA642 CH

Example: The production quantity could be changed by changing the counter set value from 100 to 150.

Turning the adjuster on the CP1E changes the value in A642 to between 0000 and 0255 (00 and FF hex).

Page 35: CP1E CPU Unit Software Users Manual

1-7

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-1 CP

1E O

verview

1

1-1-2 Features

One Serial Communications Option Board with one RS-232C port or one RS-422A/485 port can beadded to an N-type CPU Unit with 30 or 40 I/O points. With the serial communications port, it is easy toconnect to general components, such as barcode readers, and other components such as PTs, otherCP-series PLCs, and Inverters.

Mounting Serial Option Boards to N-type CPU Units with 30 or 40 I/O Points

RS-232C

NS-series PT, Barcode Reader, etc.

Example: Inverter

RS-422A

Modbus-RTU Easy Master Function

Serial PLC Links

CP1E, CP1H CP1L, CJ1M

Built-in RS-232C port

RS-422A/485 Option BoardWith the CP1W-CIF11 or CP1W-CIF 12 mounted

Page 36: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-8 CP1E CPU Unit Software User’s Manual(W480)

There are the following two types of CP1E CPU Units.

Precautions for Correct UsePrecautions for Correct Use

A battery cannot be used with an E-type CPU Unit. Do not use an E-type CPU Unit if data in thefollowing areas need to be retained after a power interruption lasting longer than 50 hours at 25°C.

• DM Area (excluding backed up DM Area words)

• Holding Area (H)

• Counter PVs and Completion Flags (C)

• Auxiliary Area (A)

Use an N-type CPU Unit and attach the CP1W-BAT01 Battery (sold separately) if data in theabove areas need to be retained after a power interruption lasting longer than 50 hours at 25°C.

1-1-3 CP1E CPU Unit Types

E-type CPU Units: Basic models for standard control operations using basic, movement, arithmetic, and comparison instructions.

N-type CPU Units: Application models that support connections to Programmable Terminals, Inverters, and Servo Drives.

Basic Models(E-type CPU Units)

CP1E Application Models(N-type CPU Units)

CPU with 20 I/O Points

CPU Unit with 30 or 40 I/O Points

CPU with 20 I/O Points

CPU Unit with 30 or 40 I/O Points

Appearance

Program capacity 2 Ksteps 8 KstepsDM Area capacity 2K words

Of these 1.5K words can be written to the built-in EEPROM.

8K wordsOf these 7K words can be written to the built-in EEPROM.

Mounting Expan-sion I/O Units and Expansion Units

Not possible. 3 Units maximum Not possible. 3 Units maximum

Model with transis-tor outputs

Not available. Available

Pulse outputs Not supported. SupportedBuilt-in serial com-munications port

Not provided. RS-232C port provided

Option Board Not supported. Not supported. Supported (for one port)Connection port for Programming Device

USB port USB port

Clock Not provided. ProvidedUsing a Battery Cannot be used. Can be used (sold separately).Backup time of built-in capacitor

50 hours at 25°C 40 hours at 25°C

Battery-free opera-tion

Always battery-free operation. Only data in the built-in EEPROM will be retained if power is inter-rupted for longer than 50 hours.

Battery-free operation if no battery is attached. In this case, only data in the built-in EEPROM will be retained if power is interrupted for longer than 40 hours.

Page 37: CP1E CPU Unit Software Users Manual

1-9

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-2 Basic O

peratin

g P

roced

ure

1

1-2 Basic Operating Procedure

In general, use the following procedure.

1. Setting Devices and Hardware

2. Wiring

3. Connecting Online to the PLC

4. I/O Allocations

5. Software Setup

6. Writing the Programs

8. Basic Program Operation

Connect the CPU Unit, Expansion I/O Units, and Expansion Units.Set the DIP switches on the Option Board and Expansion Units as required.

Wire the power supply, I/O, and communications.

Connect the personal computer online to the PLC.

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.

Make the PLC software settings.With a CP1E CPU Unit, all you have to do is set the PLC Setup.

Write the programs using the CX-Programmer. Debug the programs offline using the CX-Stimulator.

Check the I/O wiring and the Auxiliary Area settings, and perform trial operation.The CX-Programmer can be used for monitoring and debugging.

7. Checking Operation

Set the operating mode to RUN mode to start operation.

Refer to Section 3 Part Names and Functions and Section 5 Installation and Wiring in the CP1E Hardware User’s Manual (Cat. No. W479).

Refer to Section 5 Installation and Wiring in the CP1E Hardware User’s Manual (Cat. No. W479).

Refer to Section 4 Programming Device in the CP1E Hardware User’s Manual (Cat. No. W479).

Refer to Section 8 Backup Operations in the CP1E Hardware User’s Manual (Cat. No. W479).

Refer to Section 4 Initial Settings for CPU Unit and Section 9 PLC Setup in the CP1E CPU Unit Software User’s Manual (Cat. No. W480).

Refer to Section 5 Programming Concepts in the CP1E CPU Unit Software User’s Manual (Cat. No. W480).

Refer to Section 10 Overview and Allocation of Built-in Functions and 17-8 Debugging in the CP1E CPU Unit Software User’s Manual (Cat. No. W480).

Page 38: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-10 CP1E CPU Unit Software User’s Manual(W480)

1-3 SYSMAC PLC Operation and Programming Features

This section describes the features of OMRON PLCs.

SYSMAC PLCs have parameters that are called the PLC Setup. The PLC Setup enables a single PLCto achieve different functions. The PLC Setup is used for the initial settings of a PLC. For example, for aCP1E CPU Unit it is used to specify how to treat the input terminals (e.g., as interrupt inputs, quick-response inputs, or high-speed counters). The settings of the parameters are applied to the CPU Unitwhen the power supply is turned ON.

Additional Information

For SYSMAC PLCs, the PLC Setup is used for initial settings of parameters that need to bechanged during operation. Programming instructions are used to set parameters that need to bechanged during operation.

1-3-1 PLC Setup

As shown above, the initial settings of PLC functions, such as interrupts and high-speedcounters, can be set using software.

C 1 3 5 7 9 11

0 2 4 6 8 10

Requirements for Input Interrupts, Quick-response Inputs, and High-speed Counters

How are the input terminals going to be used?

Set in the PLC Setup

Set the PLC Setup using CX-Programmer for CP1E.

CX-Programmer for CP1E

Page 39: CP1E CPU Unit Software Users Manual

1-11

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-3 SY

SM

AC

PL

C O

peratio

n an

dP

rog

ramm

ing

Featu

res

1

1-3-2 Operating M

ode at Startup: R

UN

Mode

For the SYSMAC PLCs, the default setting in the PLC Setup is started in RUN mode when the powersupply is turned ON.

To start the CPU Unit in PROGRAM mode, set the Operating Mode on the Startup Tab Page of the PLCSetup to PROGRAM in the CX-Programmer for CP1E.

Additional Information

With a SYSMAC PLCs, turn ON the PLC power supply to enable the initial settings, such asthose in the PLC Setup. When the power supply is turned ON, operation will begin. Change theoperating mode to PROGRAM mode to transfer programs and the PLC Setup from the CX-Pro-grammer for CP1E.

1-3-2 Operating Mode at Startup: RUN Mode

As shown above, by default, operation will begin when the power supply is turned ON.

CP1E

Power supply ON

Operation

Programs

The default mode is RUN Mode

Set in PLC Setup

Page 40: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-12 CP1E CPU Unit Software User’s Manual(W480)

In a SYSMAC PLC, I/O Area bits are allocated to inputs and outputs. (I/O Area word and bit addressesappear on the CX-Programmer for CP1E without a prefix.) For CP1E CPU Units, the bit addresses inthe following words are always used for I/O bits and are allocated as input bits or output bits.

Inputs and outputs can be distinguished by the notation used by the CX-Programmer for CP1E.

The address notation can be changed to X or Y.

1-3-3 I/O Allocation and Notation

As shown above, input bit addresses start at CIO 0 (for terminal block 0CH) and output bit addresses start at CIO 100 (for terminal block 100CH). You can thus differentiate input bits and output bits by their addresses.

0CH

1CH

100CH

101CH

CIO 0 (0CH) and CIO 1 (1CH) → Input bitsCIO 100 (100CH) and CIO 101 (101CH) → Output bits

Inputs Outputs

I0.00 Q100.00

Addresses that start with “I” are for input bits. Example: I0.00Addresses that start with “Q” are for output bits. Example: Q100.00

X0.00 Y100.00

Addresses that start with “X” are input bits. Example: X0.00Addresses that start with “Y” are output bits. Example: Y100.00

Page 41: CP1E CPU Unit Software Users Manual

1-13

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-3 SY

SM

AC

PL

C O

peratio

n an

dP

rog

ramm

ing

Featu

res

1

1-3-4 Specifying I/O

Mem

ory Addresses

I/O memory addresses consist of a bit number that specifies the bit and a word address that specifiesthe word. (Each word has 16 bits.) The bit number specifies the bit in the 16-bit word. A period “.” isplaced between the word address and bit number.

Example: W0.00

The word address specifies the word.

Example: W0

Addresses in the Data Memory Area are indicated by “D”.

Example: D100

Additional Information

• Bits are specified by placing a period after the word address and indicating the bit numberfrom 00 to 15.

1-3-4 Specifying I/O Memory Addresses

As shown above, it is possible to specify either words or bits in the same area of the memory map for bit-addressable areas.

15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

W0

W1

W2...

W0 00 W2 .

Bit number

Word Address

Word Address

Word Address

Word Address

Bit Address

Bit number (00 to 15)

Period (.): Inserted between word address and bit number

Page 42: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-14 CP1E CPU Unit Software User’s Manual(W480)

The CP1E normally treats data in hexadecimal format. For example, the present value of high-speedcounter 0 is stored in the Auxiliary Area words A271 and A270 in hexadecimal format. The high-speedcounter frequency read using the PRV instruction and present value are also stored in hexadecimal for-mat. Values that can be treated as measured values by the PIDAT instruction are unsigned hexadeci-mal numbers.

Example:

Additional Information

Numbers without a symbol are not treated as constants except for operands that specify num-bers.

Example: “10” is not the constant 10. Instead it indicates word CIO 10.

1-3-5 CP1E Data: Normally Hexadecimal

As shown above, data is normally handled in hexadecimal format. The symbol # is placed at the beginning of hexadecimal numbers. An & is used to denote unsigned decimal numbers. The + and - signs are used for signed decimal numbers.

D100 #FFFF

PRV

0

D0

D100#7FFFD101

16 Stored in hexadecimal format

16 Stored in hexadecimal format

A270

A271

#FFFF

#7FFF

The high-speed counter frequency or present value is read to D100 and D101

The high-speed counter PV is automatically stored in A270 and A271

Page 43: CP1E CPU Unit Software Users Manual

1-15

1 Overview and SYSMAC Features

CP1E CPU Unit Software User’s Manual(W480)

1-3 SY

SM

AC

PL

C O

peratio

n an

dP

rog

ramm

ing

Featu

res

1

1-3-6 Condition F

lags

Instruction execution errors and execution results, such as comparison results are indicated by flagsthat are shared by all tasks called Condition Flags. These flags are shared by other instructions so theymust be accessed immediately after an instruction has been executed and before executing anotherinstruction.

Additional Information

Instruction execution results are given by the Condition Flags, which are shared by all tasks.

1-3-6 Condition Flags

As shown above, Condition Flags show the results of instruction execution and are shared by all instructions.

1P_ER

P_ER

P_ER

1P_EQ

P_EQ

HEX

S

C

D

W0.00 P_EQ

CMP

S1

S2

W0.00

Turns ON when there is an instruction error

Immediately accessed Immediately accessed

Result in the Error Flag

Example:Example:

Instruction error occurs

ASCII TO HEX instruction

Data to be converted

ON if comparison results in “equal”

Result in the Equals Flag

Comparison instruction

Comparison data 1

Comparison data 2

When S1 = S2, the Equals Flag (P_EQ) turns ON, which turns ON W0.00.

When the ASCII TO HEX instruction is executed but the data to be converted is ASCII data that cannot be converted, the Error Flag (P_ER) turns ON, which turns ON W0.00.

Equal when compared

Page 44: CP1E CPU Unit Software Users Manual

1 Overview and SYSMAC Features

1-16 CP1E CPU Unit Software User’s Manual(W480)

SYSMAC PLCs have instruction operands that are called control data. The control data is used to exe-cute different functions with a single instruction. For example, control data is used to specify the startaddress in the DM Area or other I/O memory area. Set the parameters that specify the function of theinstruction starting with the specified first address.

Additional Information

With SYSMAC PLCs, one instruction can be used for different functions by indirectly accessingI/O memory using the instruction parameters as control data.

1-3-7 Control Data that Sets the Instruction Function

As shown above, the instruction’s function can be set as required.

HEX

S

D100

D

D100

D101

=

D100

First address of control data

Specifies the first address

Used as parameters

Configures the instruction’s function

ParametersControl data

I/O memory

Example:

ASCII TO HEX instruction

Control data

Specifies the ASCII-to-hexadecimal conversion method

Number of digits to be converted, etc.

Example:D100

Page 45: CP1E CPU Unit Software Users Manual

2-1CP1E CPU Unit Software User’s Manual(W480)

2

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

2-1-2 Memory Areas and Stored Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4

2-1-3 Transferring Data from a Programming Device to the Internal Memory in the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5

Internal Memory in the CPU Unit

Page 46: CP1E CPU Unit Software Users Manual

2 Internal Memory in the CPU Unit

2-2 CP1E CPU Unit Software User’s Manual(W480)

2-1 Internal Memory in the CPU Unit

As shown in the following diagram, the internal memory in the CPU Unit consists of built-in RAM andbuilt-in EEPROM. The built-in RAM is used as execution memory and the built-in EEPROM is used asbackup memory.

The built-in RAM is the execution memory for the CPU Unit.

The user programs, PLC Setup, and I/O memory are stored in the built-in RAM.

The data is backed up by a built-in capacitor.

The backup time of the built-in capacitor is 50 hours for an E-type CPU Unit and 40 hours for an N-typeCPU Unit at 25°C.

If a CP1W-BAT01 Battery (sold separately) is mounted to an N-type CPU Unit, the data is backed up bythe Battery.

The user programs and parameters are backed up to the built-in EEPROM, so they are not lost.

2-1-1 CPU Unit Memory Backup

Built-in RAM

Page 47: CP1E CPU Unit Software Users Manual

2-3

2 Internal Memory in the CPU Unit

CP1E CPU Unit Software User’s Manual(W480)

2-1 Intern

al Mem

ory in

the C

PU

Un

it

2

2-1-1 CP

U U

nit Mem

ory Backup

The built-in EEPROM is the backup memory for user programs, PLC Setup, and Data Memory backedup using control bits in the Auxiliary Area. Data is retained even if the power supply is interrupted forlonger than the backup time of the built-in capacitor. Only the Data Memory Area words that have been

backed up using the Auxiliary Area control bits are backed up ( Refer to 17-6 DM Backup). All data inall other words and areas is not backed up.

Precautions for Correct UsePrecautions for Correct Use

Data in the I/O memory is cleared when the power supply is interrupted for longer than thebackup time of the built-in capacitor.

Create a system and write the ladder programs so that problems will not occur in the system ifthe data in these areas is cleared.

• Data in areas such as the DM Area and Holding Area, which is retained by the Battery, willalso be cleared when the power supply is reset. (Except for the DM Area words that areretained by the built-in EEPROM using the Auxiliary Area bit.)

• The error log, Output OFF Bit, and clock data (N-type CPU Unit only) in the Auxiliary Area willbe cleared. Other words and bits in the Auxiliary Area will be cleared to their default values.The built-in capacitor's backup time varies with the ambient temperature as shown in the fol-lowing graph.

Built-in EEPROM

25˚C 40˚C 60˚C

50 hours

40 hours

25 hours20 hours

9 hours7 hours

CP1E-E CPU Unit

CP1E-N CPU Unit

Bac

kup

time

of b

uilt-

in c

apac

itor

Ambient temperature

Page 48: CP1E CPU Unit Software Users Manual

2 Internal Memory in the CPU Unit

2-4 CP1E CPU Unit Software User’s Manual(W480)

The following table lists the CPU Unit memory areas and the data stored in each area.

2-1-2 Memory Areas and Stored Data

Memory area and stored data DetailsBuilt-in

RAMBuilt-in

EEPROM

User Program Area The User Program Area stores the object code for executing the user program that was created using the CX-Programmer for CP1E.

Stored Stored

Parameter Area The Parameter Area stores the initial settings for the PLC. Stored Stored

PLC Names Not supported.

Setting PLC Setup Various initial settings are made in the PLC Setup using soft-ware switches.

Refer to Section 9 PLC Setup.

I/O Tables Not supported.

Routing Tables

CPU Bus Unit Setup

I/O Memory Areas The I/O Memory Areas are used for reading and writing from the user programs.It is partitioned into the following regions according to purpose.

• Regions where data is cleared when power to the CPU Unit is reset, and regions where data is retained.

• Regions where data are exchanged with other Units, and regions that are used internally.

Stored Not stored

DM Area words backed up to EEPROM using control bits in the Auxiliary Area.

Stored Stored

Source Code and Comment Area Not stored

Stored

Source Code Not supported.

Symbol Table The symbol table contains symbols created using the CX-Pro-grammer for CP1E (symbol names, addresses, and I/O com-ments).

Comments Comments are created using the CX-Programmer for CP1E and include annotations and row comments.

Program Index The program index provides information on program sections created using the CX-Programmer for CP1E, as well as pro-gram comments.

Network Symbols (Tags) Not supported. Note stored

Stored

Page 49: CP1E CPU Unit Software Users Manual

2-5

2 Internal Memory in the CPU Unit

CP1E CPU Unit Software User’s Manual(W480)

2-1 Intern

al Mem

ory in

the C

PU

Un

it

2

2-1-3 Transferring Data from

a Program

ming D

evice to the Internal M

emory in the C

PU

Unit

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

2-1-3 Transferring Data from a Programming Device to the Internal Memory in the CPU Unit

User-created Programs

User programs

Symbol Table

Comments and program index

Symbol Table

Comments and program index

PLC Setup

PLC Memory

CIO Area, Work Area, Holding Area, Timer Area, Counter Area, DM Area, and Auxiliary Area

CPU Unit

User Program Area

User programs

Source Code and Comment Area

Parameter Area

I/O Memory Areas

PLC Setup

· The CX-Programmer for CP1E can be used to set status in each I/O memory area and to write data to the I/O memory areas.

CX-Programmer

Page 50: CP1E CPU Unit Software Users Manual

2 Internal Memory in the CPU Unit

2-6 CP1E CPU Unit Software User’s Manual(W480)

Page 51: CP1E CPU Unit Software Users Manual

3-1CP1E CPU Unit Software User’s Manual(W480)

3

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

3-1 CPU Unit Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23-1-1 Overview of CPU Unit Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

3-1-2 CPU Unit Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3

3-1-3 Load OFF Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

3-1-4 Operation for Power Interruptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7

3-2 Backing Up Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-103-2-1 CPU Unit Memory Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10

3-2-2 Backing Up Ladder Programs and PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . 3-11

3-2-3 I/O Memory Backup during Power Interruptions. . . . . . . . . . . . . . . . . . . . . . . 3-11

CPU Unit Operation

Page 52: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-2 CP1E CPU Unit Software User’s Manual(W480)

3-1 CPU Unit Operation

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

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.

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

Instructions are executed in order of the mnemonic code and I/O memory is refreshed.

Data to and from external devices, such as sensors and switches, directly connected to the built-in I/Oterminals 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 is used to communicate with devices connected to the communications port or forexchanging data with the CX-Programmer.

The cycle time is the time between one I/O refresh and the next. The cycle time can be determinedbeforehand for SYSMAC PLCs. Refer to 19-2 Computing the Cycle Time for how to calculate thecycle time.

Additional Information

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

3-1-1 Overview of CPU Unit Operation

Overhead Processing (Self-diagnosis)

Ladder Program Execution

I/O Refresh

Peripheral Servicing

Cycle Time

0 0 1 1 1 0 1 01 1 0 1 1 0 0 0

1 0 1 0 1 0 0 1

0 0 0 0 0 0 0 00 0 0 0 0 0 0 0

1 0 1 1 1 0 1 11 1 0 0 1 0 1 0

1 0 0 0 1 1 0 1

0 1 0 1 0 1 0 00 1 1 0 1 0 1 0

CPU Unit Internal Memory

CPU Unit processing cycle

Overhead processing (self-diagnosis)

Program execution

I/O refreshing

Peripheral servicing

Access

I/O memory

Change in status after all instructions have been executed

Exchange

Refreshes external devices at this timing

Inputs

Outputs

Page 53: CP1E CPU Unit Software Users Manual

3-3

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-1 CP

U U

nit O

peratio

n

3

3-1-2 CP

U U

nit Operating M

odes

User ladder programs are saved in memory.

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

CPU Units have the following three operating modes.

Precautions for Correct UsePrecautions for Correct Use

The default operating mode at startup is the RUN mode. To change the operating mode to PRO-GRAM mode or MONITOR mode, change the operating mode on the Startup Tab Page of thePLC Setup to PROGRAM or MONITOR and transfer the PLC Setup to the CP1E CPU Unit.

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

Changing the Startup ModeThe 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 StartupSetting in PLC Setup from the CX-Programmer for CP1E.

Ladder Programs

I/O Memory

3-1-2 CPU Unit Operating Modes

Overview of 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.

RUN mode: This is the mode in which the ladder program is executed. Some operations are dis-abled during this mode. It is the default startup mode.

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.

Changing the Operating Mode

Page 54: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-4 CP1E CPU Unit Software User’s Manual(W480)

Changing the Operating Mode after StartupUse one of the following procedures.

• Select PROGRAM, MONITOR, or RUN from the Operating Mode Menu.

• Right-click the PLC in the project tree, and then select PROGRAM, MONITOR, or RUN from theOperating Mode Menu.

The following table lists status and operations for each mode.

Operating Modes and Operation

Operating mode PROGRAM RUN MONITOR

Ladder program execution Stopped Executed Executed

I/O refresh Executed Executed Executed

External I/O status OFF after changing to PROGRAM mode but can be turned ON from the CX-Programmer for CP1E afterward.

Controlled by the ladder pro-grams.

Controlled by the ladder pro-grams.

I/O memory Non-retained memory Cleared Controlled by the ladder pro-grams.

Controlled by the ladder pro-grams.

Retained memory Retained

CX-Program-mer opera-tions

I/O memory monitoring

Ladder program monitoring

Ladder pro-gram transfer

From CPU Unit

To CPU Unit

Checking programs

Setting the PLC Setup

Changing ladder programs

Forced-set/reset operations

Changing timer/counter SV

Changing timer/counter PV

Change I/O memory PV

Page 55: CP1E CPU Unit Software Users Manual

3-5

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-1 CP

U U

nit O

peratio

n

3

3-1-2 CP

U U

nit Operating M

odes

*1 The outputs from the Output Units will be turned OFF when power is interrupted even if the IOM Hold Bit is ONand the status of the output bits in CPU Unit’s I/O memory is retained.

*2 The cycle time will increase by approximately 10 ms when the operating mode is changed from MONITOR toRUN mode. This will not, however, cause an error for exceeding the maximum cycle time limit.

Refer to Section 6 I/O Memory for details on the I/O memory.

The RUN indicator on the front of the CPU Unit indicates the operating mode as described below.

: Not lit : Flashing : Lit

Operating Mode Changes and I/O Memory

Mode changes

Non-retained areas Retained areas

• I/O bits• Serial PLC Link Words

• Work bits

• Timer PV/Completion Flags• Data Registers

(Auxiliary Area bits/words are retained or not retained depending on the address.)

• Holding Area• DM Area

• Counter PV and Completion Flags (Auxiliary Area bits/words are retained or not retained depending on the address.)

RUN or MONITOR toPROGRAM

Cleared*1 Retained

PROGRAM to RUN or MONITOR

Cleared*1 Retained

RUN to MONITOR orMONITOR to RUN

Retained*2 Retained

IOM Hold Bit (A500.12)

I/O memory Output bits allocated to Output Units

Mode change PROGRAM to or from RUN or MONITOR

Operation stop Mode change PROGRAM to or from RUN or MONITOR

Operation stop

Fatal error other than

FALS

Execution of FALS

Fatal error other than

FALS

Execution of FALS

OFF Cleared Cleared Retained OFF OFF OFF

ON Retained Retained Retained Retained OFF OFF

Checking the Operating Mode

Operating modeRUN indicator on

CPU UnitRemarks

PROGRAM mode

Not lit

RUN or MONITOR mode

Lit (green)

Use the CX-Programmer to see if the mode is RUN or MONITOR mode.

Page 56: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-6 CP1E CPU Unit Software User’s Manual(W480)

Checking with the CX-ProgrammerYou can check the operating mode in the project tree or status bar of the CX-Programmer.

• Project Tree

• Status Bar

The load OFF function stops refreshing outputs and turns OFF all outputs during operation in RUN orMONITOR mode.

3-1-3 Load OFF Function

Load OFF Function Overview

Offline Online

The CPU Unit’s operating mode is displayed.

The operating mode is displayed here. The average cycle time will be displayed if the CPU Unit is in RUN or MONITOR mode.

CP1E CPU Unit

Operation

ProgramsI/O memory

Output OFF Bit (A500.15) = ON

Operation is started but output refreshing is stopped

All outputs are turned OFF

Page 57: CP1E CPU Unit Software Users Manual

3-7

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-1 CP

U U

nit O

peratio

n

3

3-1-4 Operation for P

ower Interruptions

The load OFF function is executed by turning ON the Output OFF Bit (A500.15) in the Auxiliary Areausing an instruction in a ladder program or the CX-Programmer.

The load OFF function can be used to turn OFF all outputs in an emergency situation during operation.It can also be used to turn OFF outputs to external loads by force-setting the Output OFF Bit duringdebugging.

While the Load OFF Bit is ON, the CP1E will not refresh outputs, resulting in a “load OFF” status, andall outputs (built-in outputs, outputs from the Expansion I/O Units, and outputs from Expansion Units)will be OFF. However, the status of output bits in the I/O memory will still be controlled by the ladder pro-grams and it will not be cleared.

The INH indicator on the front of the CPU Unit will be lit when all outputs are OFF (i.e., when the Output OFF Bit is ON).

Clearing the Output OFF BitThe status of the Output OFF Bit (A500.15) is held when the operating mode is changed and thepower is turned OFF and ON, i.e., the outputs will remain OFF.

It is necessary to turn OFF the Output OFF Bit using the ladder program or by directly writing to PLCmemory.

Precautions for Correct UsePrecautions for Correct Use

The Output OFF Bit (A500.15) will be cleared if power is interrupted for longer than the I/O mem-ory backup time. If you want to keep loads OFF after restarting, use A509.15 (I/O Memory Previ-ous Corruption Flag (held at startup)) as the input condition for turning ON the Output OFF Bit(A500.15). Refer to 3-2-3 Power Interruptions Longer than I/O Memory Backup Time for details.

Power Supply Voltage DropIf the power supply voltage falls below the specified value (85% of rated voltage) while the CPU Unitis in RUN or MONITOR mode, operation will be stopped and all outputs will be turned OFF.

All outputs will turn OFF despite the status of the I/O Memory Hold Bit or I/O Memory Hold Bit atPower ON settings in the PLC Setup.

Detection of Momentary Power InterruptionsThe system will continue to run if the momentary power interruption lasts less than 10 ms. If power isinterruped for longer than 10 ms, the CPU Unit will be stopped and outputs will be turned OFF.

Method

Applications

Load OFF Status

3-1-4 Operation for Power Interruptions

Overview of Operation for Power Interruptions

Page 58: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-8 CP1E CPU Unit Software User’s Manual(W480)

Precautions for Correct UsePrecautions for Correct Use

The power OFF detection delay and power OFF interrupt task cannot be used.

Automatic RecoveryOperation is automatically restarted when the power supply voltage is restored.

Description of OperationThe power interruption will be detected if the 100 to 240 VAC power supply falls below 85% of theminimum rated voltage for the power OFF detection time (10 ms minimum, not fixed).

The CPU reset signal will turn ON and the CPU Unit will be reset immediately.

Power OFF Timing Chart

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.

10ms

10ms

0

Below 85% of rated voltage

0 to 10 ms max.Momentary power interruption not detected Operation continues

Supply voltage

Supply voltage

Operation will continue or stop depending on whether a momentary power interruption is detected.

Time

AC: 10msDC: 2ms

Power supply voltage: 85%

Operation always stopped at this point

Holding time for 5 V internal power supply after power OFF detection: 1 ms

Power OFF detection

Power OFF Detection Time

Power OFF detected signal

Program execution status

CPU Unit reset signal

Cyclic task or interrupt task Stop

Page 59: CP1E CPU Unit Software Users Manual

3-9

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-1 CP

U U

nit O

peratio

n

3

3-1-4 Operation for P

ower Interruptions

The power OFF detection time for CP1E CPU Units is 10 ms minimum. If power is interrupted and theinterruption is detected when the CPU Unit is operating in RUN or MONITOR mode, the instruction cur-rently being executed will be completed and then the CPU Unit will be reset.

Malfunction Countermeasures If only a couple of Expansion I/O Units or Expansion Units are connected to the CPU Unit resultingin a light power supply circuit load and a small current consumption, the time required by the CPUUnit to detect a power interruption will be longer. For this reason, inputs may be incorrectly identifiedas being OFF if external power supply used for an input turns OFF before the power interruption isdetected. If an external NC contact input is used or the ladder program counts the number of ON toOFF transitions, a malfunction may occur if the external power supply turns OFF.

The following diagram shows an example countermeasure for this situation.

• Wiring

• Ladder Program

Instruction Execution for Power Interruptions

Power supply voltage: 85%

Power OFF detected singal

Program execution status

CPU reset signal

External power supply

Input signal to CP1E

Power OFF detection time: 10 ms min.

Power OFF detected

Cyclic task or interrupt task

If the external power supply turns OFF before the power interruption is detected, the CPU Unit will read the input as being OFF

CP1E

COM 0.00 0.01L1 L2

Emergency stop input

100 VAC

External power supply input

0.00 0.01

Emergencystop input Emergency stop

release input

External power supply input (Enables emergency stop output.) Emergency

stop output

Emergency stop output

Page 60: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-10 CP1E CPU Unit Software User’s Manual(W480)

3-2 Backing Up Memory

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

The following table describes data backup to the CP1E CPU Unit's built-in EEPROM backup memory.

3-2-1 CPU Unit Memory Configuration

• Ladder programs and PLC Setup Automatically backed up to the built-in EEPROM when-ever changed.

• DM Area in the I/O memory Data in specified words of the DM Area can be backed up to the built-in EEPROM by using bits in the Auxiliary Area. Other words are not backed up.

• Other areas in the I/O memory (including Holding Area data, Counter PVs, and Counter Completion Flags)

Not backed up to the built-in EEPROM.

Ladder programs

CP1E CPU Unit

Built-in EEPROM backup memory Ladder programs

Parameter Area

· PLC Setup

Parameter Area

· PLC Setup

· DM Area

PLC power turned ON

Operation using control bits in Auxiliary Area

PLC power turned ON

PLC power turned ON

PLC Setup changed

Changing program

Built-in RAM

I/O Memory Areas

· I/O Area· Work Area· Holding Area· Auxiliary Area· Timer/Counter

Areas

· DM Area

Page 61: CP1E CPU Unit Software Users Manual

3-11

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-2 Backin

g U

p M

emo

ry

3

3-2-2 Backing U

p Ladder Program

s and PLC

Setup

Ladder programs and the PLC Setup are automatically backed up to and restored from the built-inEEPROM backup memory.

Backing Up MemoryLadder programs and PLC Setup are backed up to the built-in EEPROM backup memory by trans-ferring them from the CX-Programmer or writing them using online editing.

Restoring MemoryLadder programs and PLC Setup are automatically transferred from the built-in EEPROM backupmemory to the RAM 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 EEPROM backup memory. Never turn OFF the power supply to the CPU Unit when the BKUPindicator is lit.

The built-in capacitor’s backup time for I/O memory during a power interruption is listed below for E-typeCPU Units and N-type CPU Units.

E-type CPU Units: 50 hours at 25°C

N-type CPU Units (without a battery): 40 hours at 25°C

The following areas are cleared when power is interrupted for longer than the I/O memory backuptimes given above.

• DM Area (D) (excluding words backed up to the EEPROM using the DM backup function)

• Holding Area (H)

• Counter PVs and Completion Flags (C)

• Auxiliary Area (A) (including clock data for N-type CPU Units)

3-2-2 Backing Up Ladder Programs and PLC Setup

3-2-3 I/O Memory Backup during Power Interruptions

I/O Memory Backup Time during Power Interruptions

25˚C 40˚C 60˚C

50 hours

40 hours

25 hours

20 hours

9 hours7 hours

Bac

kup

time

of b

uilt-

in c

apac

itor

CP1E E-type CPU Unit

CP1E N-type CPU Unit without a battery

Ambient temperature

Page 62: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-12 CP1E CPU Unit Software User’s Manual(W480)

Additional Information

The following words in the Auxiliary Area are cleared to zero. Others are cleared to default val-ues.

Words Name

Power interrution time CPU Unit

Less than I/O memory backup time

Longer than I/O memory backup time

E-type CPU UnitN-type CPU

Unit

A90 to A93 User Program Date Retained Cleared to zero Not supported. Supported

A94 to A97 Parameter Date Not supported.

A100 to A199 Error Log Area Supported

A300 Error Log Pointer Supported

A351 to A354 Clock Area Not supported.

A500.15 Output OFF Bit Supported

A510 to A511 Startup Time Not supported.

A512 to A513 Power Interruption Time Not supported.

A514 Number of Power Interruptions

Supported

A515 to A517 Operation Start Time Not supported.

A518 to A520 Operation End Time Not supported.

A523 Total Power ON Time Not supported.

A720 to A749 Power ON Clock Data 1 to 10 Not supported.

Write the ladder programs and construct the system so that problems will not occur even if the DM Area, Holding Aea, Counter PVs, and Counter Completion Flags (C) are cleared to zero and the Auxiliary Area is cleared to default values when a power interruption continues for longer than 50 hours for an E-type CPU Unit or 40 hours for an N-type CPU Unit (at 25°C).Always mount a CP1W-BAT01 Battery (sold separately) to an N-type CPU Unit. (This Battery cannot be mounted to an E-type CPU Unit.)

Data may be lost and abnormal operation may occur if a power interruption lasts too long, possi-bly resulting in serious accidents.

Caution

Power supply

Power interruption longer than I/O memory backup time

E-type: Power interruption longer than 50 hours*1

N-type: Power interruption longer than 40 hours*1

*1: At 25˚C.

Retained when power supply is turned ON or there is a momentary interruption.

Cleared

DM Area (D)*

Holding Area (H)

Counter PVs and Completion Flags (C)

Auxiliary Area (A)

*Excluding words backed up to EEPROM using Auxiliary Area bits.

Create a system and write the ladder programs so that problems will not occur in the system if the data in these areas is cleared.

Page 63: CP1E CPU Unit Software Users Manual

3-13

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-2 Backin

g U

p M

emo

ry

3

3-2-3 I/O M

emory B

ackup during Pow

er Interruptions

Additional Information

Ladder programs and PLC Setup are automatically backed up to backup memory. Words in theDM Area backed up to the backup memory using Auxiliary Area bits are also backed up to thebackup memory.

If DM Area data, Holding Area data, Counter PVs, Counter Completion Flags, and Auxiliary Area dataare cleared because of a power interruption lasting longer than the I/O memory backup time, operationcan be stopped by creating a memory error.

Not Creating a Memory Error (Default)The system continues operation without detecting a memory error. If a non-fatal error is detected,outputs may be turned OFF.

• Creating User-defined Non-fatal ErrorsTo create user-defined non-fatal errors by executing the FAL instruction, insert the followinginstructions at the start of the ladder program.

Power Interruptions Longer than I/O Memory Backup Time

A509.15

10

FAL

#0000

A509.15 ON

OFF

I/O Memory Corruption Flag

User-defined non-fatal error

Power interruption longer than I/O memory backup time

I/O Memory Previous Corruption Flag (Held at startup.)

Turned OFF by user.

I/O memory: Cleared

Create user-defined non-fatal errors or turn the loads OFF using instructions.

Make the necessary settings in the DM Area words and Holding Area words.

Page 64: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-14 CP1E CPU Unit Software User’s Manual(W480)

• Continuing Operation but Turning All Outpus OFFOutputs are turned OFF if power is interrupted for longer than the I/O memory backup time andDM Area data, Holding Area data, Counter PVs, and Counter Completion Flags are cleared.

1 Insert the following instructions at the start of the ladder program.

2 Make the necessary settings in DM Area words and Holding Area words using the CX-Program-

mer after checking that the load OFF function is being executed (front panel INH Indicator).

3 Use the CX-Programmer to turn OFF A509.15 (I/O Memory Previous Corruption Flag (held at

startup)).

Additional Information

To detect the clock stopping as well as I/O memory lost, use A509.13 (I/O Memory Previous Cor-ruption or Clock Stopped Flag (held at startup)) as the input condition instead of A509.15. Thisflag turns ON when power is interrupted for longer than the I/O memory backup time, butA509.14 (I/O Memory Lost Flag (cleared at startup)) is cleared when power supply is turned ON.This flag can be used to check whether I/O memory was cleared by a power interruption.

A500.15

SET

A509.15

I/O Memory Previous Corruption Flag (Held at startup.)

Turn ON the Output OFF Bit.

ON

OFF

ON

OFF

A509.14

Power interruption for longer than memory backup time

A509.15(I/O Memory Previous Corruption Flag (Held at startup.))

(I/O Memory Corruption Flag (Held at startup.))

I/O memory:Cleared Cleared

Power supply turned ON

E-type CPU Unit: Power interrution for longer than 50 hoursN-type CPU Unit: Power interruption for longer than 40 hours

Page 65: CP1E CPU Unit Software Users Manual

3-15

3 CPU Unit Operation

CP1E CPU Unit Software User’s Manual(W480)

3-2 Backin

g U

p M

emo

ry

3

3-2-3 I/O M

emory B

ackup during Pow

er Interruptions

Creating a Memory ErrorIf I/O memory is not retained, a memory error can be created to stop the system. Use this setting todefinitively stop operation if I/O memory is not retained, e.g., in systems that operate 24 hours a day.

1 To create a memory error, select the Create memory error when I/O memory is lost Check Box

in the Execution Settings Area on the Startup Tab Page of the PLC Setup.

2 The following table shows what happens if a memory error occurs at startup. A memory error is

created if the user memory (ladder programs and PLC Setup) or I/O memory could not beretained or the clock stopped.

3 Make the necessary setting in DM Area words and Holding Area words using the CX-Program-

mer after confirming the memory error.

4 Turn OFF A509.13 (I/O Memory Previous Corruption or Clock Stopped Flag (held at startup)) or

A509.15 (I/O Memory Previous Corruption Flag (held at startup) using the CX-Programmer.

5 Clear the error display by clicking the Clear All Button on the Error Tab Page of the CX-Pro-

grammer.

6 Restart operation.

CX-Programmer’s Error Tab Page

Item Memory Error

Error code 0x80F1

CX-Programmer’s Error Log Tab Page

Error0002 hex

Auxiliary Area A403.01 (Memory Error Location = I/O memory) is ON

CPU Unit operation Stopped

ERR/ALM indicator on front of CPU Unit

Lit

A509.13ON

OFF

Power interruption longer than I/O memory backup time

I/O Memory Previous Corruption or Clock Stopped Flag (Held at startup.)

or A509.15I/O Memory Previous Corruption Flag (Held at startup.)

Select the Output memory error when I/O memory lost Check Box in the PLC Setup.

I/O memory: Cleared

Memory Error Location

Make the necessary settings in DM Area words and Holding Area words.

Turned OFF by user.

Click the Clear All Button on the Error Tab Page to clear the error display.

Page 66: CP1E CPU Unit Software Users Manual

3 CPU Unit Operation

3-16 CP1E CPU Unit Software User’s Manual(W480)

Related Flags and Words

Name Bit Description

Memory Previous Corruption or Clock Stopped Flag (Held at startup.)

A509.13 This bit is turned ON and latched if power is interrupted for longer than the I/O memory backup time and data in the DM Area words (excluding words backed up to the backup memory), Holding Area words, Counter PVs, and Counter Completion Flags cannot be retained, or the clock has stopped.

This flag will remain ON until the user turns it OFF.

I/O Memory Corruption Flag(Cleared at startup.)

A509.14 This bit is turned ON if power is interrupted for longer than the I/O memory backup time and data in the DM Area words (excluding words backed up to the backup memory), Holding Area words, Counter PVs, and Counter Completion Flags cannot be retained.

I/O Memory Previous Cor-ruption Flag (Held at star-tup.)

A509.15 This bit is turned ON and latched if power is interrupted for longer than the I/O memory backup time and data in the DM area words (excluding words backed up to the backup memory), Holding Area words, Counter PVs, and Counter Completion Flags cannot be retained.

This flag will remain OFF until the user turns it ON.

Memory Error Location: I/O memory

A403.01 This bit is turned ON when the Create I/O memory error when I/O memory is lost Check Box is selected in the CPU Execute Process Settings of the Startup Tab Page or a memory error occurs because power was interrupted for longer thant he I/O emory backup time. It is turned OFF when all memory is cleared or the memory error is cleared.

Page 67: CP1E CPU Unit Software Users Manual

4-1CP1E CPU Unit Software User’s Manual(W480)

4

This section describes the initialization processing that is performed by the CPU Unit atstartup.

4-1 CPU Unit Initial Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24-1-1 CPU Unit Initial Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2

4-2 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-44-2-1 PLC Setup Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4

CPU Unit Initialization

Page 68: CP1E CPU Unit Software Users Manual

4 CPU Unit Initialization

4-2 CP1E CPU Unit Software User’s Manual(W480)

4-1 CPU Unit Initial Settings

The only initial settings required by the CPU Unit are in the PLC Setup.

There are no DIP switches on CP1E CPU Units.

The following table gives the software setting applications and setting methods for applicable Units.

PLC SetupThe PLC Setup is used to make changes for using the CPU Unit with non-default specifications.

The following settings are examples of the defaults for the CPU Unit.

Example:

Startup mode: RUN mode

Fixed servicing time: 4% of cycle time

To use specifications other than these defaults, change the PLC Setup using the CX-Programmerfor CP1E, and transfer the PLC Setup to the CPU Unit.

4-1-1 CPU Unit Initial Settings

Hardware Settings

Software Settings

Applicable Units

Set data ApplicationsSetting method

Files created with Program-ming Device

Backup desti-nation

CPU Unit Parame-ter Area

PLC Setup

Using non-default specifications

CX-Program-mer for CP1E

CX-Programmer for CP1E project file (.CXP)

Backup mem-ory (built-in EEPROM)

Parameter Area

CPU Unit

Hardware Settings

(The CP1E does not require hardware settings, such as DIP switches.)

Software Settings

PLC Setup

(The following items do not apply to CP1E CPU Units.· Registered I/O tables· Routing tables· CPU Bus Unit Setup)

I/O Memory Areas

(The CP1E does not allocate DM Area words to Special I/O Units or CPU Bus Unit.)

Page 69: CP1E CPU Unit Software Users Manual

4-3

4 CPU Unit Initialization

CP1E CPU Unit Software User’s Manual(W480)

4-1 CP

U U

nit In

itial Settin

gs

4

4-1-1 CP

U U

nit Initial Settings

From CX-Programmer for CP1E

PLC Setup

PLC Setup

CP1E CPU Unit

Page 70: CP1E CPU Unit Software Users Manual

4 CPU Unit Initialization

4-4 CP1E CPU Unit Software User’s Manual(W480)

4-2 PLC Setup

The PLC Setup contains the basic settings for the CPU Unit.

Parameters in the PLC Setup must be changed if the CP1E CPU Unit is to be used with specificationsthat are not the defaults.

The parameters in the PLC Setup are set by using the CX-Programmer for CP1E.

The following table gives the default settings in the PLC Setup.

To change the settings, edit the PLC Setup with the CX-Programmer for CP1E, and then transfer thePLC Setup to the CPU Unit.

Refer to Section 9 PLC Setup for details on the PLC Setup.

4-2-1 PLC Setup Defaults

CX-Programmer for CP1E PLC

Setup Tab PageParameter Default

Startup Startup Hold Settings Forced Status Hold Bit Not retained when power is ON.

IOM Hold Bit Startup Hold Setting Not retained when power is ON.

Mode Run

Settings Execute Settings Create error for I/O memory cor-ruption

Do not create

Do not detect Low Battery Do not detect

Stop CPU on Instruction Error Do not stop

Do not register FAL to error log Register to error log

Timings Watch Cycle Time 1000 ms (1 s)

Constant Cycle Time No Setting

Scheduled Interrupt Interval 10 ms

Peripheral Service CPU Processing Mode Normal Mode

Set Time to All Events 4% of cycle time

Serial Port Communications Settings Used to sets serial communi-cations.

Standard (Host Link and 9,600 bps)

Built-in Inputs Interrupt Input Settings Used to sets quick-catch inputs and input interrupts.

Normal inputs (general-purpose inputs)

High-speed Counter Settings Used to set high-speed counters.

High-speed counters not used.

Pulse Outputs Base Settings Sets origin searches and ori-gin returns for pulse outputs.

Origin searches and returns not used. Origin Search

Origin Return

Page 71: CP1E CPU Unit Software Users Manual

5-1CP1E CPU Unit Software User’s Manual(W480)

5

This section provides basic information on ladder programming for CP1E CPU Units.

5-1 Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25-1-1 Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2

5-1-2 Program Capacity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

5-1-3 Basics of Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3

5-2 Tasks, Sections, and Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-75-2-1 Overview of Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7

5-2-2 Overview of Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7

5-2-3 Overview of Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7

5-3 Programming Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-95-3-1 Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9

5-3-2 Instruction Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10

5-3-3 Execution Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10

5-3-4 Specifying Data in Operands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13

5-3-5 Data Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14

5-3-6 I/O Refresh Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16

5-4 Constants: &, #, +, -, and Numbers without Symbols . . . . . . . . . . . . . . . . 5-17

5-5 Specifying Offsets for Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-215-5-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21

5-5-2 Application Examples for Address Offsets . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-23

5-6 Checking Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-255-6-1 Checking during Input Operations from the CX-Programmer. . . . . . . . . . . . . 5-25

5-6-2 Program Checks with the CX-Programmer for CP1E . . . . . . . . . . . . . . . . . . . 5-25

5-6-3 Debugging with the Simulator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-26

5-6-4 Program Execution Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-28

5-7 Ladder Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-315-7-1 Ladder Programming Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-31

5-7-2 Special Program Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-35

Understanding Programming

Page 72: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-2 CP1E CPU Unit Software User’s Manual(W480)

5-1 Programming

User programs are created by using the CX-Programmer for CP1E.

The user programs consist of the following parts.

• ProgramsA program ends with an END instruction.

• Tasks (Smallest Executable Unit) The CP1E has only one cyclic task. For interrupts, a program is assigned to an interrupt task to execute it. (In the CX-Programmer forCP1E, the interrupt task number is specified in the program properties.)

• SectionsWhen creating and displaying programs with the CX-Programmer for CP1E, the one program can bedivided into any number of parts. Each part is called a section. Sections are created mainly to make programs easier to understand.

• Subroutines You can create subroutines within a program.

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

Programs can be written using only ladder programs.

5-1-1 Programs

Structure of User Programs

User Program Data

Programming Languages

.CXP

User programs

Symbol table

PLC Setup

I/O memory data

CX-Programmer for CP1E project file

Page 73: CP1E CPU Unit Software Users Manual

5-3

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-1 Pro

gram

min

g

5

5-1-2 Program

Capacity

The maximum program capacities of the CP1E CPU Units for all ladder programs (including programsfor interrupt tasks) are given in the following table.

The total number of steps must not exceed the maximum program capacity.

It is possible to check the program size by selecting View - Memory View in the CX-Programmer.

The size of a ladder instruction depends on the specific instruction and operands that are used. For details,

refer to A-3 Instruction Execution Times and Number of Steps.

This section describes the basics of programming for the CP1E.

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

Structural Elements of a Ladder DiagramA ladder diagram consists of left and right bus bars, connecting lines, input conditions, OUTPUT(OUT) instructions, and special instructions.

A ladder program consists of many program rungs. A program rung is a unit that can be horizontallyseparated from other parts of the program by drawing lines between the bus bars. In mnemonicform, a program rung is all of the instructions from an LD or LD NOT instruction to the output instruc-tion just before the next LD or LD NOT instruction.

Program rungs consist of instruction blocks that begin with an LD or LD NOT instruction. The LD orLD NOT instruction indicates a logical start.

5-1-2 Program Capacity

Unit type Model numbers Program capacity

E-type CPU Unit CP1E-E - 2K steps

N-type CPU Unit CP1E-N - 8K steps

5-1-3 Basics of Programming

Basic Concepts of Ladder Programming

Left bus bar

Input condition

Connecting line

Special instruction OUT

instructionRight bus bar

RungsInstruction blocks

Page 74: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-4 CP1E CPU Unit Software User’s Manual(W480)

• Mnemonics

A mnemonic program is ladder program given using only instructions in mnemonic form.

It has program addresses, and one program address is equivalent to one instruction.

Example:

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 thoughthe 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, thepower flow in figure B cannot be programmed directly and must be rewritten.

• 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 even if it means using moreinput bits to make the programs easier to understand and maintain.

Program address

Instruction (mnemonic

form)Operand

0 LD 0.00

1 AND 0.01

2 LD 0.02

3 AND NOT 0.03

4 LD NOT 1.00

5 AND 1.01

6 OR LD

7 AND LD

8 OUT 102.00

9 END

0.00 0.01 0.02 0.03

1.00 1.01

102.00

END

A B

A

C E

E

C D

B

E

()

()

()R1

R2

R1

R2

AND B

OUT R1

LD TR0

AND E

OUT R2

LD A

LD C

OUT TR0

AND D

OR LD

Figure A

Signal flow

Figure B

Order of execution (mnemonics)

Page 75: CP1E CPU Unit Software Users Manual

5-5

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-1 Pro

gram

min

g

5

5-1-3 Basics of P

rogramm

ing

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

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

• Output bits can also be used in input conditions.

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 flowfrom the left bus bar to the right bus bar. A rung error will occur if the rungs are not connected to both bus bars. Program execution will stillbe possible.

• A rung error will occur if an attempt is made to directly connect to the bus bar an instruction thatcannot be connected. OUT instructions, timers, counters, and other output instructions cannot be connected directly tothe left bus bar. If one is connected directly to the left bus bar, a rung error will occur during the program check onthe CX-Programmer for CP1E.

Additional Information

Insert an unused work bit or the Always ON Flag (ON, one of the Condition Flags) in an NC con-dition if an input condition must be kept ON at all times.

0.00 0.05

102.00

TIM

0000

#100

102.00

102.00

MOV

Page 76: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-6 CP1E CPU Unit Software User’s Manual(W480)

• A location error will occur if an instruction that cannot be connected to the right bus bar is con-nected to it. An input condition cannot be inserted after an OUT instruction or other output instruction. Theinput condition must be inserted before an OUT instruction or other output instruction. If it isinserted after an output instruction, then a location error will occur during the program check in theCX-Programmer for CP1E.

• A warning will occur if the same output bit is used more than once in an OUT instruction. The same output bit cannot be controlled by more than one instruction. Instructions in a ladderprogram are executed in order from the top rung in each cycle. The result of an OUT instruction ina lower rung will be ultimately saved in the output bit. The results of any previous instructions con-trolling the same bit will be overwritten and not output.

MOV

Unused work bit

ON (Always ON Flag)

0.00 0.03 0.04

0.01 102.01

102.01

Output bit CIO 100.00

Output bit CIO 100.00

Page 77: CP1E CPU Unit Software Users Manual

5-7

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-2 Tasks, Sectio

ns, an

d S

ymb

ols

5

5-2-1 Overview

of Tasks

5-2 Tasks, Sections, and Symbols

There are basically two types of tasks.

Task settings must be made to use interrupt tasks with a CP1E CPU Unit.

With the CX-Programmer for CP1E, programs can be created and displayed in functional units calledsections.

Any program in a task can be divided into sections.

Using sections improves program legibility and simplifies editing.

I/O memory area addresses or constants can be specified using character strings by registering thecharacter strings as symbols.

Register the symbols in the symbol table of the CX-Programmer for CP1E.

Programming with symbols enables programming with names rather than having to be aware of theactual addresses.

The symbol table is saved in the CX-Programmer project file (.CXP) along with other parameters, suchas the user programs.

The following types of symbols are supported.

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

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

5-2-1 Overview of Tasks

Task type DescriptionApplicable

programming language

Execution condition

Cyclic task Executed once per cycle Ladder diagram Only one for the CP1E.

(Normally, the user does not have to con-sider this.)

Interrupt tasks Executed when a specific condition occurs. The process being executed is interrupted.

Ladder diagram An interrupt task is placed into READY status when the interrupt condition that is set for it occurs. A condition can be set for each of the following interrupt tasks.

• Scheduled interrupt tasks

• I/O interrupt tasks

5-2-2 Overview of Sections

5-2-3 Overview of Symbols

Symbols

Symbol Types

Page 78: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-8 CP1E CPU Unit Software User’s Manual(W480)

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

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

• User Specifications

• Automatic allocation using the CX-Programmer for CP1EThe 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 for CP1E.

Note “Global” and “local” indicate only the scope of application of the symbol. They have nothing to do with the scope of application for memory addresses.Therefore, a warning but not an error will occur in the following cases, and it will be possible totransfer 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 for CP1E, global symbols and local symbols can be identi-fied by the following character colors and symbol icons.

Classifica-tion

NameProject tree in the CX-Pro-

grammer for CP1E

ScopeAddress and I/O comment

(without a symbol name)

Access using sym-bols from a

network

Access from other

tasks

Access from the

local task

Symbols in program-ming

Global symbols

PLC tree Not possible.

Possible. Possible. Supported

Local symbols

Program tree Notpossible.

Possible. Not supported

Classification Display color Example (default color)

Global symbols Black (fixed)

Local symbols Blue (default)Select Tools - Options, display the Appear-ance Tab Page, and select Local Symbols to change the color.

Start

3.00

Error

W0.00

Page 79: CP1E CPU Unit Software Users Manual

5-9

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-3 Pro

gram

min

g In

structio

ns

5

5-3-1 Operands

5-3 Programming Instructions

This section describes operands, instruction variations, and execution conditions.

Operands specify preset instruction parameters that are used to specify I/O memory area contents orconstants. 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.

Example:

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

5-3-1 Operands

Operand typeOperand symbol

Description

Source oper-and

Specifies the address of the data to be read or a constant.

SS Source oper-and

Source operand other than control data (C)

CC Control data Compound data in a source operand that has different meanings depend-ing on bit status.

Destination operand (results)

Specifies the address where data will be writ-ten.

DD −

Number Specifies a particular number used in the instruction, such as a subroutine number.

N With numbers, it is not possible to specify an address for indirect specification (except for jump instruction numbers).

MOV

&0

D0

S (source)

D (destination)

SBS

2 N (number)

MOV

#0

D0

First operand

Second operand

Page 80: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-10 CP1E CPU Unit Software User’s Manual(W480)

The following variations are available for instructions to differentiate executing conditions and to refreshdata when the instruction is executed (immediate refreshing).

The following two types of basic and special instructions can be used.

• Non-differentiated instructions: Executed every cycle

• Differentiated instructions: Executed only once

Output Instructions (Instructions That Require Input Conditions)These instructions are executed once every cycle while the execution condition is satisfied (ON orOFF).

Input Instructions (Logical Starts and Intermediate Instructions)These instructions read bit status, make comparisons, test bits, or perform other types of processingevery cycle. If the results are ON, the input condition is output (i.e., the execution condition is turnedON).

5-3-2 Instruction Variations

Variation Symbol Description

No variation used. These instructions are executed once every cycle while the execution condition is satisfied.

Differentiation variations

ON @ These instructions are executed only once when the exe-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.

5-3-3 Execution Conditions

Non-differentiated Instructions

MOV

Instruction (mnemonic)

Differentiation variation

Immediate refresh variation

@!

Example:

MOVNon-differentiated Output instructions executed every cycle

Input instruction executed every cycle Example:

Page 81: CP1E CPU Unit Software Users Manual

5-11

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-3 Pro

gram

min

g In

structio

ns

5

5-3-3 Execution C

onditions

Upwardly Differentiated Instructions (Instructions Preceded by @) • Output Instructions

The instruction is executed only during the cycle in which the execution condition changes fromOFF to ON. The instruction is not executed in the following cycle.

• 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 when the result changes from OFFto ON. The execution condition will turn OFF the next cycle.

• 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 resultchanges from OFF to ON.

Downwardly Differentiated Instructions (Instruction Preceded by %)• Output Instructions

The instruction is executed only during the cycle in which the execution condition changes fromON to OFF. It is not executed in the following cycle.

Input-differentiated Instructions

@MOV

Example: 1.02

Executes the MOV instruction once when CIO 1.02 turns ON.

@ Upwardly differentiated instruction

Upwardly differentiated instruction Example: 1.03

ON execution condition created for one cycle when CIO 1.03 turns ON.

Upwardly differentiated instructionExample: 1.03

OFF execution condition created for one cycle when CIO 1.03 turns ON.

%SET

Example: 1.02

Executes the SET instruction once when CIO 1.02 turns OFF.

% Downwardly differentiated instruction

Page 82: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-12 CP1E CPU Unit Software User’s Manual(W480)

• 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 resultchanges from ON to OFF. The execution condition will turn OFF the next cycle.

• 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 resultchanges from ON to OFF.The execution condition will turn OFF the next cycle.

Downwardly differentiated instruction Example: 1.03

OFF execution condition created for one cycle when CIO 1.03 turns ON.

Downwardly differentiated instruction Example: 1.03

OFF execution condition created for one cycle when CIO 1.03 turns OFF.

Page 83: CP1E CPU Unit Software Users Manual

5-13

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-3 Pro

gram

min

g In

structio

ns

5

5-3-4 Specifying D

ata in Operands

5-3-4 Specifying Data in Operands

Specifying Addresses

Operand Description ExampleApplicationexamples

Specifying bit addresses

The word address and bit number are speci-fied directly to specify a bit.

Note For Timer Completion Flags and Counter Completion Flags, there is no distinction between word addresses and bit addresses.

Specifying word addresses

The word address is specified directly to specify a 16-bit word.

MOV 3 D200

Specifying offsets for bit addresses

In brackets, specify the number of bits to off-set the specified 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 offsets for word addresses

In brackets, specify the number of words to offset the specified starting bit 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.

MOV 3 D0[200]

Bit number(00 to 15)

Word address

.

Bit number 02

1

Word address CIO 1

. 02 1.02

Word address

3

Word address CIO 3

D200

Word address D200

Offset Constant0 to 15 or wordaddress in I/O memory

Starting bit address

.

10.00[2]Number of bits to offset the address→10.02

Starting bit address

10.00 [W0]

Number of bits to offset the address When W0 = &2→10.02

Starting bit address

10.00[2]

Starting word address

.

Offset Constant of 0 or higher or word address in I/O memory

[ ]

D0[2]

Number of words to offset the address→D2

Starting word address

D0 [W0]

Number of words to offset the addressWhen W0 = &2 →D2

Starting word address

Page 84: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-14 CP1E CPU Unit Software User’s Manual(W480)

The following table shows the data formats that the CP1E CPU Units can handle.

Operand Description ExampleApplicationexamples

Specifying indirect DM addresses in Binary Mode

An offset from the beginning of the DM Area is specified. The contents of the address will be treated as binary data (00000 to 32767) to specify the word address in DM Area.

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

MOV #0001 @D300

Indirect DM Addressing in BCD Mode

An offset from the beginning of the DM Area is specified. The contents of the address will be treated as BCD data (0000 to 9999) to specify the word address in the DM Area.Add an asterisk (*) at the front to specify an indirect address in BCD Mode.

MOV #0001 *D200

5-3-5 Data Formats

Type Data formatDecimal

equivalent

4-digit hexadeci-

mal

Unsigned binary

&0 to &65535

#0000 to #FFFF

Signed binary

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).

Negative: -1 to- 32768

Negative: #8000 to #FFFF

Positive: 0 to 32767

Positive: #0000 to #7FFF

@D

&0 to &32767 decimal(#0000 to #7FFF hex)

D

Contents

@D300

Add @

&256 decimal

(#0100 hexadecimal)

Specify D00256

Contents

0000 to 9999(BCD)

*D

D

Contents

Contents

Specify D100

* D200

Add *

#0100

215

23

32768

214

22

16384

213

21

8192

212

20

4096

211

23

2048

210

22

1024

29

21

512

28

20

256

27

23

128

26

22

64

25

21

32

24

20

16

23

23

8

22

22

4

21

21

2

20

20

1

Binary→

Hexadecimal→

Decimal→

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

215

23

-32768

214

22

16384

213

21

8192

212

20

4096

211

23

2048

210

22

1024

29

21

512

28

20

256

27

23

128

26

22

64

25

21

32

24

20

16

23

23

8

22

22

4

21

21

2

20

20

1

Binary: →Hexadecimal: →

Decimal: →

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

Sign bit: 1:Negative, 0:Non-negative

Page 85: CP1E CPU Unit Software Users Manual

5-15

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-3 Pro

gram

min

g In

structio

ns

5

5-3-5 Data F

ormats

Note 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

Type Data formatDecimal

equivalent

4-digit hexadeci-

mal

BCD (binary coded deci-mal)

#0 to #9999 #0000 to #9999

Single-preci-sion floating-point decimal

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 for CP1E 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 for CP1E 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 values 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.

(Refer to the follow-ing note.)

23 22 21 20BCD →

Decimal →

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

23 22 21 20 23 22 21 20 23 22 21 20

0 to 9 0 to 9 0 to 9 0 to 9

Sign ofmantissa

Exponent Mantissa

Value = (-1)sign×1.[Mantissa] × 2Exponent

· 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. Indicates this value.

3031 29 23 2122 20 19 2 1 0

Binary

· The 8 bits from bit 23 to bit 30 contain the exponent. The exponent is expressed in binary as the n in 2n. The actual value is 2n-127.

Page 86: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-16 CP1E CPU Unit Software User’s Manual(W480)

The following methods are used to refresh external I/O.

• Cyclic refreshing

• Immediate refreshing (instructions with the ! variation and IORF)

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

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

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.

Instructions with Refresh Variation (!)I/O will be refreshed as shown below when an instruction is executing if a real I/O bit in the CPUUnit’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 exe-cuted.

Add an exclamation mark (!) in front of the instruction to specify immediate refreshing.

IORF(097) Instruction An I/O refresh (IORF) instruction is supported as a special instruction to refresh actual I/O data inthe 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 UsePrecautions for Correct Use

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

5-3-6 I/O Refresh Timing

Cyclic Refreshing

Immediate Refresh

Start

!LD1.01

!OUT2.09

END

I/O refresh

CIO 0001

15 0

CIO 0002

15 016-bit increments

All actual I/O data

Cyclic refreshing(batch)

Page 87: CP1E CPU Unit Software Users Manual

5 - 17

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-4 Co

nstan

ts: &, #, +, -, an

d N

um

bers w

itho

ut S

ymb

ols

5

5-4 Constants: &, #, +, -, and Numbers without Symbols

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 →Decimal Notation (No Symbol)

• Floating Point (Real Number) Notation →Signed decimal notation (with + or - symbol and decimal point)

Using Operands for Bit Strings or Numeric Values (Integers) • Unsigned Binary

Overview

Notation and Ranges

Data type Decimal values Hexadecimal values

Notation With & symbol With # symbol

Application example:

MOV &10 D0

Stores 10 decimal (#000A hex) in D0.

Application example:

MOV #000A D0

Stores #000A hex (&10 decimal) in D0.

Precautions for Correct Use

• An error will occur and the left bus bar will be displayed in red if a hexadecimal value including A to F is input with & from the CX-Programmer for CP1E.

• 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 for CP1E.

Precautions for Correct Use

• An error will occur and the left bus bar will be displayed in red if a hexadecimal value including A to F is input without # from the CX-Programmer for CP1E.

• 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 for CP1E.

Range 16 bits &0 to 65535 #0000 to #FFFF

32 bits &0 to 4294967295 #00000000 to #FFFFFFFF

&

Decimal symbol

Decimal value(integer)

10 #

Hexadecimal symbol

Hexadecimal valueusing 0 to F

000A

Page 88: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-18 CP1E CPU Unit Software User’s Manual(W480)

• Signed Binary

• Unsigned BCD

Data type Decimal values Hexadecimal values

Notation Signed + or - With # symbol

Application example:

MOV -10 D0

Stores 10 decimal (#FFF6 hex) in D0.

Application example:

MOV # 0100 D0

Stores #FFF6 hex (10 decimal) in D0.

Precautions for Correct Use

• 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 + or - is input from the CX-Programmer for CP1E.

Precautions for Correct Use

• An error will occur and the left bus bar will be displayed in red if a hexadecimal value including A to F is input without # from the CX-Programmer for CP1E.

• 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 for CP1E.

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: #8000 0000 to #FFFF FFFF

Positive: 0 to +2147483647 Positive: #0000 0000 to #7FFF FFFF

Data type Decimal values BCD values

Notation None

Application example:

+B #0010 D0 D1

Adds #0010 and the contents of D0 as BCD data and stores the result in D1.

Precautions for Correct Use

• 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 for CP1E.

Range 16 bits None #0000 to #9999

32 bits #0000 0000 to #9999 9999

- 10

+ or - sign

Decimal value(integer)

# FFF6

Hexadecimal symbol

Hexadecimal valueusing 0 to F

# 0010

BCD symbol

Decimal value using0 to 9

Page 89: CP1E CPU Unit Software Users Manual

5 - 19

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-4 Co

nstan

ts: &, #, +, -, an

d N

um

bers w

itho

ut S

ymb

ols

5

Using Operands to Specify Numbers

Using Floating-point (Real Number) Notation for Operands

Additional Information

• Zero suppression can be used when inputting any data type. Example: “&2” can be input rather than “&02” .Example: “#2” can be input rather than “#02”.

• “BIN” indicates binary data.

• BCD data is binary coded decimal.

Data type Decimal values Hexadecimal values or BCD values

Notation No symbol (value only) Not possible.

Application example:SBS 0

Jumps to subroutine 0.

Precautions for Correct Use

• An error will occur and the left bus bar will be displayed in red if a deci-mal value is input with & from the CX-Programmer for CP1E.

Data type Decimal values Hexadecimal values

Notation With + or - With # symbol

(for single-precision data)

Application example:FIX +0.10 D0Converts floating point +0.10 into 16-bit signed binary data and stores the integer portion in D0.

Application example:FIX #3DCCCCCD D0Converts floating point #3DCCCCCD (+0.10 deci-mal) into 16-bit signed binary data and stores the integer portion in D0.

Precautions for Correct Use

• The input will be treated as an address in the CIO Area, an error will occur, and the left bus bar will be dis-played in red if a decimal value with a decimal point is input without + from the CX-Programmer for CP1E.

Precautions for Correct Use

• The input will be treated as an address in the CIO Area, an error will occur, and the left bus bar will be displayed in red if a hexadecimal value including A to F is input without # from the CX-Programmer for CP1E.

10

Number only

0.10

+ or - sign

Decimal value(real number)

+# 3DCCCCCD

Hexadecimal symbol

Hexadecimal valueusing 0 to F

Page 90: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-20 CP1E CPU Unit Software User’s Manual(W480)

Using Operands for Bit Strings or Numeric Values• Bit String

Input the operand using decimal representation with the & symbol or hexadecimal representationwith the # symbol.

Example: Input &0 to &65535 as decimal or #0000 to #FFFF as hexadecimal for operand S(source data) of the MOV instruction.

Signed decimal data can also be input.

• Numeric Values Input the operand using decimal representation with the & symbol or hexadecimal representationwith the # symbol.

Example: Input &0 to &65535 decimal or #0000 to #FFFF hexadecimal for operand N (number ofwords) of the XFER instruction.

Indirect specification is possible.

Example: Operand N of the XFER instruction: When an address (e.g., W100) is input as the num-ber of words to transfer, the contents of the addressed word (e.g., the contents ofW100) is indirectly specified.

Using Operands to Specify NumbersInput the operand using decimal representation with a value only (i.e., no & prefix).

Example: Operand N of SBS Instruction: Input 0 to 1023 decimal as the subroutine number.

Indirect specification is not possible.

Input a numeric value for operands that can be indirectly specified (e.g., jump numbers for JMPinstruction or JME instruction).

• Operands That Specify Numbers

Using Operands to Specify Floating-point Values (Real Number) Input the operand using decimal representation with + or - symbol or hexadecimal representationwith # symbol.

Example: Input decimal values in the following ranges or #0000 0000 to #FFFF FFFF hexadecimalfor operand S (first source word) of the FIX instruction.

-3.402823 × 1038 ≤ Value ≤ -1.175494 × 10-38, 0,

+1.175494 × 10-38 ≤ Value ≤ +3.402823 × 1038

Details

Instruction type Instruction operand

Timer instructions Timer numbers for TIM/TIMX, TIMH/TIMHX, TMHH/TMHHX, TIMU/TIMUX, TMUH/TMUHX, and TTIM/TTIMX instructions

Counter instructions Counter numbers for CNT/CNTX and CNTR/CNTRX instructions

Multi-interlock instructions Interlock numbers for MILH and MILR instructions

Subroutine instructions Subroutine numbers for SBS instructions

Interrupt control instructions Interrupt numbers for MSKS and CLI instructions

Failure diagnosis instructions FAL numbers for FAL instructions and FALS numbers for FALS instruc-tions

Page 91: CP1E CPU Unit Software Users Manual

5-21

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-5 Sp

ecifying

Offsets fo

r Ad

dresses

5

5-5-1 Overview

5-5 Specifying Offsets for Addresses

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

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

• Start Bit AddressIt is possible to specify the start bit address with a bit address or with a symbol (except the NUM-BER data type cannot be used). Offsetting is possible only for addresses in the Holding, Work, and DM Areas.The I/O comment for the start bit address is displayed.

• OffsetThe offset can be specified as a decimal constant, word address (but CIO Area addresses cannotbe specified), or a one-word symbol (i.e., symbols with the following data types: INT, UINT,WORD, CHANNEL).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 nextword.If the offset is specified indirectly, make sure that the final bit address does not exceed the upperlimit of the memory area by using input comparison or other instruction.

5-5-1 Overview

When the start address is W100.0 and W0 is &2, 2 is added, resulting in W100.2. When the start address is

D100 and W1 is &3, 3 is added, resulting in D103.

An offset of 12 is added to the start address of D100, resulting in D112.

An offset of 4 is added to the start address of W300.0, resulting in W300.4.

Examples of Specifying Bit Address Offsets

Examples of Specifying Word Address Offsets

W100.0[W0]

W300.0[4]

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

Number of bits to offset: +n

A [n]

Offset

Starting bit address

Starting bit address A

Page 92: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-22 CP1E CPU Unit Software User’s Manual(W480)

If the number of offset bits exceeds the memory area of the start bit address, the final bit address willbe in the next memory area in the order determined by the actual PLC memory addresses.

Examples:

Word AddressesThe word address is offset by the amount specified by n (number of offset words) from A (start wordaddress).

• Start Word AddressIt is possible to specify the start word address with a word address or with a symbol (except theNUMBER 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.

• OffsetThe offset can be specified as a decimal constant, word address (but CIO Area addresses cannotbe 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 nextword.If the offset is specified indirectly, make sure that the final bit address does not exceed the upperlimit of the memory area by using input comparison or other instruction.

If the number of offset words exceeds the memory area of the start word address, the final wordaddress will be in the next memory area in the order determined by the actual PLC memoryaddresses.

Examples:

10.0 [2] 10.02

10.02

a [2] 10.02

10.00 [W0]a [b]

Offset; symbol b = &2

Start bit address; symbol a = 10.0

10.02Offset when W0 = &2(word address in I/O memory)

Start bit address(bit address in I/O memory)

Offset (decimal value)

Start bit address; symbol a = 10.0(bit symbol named a)

Offset (decimal value)

Start bit address(bit address in I/O memory)

WordBit 15 14 13 12 11 10 9 8 7 6 5 0

Start word address

Offset

A [n] 4 3 2 1

A

+n

D0 [2] D2

D2

a [2] D2

[W0]a [b]

Offset; symbol b(one-word symbol) = &2

Start word address;symbol a (one-word symbol) = D0

D2

Offset (decimal value)

Start word address(word address in I/O memory)

Offset; W0 = &2(word address in I/O memory)

Start bit address(bit address in I/O memory)

Offset (decimal value)

Start word address; symbol a (one-word symbol) = D0

D0

Page 93: CP1E CPU Unit Software Users Manual

5-23

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-5 Sp

ecifying

Offsets fo

r Ad

dresses

5

5-5-2 Application E

xamples for A

ddress Offsets

It is possible to dynamically specify the offset by specifying a word address in I/O memory for the offsetin 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 thebrackets and using only one instruction.

Ladder Program ExampleIn 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 theend of the areas and the sums are output to D200 to D299 starting from the specified offset fromD200.

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.

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

Observe the following precaution if a symbol or address is specified for an offset in a ladder dia-gram.

Program so that the memory area of the start address is not exceeded when the offset is spec-ified indirectly using a word address or symbol.

For example, write the program so that processing is executed only when the indirect specifica-tion 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 sys-tem will access data in other area, and unexpected operation may occur.

5-5-2 Application Examples for Address Offsets

Caution

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

Repeat this process 100 times.

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

Page 94: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-24 CP1E CPU Unit Software User’s Manual(W480)

MOVW0W1

a

FOR&100

Execution condition

Execution condition

++

W1

a

Starts FOR loop

NEXT Returns to FOR

+

D0[W1]D100[W1]D200[W1]

<

W1&100

When execution condition a (upwardly differentiated) turns ON, the value of W0 is set to W1.

If execution condition a is ON and the value of W0 is less than &100, the data from the start position until D99 and the data until D199 are added, and the sum for each is output until D299.

While execution condition a is ON, W0 is incremented.

Page 95: CP1E CPU Unit Software Users Manual

5-25

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-6 Ch

ecking

Pro

gram

s

5

5-6-1 Checking during Input O

perations from the C

X-P

rogramm

er

5-6 Checking Programs

CJ-series programs can be checked at the following stages.

• Checking during input operations from the CX-Programmer for CP1E

• Checking programs using the CX-Programmer for CP1E

• Instruction check during execution

• Fatal error check (program errors) during execution

The programming will be automatically checked by the CX-Programmer for CP1E at the following times.

The results of checking are output to the Text Tab Page of the Output Window.

Also, the left bus bar of illegal program sections will be displayed in red in Ladder View.

The user program can be checked in the CX-Programmer for CP1E. When the program is checked, theuser can specify program check in any of four levels: A, B, or C (in order of the seriousness of theerrors) or a custom check level.

The CX-Programmer for CP1E does not check range errors for indirectly addressed operands ininstructions. If an instruction’s operand data is invalid, the ER Flag will be turned ON during the programexecution check, which is described in the next section.

Refer to the CS/CJ/NSJ-series Instructions Reference Manual (Cat. No. W483) for details.

5-6-1 Checking during Input Operations from the CX-Programmer

Timing Checked

When inputting ladder diagrams Instruction inputs, operand inputs, programming patterns

When loading files All operands for all instructions and all programming patterns

When downloading files Support for CP1E CPU Unit model and all operands for all instructions

During online editing Memory capacity, etc.

5-6-2 Program Checks with the CX-Programmer for CP1E

Page 96: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-26 CP1E CPU Unit Software User’s Manual(W480)

Programming can be debugged without connecting to the actual PLC by simulating CPU Unit operationon a computer.

Programming that has been created can be checked and debugged with a virtual PLC by starting theSimulator in the CX-Simulator from the CX-Programmer for CP1E.

In addition to transferring programs and monitoring, the following functions can be used with the Simu-lator.

• Executing Step Run, Continuous Step Run, or Scan Run.

• Specifying break points, start points, and I/O break conditions.

• Checking the number of executions and execution time for each task.

• Simulating execution of interrupt tasks.

• Force-setting and force-resetting bits.

This functionality is not supported for the CP1E.

5-6-3 Debugging with the Simulator

Checking Ladder Program Operation

Debugging with Operation between PT and Ladder Programming: Integrated Simulation

CX-Programmer

Virtual PLC(Simulator)

SimulationSimulation line connection

Download

Page 97: CP1E CPU Unit Software Users Manual

5-27

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-6 Ch

ecking

Pro

gram

s

5

5-6-3 Debugging w

ith the Sim

ulator

With the CX-Programmer for CP1E, it is possible to generate system errors in the virtual PLC duringladder programming simulation.

It is easy to check operation of the ladder programming an the NS-series PT when a PLC system erroroccurs by generating the desired fatal or non-fatal system error using a special operation window.

Note Unlike with an actual error, ladder execution will not stop even if a fatal error is generated using the PLC errorgeneration simulation function.

Additional Information

System errors can also be generated in the PLC by using a FAL or FALS instruction.

Debugging Operation with PLC Error (Error Simulation Function)

CX-Programmer

Virtual PLC

PLC Error SimulatorSimulation

PLC error SimulatorStart

An error is simulated

An error occurs

An error occurs

Simulation in progress

Error listExample: The Battery Error Flag (A402.04) turns ON.

The Cycle Time Too Long Flag (A401.08) turns ON. The Memory Error Flag (A401.15) turns ON.

Page 98: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-28 CP1E CPU Unit Software User’s Manual(W480)

The following checks can be performed using the CX-Programmer for CP1E during instruction execution.

The following checks are performed during instruction execution.

*1 The Instruction Processing Error Flag (A295.08) will also turn ON if Stop Operation is specified when an erroroccurs.

*2 The Access Error Flag (A295.10) will turn ON if Stop Operation is specified when an error occurs.

• An instruction processing error will occur if incorrect data was provided when executing an instructionor an attempt was made to execute an instruction outside of a task. Here, data required at the beginning of instruction processing was checked and as a result, theinstruction was not executed and the P_ER Flag (Error Flag) will be turned ON. The P_EQ and P_NFlags may be retained or turned OFF depending upon the instruction.The P_ER Flag (error Flag) will turn OFF if the instruction (excluding input instructions) ends nor-mally.Conditions that turn ON the P_ER Flag will vary with individual instructions.

Refer to the CP-series Instructions Reference Manual (Cat. No. W483).

• If Instruction Errors are set to Stop Operation in the PLC Setup, then operation will stop (fatal error)and the Instruction Processing Error Flag (A295.08) will turn ON if an instruction processing erroroccurs and the P_ER Flag turns ON.

• Illegal access errors indicate that the wrong area was accessed in one of the following ways when theaddress specifying the instruction operand was accessed.

• A read or write was executed for a parameter area.

• Writing memory that is not installed. (See note.)

• Writing to a read-only area.

• The value specified in an indirect DM address in BCD mode was not BCD (e.g., D1 contains#A000).

5-6-4 Program Execution Check

Type of error Flag that turns ON for error Stop/Continue operation

Instruction Processing Error

ER Flag (See note 1.) A setting in the PLC Setup can be used to specify whether to stop or continue operation for instruction processing errors. The default is to continue opera-tion.

A program error will be generated and operation will stop only if Stop Operation is specified.

Illegal Area Access Error AER Flag (See note 2.) A setting in the PLC Setup can be used to specify whether to stop or continue operation for instruction processing errors. The default is to continue opera-tion.

A program error will be generated and operation will stop only if Stop Operation is specified.

Illegal Instruction Errors Illegal Instruction Error Flag (A295.14)

Fatal (program error)

User Program Area Over-flow Errors

User Program Area Overflow Error Flag (A295.15)

Fatal (program error)

1. Instruction Processing Errors (Error Flag ON Errors)

2. Illegal Access Errors (P_AER Flag ON Errors)

Page 99: CP1E CPU Unit Software Users Manual

5-29

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-6 Ch

ecking

Pro

gram

s

5

5-6-4 Program

Execution C

heck

• Instruction processing will continue and the Error Flag (ER Flag) will not turn ON if an access erroroccurs, but the Access Error Flag (P_AER Flag) will turn ON. An access error will occur for the following:

• If Instruction Errors are set to Stop Operation in the PLC Setup, then operation will stop (fatal error)and the Illegal Access Error Flag (A295.10) will turn ON if an illegal access error occurs and the AERFlag turns ON.

Additional Information

The Access Error Flag (P_AER Flag) will not be cleared after a task is executed. If InstructionErrors are set to Continue Operation, this Flag can be monitored until just before the ENDinstruction to see if an illegal access error has occurred in the task program. (The status of thefinal P_AER Flag after the entire user program has been executed will be monitored if the AERFlag is monitored on the CX-Programmer for CP1E.)

Illegal Instruction ErrorsIllegal instruction errors indicate that an attempt was made to execute instruction data other thanthat defined in the system.

This error will normally not occur as long as the program is created with CX-Programmer for CP1E.

In the rare even that this error does occur, it will be treated as a program error, operation will stop(fatal error), and the Illegal Instruction Flag (A295.14) will turn ON.

User Program Area Overflow ErrorsUser program area overflow errors indicate that an attempt was made to execute instruction datastored beyond the last address in the user program area defined as program storage area.

This error will normally not occur as long as the program is created with the CX-Programmer forCP1E.

In the rare event that this error does occur, it will be treated as a program error, operation will stop(fatal error), and the UM Overflow Flag (A295.15) will turn ON.

Additional Information

If the Error Flag (P_ER) or Illegal Access Error Flag (P_AER) turns ON, it will be treated as aprogram error and it can be used to stop the CPU Unit from running. Specify operation for pro-gram errors in the PLC Setup.

3. Other Errors

Page 100: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-30 CP1E CPU Unit Software User’s Manual(W480)

Program Errors

Program error Description Related flags

No END Instruction An END instruction is not present in the program. The No END Flag (A295.11) turns ON.

Error During Task Execution No task is ready in the cycle.

No program is allocated to a task.

The corresponding interrupt task number is not present even though the execution condition for the interrupt task was met.

The Task Error Flag (295.12) turns ON.

Instruction Processing Error (ER Flag ON) and Stop Oper-ation set for Instruction Errors in PLC Setup

The wrong data values were provided in the oper-and when an attempt was made to execute an instruction.

The ER Flag turns ON and the Instruction Processing Error Flag (A295.08) turns ON if Stop Operation set for Instruction Errors in PLC Setup.

Illegal Access Error (AER Flag ON) and Stop Opera-tion set for Instruction Errors in PLC Setup

A read or write was executed for a parameter area.

A read or write was executed for a memory area that is not mounted.

Writing to a read-only area.

The value specified in an indirect DM address in BCD mode is not BCD.

The AER Flag turns ON and the Illegal Access Error Flag (A295.10) turns ON if Stop Operation set for Instruction Errors in PLC Setup.

Indirect DM/EM BCD Error and Stop Operation set for Instruction Errors in PLC Setup

The value specified in an indirect DM address in BCD mode is not BCD.

The AER Flag turns ON and the DM/EM Indirect BCD Error Flag (A295.09) turns ON if Stop Operation set for Instruction Errors in the PLC Setup.

Differentiation Address Over-flow Error

During online editing, more than 131,071 differenti-ated instructions have been inserted or deleted.

The Differentiation Over-flow Error Flag (A295.13) turns ON.

Illegal Instruction Errors Execution of an unexecuteable instruction was attempted.

The UM (User Memory) Overflow Flag (A295.14) turns ON.

User Program Area Overflow Errors

An attempt was made to execute instruction data stored beyond the last address in user memory (UM) defined as program storage area.

The UM (User Memory) Overflow Flag (A295.15) turns ON.

Page 101: CP1E CPU Unit Software Users Manual

5-31

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-7 Lad

der P

rog

ramm

ing

Precau

tion

s

5

5-7-1 Ladder Program

ming P

recautions

5-7 Ladder Programming Precautions

The Condition Flags are shared by all of the instructions, so their status may change often in a singlecycle.

Therefore, be sure to use Condition Flags on a branched output with the same execution conditionimmediately after an instruction to show the results of instruction execution.

Do not connect an input condition for a Condition Flag directly to the bus bar. Never connect an input condition for a Condition Flag directly to the bus bar because this will causeit to show the execution results for another instruction.

Example: Using Instruction A Execution Results

5-7-1 Ladder Programming Precautions

Using Condition Flags

The same execution condition (a) is used for instructions A and B to execute instruction B based on the execution results of instruction A.

In this case, instruction B will be executed according to the Condition Flag only if instruction A is executed.

If the Condition Flag is directly connected to the bus bar, instruction B will be executed based on the execution results of the previous instruction even if instruction A is not executed.

Instruction B

Instruction Operands

LD

Instruction A

AND

Instruction B

Correct Use

Instruction Aa Incorrect use

Previous runga

The result from instruction A is shown in the Equals Flag.

Condition FlagEx) = Instruction A

Instruction B

Shows the execution results of the preceding rung if instruction A is not executed.

=

Condition FlagEx) =

Page 102: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-32 CP1E CPU Unit Software User’s Manual(W480)

Creating N.C. and N.O. Condition Flag Inputs Using OUT Instructions The Condition Flags are used by all instructions, so make sure that they do not cause interference inthe same program.

Precautions for Correct UsePrecautions for Correct Use

Precautions for Using Condition Flags for Differentiated Instructions

With differentiated instructions, execution results for instructions are shown in Condition Flagsonly when execution condition is met, and results for a previous rung (rather than executionresults for the differentiated instruction) will be shown in Condition Flags in the next cycle.

You must therefore be aware of what Condition Flags will do in the next cycle if execution resultsfor differentiated instructions are to be used.

Example: Using Execution Results in N.C. and N.O. Inputs

Incorrect Use Correct use

The Condition Flags will pick up instruction B execution results even though the N.C. and N.O. input bits are executed from the same output branch.

Make sure each of the results is picked up once by an OUT instruction to ensure that execution results for instruction B will be not be picked up.

A rung will have to be inserted to prevent execution results for the first MOV instruction from being picked up.

Condition Flag

C

D Condition Flag

C

D

Instruction A

The result from instruction A is shown in the Equals Flag.

Ex) =

Instruction B

The result from instruction B is shown in the Equals Flag.

Instruction AThe result from instruction A is shown in the Equals Flag.

The result from instruction A is shown in the Equals Flag.

Condition FlagEx) =

Ex) =

Condition Flag

Ex) =Instruction B

CMP

#10

D100

MOV

#200

D200

MOV

#300

D300

CMP

#10

D100

MOV

#200

D200

MOV

#300

D300

B

B

A

A

Shows results of executing CMP.

Shows the result of executing MOV.

Shows results of executing CMP.

=

=

=

=

Page 103: CP1E CPU Unit Software Users Manual

5-33

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-7 Lad

der P

rog

ramm

ing

Precau

tion

s

5

5-7-1 Ladder Program

ming P

recautions

Additional Information

The CONDITION FLAG SAVE and CONDITION FLAG LOAD (CCS and CCL) instructions canbe used to save and load the Condition Flag status. These can be used to access the status ofthe Condition Flags at other locations in a task or in a different task.

Refer to 6-10 Condition Flags(P_) for a list of Condition Flags.

Error Flag (P_ER)The Error Flag will turn ON under special conditions, such as when operand data for an instruction isincorrect.

The instruction will not be executed when the Error Flag turns ON.

When the Error Flag is ON, the status of other Condition Flags, such as the <, >, OF, and UF Flags,will not change.

The status of the = and N Flags will vary from instruction to instruction.

For information on the conditions that turn ON the Error Flag, refer to the pages in this manual thatdescribe the instructions.

Caution is required because some instructions will turn OFF the Error Flag regardless of conditions.

Additional Information

The PLC Setup Settings for when an instruction error occurs determines whether execution willstop when the Error Flag turns ON.

In the default setting, operation will continue when the Error Flag turns ON.

If Stop Operation is specified when the Error Flag turns ON and operation stops (treated as aprogram error), the program address at the point where operation stopped will be stored at inA298 to A299.

At the same time, A295.08 will turn ON.

Example: Instructions A and B will execute only if execution condition C is met, and instruction B picks up the execution results from instruction A.

Incorrect Use Correct use

If execution condition C remains ON in the next cycle after instruction A was executed, then instruction B will be executed (by the execution condition) when the Condition Flag turns ON because of results shown from a previous rung.

If instructions A and B are not differentiated instructions, the DIFU (or DIFD) instruction is used instead and instructions A and B are both upwardly (or downwardly) differentiated and executed for one cycle only.

Main Conditions Turning ON Condition Flags

Previous rung

CDIFU

D D

C

Instruction A

Ex) =Condition Flag

Instruction B

Shows execution results for instruction A when execution condition is met, and then in the next cycle, shows the execution results of the previous rung.

The result from instruction A is shown in the Equals Flag.

Instruction B

Instruction A

Ex) =Condition Flag

Previous rung

Page 104: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-34 CP1E CPU Unit Software User’s Manual(W480)

Equals Flag (P_EQ) The Equals Flag is a temporary flag for all instructions except when comparison results are equal(=). It is set automatically by the system, and it will change.

The Equals Flag can be turned OFF (ON) by an instruction after a previous instruction has turned itON (OFF).

The Equals Flag will turn ON, for example, when MOV or another move instruction moves 0000 hexas source data and will be OFF at all other times.

Even if an instruction turns the Equals Flag ON, the move instruction will execute immediately andthe Equals Flag will turn ON or OFF depending on whether the source data for the move instructionis 0000 hex or not.

Some instructions will simply turn OFF the Equals Flag when the instruction is executed.

Carry Flag (P_CY)The Carry Flag is used in shift instructions, addition and subtraction instructions with carry input,addition and subtraction instruction borrows and carries, as well as with PID instructions and FPDinstructions.

Note the following precautions.

• Be care when executing instructions that use the Carry Flag as an input (e.g., addition and sub-traction instructions with borrows and carries) to be sure that the Carry Flag has not been turnedON or OFF by an unrelated instruction.

• The Carry Flag can be turned ON (or OFF) by the execution results for a certain instruction andcan then be turned OFF (or ON) by another instruction.

Greater Than and Less Than Flags (P_>, P_<) The P_> and P_< Flags are used in comparison instruction, as well as in the PIDAT and otherinstructions.

The P_> or P_< Flag can be turned OFF (or ON) by another instruction even if it is turned ON (orOFF) by execution results for a certain instruction.

Negative Flag (P_N)The Negative Flag is turned OFF when the leftmost bit of the instruction execution results word is 1for certain instructions and it is turned OFF unconditionally for other instructions.

Specifying Operands for Multiple WordsAn instruction will be executed as written even if an operand requiring multiple words is specified sothat all of the words for the operand are not in the same area. In this case, words will be taken inorder of the PLC memory addresses, as is normal for instructions in the CP1E.

The Error Flag will not turn ON.

As an example, consider the results of executing a block transfer with XFER if 20 words are speci-fied for transfer beginning with W500. Here, the Work Area, which ends at W511, will be exceeded,but the instruction will be executed without turning ON the Error Flag.

In the PLC memory addresses, the present values for timers are held in memory after the WorkArea, and thus for the following instruction, W500 to W511 will be transferred to D0 to D11 and thepresent values for T0 to T7 will be transferred to D12 to D19.

XFER

&20

W500

D0

W500

W511

~~

~~

D00000

D00011

~

D00012

D00019

~

~~T0000

T0007

Number of transfer words

First source word

First destination word

Transfer

Page 105: CP1E CPU Unit Software Users Manual

5-35

5 Understanding Programming

CP1E CPU Unit Software User’s Manual(W480)

5-7 Lad

der P

rog

ramm

ing

Precau

tion

s

5

5-7-2 Special P

rogram S

ections

CP-series programs have special program sections that will control instruction conditions.

The following special program sections are available

The following table shows which of the special instructions can be used inside other program sections.

:Applicable, : Not applicable

Place all the subroutines together just before the END instruction in all programs but after all of themain program.

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), thoseinstructions will not be executed.

5-7-2 Special Program Sections

Program sections InstructionsInstructionconditions

Status

Subroutines SBS, SBN, and RET instruc-tions

Subroutine program is executed.

The subroutine program section between SBN and RET instructions is exe-cuted.

IL - ILC sections IL and ILC instructions During IL The output bits are turned OFF and timers are reset.Other instructions will not be executed and previous sta-tus will be maintained.

Step ladder sections STEP instructions

FOR-NEXT loop FOR instructions and NEXT instructions

Break in progress. Looping

Instruction Combinations

SubroutinesIL-ILC

sectionsStep ladder

sectionsFOR-NEXTsections

Subroutine

IL-ILC

Step Ladder section

FOR - NEXT loop

Subroutines

Program

Subroutines

Program

Subroutines

Page 106: CP1E CPU Unit Software Users Manual

5 Understanding Programming

5-36 CP1E CPU Unit Software User’s Manual(W480)

The following instructions cannot be placed in a subroutine.

The following instructions cannot be used in step ladder program sections.

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.

Instructions Not Supported in Subroutines

Classification by function

Mnemonic Instruction

Step Ladder Instructions

STEP STEP DEFINE

SNXT STEP NEXT

Instructions Not Available in Step Ladder Program Sections

Classification by function

Mnemonic Instruction

Sequence Con-trol Instructions

FOR, NEXT, and BREAK FOR, NEXT, and BREAK LOOP

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

Page 107: CP1E CPU Unit Software Users Manual

6-1CP1E CPU Unit Software User’s Manual(W480)

6

This section describes the I/O memory areas in a CP1E CPU Unit. Be sure you understand the information in the section before attempting to write ladderdiagrams.

Refer to the Instructions Reference Manual (Cat. No. W483) for detailed informationon programming instructions.

6-1 Overview of I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-26-1-1 I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2

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

6-1-3 I/O Memory Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6

6-2 I/O Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7

6-3 Work Area (W) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8

6-4 Holding Area (H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9

6-5 Data Memory Area (D) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-11

6-6 TR Area (TR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-13

6-7 Timer Area (T) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

6-8 Counter Area (C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-17

6-9 Auxiliary Area (A) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-19

6-10 Condition Flags (P_) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-21

6-11 Clock Pulses (P_) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-23

I/O Memory

Page 108: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-2 CP1E CPU Unit Software User’s Manual(W480)

6-1 Overview of I/O Memory Areas

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

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

In the CIO Area, input bit addresses range from CIO 0 to CIO 99 and output bit addresses range fromCIO 100 to CIO 199.

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 CP1E CPU Unit and tothe Expansion Units and Expansion I/O Units.

Input words and output bits that are not allocated may be used as work bits in programming.

6-2 I/O Bits

6-1-1 I/O Memory Areas

CIO Area (CIO 0 to CIO 289)

Page 109: CP1E CPU Unit Software Users Manual

6-3

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-1 Overview

of I/O

Mem

ory A

reas

6

6-1-1 I/O M

emory A

reas

These areas can be used freely by the user.

Work Area (W)The Word Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike theinput bits and output bits in the CIO Area, I/O to and from external devices is not refreshed for thisarea.

Use this area for work words and bits before any words in the CIO Area. These words should beused first in programming because they will not be assigned to new functions in future versions ofCP1E CPU Units.

6-3 Work Area (W)

Holding Area (H)The Holding Area is part of the internal memory of the CPU Unit. It is used in programming. Unlikethe input bits and output bits in the CIO Area, I/O to and from external devices is not refreshed forthis area.

These words retain their content when the PLC is turned ON or the operating mode is switchedbetween PROGRAM mode and RUN or MONITOR mode.

This data is cleared if a power interruption lasts longer than the I/O memory backup time (50 hoursfor an E-type CPU Unit and 40 hours for an N-type CPU Unit).

6-4 Holding Area (H)

Data Memory Area (D)This data area is used for general data storage and manipulation and is accessible only by word (16bits).

These words retain their content when the PLC is turned ON or the operating mode is switchedbetween PROGRAM mode and RUN or MONITOR mode.

Specified words can be retained in the built-in EEPROM backup memory using Auxiliary Area bits.

This data is cleared, however, if a power interruption lasts longer than the I/O memory backup time(50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

6-5 Data Memory Area (D)

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 FlagsEach 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 PVsEach timer PV is accessed as one word (16 bits) using the timer number. The PV increases or decreases as the timer operates.

6-7 Timer Area (T)

User Areas

Page 110: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-4 CP1E CPU Unit Software User’s Manual(W480)

Counter Area (C)There are two parts to the Counter Area: the Counter Completion Flags and the Counter PresentValues (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 switchedbetween PROGRAM mode and RUN or MONITOR mode.

This data is cleared if a power interruption lasts longer than the I/O memory backup time (50 hoursfor an E-type CPU Unit and 40 hours for an N-type CPU Unit).

• Counter Completion FlagsEach 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 PVsEach counter PV is accessed as one word (16 bits) using the timer number. The PVs count up or down as the counter operates.

6-8 Counter Area (C)

Additional Information

Constants ($, #, +, -, or numbers without symbols)

Constants are numerical values that can be specified as the instruction operands in 16 bits or 32bits.

• For an operand for a bit string or integer, & indicates a decimal number and # indicates a hexa-decimal number. Bit strings can also be expressed with a signed decimal number.

• For an operand for a number, an unsigned decimal number is used.

• For an operand for a floating point number (real number), a signed decimal number is used.

Refer to 5-4 Constants: $, #, +, -, and Numbers without Symbols for details on constants.

System Areas contain bits and words with preassigned functions.

Auxiliary Area (A)The words and bits in this area have preassigned functions.

A-2 Auxiliary Area by Address

Condition Flags (P_)The Condition Flags include the flags that indicate the results of instruction execution, as well as theAlways ON and Always OFF Flags.

The Condition Flags are specified with global symbols rather than with addresses.

Clock Pulses (P_)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.

System Areas

Page 111: CP1E CPU Unit Software Users Manual

6-5

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-1 Overview

of I/O

Mem

ory A

reas

6

6-1-2 I/O M

emory A

rea Address N

otation

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

Word AddressesSpecifies a16-bit word.

Bit AddressesA bit addresses specifies one of the 16 bits in a word.

The word number and bit number are separated with a period.

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

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

W 1 0 0

I/O memory area designatorExamples: D, A, and W

The word number within the area given in decimal

W 1 0 0 0 2

Word number Period Bit number (00 to 15)

.

I/O memory area designator

Period

0 . 0 3C 1

0 2 4 6 8 10

3 5 7 9 11IN CIO 0

Inputs begin from CIO 0 Outputs begin from CIO 100

Bit number00 to 11: Input bits00 to 07: Output bits

Page 112: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-6 CP1E CPU Unit Software User’s Manual(W480)

6-1-3 I/O Memory Areas

Name No. of bits Word addresses Remarks Reference

CIO Area Input Bits 1,600 bits(100 words)

CIO 0 to CIO 99Refer to 6-2 I/O Bits.

Output Bits 1,600 bits (100 words)

CIO 100 to CIO 199

Serial PLC Link Words

1,440 bits (90 words)

CIO 200 to CIO 289Refer to Section 16

Serial Communications.

Work Area (W) 1,600 bits (100 words)

W0 to W99Refer to 6-3 Work

Area (W).

Holding Area (H) 800 bits (50 words) H0 to H49 This data is cleared if a power interruption lasts longer than the I/O mem-ory backup time (50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

Refer to 6-4 Holding Area (H).

Data Memory Area (D)

E-type CPU Unit

2K words D0 to D2047 Data in specified words of the DM Area can be retained in the built-in EEPROM in the backup memory by using a bit in the Auxiliary Area. Applica-ble words: D0 to D1499 (500 words can be speci-fied at a time.)

Refer to 6-5 Data Memory Area (D).

N-type CPU Unit

8K words D0 to D8191 Data in specified words of the DM Area can be retained in the built-in EEPROM in the backup memory by using a bit in the Auxiliary Area.Applica-ble words: D0 to D6999 (500 words can be speci-fied at a time.)

Timer Area (T) Present values 256 T0 to T255Refer to 6-7 Timer

Area (T).Timer Comple-tion Flags

256

Counter Area (C) Present values 256 C0 to C255 This data is cleared if a power interruption lasts longer than the I/O mem-ory backup time (50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

Refer to 6-8 Counter Area (C).

Counter Com-pletion Flags

256

Auxiliary Area (A)

Read only 7,168 bits (448 words)

A0 to A447 This data is cleared if a power interruption lasts longer than the I/O mem-ory backup time (50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

Refer to A-2 Auxiliary Area by Address.

Read-write 4,896 bits (306 words)

A448 to A754

Temporary Area (TR) 16 bits TR0 to TR15Refer to 6-6 TR Area

(TR).

Page 113: CP1E CPU Unit Software Users Manual

6-7

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-2 I/O B

its

6

6-2 I/O Bits

This section describes the bits in the CIO Area that are used as external I/O bits.

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

Input bits: CIO 0.00 to CIO 99.15 (100 words)

Output bits: CIO 100.00 to CIO 199.15 (100 words)

Built-in inputs can be used as basic inputs, interrupt inputs, quick-response inputs, high-speed counters, or origin inputs.

Built-in outputs can be used as basic outputs, pulse outputs, or PWM outputs.

Refer to Section 10 Overview and Allocation of Built-in Functions for 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.)

Overview

Notation

Range

Applications

Details

Bit number: 02

0 . 02

Word number: 0

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

Page 114: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-8 CP1E CPU Unit Software User’s Manual(W480)

6-3 Work Area (W)

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

The Work Area contains 100 words with addresses ranging from W0 to W099.

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

• 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.)

Overview

Notation

Range

Applications

Details

Bit number: 02

W 0 20 . 02

Word number: 020

I/O memory area designator: W

W100

W100

W100

NO bit

NC bit

Storing a Condition in a Work Bit

Page 115: CP1E CPU Unit Software Users Manual

6-9

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-4 Ho

ldin

g A

rea (H)

6

6-4 Holding Area (H)

The Holding Area is part of the internal memory of the CPU Unit. It is used in programming. Unlike theinput 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 switchedbetween PROGRAM mode and RUN or MONITOR mode.

Precautions for Safe Use

Words in the DM Area that are not saved to the built-in EEPROM backup memory using AuxiliaryArea bits are cleared if power is interrupted for longer than the I/O memory backup time (50hours for E-type CPU Units and 40 hours for N-type CPU Units).

Write the ladder programs and construct the system so that problems will not occur even if thisdata is cleared.

The Holding area contains 50 words with addresses ranging from H0 to H049.

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

Precautions for Correct UsePrecautions for Correct Use

Holding Area data is retained only when a Battery is mounted to an N-type CPU Unit. Whenusing E-type CPU Units or N-type CPU Units without a Battery, data can be held only up to 50hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit.

Overview

Notation

Range

Applications

H 0 2 0 . 0 2

Bit number: 02

Word number: 020

I/O memory area designator: H

Page 116: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-10 CP1E CPU Unit Software User’s Manual(W480)

• Bits in the Holding Area can be force-set and force-reset.

• A Holding Area bit will be cleared if it is programmed between the ILC and IL instructions and the exe-cution condition for IL(002) is OFF. To keep a bit ON even when the execution condition for the IL instruction is OFF, turn ON the bit withthe SET instruction just before the IL instruction.)

• When a self-maintaining bit is programmed with a Holding Area bit, the self-maintaining bit will not becleared even when the power is reset.

Precautions for Correct UsePrecautions for Correct Use

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

• There are no restrictions in the order of using bit address or in the number of N.C. or N.O. con-ditions that can be programmed.

Details

If a Holding Area bit is not used for the self-maintainingbit, the bit will be turned OFF and the self-maintainingbit will be cleared when the power is reset.If a Holding Area bit is used but not programmed as aself-maintaining bit as in the following diagram, the bitwill be turned OFF by execution condition A when thepower is reset.

H0.00

H0.00

A H0.00

A B

A

KEEP

H1.00

Set

Set

Reset

Reset

~

A B

A

KEEP

H1.00~

Inpu

t Uni

t

Inpu

t Uni

t

Page 117: CP1E CPU Unit Software Users Manual

6-11

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-5 Data M

emo

ry Area (D

)

6

6-5 Data Memory Area (D)

This data area is used for general data storage and manipulation and is accessible only by word (16bits).

These words retain their contents when the PLC is turned ON or the operating mode is switchedbetween PROGRAM mode and RUN or MONITOR mode.

Some words in the DM Area can be saved to the built-in EEPROM backup memory using Auxiliary Areabits. These words are specifically referred to as the backed up words in the DM Area.

Precautions for Safe Use

Words in the DM Area that are not saved to the built-in EEPROM backup memory using AuxiliaryArea bits are cleared if power is interrupted for longer than the I/O memory backup time (50hours for E-type CPU Units and 40 hours for N-type CPU Units). Write the ladder programs andconstruct the system so that problems will not occur even if this data is cleared.

• E-type CPU Units have DM Area addresses ranging from D0 to D2047. (Of these, D0 to D1499 can be backed up in backup memory (built-in EEPROM).)

• N-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 EEPROM).)

Overview

Notation

Range

D 0200

Word number: 0200

I/O memory area designator: D

· CPU Unit with 30 or 40 I/O Points

D1300

D1200

D1399

D0

D1299

· CPU Unit with 20 I/O Points

D1399

D1300

D1299

D8191

D1400

D0

D8191

D1400

D1199

· All CPU Units Regardless of I/O Capacity

D2047

D0

[ E-type CPU Unit ] [ N-type CPU Unit ]

D6999

D7000D6999

D7000

D1499

D1500

~~

Words that can be backed up to backup memory

Words that can be backed up to backup memory

DM Fixed Allocation Words for the Modbus-RTU Easy Master (for Built-in RS-232C Port)

DM Fixed Allocation Words for the Modbus-RTU Easy Master (for Built-in RS-232C Port)

DM Fixed Allocation Words for the Modbus-RTU Easy Master (for Serial Option Port)

Words that can be backed up to backup memory

~~

~~

~~

~

~~

Page 118: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-12 CP1E CPU Unit Software User’s Manual(W480)

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.

Bits in the DM Area cannot be addressed individually.

Backing Up to the Built-in EEPROM Backup Memory• The corresponding DM Area words can be saved to the built-in EEPROM backup memory in 500

word increments during operation by turning ON the following Auxiliary Area bits.

• Words that can be Backed Up and the Corresponding Auxiliary Area Bits

• Specify in the PLC Setup whether to read the data in the DM Area words to the RAM as the initialvalues when the power supply is turned ON or at startup.

Refer to 17-6 DM Backup for how to use DM Area words and bits.

DM Fixed Allocation Words for the Modbus-RTU Easy MasterThe following DM area words are used as command and response storage areas for the Modbus-RTU Easy Master function.

Refer to 16-5 Modbus-RTU Easy Master function for how to use the DM Area words and bits.

Indirect Addressing of the DM AreaIndirect 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 treatedas a hexadecimal (binary) address and the instruction will operate on the DM Area word at thataddress.

The entire DM Area can be indirectly addressed with hexadecimal values 0000 to 7FFF.

Example:

• BCD-mode Addressing (*D)

If a * symbol is input before a DM Area address, the content of that DM Area word is treated as aBCD 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:

Applications

Details

Type of CP1EWords that can be saved to the built-in

EEPROM backup memoryAuxiliary Area bits

E-type CPU Unit D0 to D1499 (total area: D0 to D2047) A752.00 to A752.02

N-type CPU Unit D0 to D6999 (total area: D0 to D8191) A752.00 to A752.13

Unit I/O capacity DM Area wordsE-type CPU Units − D0 to D2047N-type CPU Units 20 I/O points D1300 to D1399 (for built-in RS-232C ports)

30 or 40 I/O points • D1200 to D1299 (for built-in RS-232C ports)

• D1300 to D1399 (for serial option ports)

Address actually used.

0100 D256@D100

Address actually used.

0100 D100*D100

Page 119: CP1E CPU Unit Software Users Manual

6-13

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-6 TR

Area (T

R)

6

6-6 TR Area (TR)

TR bits are used to temporarily store ON/OFF status when there are several output branches in a lad-der program.

They are used only with mnemonic programs.

There is no need to use them when writing ladder programs using symbols with the CX-Programmer.

There are no restrictions in the order or the number of times that TR0 to TR15 can be used.

The TR Area contains 16 bits with addresses ranging from TR0 to TR15.

The TR Area is used in the following situations.

Overview

Notation

Reference

Range

Applications

• In this example, a TR bit is used when two outputs have been directly connected to a branch point and there are input conditions after the branch point.

• In this example, a TR bit is used when two outputs are connected to a branch point without a separate input condition for the second output.

TR 2

Bit number: 2

I/O memory area designator: TR

TR00.00

0.050.01

0.02

0.04

0.03 LDOR

OUTANDOUTLD

ANDOUT

Instruction Operand0.000.01

0.020.03

0.040.05

TR0

TR0

TR00.00 0.01

0.03

LDOUTANDOUTLD

OUT

0.00

0.010.02

0.03

TR0

TR0

0.02Instruction Operand

Page 120: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-14 CP1E CPU Unit Software User’s Manual(W480)

• TR bits can be used only with the OUT and LD instructions.OUT instructions (OUT TR0 to OUT TR15) store the ON/OFF status of a branch point and LDinstructions recall the stored ON/OFF status of the branch point.

• TR bits cannot be used twice in the same instruction block. They can be used as many times as nec-essary as long as they are used only once in each instruction block.

• TR bit status cannot be changed using the CX-Programmer.A TR bit is not required when there are no execution conditions after the branch point or there is anexecution condition only in the last line of the instruction block.

Details

0.00 0.01

0.02

0.00 0.01

0.030.02

LDOR

OUT

0.000.010.02

LDOR

OUTAND

0.000.01

0.030.02

Instruction Operand

Instruction Operand

Page 121: CP1E CPU Unit Software Users Manual

6-15

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-7 Tim

er Area (T

)

6

6-7 Timer Area (T)

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 0.

Timer numbers range from T0 to T255.

Types of TimersThe following table shows which instructions are used to refresh timer PVs in BCD and binary mode.

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

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

Overview

Notation

Range

Details

Timer instruction BCD mode Binary mode

ONE-MS TIMER TIM TIMX

TEN-MS TIMER TIMH TIMHX

HUNDRED-MS TIMER TMHH TMHHX

ACCUMULATIVE TIMER TTIM TTIMX

T 0002

Time number: 0002

I/O memory area designator: T

· BCD mode

· Binary mode

Timer Completion Flag

Timer Completion Flag

TIM

0000

#10

TIMX

0000

#A

T0000

T0000

or &10

Page 122: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-16 CP1E CPU Unit Software User’s Manual(W480)

Timer PV Refresh Method

Precautions for Correct UsePrecautions 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 duringthe program check.

Resetting or Maintaining TimersThe following table shows when timers will be reset or maintained.

*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 orMONITOR mode or vice-versa. (The PV and Completion Flag will be cleared when power is cycled.)

*2 If the IOM Hold Bit (A500.12) is ON and the IOM Hold Bit Check Box is selected in the Startup Hold Area onthe Startup Tab Page in the PLC Setup, the PV and Completion Flag will be retained when the PLCs power iscycled. This data is cleared, however, if a power interruption lasts longer than the I/O memory backup time (50 hoursfor an E-type CPU Unit and 40 hours for an N-type CPU Unit).

*3 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.

*4 The PV of timers programmed with timer numbers T0016 to T0255 will be held when jumped.

• 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. condi-tions that can be programmed.

• Timer PVs can be read as word data and used in programming.

Timer num-bers

Timer PV refresh method

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 instruction.

• When the cycle time is longer than 10 ms, delay is generated by the TIMH instruction.

• When the cycle time is longer than 1 ms, delay is generated by the TIMHH instruction.

InstructionTIM/TIMX TIMH/TIMHX

TMHH/TMHHX

TTIM/TTIMX

Timer AreaHIGH-SPEED

TIMERONE-MS TIMER

ACCUMULATIVE TIMER

When the operating mode is changed between PROGRAM or MONITOR mode and RUN mode*1

PV=0 Flag=OFF

When the PLC power is reset*2 PV=0 Flag=OFF

CNR/CNRX instructions (timer/counter reset)*3

PV= 9999/FFFF

Flag=OFF

Jumps (JMP-JME) or tasks in WAIT status*4

PVs refreshed in operating timers Retained

Interlocks (IL-ILC) with OFF inter-lock conditions

Reset (PV = SV, Timer Completion Flag = OFF)

Retained

Page 123: CP1E CPU Unit Software Users Manual

6-17

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-8 Co

un

ter Area (C

)

6

6-8 Counter Area (C)

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).

Precautions for Safe Use

Counter values are cleared if a power interruption lasts longer than the I/O memory backup time(50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

Write the ladder programs and construct the system so that problems will not occur even if thisdata is cleared.

Counter numbers range from C0 to C0255.

Types of CountersThe following table shows which instructions are used to refresh counter PVs in BCD and binary mode.

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

The refresh method for counter PVs can be set from the CX-Programmer to either BCD or binary.

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

Precautions for Correct UsePrecautions for Correct Use

It is not recommended to use the same counter number in two counter instructions because thecounters 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.

Overview

Notation

Range

Details

Counter instruction BCD mode Binary mode

COUNTER CNT instruction CNTX instruction

REVERSIBLE COUNTER

CNTR instruction CNTRX instruction

C 0002

Counter number: 0002

I/O memory area designator: C

Page 124: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-18 CP1E CPU Unit Software User’s Manual(W480)

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

Resetting or Maintaining Counter PVsThe following table shows when counters PVs are reset or maintained.

• 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 byforce-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. con-ditions that can be programmed.

• Counter PVs can be read as word data and used in programming.

InstructionCNT/CNTX CNTR/CNTRX

COUNTER REVERSIBLE COUNTER

PV and Counter Completion Flag when counter is reset

PV=0Counter Completion Flag = OFF

When the operating mode is changed between PROGRAM or MONITOR mode and RUN mode

Retained

When the PLC power is reset Retained

Reset Input Reset

CNR/CNRX instructions Reset

Interlocks (IL-ILC) with OFF interlock conditions Retained

CNT

0000

#10

CNTX

0000

#A or &10

Counter Completion Flag

Counter Completion Flag

· BCD mode

· Binary mode

C0000

C0000

Page 125: CP1E CPU Unit Software Users Manual

6-19

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-9 Au

xiliary Area (A

)

6

6-9 Auxiliary Area (A)

The words and bits in this area have preassigned functions.

Refer to A-2 Auxiliary Area by Address for details.

Precautions for Safe Use

The following words are cleared to all zeros if a power interruption lasts longer than the I/O mem-ory backup time (50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit).

Other words are cleared to default values.

Write the ladder programs and construct the system so that problems will not occur even if thisdata is cleared.

The Auxiliary Area contains 754 words with addresses ranging from A0 to A753.

Overview

Bit/word Name

At startup CPU Unit

Within I/O memory

backup time

Longer than I/O memory backup time

E-type CPU Unit

N-type CPU Unit

A90 to A93 User Program Date Retained Cleared to all zeros Not provided. Supported

A94 to A97 Parameter Date Not provided.

A100 to A199 Error Log Area Supported

A300 Error Log Pointer Supported

A351 to A354 Calendar/Clock Area Not provided.

A500.15 Output OFF Bit Supported

A510 to A511 Startup Time Not provided.

A512 to A513 Power Interruption Time

Not provided.

A514 Number of Power Interruptions

Supported

A515 to A517 Operation Start Time Not provided.

A518 to A520 Operation End Time Not provided.

A523 Total Power ON Time Not provided.

A720 to A749 Power ON Clock Data 1 to 10

Not provided.

Notation

Range

Bit number: 02

A 020. 02

Word number: 020

I/O memory area designator: A

Page 126: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-20 CP1E CPU Unit Software User’s Manual(W480)

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.

• Some words or bits are set automatically by the system and others are set and manipulated by theuser.The Auxiliary Area includes error flags set by self-diagnosis, initial settings, control bits, and statusdata.

• 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 andwritten (A448 to A754).

• Even the read/write bits in the Auxiliary Area cannot be force-set and force-reset continuously.

• Refer to A-2 Auxiliary Area by Address for the functions of bits and words in the Auxiliary Area.

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 glo-bal symbol table as system-defined symbols.

Refer to A-2 Auxiliary Area by Address for details.

Applications

Details

Word/Bit Name Name in CX-Programmer

A200.11 First Cycle Flag P_First_Cycle

A200.12 Step Flag P_Step

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

Page 127: CP1E CPU Unit Software Users Manual

6-21

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-10 Co

nd

ition

Flag

s (P_)

6

6-10 Condition Flags (P_)

These flags include the flags that indicate the results of instruction execution, as well as the Always ONand Always OFF Flags.

These bits are specified with symbols rather than addresses.

The Condition Flags are specified with symbols, such as P_CY and P_ER, rather than addresses.

The CX-Programmer treats condition flags as system-defined symbols (global symbols) beginning with P_.

The Condition Flags are read-only; they cannot be written from instructions or from the CX-Program-mer.

All Condition Flags are cleared when the program switches tasks.

The status of the ER Flag, AER Flag, and other flags are thus retained only in the task in which theerror occurred.

The Condition Flags cannot be force-set and force-reset.

Types of Condition Flags

Refer to 5-7-1 Ladder Programming Precautions for details.

Overview

Notation

Details

NameName in CX-Programmer

Function

Always ON Flag P_OnP_On Always ON.

Always OFF Flag P_OffP_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.

Condition flag name: ER

P_ ER

I/O memory area designator: P_ (indicates a system symbol name)

Page 128: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-22 CP1E CPU Unit Software User’s Manual(W480)

Using the Condition FlagsThe 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 conditionimmediately after an instruction to reflect the results of instruction execution.

Example: Using Instruction A Execution Results

Precautions for Correct UsePrecautions for Correct Use

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

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.

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 Equals Flag

P_GE Turned ON when the first operand of a Comparison Instruction is 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 Flag

P_LE Turned ON when the first operand of a Comparison Instruction is less than or equal to the second.

NameName in CX-Programmer

Function

Instruction A

Instruction B

Condition Flag

Example: =

Operand

=

Instruction

LD

Instruction A

AND

Instruction B

The result from instruction A is reflected in the Equals Flag

Page 129: CP1E CPU Unit Software Users Manual

6-23

6 I/O Memory

CP1E CPU Unit Software User’s Manual(W480)

6-11 Clo

ck Pu

lses (P_)

6

6-11 Clock Pulses (P_)

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_.

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

They are cleared at the start of operation.

Clock Pulses

Overview

Notation

Details

NameName in CX-Programmer

Description

0.02-s Clock Pulse P_0_02s ON for 0.01 s OFF for 0.01 s

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

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

1-s clock pulse P_1s ON for 0.5 sOFF for 0.5 s

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

P_ 0_02s

Clock pulse name: 0_02s

I/O memory area designator:P_ (indicates a system symbol name)

0.01s

0.01s

0.05s

0.05s

0.1s

0.1s

0.5s

0.5s

30s

30s

Page 130: CP1E CPU Unit Software Users Manual

6 I/O Memory

6-24 CP1E CPU Unit Software User’s Manual(W480)

Using the Clock PulsesThe following example turns a bit ON and OFF at 0.5-s intervals.

1s 100.00 Instruction OperandLD 1s

OUT 100.00 0.5s 0.5s100.00

Page 131: CP1E CPU Unit Software Users Manual

7-1CP1E CPU Unit Software User’s Manual(W480)

7

The CP1E does not support file operations.

File Operations

Page 132: CP1E CPU Unit Software Users Manual

7 File Operations

7-2 CP1E CPU Unit Software User’s Manual(W480)

Page 133: CP1E CPU Unit Software Users Manual

8-1CP1E CPU Unit Software User’s Manual(W480)

8

This section describes I/O allocation in a CP1E CPU Unit. Be sure you understand the information in the section before attempting to write ladderdiagrams.

8-1 Allocation of Input Bits and Output Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-28-1-1 I/O Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

8-1-2 I/O Allocation Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

8-1-3 Allocations on the CPU Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-3

8-1-4 Allocations to Expansion Units and Expansion I/O Units . . . . . . . . . . . . . . . . . 8-4

I/O Allocation

Page 134: CP1E CPU Unit Software Users Manual

8 I/O Allocation

8-2 CP1E CPU Unit Software User’s Manual(W480)

8-1 Allocation of Input Bits and Output Bits

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

The I/O on Expansion I/O Units are allocated I/O bits in the words immediately following the words con-taining the bits allocated to the built-in I/O on the CPU Unit.

OMRON calls allocating bits in memory “I/O allocation.”

8-1-1 I/O Allocation

Inputs

CPU Unit

100CH (CIO 100)Outputs

00 to 11

00 to 07

Expansion I/O Unit

101CH (CIO 101)

00 to 11

00 to 07

Allocated 12 bitsAllocated 12 bits in the next word

Allocated 8 bits Allocated 8 bits in the next word

C C C 3 c 6

0 1 2 4 5 7

C 1 3 5 7 9 11

0 2 4 6 8 10

CPU Unit

0CH (CIO 0)

Inputs

Outputs

Bit 03 in CIO 0

Bit 03 in CIO 100100CH (CIO 100)

C C C 3 c 6

0 1 2 4 5 7

C 1 3 5 7 9 11

0 2 4 6 8 10

Expansion I/O Unit

1CH (CIO 1)

Bit 05 in CIO 1

Bit 02 in CIO 101

101CH(CIO 101)

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

Page 135: CP1E CPU Unit Software Users Manual

8-3

8 I/O Allocation

CP1E CPU Unit Software User’s Manual(W480)

8-1 Allo

cation

of In

pu

t Bits an

d O

utp

ut B

its

8

8-1-2 I/O A

llocation Concepts

I/O bits are automatically allocated to the I/O on CPU Units, Expansion I/O Units, and Expansion Unitswhen the power supply is turned ON.

It is not necessary to specify I/O bits in parameters.

Input bits are allocated from CIO 0 and output bits are allocated from CIO 100 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.

Words Allocated by the System and the Number of Connected UnitsThe starting words for inputs and outputs are predetermined for a CP1E 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 tothe 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 andExpansion Units that can be connected are given in the following table.

Application Example: CPU Unit with 40 I/O Points

For a CPU Unit with 40 I/O points, a total of 24 input bits are allocated to the input terminal block. Thebits 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 CIO1.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 allocatedare 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 CIO101.07 (i.e., bits 00 to 07 in CIO 1).

The upper bits (bits 12 to 15) that are not used in the input words cannot be used as work bits. Only theupper bits that are not used in the output words can be used as work bits.

8-1-2 I/O Allocation Concepts

8-1-3 Allocations on the CPU Unit

CPU UnitAllocated words Number of Expansion

Units and Expansion I/O Units connectedInput Bits Output Bits

CPU Unit with 20 I/O points

CIO 0 CIO 100 0 Unit

CPU Unit with 30 I/O points

CIO 0 and CIO 1 CIO 100 and CIO 101 3 Units

CPU Unit with 40 I/O points

CIO 0 and CIO 1 CIO 100 and CIO 101 3 Units

15 14 13 1112 09 08 07 06 05 04 02 01 00

Can be used as work bits Output bits: 16

0310

Cannot be used

CPU Unit with 40 I/O Points24 inputs

Input Bits

Output Bits

CIO 0 (CIO 0.00 to CIO 0.11) CIO 1 (CIO 1.00 to CIO 1.11)

CIO 100 (CIO 100.00 to CIO 100.07) CIO 101 (CIO 101.00 to CIO 101.07)

16 outputs

CIO 0

CIO 1

CIO 100

CIO 101

Input bits: 24

Page 136: CP1E CPU Unit Software Users Manual

8 I/O Allocation

8-4 CP1E CPU Unit Software User’s Manual(W480)

Expansion Units and Expansion I/O Units connected to the CPU Unit are automatically allocated inputbits 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 CIO100 and CIO 101 are allocated for outputs. Thus, words from CIO 2 onward for inputs and words fromCIO 102 onward for outputs are automatically allocated in order to the Expansion I/O Units and Expan-sion Units in the order that the Units are connected.

There are Expansion I/O Units for expanding inputs, for expanding outputs, and for expanding bothinput 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 inputwords and as “CIO n” for output words.

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

Allocations to Expansion I/O Units

ModelInput bits Output bits

No. of bits

No. of words

AddressesNo. of bits

No. of words

Addresses

8-point Input Unit CP1W-8ED 8 1 CIO m, bits 00 to 07 − None None

8-point Output Unit

Relay outputs CP1W-8ER − None None 8 1 CIO n, bits 00 to 07Sinking transistor

outputsCP1W-8ET

Sourcing transis-tor outputs

CP1W-8ET1

16-point Output Unit

Relay outputs CP1W-16ER − None None 16 2 CIO n, bits 00 to 07

CIO n+1, bits 00 to 07

Sinking transistor outputs

CP1W-16ET

Sourcing transis-tor outputs

CP1W-16ET1

20-point I/O Units

Relay outputs CP1W-20EDR1 12 1 CIO m, bits 00 to 11 8 1 CIO n, bits 00 to 07Sinking transistor

outputsCP1W-20EDT

Sourcing transis-tor outputs

CP1W-20EDT1

32-point Output Unit

Relay outputs CP1W-32ER − None None 32 4 CIO n, bits 00 to 07

CIO n+1, bits 00 to 07

CIO n+2, bits 00 to 07

CIO n+3, bits 00 to 07

Sinking transistor outputs

CP1W-20EDT

Sourcing transis-tor outputs

CP1W-20EDT1

40-point I/O Unit

Relay outputs CP1W-40EDR 24 2 CIO m, bits 00 to 11

CIO m+1, bits 00 to 11

16 2 CIO n, bits 00 to 07

CIO n+1, bits 00 to 07

Sinking transistor outputs

CP1W-40EDT

Sourcing transis-tor outputs

CP1W-40EDT1

Page 137: CP1E CPU Unit Software Users Manual

8-5

8 I/O Allocation

CP1E CPU Unit Software User’s Manual(W480)

8-1 Allo

cation

of In

pu

t Bits an

d O

utp

ut B

its

8

8-1-4 Allocations to E

xpansion Units and

Expansion I/O

Units

I/O Bits Allocation with Expansion I/O Units Connected• Allocation Example: 40-point I/O Unit (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).

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

Input bits 12 to 15 cannot be used as work bits. Output bits 08 to 15, however, can be used as workbits.

• Allocation Example: Maximum I/O CapacityThe configuration shown in this example is for the maximum I/O capacity. It consists of a CPU Unitwith 40 I/O points and three Expansion I/O Units, each with 40 I/O points.Control is possible using 96 inputs and 64 outputs, or a total of 160 points.

15 14 13 1112 09 08 07 06 05 04 02 01 00

Cannot be used

Can be used as work bits

0310

Input bits

Output bits

CIO m

CIO m+1

CIO n

CIO n+1

bit 15 14 13 1112 09 08 07 06 05 04 02 01 000310

Cannot be used

Can be used as work bits

CPU Unit with 40 I/O Points

Input bits

Output bits

CIO 0.00 to CIO 0.11CIO 1.00 to CIO 1.11

24 inputs

16 outputs

24 inputs

16 outputs

24 inputs

16 outputs

24 inputs

16 outputs

CIO 100.00 to CIO 100.07CIO 101.00 to CIO 101.07

Three Expansion I/O Unit with 40 I/O points each

CIO 2.00 to CIO 2.11CIO 3.00 to CIO 3.11

CIO 102.00 to CIO 102.07CIO 103.00 to CIO 103.07

1st Unit

CIO 4.00 to CIO 4.11CIO 5.00 to CIO 5.11

CIO 104.00 to CIO 104.07CIO 105.00 to CIO 105.07

2nd Unit

CIO 6.00 to CIO 6.11CIO 7.00 to CIO 7.11

CIO 106.00 to CIO 106.07CIO 107.00 to CIO 107.07

3rd Unit

Input bits

Output bits

CIO 0

CIO 1

CIO 2

CIO 3

CIO 4

CIO 5

CIO 6

CIO 7

CIO 100

CIO 101

CIO 102

CIO 103

CIO 104

CIO 105

CIO 106

CIO 107

CPU Unit with 40 I/O Points

1st Unit: Expansion I/O Unit with 40 I/O Points

2nd Unit: Expansion I/O Unit with 40 I/O Points

3rd Unit: Expansion I/O Unit with 40 I/O Points

CPU Unit with 40 I/O Points

1st Unit: Expansion I/O Unit with 40 I/O Points

2nd Unit: Expansion I/O Unit with 40 I/O Points

3rd Unit: Expansion I/O Unit with 40 I/O Points

Page 138: CP1E CPU Unit Software Users Manual

8 I/O Allocation

8-6 CP1E CPU Unit Software User’s Manual(W480)

• Allocation Example: Expansion Input Units and Expansion Output UnitsIf Expansion Input Units or Expansion Output Units are connected, the input or output word notused by an Expansion I/O Unit is allocated to the next Unit that requires it.

I/O Word Allocations to Expansion Units

Interpreting the Table

m: Indicates the next input word after the input word allocated to the Expansion Unit, Expansion I/OUnit, or CPU Unit to the left of the current Unit.

n: Indicates the next output word after the output word allocated to the Expansion Unit, ExpansionI/O Unit, or CPU Unit to the left of the current Unit.

Allocations for Expansion Units

Name Model number Input words Output words

Analog I/O Unit CP1W-MAD11 2 words CIO m and m+1 1 word CIO n

Analog Input Unit CP1W-AD041 4 words CIO m to m+3 1 word

2 words

CIO nCIO n and CIO n+1

Analog Output Unit CP1W-DA041 None − 4 words CIO n to CIO n+3

Temperature Sensor Units CP1W-TS001 2 words CIO m and m+1 Not supported −

CP1W-TS002 4 words CIO m to m+3 Not supported −

CP1W-TS101 2 words CIO m and m+1 Not supported −

CP1W-TS102 4 words CIO m to m+3 Not supported −

CompoBus/S I/O Link Unit CP1W-SRT21 1 word CIO m 1 word CIO n

CPU Unit with 30 I/O Points

Input bits

Output bits

CIO 0.00 to CIO 0.11CIO 1.00 to CIO 1.05

18 inputs

12 outputs

CIO 100.00 to CIO 100.07CIO 101.00 to CIO 101.03

1st Unit: 8-point Input Unit

CIO 2.00 to CIO 2.07

8 inputs

No outputs

2nd Unit: 16-point Output Unit

No inputs

16 outputs

CIO 102.00 to CIO 102.07CIO 103.00 to CIO 103.07

3rd Unit: 20-point I/O Unit

CIO 3.00 to CIO 3.11

12 inputs

8 outputs

CIO 104.00 to CIO 104.07

bit 15 14 13 1112 09 08 07 06 05 04 02 01 000310

Can be used as work bits

Input bits

Output bits

CIO 0

CIO 1

CIO 2

CIO 3

CIO 100

CIO 101

CIO 102

CIO 103

CIO 104

Cannot be used

CPU Unit with 30 I/O Points

CPU Unit with 30 I/O Points

1st Unit: 8-point Input Unit

3rd Unit: 20-point I/O Unit

3rd Unit: 20-point I/O Unit

2nd Unit: 16-point Output Unit

Page 139: CP1E CPU Unit Software Users Manual

8-7

8 I/O Allocation

CP1E CPU Unit Software User’s Manual(W480)

8-1 Allo

cation

of In

pu

t Bits an

d O

utp

ut B

its

8

8-1-4 Allocations to E

xpansion Units and

Expansion I/O

Units

I/O Word Allocations to Expansion Units• Allocation Example: CPU Unit with 40 I/O Points + TS002 + DA041 + 40ED

TS002 DA041

None

None

CPU Unit with 40 I/O Points

Input bits

Output bits

CIO 0.00 to CIO 0.11CIO 1.00 to CIO 1.11

24 inputs

16 outputsCIO 100.00 to CIO 100.07CIO 101.00 to CIO 101.07

1st Unit: Temperature Sensor Unit

CIO 2 to CIO 5

2nd Unit: Analog Output Unit

3rd Unit: 40-point I/O Unit

CIO 102 to CIO 105

CIO 6.00 to CIO 6.11CIO 7.00 to CIO 7.11

CIO 106.00 to CIO 106.07CIO 107.00 to CIO 107.07

24 inputs

16 outputs

bit

Input bits

Output bits

15 14 13 1112 09 08 07 06 05 04 02 01 000310

Cannot be used

Cannot be used

Can be used as work bits

Can be used as work bits

CIO 0

CIO 1

CIO 2

CIO 3

CIO 4

CIO 5

CIO 6

CIO 7

CIO 100

CIO 101

CIO 102

CIO 103

CIO 104

CIO 105

CIO 106

CIO 107

CPU Unit with 40 I/O Points

CPU Unit with 40 I/O Points

1st Unit: Temperature Sensor Unit

3rd Unit: Expansion I/O Unit with 40 I/O Points

3rd Unit: Expansion I/O Unit with 40 I/O Points

2nd Unit: Analog Output Unit

Page 140: CP1E CPU Unit Software Users Manual

8 I/O Allocation

8-8 CP1E CPU Unit Software User’s Manual(W480)

Page 141: CP1E CPU Unit Software Users Manual

9-1CP1E CPU Unit Software User’s Manual(W480)

9

This section describes the parameters in the PLC Setup, which are used to make basicsettings for the CP1E CPU Unit.

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

9-2 PLC Setup Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-39-2-1 Startup and CPU Unit Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-39-2-2 Timing, Interrupt, and Peripheral Servicing Settings . . . . . . . . . . . . . . . . . . . . 9-4

9-2-3 Input Constant Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5

9-2-4 Serial Port 1 Settings (Built-in RS-232C Port for N-type CPU Units) . . . . . . . . 9-59-2-5 Serial Port 2 (N-type CP1E CPU Unit with 30 or 40 I/O Points) . . . . . . . . . . . 9-8

9-2-6 Built-in Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12

9-2-7 Pulse Output 0 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-149-2-8 Pulse Output 1 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-16

PLC Setup

Page 142: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-2 CP1E CPU Unit Software User’s Manual(W480)

9-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.The PLC Setup is used to make the basic settings for the CPU Unit. These settings can be changed from a Programming Device. Change the PLC Setup in the followingcases.

Related Auxiliary Area Flags

Setting Methods for the PLC SetupSet using the CX-Programmer for CP1E.

Application requiring changes to default settings Parameter

A memory error must be generated when a power interruption last longer than 40 hours for an N-type CPU Unit or more than 50 hours for an E-type CPU Unit.

Select the ??? Generate memory error when I/O memory is corrupted Check Box on the Settings Tab Page.

Data in all regions of I/O Memory (including the CIO Area, Work Area, Timer Flags, Timer PVs, Task Flags, Index Registers, and Data Registers) must be retained when the PLC’s power is turned ON.

IOM Hold Bit Status at Startup

The status of bits that are force-set or force-reset from a Pro-gramming Device must be retained when the PLC’s power is turned ON.

Forced Status Hold Bit Status at Startup

Changing the Startup Mode to PROGRAM or MONITOR mode when debugging.

Startup Mode

Detection of low-battery errors is not required when using bat-tery-free operation.

Detect Low Battery

You want the intervals for scheduled interrupts to be set in units of 1 ms or 0.1 ms rather than 10 ms.

Scheduled Interrupt Interval

Finding instruction errors when debugging. Stop CPU on Instruction Error

You want a minimum cycle time setting to create a consistent I/O refresh cycle.

Minimum Cycle Time

You want to set a maximum cycle time other than 1 second (10 ms to 40,000 ms).

Watch Cycle Time

You do not want to record user-defined errors for FAL in the error log.

FAL Error Log Registration

Name Word Description Read/write

PLC Setup Error Flag (Non-fatal error)

A40210 ON when there is a setting error in the PLC Setup. Read only

From the CX-Programmer for CP1E

PLC Setup

CP1E CPU Unit

PLC Setup

Page 143: CP1E CPU Unit Software Users Manual

9-3

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-1 Startup and C

PU

Unit S

ettings

9-2 PLC Setup Settings

9-2-1 Startup and CPU Unit Settings

Startup Hold Settings

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Forced Status Hold Bit Startup HoldSetting

Not held. Not held. When power is turned ON

36 14 0

Held. 1

2 IOM Hold Bit Startup Hold Setting Not held. Not held. When power is turned ON

36 15 0

Held. 1

Startup Data Read Setting

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Read DM from backup memory Do not read. Do not read. When power is turned ON

38 15 0

Read. 1

Startup Mode Setting

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Startup Mode Setting Run: RUN mode Program: PROGRAM mode When power is turned ON

37 0 to 15 8000 hex

Monitor: MONITOR mode 8001 hex

Run: RUN mode 8002 hex

Execute Process Settings

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Do not detect Low Battery Do not detect. Do not detect. Every cycle 40 15 0

Detect. 1

2 Generate error for I/O memory corruption Do not generate. Do not generate. At start of operation

40 13 0

Generate. 1

3 Stop CPU on Instruction Error Do not stop. Do not stop. At start of operation

67 15 0

Stop. 1

4 Don’t register FAL to error log Register. Register. Every cycle 41 15 0

Do not register. 1

Page 144: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-4 CP1E CPU Unit Software User’s Manual(W480)

9-2-2 Timing, Interrupt, and Peripheral Servicing Settings

Timing and Interrupt Settings

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Watch Cycle Time ON:Default (1 s) ON:Default (1 s) At start of operation

71 15 0

OFF: Use user setting. 1

1-1 OFF: When Using User Setting Is Specified

Watch Cycle Time

0 1 (×10 ms) At start of operation

71 0 to 14 001 hex

: :

40,000 (×10 ms) FA0 hex

2 Constant Cycle Time ON (variable) No setting (variable) At start of operation

70 0 to 15 0000 hex

1ms 0001 hex

: :

32,000 ms 7D00 hex

3 Scheduled Interrupt Interval 10 ms 10 ms At start of operation

66 0 to 3 0 hex

1 ms 1 hex

0.1 ms 2 hex

Peripheral Service Settings

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Set Time to All Events 4% of cycle time ON: Default (4% of cycle time)

At start of operation

74 15 0

OFF: Use user setting. 1

1-1 OFF: When Using User Setting Is Specified

Set Time to All Events

0 0 (×0.1 ms) At start of operation

74 0 to 7 00 hex

: :

255 (×0.1 ms) FF hex

Page 145: CP1E CPU Unit Software Users Manual

9-5

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-3 Input Constant S

ettings

9-2-3 Input Constant Settings

Input Constants

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

1 0CH: CIO 0 8 ms No filter (0 ms) When power is turned ON

0 0 to 7 10 hex

1 ms 12 hex

2 ms 13 hex

4 ms 14 hex

8 ms 15 hex

16 ms 16 hex

32 ms 17 hex

2 1CH: CIO 1 Same as above. Same as above. Same as above.

1 8 to 15 Same as above. 3 2CH: CIO 2 2 0 to 7

4 3CH: CIO 3 3 8 to 15

5 4CH: CIO 4 4 0 to 7

6 5CH: CIO 5 5 8 to 15

7 6CH: CIO 6 6 0 to 7

8 7CH: CIO 7 7 8 to 15

9 8CH: CIO 8 8 0 to 7

10 9CH: CIO 9 9 8 to 15

11 10CH: CIO 10 15 0 to 7

12 11CH: CIO 11 15 8 to 15

13 12CH: CIO 12 16 0 to 7

14 13CH: CIO 13 16 8 to 15

15 14CH: CIO 14 17 0 to 7

16 15CH: CIO 15 17 8 to 15

17 16CH: CIO 16 18 0 to 7

18 17CH: CIO 17 18 8 to 15

9-2-4 Serial Port 1 Settings (Built-in RS-232C Port for N-type CPU Units)

Communications Settings

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

1 Communications Settings Standard (9,600; 1, 7, 2, E)

(Default settings)

Standard

Baud rate: 9,600 bps

Start bits: 1 bit

Data length: 7 bits

Parity: Even

Stop bits: 2 bits

Host Link

Every cycle 46 15 0

Custom 1

2 Mode

(When custom settings have been selected.)

Host Link Host Link Every cycle 8 to 11 0 hex 5 hex

NT Link (1:N): 1:N NT Links 2 hex

RS-232C (No-protocol) 3 hex

PC Link (Slave) 7 hex

PC Link (Master) 8 hex

Modbus-RTU Easy Master 9 hex

Page 146: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-6 CP1E CPU Unit Software User’s Manual(W480)

2 2-1 Host Link Settings

2-1-1 Baud 9,600 bps 300 bps Every cycle 47 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

2-1-2 Format (data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 46 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

2-1-3 Unit Number 0 0 Every cycle 49 0 to 7 00 hex

: :

31 1F hex

2-2 NT Link (1:N) Settings

2-2-1 Baud 115,200 bps

(disabled)

38,400 bps (standard) Every cycle 47 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-2-2 No.NT/PC Link Max. (Highest unit number of PT that can beconnected to the PLC)

1 0 Every cycle 52 0 to 3 0 hex

: :

7 7 hex

2-3 RS-232C (No-protocol) Settings

2-3-1 Baud 9,600 bps 300 bps Every cycle 47 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 147: CP1E CPU Unit Software Users Manual

9-7

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-4 Serial P

ort 1 Settings (B

uilt-in RS

-232C

Port for N

-type CP

U U

nits)

2 2-3 2-3-2 Format (data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 46 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

2-3-3 Start Code Disable. Disable. Every cycle 51 12 0

Set. 1

2-3-4 Start Code (setting) 00 Hex 00 Hex Every cycle 50 8 to 15 00 hex

: :

FF hex FF hex

2-3-5 End Code None (Received Bytes)

Received Bytes (no end code)

Every cycle 51 8 and 9 00

CR, LF 10

Set End Code 01

2-3-6 Received Bytes (setting)

256 bytes 256 bytes Every cycle 51 0 to 7 00 hex

1 byte 01 hex

: :

255 bytes FF hex

2-3-7 Set End Code (setting)

00 Hex 00 Hex Every cycle 50 0 to 7 00 hex

: :

FF Hex FF hex

2-3-8 Delay 0 ms 0 (×10 ms) Every cycle 48 0 to 15 0000 hex

: :

9999 (×10 ms) 270F hex

2-5 Modbus-RTU Easy Master Settings

2-5-1 Baud 9,600 bps 300 bps Every cycle 47 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

2-5-2 Format (data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 46 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 148: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-8 CP1E CPU Unit Software User’s Manual(W480)

2 2-5 2-5-3 Response Timeout 5 s 5 s Every cycle 53 8 to 15 00 hex

1 (×100 ms) 01 hex

: :

255 (×100 ms) FF hex

2-6 PC Link (Slave) Settings

2-6-1 Baud 9,600 bps (disabled)

38,400 bps (standard) Every cycle 47 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-6-2 PLC Link Unit No. 0 0 Every cycle 53 0 to 3 0 hex

: :

7 7 hex

2-7 PC Link (Master) Settings

2-7-1 Baud 9,600 bps (disabled)

38,400 bps (standard) Every cycle 47 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-7-2 Link Words 10 Words 1 word

:

10 words

Every cycle 52 4 to 7 1 hex

:

0 or A hex

2-7-3 PC Link Mode ALL ALL Every cycle 52 15 0

Masters 1

2-7-4 No.NT/PC Link Max. (Highest unit number of PT that can be connected to the PLC)

1 0 Every cycle 63 0 to 3 0 hex

: :

7 7 hex

9-2-5 Serial Port 2 (N-type CP1E CPU Unit with 30 or 40 I/O Points)

Communications Settings

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

1 Communications Settings Standard (9600; 1, 7, 2, E) (Default settings)

Standard

Baud rate: 9,600 bps

Start bits: 1 bit

Data length: 7 bits

Parity: Even

Stop bits: 2 bits

Every cycle 56 15 0

Custom 1

2 Mode

(When custom settings have been selected.)

Host Link Host Link Every cycle 56 8 to11 0 or 5 hex

NT Link (1:N): 1:N NT Links 2 hex

RS-232C (No-protocol) 3 hex

PC Link (Slave) 7 hex

PC Link (Master) 8 hex

Modbus-RTU Easy Master 9 hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 149: CP1E CPU Unit Software Users Manual

9-9

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-5 Serial P

ort 2 (N-type C

P1E

CP

U U

nit with

30 or 40 I/O P

oints)

2 2-1 Host Link Settings

2-1-1 Baud 9,600 bps 300 bps Every cycle 57 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

2-1-2 Format (data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 56 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

2-1-3 Unit Number 0 0 Every cycle 59 0 to 7 00 hex

: :

31 1F hex

2-2 NT Link (1:N) Settings

2-2-1 Baud 115,200 bps (disabled)

38,400 bps (standard) Every cycle 57 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-2-2 NT/PC Link Max. (Highest unit number of PT that can be con-nected to the PLC)

1 0 Every cycle 62 0 to 3 0 hex

: :

7 7 hex

2-3 RS-232C (No-protocol) Settings

2-3-1 Baud 9,600 bps 300 bps Every cycle 57 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 150: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-10 CP1E CPU Unit Software User’s Manual(W480)

2 2-3 2-3-2 Format (data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 56 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

2-3-3 Start Code Disable. Disable. Every cycle 61 12 0

Set. 1

2-3-4 Start Code (setting)

00 hex 00 hex Every cycle 60 8 to 15 00 hex

: :

FF hex FF hex

2-3-5 End Code None(Received Bytes)

Received Bytes (no end code)

Every cycle 61 8 and 9 00

CR, LF 10

Set End Code 01

2-3-6 Received Bytes (set-ting)

256 bytes 256 bytes Every cycle 60 0 to 7 00 hex

1 byte 01 hex

: :

255 bytes FF hex

2-3-7 Set End Code (setting) 00 hex 00 hex Every cycle 61 0 to 7 00 hex

: :

FF hex FF hex

2-3-8 Delay 0 ms 0 (×10 ms) Every cycle 58 0 to 15 0000 hex

: :

9999 (×10 ms) 270F hex

2-5 Modbus-RTU Easy Master Settings

2-5-1 Baud 9,600 bps 300 bps Every cycle 57 0 to 7 01 hex

600 bps 02 hex

1,200 bps 03 hex

2,400 bps 04 hex

4,800 bps 05 hex

9,600 bps 00 or 06 hex

19,200 bps 07 hex

38,400 bps 08 hex

57,600 bps 09 hex

115,200 bps 0A hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 151: CP1E CPU Unit Software Users Manual

9-11

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-5 Serial P

ort 2 (N-type C

P1E

CP

U U

nit with

30 or 40 I/O P

oints)

2 2-5 2-5-2 Format(data length, stop bits, parity)

7 bits, 2 bits, even 7 bits, 2 bits, even Every cycle 56 0 to 3 0 hex

7 bits, 2 bits, odd 1 hex

7 bits, 2 bits, no parity 2 hex

7 bits, 1 bit, even 4 hex

7 bits, 1 bit, odd 5 hex

7 bits, 1 bit, no parity 6 hex

8 bits, 2 bits, even 8 hex

8 bits, 2 bits, odd 9 hex

8 bits, 2 bits, no parity A hex

8 bits, 1 bit, even C hex

8 bits, 1 bit, odd D hex

8 bits, 1 bit, no parity E hex

2-5-3 Response Timeout 5 s 5 s Every cycle 63 8 to 15 00 hex

1 (×100 ms) 01 hex

: :

255 (×100 ms) FF hex

2-6 PC Link (Slave) Settings

2-6-1 Baud 9,600 bps (disabled)

38,400 bps (standard) Every cycle 57 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-6-2 PLC Link Unit No. 0 0 Every cycle 63 0 to 3 0 Hex

: :

7 7 hex

2-7 PC Link (Master) Settings

2-7-1 Baud 9,600 bps (disabled)

38,400 bps (standard) Every cycle 57 0 to 7 00 hex

115,200 bps (high speed) 0A hex

2-7-2 Link Words 10 words 1 word

:

10 words

Every cycle 62 4 to 7 1 hex

:

0 or A hex

2-7-3 PC Link Mode ALL ALL Every cycle 62 15 0

Masters 1

2-7-4 NT/PC Link Max. (Highest unit number of PT that can be con-nected to the PLC)

1 0 Every cycle 63 0 to 3 0 hex

: :

7 7 hex

Name Default Possible settingsWhen set-ting is read by CPU Unit

Internal address

Bits Data

Page 152: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-12 CP1E CPU Unit Software User’s Manual(W480)

9-2-6 Built-in Inputs

High-speed Counter Settings

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

1 Use high-speed counter 0 Do not use. Do not use. When power is turned ON

10 12 to 15 0 hex

Use. 1 hex

1-1 Counting mode Linear mode Linear mode At start of operation

10 8 to 11 0 hex

Circular mode 1 hex

1-1-1 Circular Max. Count 0 0 At start of operation

11 and 12 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

1-2 Reset Z phase, software reset(stop comparing)

Z phase, software reset (stop comparing)

When power is turned ON

10 4 to 7 0 hex

Software reset(stop comparing)

1 hex

Phase Z, software reset (comparing)

2 hex

Software reset (comparing) 3 hex

1-3 Input Setting Differential phase input (×4)

Differential phase input (×4) When power is turned ON

10 0 to 3 0 hex

Pulse + direction input 1 hex

Up/Down input 2 hex

Increment pulse input 3 hex

2 Use high-speed counter 1 Do not use. Do not use. When power is turned ON

13 12 to 15 0 hex

Use. 1 hex

2-1 Counting mode Linear mode Linear mode At start of operation

13 8 to 11 0 hex

Circular mode 1 hex

2-1-1 Circular Max. Count 0 0 At start of operation

14 and 15 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

2-2 Reset Z phase, software reset (stop comparing)

Z phase, software reset (stop comparing)

When power is turned ON

13 4 to 7 0 hex

Software reset(stop comparing)

1 hex

Phase Z, software reset (comparing)

2 hex

Software reset (comparing) 3 hex

2-3 Input Setting Differential phase input (×4)

Differential phase input (×4) When power is turned ON

13 0 to 3 0 hex

Pulse + direction input 1 hex

Increment 2 hex

Increment 3 hex

3 Use high-speed counter 2 Do not use. Do not use. When power is turned ON

16 12 to 15 0 hex

Use. 1 hex

3-1 Counting mode Linear mode Linear mode At start of operation

16 8 to 11 0 hex

Circular mode 1 hex

3-1-1 Circular Max. Count 0 0 At start of operation

17 and 18 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

Page 153: CP1E CPU Unit Software Users Manual

9-13

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-6 Built-in Inputs

3-2 Reset Software reset Software reset When power is turned ON

16 4 to 7 1 hex

Software reset (comparing) 3 hex

3-3 Input Setting Increment pulse input

Increment pulse input When power is turned ON

16 0 to 3 3 hex

4 Use high-speed counter 3 Do not use. Do not use. When power is turned ON

19 12 to 15 0 hex

Use. 1 hex

4-1 Counting mode Linear mode Linear mode At start of operation

19 8 to 11 0 hex

Circular mode 1 hex

4-1-1 Circular Max. Count 0 0 At start of operation

20 and 21 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

4-2 Reset Software reset Software reset When power is turned ON

19 4 to 7 1 hex

Software reset (comparing) 3 hex

4-3 Input Setting Increment pulse input

Increment pulse input When power is turned ON

19 0 to 3 3 hex

5 Use high-speed counter 4 Do not use. Do not use. When power is turned ON

22 12 to 15 0 hex

Use. 1 hex

5-1 Counting mode Linear mode Linear mode At start of operation

22 8 to 11 0 hex

Circular mode 1 hex

5-1-1 Circular Max. Count 0 0 At start of operation

23 and 24 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

5-2 Reset Software reset Software reset When power is turned ON

22 4 to 7 1 hex

Software reset (comparing) 3 hex

5-3 Input Setting Increment pulse input

Increment pulse input When power is turned ON

22 0 to 3 3 hex

6 Use high-speed counter 5 Do not use. Do not use. When power is turned ON

25 12 to 15 0 hex

Use. 1 hex

6-1 Counting mode Linear mode Linear mode At start of operation

25 8 to 11 0 hex

Circular mode 1 hex

6-1-1 Circular Max. Count 0 0 At start of operation

26 and 27 0 to 15 0000 0000 hex

: :

4,294,967,295 FFFF FFFF hex

6-2 Reset Software reset Software reset When power is turned ON

25 4 to 7 1 hex

Software reset (comparing) 3 hex

6-3 Input Setting Increment pulse input

Increment pulse input When power is turned ON

25 0 to 3 3 hex

Name Default Possible settingsWhen setting

is read by CPU Unit

Internal address

Bits Data

Page 154: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-14 CP1E CPU Unit Software User’s Manual(W480)

Interrupt Input Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 IN2: CIO 0.02 Normal Normal When power is turned ON

31 0 to 3 0 hex

Interrupt 1 hex

Quick 2 hex

2 IN3: CIO 0.03 Normal Normal When power is turned ON

31 4 to 7 0 hex

Interrupt 1 hex

Quick 2 hex

3 IN4: CIO 0.04 Normal Normal When power is turned ON

31 8 to 11 0 hex

Interrupt 1 hex

Quick 2 hex

4 IN5: CIO 0.05 Normal Normal When power is turned ON

31 12 to 15 0 hex

Interrupt 1 hex

Quick 2 hex

5 IN6: CIO 0.06 Normal Normal When power is turned ON

32 0 to 3 0 hex

Interrupt 1 hex

Quick 2 hex

6 IN7: CIO 0.07 Normal Normal When power is turned ON

32 4 to 7 0 hex

Interrupt 1 hex

Quick 2 hex

9-2-7 Pulse Output 0 Settings

Base Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Undefined Origin (operation for limit signal turning ON)

Hold Hold At start of operation

88 12 to 15 0 hex

Undefined 1 hex

2 Limit Input Signal Operation Search Only Search Only When power is turned ON

76 4 to 7 0 hex

Always 1 hex

3 Limit Input Signal NC NC At start of operation

88 0 to 3 0 hex

NO 1 hex

4 Search/Return Initial Speed 0 pps (disabled) 0 pps At start of operation

78 and 79 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

Page 155: CP1E CPU Unit Software Users Manual

9-15

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-7 Pulse O

utput 0 Settings

Origin Search Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Use define origin operation Do not use. Do not use. When power is turned ON

76 0 to 3 0 hex

Use. 1 hex

1-1 Search Direction CW CW At start of operation

77 12 to 15 0 hex

CCW 1 hex

1-2 Detection Method Method 0 Method 0 At start of operation

77 8 to 11 0 hex

Method 1 1 hex

Method 2 2 hex

1-3 Search Operation Inverse 1 Inverse 1 At start of operation

77 4 to 7 0 hex

Inverse 2 1 hex

1-4 Operation Mode Mode 0 Mode 0 At start of operation

77 0 to 3 0 hex

Mode 1 1 hex

Mode 2 2 hex

1-5 Origin Input Signal NC NC When power is turned ON

88 8 to 11 0 hex

NO 1 hex

1-6 Proximity Input Signal NC NC At start of operation

88 4 to 7 0 hex

NO 1 hex

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

80 and 81 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation

82 and 83 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

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

84 and 85 0 to 15 8000 0000 hex

: :

0 0000 0000 hex

: :

+2,147,483,647 7FFF FFFF Hex

1-10 Origin Search Acceleration Ratio (Rate)

0 (disabled) 1 (pulses/4 ms) At start of operation

86 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

1-11 Origin Search Deceleration Ratio (Rate)

0 (disabled) 1 (pulses/4 ms) At start of operation

87 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation

89 0 to 15 0000 hex

: :

9,999 (ms) 270F hex

Page 156: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-16 CP1E CPU Unit Software User’s Manual(W480)

Origin Return Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Speed 0 pps (disabled) 1 pps At start of operation

90 and 91 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

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

92 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

3 Deceleration rate 0 (disabled) 1 (pulses/4 ms) At start of operation

93 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

9-2-8 Pulse Output 1 Settings

Base Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Undefined Origin

(operation for limit signal turning ON)

Hold Hold At start of operation

106 12 to 15 0 hex

Undefined 1 hex

2 Limit Input Signal Operation Search Only Search Only When power is turned ON

94 4 to 7 0 hex

Always 1 hex

3 Limit Input Signal NC NC At start of operation

106 0 to 3 0 hex

NO 1 hex

4 Search/Return Initial Speed 0 pps (disabled) 0 pps At start of operation

96 and 97 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

Page 157: CP1E CPU Unit Software Users Manual

9-17

9 PLC Setup

CP1E CPU Unit Software User’s Manual(W480)

9-2 PL

C S

etup

Settin

gs

9

9-2-8 Pulse O

utput 1 Settings

Origin Search Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Use define origin operation Do not use. Do not use. When power is turned ON

94 0 to 3 0 hex

Use. 1 hex

1-1 Search Direction CW CW At start of operation

95 12 to 15 0 hex

CCW 1 hex

1-2 Detection Method Method 0 Method 0 At start of operation

95 8 to 11 0 hex

Method 1 1 hex

Method 2 2 hex

1-3 Search Operation Inverse 1 Inverse 1 At start of operation

95 4 to 7 0 hex

Inverse 2 1 hex

1-4 Operation Mode Mode 0 Mode 0 At start of operation

95 0 to 3 0 hex

Mode 1 1 hex

Mode 2 2 hex

1-5 Origin Input Signal NC NC When power is turned ON

106 8 to 11 0 hex

NO 1 hex

1-6 Proximity Input Signal NC NC At start of operation

106 4 to 7 0 hex

NO 1 hex

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

98 and 99 0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

1-8 Search Proximity Speed 0 pps (disabled) 1 pps At start of operation

100 and 101

0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

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

102 and 103

0 to 15 8000 0000 hex

: :

0 0000 0000 hex

: :

+2,147,483,647 7FFF FFFF hex

1-10 Origin Search Acceleration Ratio (Rate)

0 (disabled) 1 (pulses/4 ms) At start of operation

104 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

1-11 Origin Search Deceleration Ratio (Rate)

0 (disabled) 1 (pulses/4 ms) At start of operation

105 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

1-12 Positioning Monitor Time 0 (ms) 0 (ms) At start of operation

107 0 to 15 0000 hex

: :

9,999 (ms) 270F hex

Page 158: CP1E CPU Unit Software Users Manual

9 PLC Setup

9-18 CP1E CPU Unit Software User’s Manual(W480)

Origin Return Settings

Name Default Possible settingsWhen setting

is read byCPU Unit

Internal address

Bits Data

1 Speed 0 pps (disabled) 1 pps At start of operation

108 and 109

0 to 15 0000 0001 hex

: :

100,000 pps 0001 86A0 hex

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

110 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

3 Deceleration rate 0 (disabled) 1 (pulses/4 ms) At start of operation

111 0 to 15 0001 hex

: :

65,535 (pulses/4 ms) FFFF hex

Page 159: CP1E CPU Unit Software Users Manual

10-1CP1E CPU Unit Software User’s Manual(W480)

10

This section describes the built-in functions, overall procedure, and allocations for func-tions of the CP1E.

10-1 Built-in Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2

10-2 Overall Procedure for Using CP1E Built-in Functions. . . . . . . . . . . . . . . . 10-3

10-3 Allocations for Built-in Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-410-3-1 Allocation of CPU Unit’s Built-in I/O Terminals . . . . . . . . . . . . . . . . . . . . . . . . 10-4

10-3-2 Specifying the Functions to Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-510-3-3 Selecting Functions in the PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-5

10-3-4 Allocating Built-in Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-6

10-3-5 Allocating Built-in Output Temrinals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9

Overview of Built-in Functions and Allocations

Page 160: CP1E CPU Unit Software Users Manual

10 Overview of Built-in Functions and Allocations

10-2 CP1E CPU Unit Software User’s Manual(W480)

10-1 Built-in Functions

The following built-in functions are provided by the CP1E CPU Units.

: Supported, −: Not supported

Type

Function

CP1E Basic Models (E-type CPU Units) CP1E Application Models (N-type CPU Units) Reference

Quick-response inputs 6 inputs 6 inputs Section 11

Input interrupts 6 inputs 6 inputs Section 12

Scheduled interrupts 1 interrupt 1 interrupt

High-speed counter

• Up/down: 10 kHz×2 counters

• Pulse plus direction: 10 kHz×2 counters

• Incremental: 10 kHz×6 counters

• Differential phases (4×): 5 kHz×2 counters

• Up/down: 100 kHz×1 counter, 10 kHz×1 counter

• Pulse plus direction: 100 kHz×2 counters

• Incremental: 100 kHz × 2 counters, 10 kHz×4 counters

• Differential phases (4×): 50 kHz×1 counter, 5 kHz×1 counter

Section 13

Pulse outputs − 2 outputs (pulse plus direction only) Section 14

PWM output − 1 output Section 15

communications − (CPU Units with 20 I/O Points: 1 port, CPU Units with 30 or 40 I/O Points: One standard port plus option slot)

Section 16

PID control Section 17

Clock functions − (While power is supplied.)

Analog adjuster

Page 161: CP1E CPU Unit Software Users Manual

10-3

10 Overview of Built-in Functions and Allocations

CP1E CPU Unit Software User’s Manual(W480)

10-2 Overall P

roced

ure fo

r Usin

gC

P1E

Bu

ilt-in F

un

ction

s

10

10-2 Overall Procedure for Using CP1E Built-in Functions

The overall procedure for using built-in CP1E functions is described in this section.

1 Select the functions to use.

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

2 Set the functions with the applicable numbers using the CX-Programmer.

Example: Input interrupt IN0 and high-speed counter 0.Parameters in the PLC Setup must be set for the following functions.

Refer to Section 9 PLC Setup and 10-3 Allocations for Built-in Functions for details.

• Input interrupts• Quick-response

inputs• High-speed counters

• Origin searches• Minimum cycle time

• Serial communications

3 Write ladder diagrams using the CX-Pro-grammer.

Example: Permitting interrupts with the MSKS instruction and program-ming high-speed counters with the CTBL instruction.

Example: Stopping high-speed counters.

Refer to A-2 Auxiliary Area by Address for details.

Example: Reading the present value of a high-speed counter.

4 Transfer the PLC Setup and ladder program from the CX-Programmer to the CPU Unit.

5 Turn ON the power supply to the PLC.

6 Start PLC operation.

Select Functions

Make the Settings inthe PLC Setup

Special Instructions

Writing Related Auxiliary Area Words

Reading RelatedAuxiliary Area Words

Create Ladder Program

Transfer PLC Setup and Ladder Program

Turn ON PLC Power

Start Operation

Page 162: CP1E CPU Unit Software Users Manual

10 Overview of Built-in Functions and Allocations

10-4 CP1E CPU Unit Software User’s Manual(W480)

10-3 Allocations for Built-in Functions

A CP1E CPU Unit uses the same built-in I/O terminals for different functions. Allocate the I/O terminalsin advance, making sure that each terminal is used for only one function.

10-3-1 Allocation of CPU Unit’s Built-in I/O Terminals

Input terminals: Normal inputs, interrupt inputs, quick-response inputs, high-speed counters, and origin searches use the same inputterminals.

Output terminals: Normal outputs, pulse outputs, PWM output, and origin searches (counter reset output) use the same output terminals.

Normal inputs

Interrupt inputs

Quick-response inputs

High-speed counters

Origin searches

These functions cannot be used simultaneously because they use the same terminals.

These functions cannot be used simultaneously because they use the same terminals.

Input terminals

CP1E CPU Unit

Output terminals

Normal outputs

Pulse outputs

Origin searches

PWM output

Page 163: CP1E CPU Unit Software Users Manual

10-5

10 Overview of Built-in Functions and Allocations

CP1E CPU Unit Software User’s Manual(W480)

10-3 Allo

cation

s for B

uilt-in

Fu

nctio

ns

10

10-3-2 Specifying the F

unctions to Use

Specify the functions to use as shown below.

Input Functions

Output Functions

Functions are enabled by setting parameters in the PLC Setup. Set the functions so that no more thanone function uses the same terminal. Select function numbers so that high-speed counter inputs andinputs for other functions, such as interrupt inputs, quick-response inputs, and origin inputs do no con-flict with each other.

1 Input functions can be selected by selecting the Use Check Box in a High-speed Counter Area

on the Built-in Internal Tab Page or by setting an input to Interrupt or Quick in the InterruptInput Area of the same page.

10-3-2 Specifying the Functions to Use

10-3-3 Selecting Functions in the PLC Setup

Interrupt inputs

Quick-response inputs

High-speed counters

Origin searches

Enable each function to be used in the PLC Setup from the CX-Programmer

Pulse outputs

PWM output

Specify the functions to use in programming instructions.

Select the Use Check Box for a High-speed Counter

Page 164: CP1E CPU Unit Software Users Manual

10 Overview of Built-in Functions and Allocations

10-6 CP1E CPU Unit Software User’s Manual(W480)

2 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.

Input Terminal Arrangement for CPU Unit with 20 I/O Points

Input Terminal Arrangement for CPU Unit with 30 I/O Points

Input Terminal Arrangement for CPU Unit with 40 I/O Points

10-3-4 Allocating Built-in Inputs

Terminal Arrangement

Select the Use define origin operation Check Box.

IN CIO 0

L1 L2/N COM 01 03 05 07 09 11

00 02 04 06 08 10NC

L1 L2/N COM

NC

01 03 05 07 09 11

00 02 04 06 08 10

01 03 05

00 02 04

IN CIO 0 IN CIO 1

L1 L2/N COM 01 03 05

00 02 04

07 09 11

06 08 10

01 03 05

00 02 04

07 09 11

06 08 10

IN CIO 0 IN CIO 1

Page 165: CP1E CPU Unit Software Users Manual

10-7

10 Overview of Built-in Functions and Allocations

CP1E CPU Unit Software User’s Manual(W480)

10-3 Allo

cation

s for B

uilt-in

Fu

nctio

ns

10

10-3-4 Allocating B

uilt-in Inputs

Input terminals are allocated functions by setting parameters in the PLC Setup. Set the PLC Setup sothat each terminal is used for only one function.

Allocating Built-in Inputs to Functions

CPU Unit Input terminal block

Settings in PLC Setup

Interrupt input setting onBuilt-in Input Tab Page

High-speed counter 0 to 3 setting on Built-in Input Tab Page

Origin search settings on

Pulse Output 0/1 Tab Page

CPU Unit with 20

I/O points

CPU Unit with 30

I/O points

CPU Unit with 40

I/O points

Terminal block label

Terminal number

Normal Interrupt Quick Use

UseNormal input

Input interrupt

Quick-response

input

Single-phase (increment pulse input)

Two-phase (differential phase×4 or up/down)

Two-phase (pulse/direc-

tion)

Applicable Applicable Applicable CIO 0 00 Normal input 0

− − Counter 0, increment input

Counter 0, phase A or up input

Counter 0, pulse input

01 Normal input 1

− − Counter 1, increment input

Counter 0, phase B or down input

Counter 1, pulse input

02 Normal input 2

Interrupt input 2

Quick-response input 2

Counter 2, increment input

Counter 1, phase A or up input

Counter 0, direction

03 Normal input 3

Interrupt input 4

Quick-response input 3

− Counter 1, phase B or down input

Counter 1, direction

04 Normal input 4

Interrupt input 4

Quick-response input 4

Counter 3, increment input

Counter 0, phase Z or reset input

Counter 0, reset input

05 Normal input 5

Interrupt input 5

Quick-response input 5

Counter 4, increment input

Counter 1, phase Z or reset input

Counter 1, reset input

06 Normal input 6

Interrupt input 6

Quick-response input 6

Counter 5, increment input

− − Pulse 0: Origin input signal

07 Normal input 7

Interrupt input 7

Quick-response input 7

− − − Pulse 1:Origin input signal

08 Normal input 8

− − − − − −

09 Normal input 9

− − − − − −

10 Normal input 10

− − − − − Pulse 0: Origin prox-imity input signal

11 Normal input 11

− − − − − Pulse 1: Origin prox-imity input signal

Not appli-cable

Applicable Applicable CIO 1 00 Normal input 12

− − − − − −

01 Normal input 13

− − − − − −

02 Normal input 14

− − − − − −

03 Normal input 15

− − − − − −

Not appli-cable

04 Normal input 16

− − − − − −

05 Normal input 17

− − − − − −

06 Normal input 18

− − − − − −

07 Normal input 19

− − − − − −

08 Normal input 20

− − − − − −

09 Normal input 21

− − − − − −

10 Normal input 22

− − − − − −

11 Normal input 23

− − − − − −

Page 166: CP1E CPU Unit Software Users Manual

10 Overview of Built-in Functions and Allocations

10-8 CP1E CPU Unit Software User’s Manual(W480)

:The black dots indicate the functions that can be set for each input. Be sure that each input is usedfor only one function.

Note 1 The same input setting must be used for high-speed counter 0 and high-speed counter.

2 High-speed counter 2 cannot be used if the input setting of high-speed counter 0 or high-speed counter 1 is set fordifferential phase inputs (4×), pulse + direction inputs, or up/down pulse inputs.

Inputs with Settable Functions

Input interrupts Quick-response inputs High-speed counter,

single-phase

High-speed

counter, differential phase or up/down

High-speed

counter, pulse +

direction

Origin searches

2 3 4 5 6 7 2 3 4 5 6 7 0 1 2 3 4 5 0 1 0 1 0 1Normal input

0

Normal input

1

Normal input

2

Normal input

3

Normal input

4

Normal input

5

Normal input

6

Normal input

7

~Normal input

10

Normal input

11

Page 167: CP1E CPU Unit Software Users Manual

10-9

10 Overview of Built-in Functions and Allocations

CP1E CPU Unit Software User’s Manual(W480)

10-3 Allo

cation

s for B

uilt-in

Fu

nctio

ns

10

10-3-5 Allocating B

uilt-in Output Tem

rinals

Output Terminal Arrangement for CPU Unit with 20 I/O Points

Output Terminal Arrangement for CPU Unit with 30 I/O Points

Output Terminal Arrangement for CPU Unit with 40 I/O Points

10-3-5 Allocating Built-in Output Temrinals

Terminal Arrangement

00 01 02 03

COM COM NC COM

04 05 07

06COMNC

CIO 100

00 01 02 04 05 07 00

03 06

02

01 03

+

- COM COMCOM COM COM

CIO 100 CIO 101

+ 00 01

07

02 03 04 06 00 01

COM COM 05 07 COM

03 04 06

02 05COMCOMCOM-

CIO 100 CIO 101

Page 168: CP1E CPU Unit Software Users Manual

10 Overview of Built-in Functions and Allocations

10-10 CP1E CPU Unit Software User’s Manual(W480)

Output terminals are allocated functions by setting parameters in the PLC Setup. Set the PLC Setup sothat each terminal is used for only one function.

:The black dots indicate the functions that can be set for each input. Be sure that each input is used for only one function.

Allocating Built-in Output Terminals to Functions

CPU UnitOutput terminal

block

Other than those shown

right

When a pulse output instruction (SPED,

ACC, PLS2, or ORG) is executed

Setting in PLC Setup When the PWM

instruction is executed

Origin searchsetting on Pulse

Output 0/1 Tab Page

20-point I/O Units

30-point I/O Units

40-point I/O Units

Terminal block label

Terminal number

Normal outputFixed duty ratio pulse output

Variable duty ratio pulse

output

Pulse + direction Use PWM output

Applicable Applicable Applicable 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

06 Normal output 6 − − −

07 Normal output 7 − − −

Not appli-cable.

CIO 101 00 Normal output 8 − − −

01 Normal output 9 − − −

02 Normal output 10 − − −

03 Normal output 11 − − −

Not appli-cable.

04 Normal output 12 − − −

05 Normal output 13 − − −

06 Normal output 14 − − −

07 Normal output 15 − − −

Outputs with Settable Functions

Pulse outputsError counter reset

outputsPWM

outputs

0 1 0 1 0

Normal output 0

Normal output 1

Normal output 2

Normal output 3

Normal output 4

Normal output 5

Normal output 6

Normal output 7

~

Normal output 14

Normal output 15

Page 169: CP1E CPU Unit Software Users Manual

11-1CP1E CPU Unit Software User’s Manual(W480)

11

This section describes the quick-response inputs that can be used to read signals thatare shorter than the cycle time.

11-1 Quick-response Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-211-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2

11-1-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3

Quick-response Inputs

Page 170: CP1E CPU Unit Software Users Manual

11 Quick-response Inputs

11-2 CP1E CPU Unit Software User’s Manual(W480)

11-1 Quick-response Inputs

Quick-response inputs can be used with any model of CP1E CPU Unit.

The quick-response inputs can read pulses with an ON time as short as 50 µs even if they are shorterthan the cycle time. Use the quick-response inputs to read signals shorter than the cycle time, such asinputs from photomicrosensors.

11-1-1 Overview

Quick-response Input Specifications

Item Specification

ON response time 50 µs max.

OFF response time 50 µs max.

Required pulse The pulse widths of quick-response input signals must meet the following conditions.

END

Cycle time.Can read ON signals shorter than this time

Photomicrosensor or otherdevice with short signal Quick-response input

Built-in inputCycle time

I/O refresh

I/O refresh

ON signal shorter than cycle time

Catch and take in

Cyclic tasks (ladder programs)

50µs 50µs

Page 171: CP1E CPU Unit Software Users Manual

11-3

11 Quick-response Inputs

CP1E CPU Unit Software User’s Manual(W480)

11-1 Qu

ick-respo

nse In

pu

ts

11

11-1-2 Flow

of Processing

Settings When Using Quick-response Input

A built-in input cannot be used as a quick-response input if it is being used as a normal input, interruptinput, or high-speed counter input.

The following terminals can be used for quick-response inputs. These terminals correspond to CIO 0.02to CIO 0.07 in I/O memory.

• Input Terminal Block on CPU Unit with 20 I/O Points

11-1-2 Flow of Processing

1 The terminals 02 to 07 of channel 0 can be used for quick-response inputs.

Bits CIO 0.02 to CIO 0.07 correspond to terminals 02 to 07.

2 Set IN0 to IN5 for quick-response inputs on the Built-in Input Tab Page of the PLC Setup using the CX-Programmer.

3 Read the status of CIO 0.02 to CIO 0.07 using the LD instruction or other instructions.

TerminalCorresponding

bit addressQuick-response setting on Built-in

Input Tab Page

02 on 0CH terminal block 0.02 IN2

Set to Quick.

03 on 0CH terminal block 0.03 IN3

04 on 0CH terminal block 0.04 IN4

05 on 0CH terminal block 0.05 IN5

06 on 0CH terminal block 0.06 IN6

07 on 0CH terminal block 0.07 IN7

Restrictions

1 Setting the Quick-response Input Terminal

Assigning terminals for quick-response inputs

Automatic bit allocation

PLC Setup

Ladder programming

Cyclic task or interrupt task

L1 L2/N COM 01 03 05 07 09 11

NC 00 02 04 06 08 10

Upper Terminal BlockQuick-response input IN5: CIO 0.05

Quick-response input IN3: CIO 0.03Quick-response input IN7: CIO 0.07

Quick-response input IN6: CIO 0.06Quick-response input IN2: CIO 0.02

Quick-response input IN4: CIO 0.04

CIO 0

Page 172: CP1E CPU Unit Software Users Manual

11 Quick-response Inputs

11-4 CP1E CPU Unit Software User’s Manual(W480)

• Input Terminal Block on CPU Unit with 30 I/O Points

• Input Terminal Block on CPU Unit with 40 I/O Points

Click the Built-in Input Tab and select Quick in the interrupt input settings.

2 PLC Setup

L1 L2/N COM 01 03 05 07 09 11

00 02 04 06 08 10

01 03 05

00 02 04

Upper Terminal Block Quick-response input IN5: CIO 0.05

Quick-response input IN3: CIO 0.03Quick-response input IN7: CIO 0.07

Quick-response input IN6: CIO 0.06Quick-response input IN2: CIO 0.02

Quick-response input IN4: CIO 0.04

CIO 0 CIO 1

L1 L2/N COM 01 03 05 07 09 11

00 02 04 06 08 10

01 03 05 07 09 11

00 02 04 06 08 10

Upper Terminal Block Quick-response input IN5: CIO 0.05

Quick-response input IN3: CIO 0.03Quick-response input IN7: CIO 0.07

Quick-response input IN6: CIO 0.06Quick-response input IN2: CIO 0.02

Quick-response input IN4: CIO 0.04

CIO 0 CIO 1

Select Quick

Page 173: CP1E CPU Unit Software Users Manual

11-5

11 Quick-response Inputs

CP1E CPU Unit Software User’s Manual(W480)

11-1 Qu

ick-respo

nse In

pu

ts

11

11-1-2 Flow

of Processing

Built-in Input Tab Page

Note The power supply must be restarted after the PLC Setup is transferred in order to validate the quick-response input settings.

Pulse inputs shorter than the cycle time can be read in the CPU Unit I/O memory using normal instruc-tions simply by setting the interrupt setting for the required input to Quick in the PLC Setup.

The status of CIO 0.02 to CIO 0.07 can be read using instructions such as the LD instruction.

Example: Setting IN2 to Quick in the PLC Setup Interrupt Settings.

• The 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 nextinput refresh period.

Quick-response input setting Corresponding bit address

IN2 Select Quick for IN2 to IN7.

CIO 0.02

IN3 CIO 0.03

IN4 CIO 0.04

IN5 CIO 0.05

IN6 CIO 0.06

IN7 CIO 0.07

3 Creating Ladder Programs

0.02

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 for one cycle and the status will be stored in memory.

Page 174: CP1E CPU Unit Software Users Manual

11 Quick-response Inputs

11-6 CP1E CPU Unit Software User’s Manual(W480)

Page 175: CP1E CPU Unit Software Users Manual

12-1CP1E CPU Unit Software User’s Manual(W480)

12

This section describes the interrupts that can be used with CP1E PLCs, including inputinterrupts and scheduled interrupts.

12-1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-212-1-1 CP1E Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2

12-2 Input Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-312-2-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

12-2-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4

12-2-3 Application Example for Input Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8

12-3 Scheduled Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1112-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

12-3-2 Flow of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12

12-4 Precautions for Using Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1512-4-1 Interrupt Task Priority and Order of Execution . . . . . . . . . . . . . . . . . . . . . . . 12-15

12-4-2 Auxiliary Area Words and Bits Related to Interrupts . . . . . . . . . . . . . . . . . . 12-15

12-4-3 Duplicate Processing in Cyclic and Interrupt Tasks . . . . . . . . . . . . . . . . . . . 12-15

Interrupts

Page 176: CP1E CPU Unit Software Users Manual

12 Interrupts

12-2 CP1E CPU Unit Software User’s Manual(W480)

12-1 Interrupts

CP1E 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 (ladderprograms) are executed.

The interrupt function, on the other hand, allows a specified condition to interrupt a cycle and execute aspecified program.

The CP1E performs the following processing when an interrupt occurs.

When an interrupt occurs, execution of the ladder programs in the normal cycle is interrupted.

The ladder program in the interrupt task is executed.

When the interrupt task is finished, the ladder program that was being executed is returned to.

Interrupts can thus be used to perform high-speed processing that is not restricted by the cycle time.

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

• Specified intervals measured by internal timers: Scheduled interrupts

• PVs of high-speed counter inputs: High-speed counter interrupts

Refer to 13-3 High-speed Counter Interrupts for information on high-speed counter interrupts.

Additional Information

The CP1E CPU Units do not support a power OFF interrupt.

12-1-1 CP1E Interrupts

Interrupt Factors and Types of Interrupts

END

ENDCycle

Cyclic tasks (ladder programs)

I/O refreshing

Interrupt occurs

Interrupt task executed

When the interrupt task is finished, the ladder diagram that was being executed is returned to.

Ladder program

Page 177: CP1E CPU Unit Software Users Manual

12-3

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-2 Inp

ut In

terrup

ts

12

12-2-1 Overview

12-2 Input Interrupts

Input interrupts can be used with any model of CP1E CPU Unit.

A corresponding interrupt task can be executed when a built-in input on the CPU Unit turns ON or turnsOFF.

12-2-1 Overview

Pulse Width Specifications for Interrupt Input Signals

Item Specification

ON response time 50 µs max.

OFF response time 50 µs max.

Required pulse The pulse widths of interrupt input signals must meet the following conditions.

END

END

Interrupt input

Built-in input

Input interrupt bit turns ON

Cycle

Cyclic tasks (ladder programs)

I/O refreshing

Interrupt occurs

Interrupt task

Ladder program

Condition for accepting interrupt

Example: CIO 0.02 (interrupt input IN0)

MSKS instruction executed to enable the interrupt

Cyclic task execution Cyclic task execution

Processinginterrupted

Processinginterrupted

Interrupt task 2 executed

Interrupt task 2 executed

50µs 50µs

Page 178: CP1E CPU Unit Software Users Manual

12 Interrupts

12-4 CP1E CPU Unit Software User’s Manual(W480)

Settings When Using Input Interrupts

A built-in input cannot be used as a normal input, high-speed counter input, or quick-response input if itis being used as an interrupt input.

12-2-2 Flow of Operation

1 Terminals 02 to 07 on the 0CH terminal block can be used for input interrupts.

Bits CIO 0.02 to CIO 0.07 correspond to terminals 02 to 07.

2 Set IN2 to IN7 for interrupt inputs on the Built-in Input Tab Page of the PLC Setup using the CX-Programmer.

Interrupt tasks 2 to 7 correspond to interrupt inputs 2 to 7.

3 • Specify whether the interrupt is executed when the input turns ON or when it turns OFF in the MSKS instruction. Set N to 112 to 117 in the MSKS instruction.

• Enable input interrupts in the MSKS instruction. Set N to 102 to 107 in the MSKS instruction.

• Write the program in the interrupt task.

TerminalCorrespond-

ing bit address

Setting in PLC SetupInter-rupt input settings on Built-

in Input Tab PageInstruction

Specify oper-and N in the

instruction to enable inter-

rupts

Interrupt task number

02 on 0CH terminal block

CIO 0.02 IN2

Set to Interrupt. MSKS

102 2

03 on 0CH terminal block

CIO 0.03 IN3 103 3

04 on 0CH terminal block

CIO 0.04 IN4 104 4

05 on 0CH terminal block

CIO 0.05 IN5 105 5

06 on 0CH terminal block

CIO 0.06 IN6 106 6

07 on 0CH terminal block

CIO 0.07 IN7 107 7

Restrictions

Assigning interruptinput terminals

Automatic bit allocation

PLC Setup

Automatic assignment of interrupt task numbers

Ladder programming

Execute MSKS instruction in a cyclic task

Interrupt task

Page 179: CP1E CPU Unit Software Users Manual

12-5

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-2 Inp

ut In

terrup

ts

12

12-2-2 Flow

of Operation

The following input terminals can be used for input interrupts. These terminals correspond to COI 0.02to CIO 0.07 in I/O memory.

• Input Terminal Block on CPU Unit with 20 I/O Points

• Input Terminal Block on CPU Unit with 30 I/O Points

• Input Terminal Block on CPU Unit with 40 I/O Points

1 Assigning Input Interrupt Terminals

L1 L2/N COM 01 03 05 07 09 11

NC 00 02 04 06 08 10

Upper Terminal Block Interrupt input IN5: CIO 0.05

Interrupt input IN3: CIO 0.03Interrupt input IN7: CIO 0.07

Interrupt input IN6: CIO 0.06Interrupt input IN2: CIO 0.02

Interrupt input IN4: CIO 0.04

CIO 0

L1 L2/N COM 01 03 05 07 09 11

00 02 04 06 08 10

01 03 05

00 02 04

Upper Terminal BlockInterrupt input IN5: CIO 0.05

Interrupt input IN3: CIO 0.03Interrupt input IN7: CIO 0.07

Interrupt input IN6: CIO 0.06Interrupt input IN2: CIO 0.02

Interrupt input IN4: CIO 0.04

CIO 0 CIO 1

L1 L2/N COM 01 03 05 07 09 11

00 02 04 06 08 10

01 03 05 07 09 11

00 02 04 06 08 10

Upper Terminal Block Interrupt input IN5: CIO 0.05

Interrupt input IN3: CIO 0.03Interrupt input IN7: CIO 0.07

Interrupt input IN6: CIO 0.06Interrupt input IN2: CIO 0.02

Interrupt input IN4: CIO 0.04

CIO 0 CIO 1

Page 180: CP1E CPU Unit Software Users Manual

12 Interrupts

12-6 CP1E CPU Unit Software User’s Manual(W480)

Click the Built-in Input Tab and select Interrupt in the interrupt intput settings.

Built-in Input Tab Page

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the interrupt inputsettings.

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.

The MSKS instruction must be executed only once to make the settings, so in general execute MSKS injust one cycle using the upwardly differentiated variation of the instruction. The first MSKS instructioncan be omitted. If it is omitted, an interrupt will be created when the input turns ON by default.

2 PLC Setup

Interrupt input settingsCorresponding

bit addressScheduled

interrupt task

IN2 Select Interrupt for IN2 to IN7.

CIO 0.02 2

IN3 CIO 0.03 3

IN4 CIO 0.04 4

IN5 CIO 0.05 5

IN6 CIO 0.06 6

IN7 CIO 0.07 7

3 Writing the Ladder Program: Execute MSKS Instruction in a Cyclic Task

Select Interrupt

@MSKSNC

C

@MSKSN

Execution condition

(1)Specifies creating an interrupt when the input turns OFF or when it turns ON.

(2)Enables input interrupts.

Page 181: CP1E CPU Unit Software Users Manual

12-7

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-2 Inp

ut In

terrup

ts

12

12-2-2 Flow

of Operation

Specifying MSKS Operands (N and C)(1)Specifying to Detect ON or OFF Input Signals

(2)Enabling the Input Interrupt

• Example

TerminalCorrespond-

ing bit address

PLC Setup on Built-in Input

Tab Page

Interrupt task

number

Operand N Operand C

Interrupt identifierSpecifying to

detect ON or OFF

02 on 0CH terminal block

CIO 0.02 Interrupt input IN2

2 112 #0000:

Detect ON

#0001:

Detect OFF

03 on 0CH terminal block

CIO 0.03 Interrupt input IN3

3 113

04 on 0CH terminal block

CIO 0.04 Interrupt input IN4

4 114

05 on 0CH terminal block

CIO 0.05 Interrupt input IN5

5 115

06 on 0CH terminal block

CIO 0.06 Interrupt input IN6

6 116

07 on 0CH terminal block

CIO 0.07 Interrupt input IN7

7 117

TerminalCorrespond-

ing bit address

PLC Setup on Built-in Input

Tab

Interrupt task

number

Operand N Operand C

Interrupt identifier Enable/Disable

02 on 0CH terminal block

CIO 0.02 Interrupt input IN2

2 102 #0000:

Enable interrupt

#0001:

Disable interrupt

03 on 0CH terminal block

CIO 0.03 Interrupt input IN3

3 103

04 on 0CH terminal block

CIO 0.04 Interrupt input IN4

4 104

05 on 0CH terminal block

CIO 0.05 Interrupt input IN5

5 105

06 on 0CH terminal block

CIO 0.06 Interrupt input IN6

6 106

07 on 0CH terminal block

CIO 0.07 Interrupt input IN7

7 107

MSKS112

#0000

END

END

01 03 0705 09 1100 02 04 06 08 10

MSKS102

#0000

Cyclic task

Specifying Detecting ON or OFF Input Signals For interrupt input IN2: Specify 112. Specifies an interrupt when the input turns ON.

Enabling Input InterruptFor interrupt input IN2: Specify 102. Enables Input interrupt.

The specified input interrupt (here, IN2) is enabled when the MSKS instruction is executed.

Interrupt

Interrupt task 2

Built-in input terminal

CIO 0.02 turns ON

CIO 0

Page 182: CP1E CPU Unit Software Users Manual

12 Interrupts

12-8 CP1E CPU Unit Software User’s Manual(W480)

Create ladder programs for interrupt tasks 2 to 7, which are executed for the corresponding interruptinputs. Right-click a program in the CX-Programmer and select Properties. Select interrupt tasks 2 to 7in the Task Type Field of the Program Properties Dialog Box.

Always put an END instruction at the last address of the program.

In this example, bent parts are detected in a moving workpiece, such as an IC component. When thesensor input (terminal 0 on terminal block 02 = CIO 0.02) changes from OFF to ON, the interrupt task isexecuted.

Writing the Interrupt Task’s Ladder Program

12-2-3 Application Example for Input Interrupts

Sensor input (interrupt)

Workpiece

Sensor input 1Sensor input 2

Sensor input 3

Sensor input (interrupt input 0)CIO 0.02

Sensor input

Sensor input

Sensor input

CIO 0.00

CIO 0.01

CIO 0.03

Reset inputCIO 0.04

OK outputCIO 100.00

NG output 1CIO 100.01

NG output 2CIO 100.02

NG output 3CIO 100.03

NG output 4CIO 100.04

Interrupt task execution

Interrupt task execution

Interrupt task execution

Page 183: CP1E CPU Unit Software Users Manual

12-9

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-2 Inp

ut In

terrup

ts

12

12-2-3 Application E

xample for Input Interrupts

1)Connecting Interrupt Input Terminals

Terminal 2 on terminal block 0CH of a CP1E CPU Unit with 20 I/O Points is interrupt input IN2.

Interrupt task 2 corresponds to interrupt input 2.

2)PLC Setup

Set IN2 to Interrupt in the interrupt input settings on the Built-in Input Tab Page.

Sensor input 3: CIO 0.03

Sensor input 2: CIO 0.01Sensor input 1: CIO 0.00

Interrupt input (sensor input):CIO 0.02

Reset input: CIO 0.04

NG output 2: CIO 100.04NG output 3: CIO 100.03NG output 4: CIO 100.02

OK output: CIO 100.00

NG output 1: CIO 100.01

Page 184: CP1E CPU Unit Software Users Manual

12 Interrupts

12-10 CP1E CPU Unit Software User’s Manual(W480)

3)Programming Example

(1) Cyclic Task

(2)Interrupt Task

0.04

Interrupt input 0

Interrupt input 0

Specifies executing interrupt when input turns ON.

Unmasks the input interrupt.

The MSKS instruction is used to specify an interrupt when the input turns ON and then it is used to unmask the input interrupt.

NG output sensor input 1

NG output sensor input 2

NG output sensor input 3

Reset input

Interrupt task 2

Sensor input 1

Sensor input 1

Sensor input 2

Sensor input 2

Sensor input 3

Sensor input 3

OK output

NG output 2Sensor input 1

NG output 3Sensor input 2

NG output 4Sensor input 3

Page 185: CP1E CPU Unit Software Users Manual

12-11

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-3 Sch

edu

led In

terrup

ts

12

12-3-1 Overview

12-3 Scheduled Interrupts

Scheduled interrupts can be used with any model of CP1E CPU Unit.

Scheduled interrupts can be used to execute interrupt tasks at fixed time intervals measured by theCPU Unit’s built-in timer.

12-3-1 Overview

END

ENDCycle

Cyclic tasks (ladder programs)

I/O refresh

Interrupt occurs

Interrupt task

Ladder program

Specified interval

Minimum interval: 0.5 ms

0.5ms 0.5ms 0.5ms

Condition foraccepting interrupts

Internal clock

Cyclic task execution

MSKS instruction executed to set the scheduled interrupt interval

Scheduled Interrupt Interval = 0.5 ms (example)

Execution interrupted

Execution interrupted

Execution interrupted

Cyclic task execution

Cyclic task execution

Executing scheduled interrupt task 1

Executing scheduled interrupt task 1

Executing scheduled interrupt task 1

Page 186: CP1E CPU Unit Software Users Manual

12 Interrupts

12-12 CP1E CPU Unit Software User’s Manual(W480)

To change the time unit to 1 ms or 0.1 ms, set the scheduled interrupt interval parameter on the TimingsTab Page of the PLC Setup.

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the time unit set-ting.

The scheduled interrupt interval is calculated by multiplying the unit set in the PLC Setup by the timerSV set with MSKS.

12-3-2 Flow of Operation

• Determine whether to set the time interval in units of 10 ms (default), 1 ms, or 0.1 ms.

1• In the PLC Setup of the CX-Programmer, set the

scheduled interrupt interval time unit to 10 ms, 1 ms, or 0.1 ms on the Timings Tab Page.

• The corresponding interrupt task number is 1.

2• Use MSKS to specify the scheduled interrupt interval.

The setting can be 0.5 ms or longer. Set N to 4 in the MSKS instruction.

• Write the program for the corresponding interrupt task.

1 PLC Setup

Determine the scheduled interrupt time unit

Make the settings in the PLC Setup

Automatic assignment of interrupt task numbers

Execute MSKS instruction in a cyclic task

Interrupt task

Ladder program

Page 187: CP1E CPU Unit Software Users Manual

12-13

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-3 Sch

edu

led In

terrup

ts

12

12-3-2 Flow

of Operation

The MSKS instruction must be executed from the ladder program in a cyclic task in order to use sched-uled interrupts.

The MSKS instruction must be executed only once to make the settings, so in general execute MSKS injust one cycle using the upwardly differentiated variation of the instruction.

Specifying MSKS Operands (N and C)• MSKS Operands

Example:

2 Writing the Ladder Program: Execute MSKS in a Cyclic Task

MSKS Operands Interrupt time interval (period)

N C Time unit set in PLC Setup

Interrupt intervalInterrupt number Interrupt time

Scheduled interrupt 0 (interrupt task 1)14: Reset and restart 4: Do not reset and restart

#0000 to #270F (0 to 9999)

10 ms 10 to 99,990 ms

1 ms 1 to 9,999 ms

0.1 ms 0.5 to 999.9 ms

@MSKS(690)N C

Execution condition

Specifies scheduled interrupt 0 (interrupt task 1)Sets the scheduled interrupt interval and starts timing

MSKS4

#0005

END

END

Cyclic tasks

Scheduled Interrupt Time Unit

Scheduled interrupt

When time unit is 0.1 ms: 0.5 ms

In intervals of 0.5 ms min

Setting in PLC SetupSet the schedule interrupt time unit to 0.1, 1, or 10 ms

Interrupt task 1

Interrupt

Page 188: CP1E CPU Unit Software Users Manual

12 Interrupts

12-14 CP1E CPU Unit Software User’s Manual(W480)

Precautions for Correct UsePrecautions for Correct Use

• Set a scheduled interrupt interval that is longer than the time required to execute the corre-sponding interrupt task.

• If you shorten the scheduled interrupt interval and increase the execution frequency of thescheduled interrupt task, the cycle time will increase, and this will affect the execution timing ofcyclic tasks.

• If an interrupt task is being executed for another interrupt (input interrupt or high-speedcounter 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 scheduled interrupt times are continually executed in paral-lel, so the execution of scheduled interrupt tasks will not be delayed.

Create the program for interrupt task 1, which is executed for the scheduled interrupt. Right-click a pro-gram in the CX-Programmer and select Properties. Select Interrupt Tasks 1 (scheduled interrupt) inTask Type Field of the Program Properties Dialog Box.

Always put an END instruction at the last address of the program.

Writing the Interrupt Task Program

Page 189: CP1E CPU Unit Software Users Manual

12-15

12 Interrupts

CP1E CPU Unit Software User’s Manual(W480)

12-4 Precau

tion

s for U

sing

Interru

pts

12

12-4-1 Interrupt Task Priority and O

rder of Execution

12-4 Precautions for Using Interrupts

If interrupt task A (an input interrupt, for example) is being executed when interrupt task B (a scheduledinterrupt, for example) is called, task A execution will not be interrupted. Task B execution will be startedwhen task A had been completed.

If multiple types of interrupts occur simultaneously, they are executed in the following order. If they arethe same interrupt type, the task with the lower interrupt task number will be executed frist.

For example, if an interrupt task is being executed for another interrupt (input interrupt or high-speedcounter interrupt) when a scheduled interrupt occurs, the scheduled interrupt will not be executed untilexecution of the other interrupt task had been completed.Even in this case, scheduled interrupt timesare continually measured in parallel, so the execution of the scheduled interrupt task will not bedelayed.

The processing time of an interrupt task and the task number of the interrupt with the maximum pro-cessing time can be found in the Auxiliary Area. The actual processing time can also be checked.

If a memory address is manipulated by instructions both in a cyclic task and an interrupt task, an inter-rupt mask must be set to disable interrupts while the instruction in the cyclic task is being executed.

Normally, if an interrupt occurs, execution of the cyclic task will be interrupted immediately, even duringexecution of an instruction in the cyclic task, and the partially processed data is saved. After the inter-rupt task had been completed, processing returns to the cyclic task and the interrupted processingrestarts with the data saved before the interrupt processing.

If the interrupt task overwrites a 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 the cyclic task.

To prevent certain instructions from being interrupted during processing, insert the MSKS instructionjust before and after the instructions, using the MSKS instruction before the instructions to disable inter-rupts and the MSKS instruction after the instructions to enable interrupts again.

12-4-1 Interrupt Task Priority and Order of Execution

12-4-2 Auxiliary Area Words and Bits Related to Interrupts

Name Addresses Description

Maximum Interrupt Task Processing Time

A440 Contains the maximum interrupt task processing time in units of 0.1 ms. This value is cleared at the start of operation.

Interrupt Task With Maximum Processing Time

A441 Contains the task number of the interrupt task with the maximum processing time.Here, #8000 to #80FF correspond to tasks 0 to 15 (00 to FF hex).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 two digits in hexadecimal.This value is cleared at the start of operation.

12-4-3 Duplicate Processing in Cyclic and Interrupt Tasks

Input interrupts High-speed counter interrupts

Scheduled interrupts

Page 190: CP1E CPU Unit Software Users Manual

12 Interrupts

12-16 CP1E CPU Unit Software User’s Manual(W480)

Page 191: CP1E CPU Unit Software Users Manual

13-1CP1E CPU Unit Software User’s Manual(W480)

13

This section describes the high-speed counter inputs, high-speed counter interrupts,and the frequency measurement function.

13-1 Overview and Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-213-1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2

13-1-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3

13-1-3 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8

13-2 High-speed Counter Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-913-2-1 Pulse Input Method (Input Setting) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9

13-2-2 Counting Modes: Linear Mode and Ring Mode . . . . . . . . . . . . . . . . . . . . . . 13-10

13-2-3 Reset Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-11

13-2-4 Reading the Present Value of a High-speed Counter . . . . . . . . . . . . . . . . . 13-12

13-2-5 High-speed Counter Frequency Measurement . . . . . . . . . . . . . . . . . . . . . . 13-12

13-3 High-speed Counter Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1413-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-14

13-3-2 Target Value Comaprison and Range Comparison . . . . . . . . . . . . . . . . . . . 13-17

13-4 Auxiliary Area Bits and Words Used with High-speed Counters . . . . . . 13-25

13-5 Application Example of High-speed Counter Interrupt . . . . . . . . . . . . . 13-26

High-speed Counters

Page 192: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-2 CP1E CPU Unit Software User’s Manual(W480)

13-1 Overview and Flow of Processing

High-speed counters can be used with any model of CP1E CPU Unit.

High-speed counters are used to measure high-speed input signals that cannot be measured bycounter instructions.

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 androtational speed conversion.

• Hhigh-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 specified values, interrupts can be generated. The count can be startedand stopped. Depending on the instruction, the frequency (speed) can be read from the presentvalue of the high-speed counter.

13-1-1 Overview

Encoder

· Phase A/phase B· Up/down pulse inputs· Reset input (phase Z) Etc.

High-speed counter PV (stored in Auxiliary Area)

Changes to PV

Target value comparison

Interrupt task

· Reading PV (from Auxiliary Area or using PRV instruction)

· Reading frequency (using PRV instruction)

· Setting target values or range upper/lowerlimits and starting comparison (with CTBLinstruction or by executing interrupt task)

Read

PRV

CTBL

Count input

High-speed counter PV comparison

Read

Settings

Range comparison for upper and lower limits

Page 193: CP1E CPU Unit Software Users Manual

13-3

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-1 Overview

and

Flow

of P

rocessin

g

13

13-1-2 Flow

of Processing

A built-in input cannot be used as a normal input, interrupt input, or quick-response input if it is beingused as a high-speed counter input.

13-1-2 Flow of Processing

1 The high-speed counter input setting can be set and ter-minals 00 to 07 on the 0CH terminal block can be used for high-speed counters.

Terminals 00 to 07 on the 0CH terminal block corre-spond to high-speed counters 0 to 5.

2 • Enable the required high-speed counters.

• Select the Use high speed counter Check Box for high-speed counters 0 to 5 and select the input setting on the Built-in Input Tab Page of the PLC Setup using the CX-Programmer.

3 • Read the PV from Auxiliary Area or by executing a PRV instruction.

• Execute a PRV instruction.

Restrictions

PLC Setup

Read counter PVLadder programming

Read counter frequency

High-speed counter allocation

Selecting the high-speed counter input setting, assigning terminals, and wiring

Page 194: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-4 CP1E CPU Unit Software User’s Manual(W480)

Pulse Input Method and High-speed Counter Input TerminalsThe following input terminals can be used for high-speed counters 0 to 5 with the pulse inputmethod.

Note 1 The same input setting 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 1is set for differential phase inputs (4x), pulse + direction inputs, or up/down pulse inputs.

1 Assigning Terminals for High-speed Counter Inputs

Input terminal block

Settings in PLC Setup

Other functions that cannot be used at the same timeHigh-speed counter 0 to 3 settings on Built-in Input Tab Page

Terminal block label

Terminal

Use

Normal input Input interrupts

Quick-response

Inputs

Origin searches for pulse outputs 0 and 1

Input setting

Single-phase (increment

pulse input)

Two-phase (differ-ential phase ×4 or

up/down)

Two-phase (pulse/

direction)

CIO 0 00 Counter 0, increment input

Counter 0, phase A or up input

Counter 0, pulse input

Normal input 0 − − −

01 Counter 1, increment input

Counter 0, phase B or down input

Counter 1, pulse input

Normal input 1 − − −

02 Counter 2, increment input

Counter 1, phase A or up input

Counter 0, direction

Normal input 2 Interrupt input 2 Quick-response input 2

03 − Counter 1, phase B or down input

Counter 1, direction

Normal input 3 Interrupt input 3 Quick-response input 3

04 Counter 3, increment input

Counter 0, phase Z or reset input

Counter 0, reset input

Normal input 4 Interrupt input 4 Quick-response input 4

05 Counter 4, increment input

Counter 1, phase Z or reset input

Counter 1, reset input

Normal input 5 Interrupt input 5 Quick-response input 5

06 Counter 5, increment input

− − Normal input 6 Interrupt input 6 Quick-response input 6

Pulse 0: Origin input signal

07 − − − Normal input 7 Interrupt input 7 Quick-response input 7

Pulse 1: Origin input signal

Page 195: CP1E CPU Unit Software Users Manual

13-5

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-1 Overview

and

Flow

of P

rocessin

g

13

13-1-2 Flow

of Processing

Wiring High-speed Counters• Using a 24-VDC Open-collector Encoder

The following example shows the connections to an encoder with phase-A, phase-B, and phase-Zinputs.

0V+24V

0.00

0.01

0.04

COM (COM 24V)

0.00

0.01

0.04

COM

0V24V 0V

IA

IB

IZ

Encoder (power supply: 24 VDC)

Example: E6B2-CWZ6CNPN open-collector output

Black Phase A

White Phase B

Orange Phase Z

Brown+Vcc

Blue 0V(COM)

24 VDC power supply

CP1E CPU Unit

(Differential Phase Input Mode)

(High-speed counter 0: Phase A 0 V)

(High-speed counter 0: Phase B 0 V)

(High-speed counter 0: Phase Z 0 V)

Power providedEncoder

(Do not use the same I/O power supply as other equipment.)

Power supply

Shielded twisted-pair cableCP1E CPU Unit

Phase A

Phase B

Phase Z

1

2

Page 196: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-6 CP1E CPU Unit Software User’s Manual(W480)

Click the Built-in Input Tab and select the Use high speed counter Check Box for high-speed counters0 to 5. Set the counting mode, reset method, and input setting.

Built-in Input Tab Page

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the high-speedcounter settings.

2 PLC Setup

Item Setting

Use high speed counter 0 to 5

Use counter Select Use high speed counter for each counter to be used.

Counting Mode Select Linear mode or Circular ring mode.

Circular Max. Count(maximum ring count)

If circular mode is selected, set the maximum ring count. 0 to 4,294,967,295 decimal

Reset Method • Phase Z and software reset

• Software reset*• Phase Z and software reset (continue comparing)

• Software reset (continue comparing)

*Only a software reset can be used if an increment pulse input is specified.

Input Setting • Differential phase inputs (4×)

• Pulse + direction inputs

• Up/down pulse inputs• Increment pulse input

Page 197: CP1E CPU Unit Software Users Manual

13-7

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-1 Overview

and

Flow

of P

rocessin

g

13

13-1-2 Flow

of Processing

3 Writing the Ladder Program

Generating interrupts for the high-speed counter PV (num-ber of pulses) and perform high-speed processing.

Execute interrupt tasks with CTBL instructions.

13-3 High-speed Counter Interrupts

Reading the high-speed counter PV (number of pulses).

Read the high-speed counter PV from the Auxiliary Area and convert it to position or length data using instruc-tions or measure the length using con-mparison instructions such as =, >, and <.

13-2-4 Reading the Present Value of a High-speed Counter

Reading the high-speed counter frequency (speed).

Execute a PRV instruction. 13-2-6 High-speed Counter Frequency Measurement

Page 198: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-8 CP1E CPU Unit Software User’s Manual(W480)

13-1-3 Specifications

Item Description

nput setting (Selected in the PLC Setup)

Increment input Differential phase inputs

Up/down pulse inputs

Pulse + direc-tion inputs

Input terminal allocations Increment pulse input

Phase-A input Up pulse input Pulse input

− Phase-B input Down pulse input Direction input

− Phase-Z input Reset input Reset input

Input method Single-phase input

Differential phase, 4× (Fixed)

Two Single-phase inputs

Single-phase pulse + direc-tion inputs

Frequency and number of high-speed counters

CP1E-N - 100 kHz: 2 counters,10 kHz: 4 counters

50 kHz: 1 counter,5 kHz: 1 counter

100 kHz: 1 counter,10 kHz: 1 counter

100 kHz: 2 counters

CP1E-E - 10 kHz: 6 counters

5 kHz: 2 counters

10 kHz: 2 counters

10 kHz: 2 counters

Counting mode Linear mode or circular (ring) mode (Select in the PLC Setup.)

Count values Linear mode: 8000 0000 to 7FFF FFFF hexRing Mode: 0000 0000 to Ring SV (The ring SV (Circular Max. Count) is set in the PLC Setup and the setting range is 0000 0001 to FFFF FFFF hex.)

High-speed counter PV storage locations

High-speed counter 0: A271 (upper 4 digits) and A270 (lower 4 digits)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)Target value comparison interrupts or range comparison interrupts can be executed based on these PVs.

Note The PVs are refreshed in the overseeing processes at the start ofeach cycle. Use PRV to read the most recent PVs.

Data format: 8 digit hexadecimal Range in linear mode: 8000 0000 to 7FFF FFFF hexRange in Ring Mode: 0000 0000 to Ring SV (Circular Max. Count)

Control method

Target value comparison

Up to 6 target values and corresponding interrupt task numbers can be registered.

Range comparison Up to 6 ranges can be registered, with a separate upper limit, lower limit, and interrupt task number for each range.

Counter reset method (Set the counter reset method in the PLC Setup.)

• Phase-Z + Software resetThe counter is reset when the phase-Z input goes ON while the Reset Bit is ON. (Phase Z cannot be used for the increment pulse.)

• Software resetThe counter is reset when the Reset Bit is turned ON.

Note Operation can be set to stop or continue the comparison operationwhen the high-speed counter is reset.

Page 199: CP1E CPU Unit Software Users Manual

13-9

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-2 Hig

h-sp

eed C

ou

nter In

pu

ts

13

13-2-1 Pulse Input M

ethod (Input Setting)

13-2 High-speed Counter Inputs

The Increment Mode counts signals on a single-phase pulse input. Only incrementing the count ispossible in this mode.

The Differential Phase Mode uses two phase signals (phase A and phase B) and increments/decre-ments the count according to the status of these two signals.

The Up/Down Mode uses two signals, an increment pulse input and a decrement pulse input.

The pulse + direction mode uses a direction signal input and pulse signal input. The count is incre-mented or decremented depending on the status (ON or OFF) of the direction signal.

13-2-1 Pulse Input Method (Input Setting)

Increment Mode

Conditions for Incrementing the Count

Differential Phase Mode (4×)

Conditions for Incrementing/Decrementing the Count

Up/Down Mode

Conditions for Incrementing/Decrementing the Count

Pulse + Direction Mode

Conditions for Incrementing/Decrementing the Count

142 151 160 9 10876 115 124 133

Pulse

H

L

Pulse Count valueIncrementNo changeNo changeNo change

· Only rising edges are counted.

111211 1010 99 888 777 666 555 444 333 222 110

Phase A

Phase B

×4

OFF

ON

ON

OFF

OFF

ON

ON

OFF

Phase A Phase B

Count valueIncrementIncrement

IncrementIncrement

DecrementDecrementDecrement

Decrement

22 11 00 7 6876 55 44 33

Increment pulse

Decrement pulse

Increment pulse

Decrement pulse

Count value

OFF

ON

ON

OFF

OFF

ON

ON

OFF

DecrementIncrement

Increment

· The count is incremented for each increment pulse and decremented for each decrement pulse.

· Only rising edges are counted.

No change

No change

No change

No change

Decrement

22 11 00 7 6876 55 44 33

Pulse

Direction OFF

ON

ON

OFF

OFF

ON

ON

OFF

Direction Pulse Count value

No change

No changeNo change

No changeNo changeNo change

Decrement

Increment

· The count is incremented when the direction signal is ON and decremented when it is OFF.

· Only rising edges are counted.

Page 200: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-10 CP1E CPU Unit Software User’s Manual(W480)

Additional Information

The count of a high-speed counter can be monitored to see if it is currently being incremented ordecremented. The count in the current cycle is compared with the count in the previous cycle todetermine if it is being incremented or decremented.

The results are reflected in the High-speed Counter Count Direction Flags.

Input pulses can be counted in the range between the lower limit and upper limit values. If the pulsecount goes beyond the lower/upper limit, an underflow/overflow will occur and counting will stop.

• Increment Mode

• Up/Down 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 automaticallyand incrementing will continue.

• If the count is decremented from 0, the count will be set to the maximum ring count automatically anddecrementing will continue.

Consequently, underflows and overflows cannot occur when Ring Mode is used.

High-speed counterAddress of High-speed

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

13-2-2 Counting Modes: Linear Mode and Ring Mode

Linear Mode

Circular (Ring) Mode

0(000000 Hex)

4294967295(FFFFFFFF Hex)

PV overflow

+2147483647(7FFFFFFF Hex)

-2147483648(80000000 Hex)

0(00000000 Hex)

PV underflow PV overflow

0

2 32-1

Maximum ring count

Count value

Page 201: CP1E CPU Unit Software Users Manual

13-11

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-2 Hig

h-sp

eed C

ou

nter In

pu

ts

13

13-2-3 Reset M

ethods

• Maximum Ring Count

Use the PLC Setup to set the maximum ring count (Circular Max. Count), which is the maximumvalue of the input pulse counting range. The maximum ring count can be set to any value between0000 0001 and FFFF FFFF hex (1 to 4,294,967,295 decimal).

• Restrictions

• 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 maximum ring count of FFFF FFFF hex.

The high-speed counter’s PV is reset when the phase-Z signal (reset input) goes from OFF to ON whilethe corresponding High-speed Counter Reset Bit is ON.

The CPU Unit recognizes the ON status of the High-speed Counter Reset Bit only at the beginning ofthe PLC cycle during the overseeing processes. Consequently, when the Reset Bit is turned ON in theladder program, the phase-Z signal does not become effective until the next PLC cycle.

Note The phase-Z signal cannot be used if an incremental counter is specified. Only a software reset can be used.

The high-speed counter’s PV is reset when the corresponding High-speed Counter Reset Bit goes fromOFF to ON.

The CPU Unit recognizes the OFF-to-ON transition of the High-speed Counter Reset Bit only at thebeginning of the PLC cycle during the overseeing processes. Reset processing is performed at thesame time. The OFF-to-ON transition will not be recognized if the Reset Bit goes OFF again within thesame cycle.

Additional Information

The comparison operation can be set to stop or continue when a high-speed counter is reset.This enables applications where the comparison operation can be restarted from a counter PV of0 when the counter is reset.

13-2-3 Reset Methods

Phase-Z Signal + Software Reset

Software Reset

One cycle

Phase Z

Reset bit

PV not reset

PV not resetPV reset PV reset PV reset PV reset

One cycle

Reset bit

PV reset PV not reset PV not reset PV not reset

Page 202: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-12 CP1E CPU Unit Software User’s Manual(W480)

The present value of a high-speed counter can be read in the following two ways.

The PV that is stored in the following words can be read using the MOVL instruction or other instruc-tions.

Reading the High-speed Counter PV with a PRV Instruction

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 isoutput in 8-digit hexadecimal and expressed in Hz. The frequency measurement function can be usedwith high-speed counter 0 only.

The frequency can be measured while a high-speed counter 0 comparison operation is in progress.Frequency measurement can be performed at the same time as functions such as the high-speedcounter and pulse output without affecting the performance of those functions.

13-2-4 Reading the Present Value of a High-speed Counter

• Value refreshed at the I/O refresh timing: Read PV from Auxiliary Area.

• Value updated when an instruction is executed: Read PV by executing a PRV instruction.

Reading the Value Refreshed at the I/O Refrefresh Timing

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 an Instruction Is Executed

13-2-5 High-speed Counter Frequency Measurement

High-speed Counter Frequency Measurement

@PRV#0010#0000D100

15 0

D100D101

C1: Port specifier (example for high-speed counter input 0)C2: Control data (for reading PV)S: First destination word

PV data lower bytes

PV data upper bytesHigh-speed counter PV that was read

Execution condition

Page 203: CP1E CPU Unit Software Users Manual

13-13

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-2 Hig

h-sp

eed C

ou

nter In

pu

ts

13

13-2-5 High-speed C

ounter Frequency Measurem

ent

Flow of Processing

Reading the High-speed Counter Frequency with a PRV Instruction

Restrictions• The frequency measurement function can be used with high-speed counter 0 only.

• Frequency measurements are not possible for high-speed counter 3.

Specifications

1 Set the high-speed counter input setting and deter-mine the use of the terminals.

High-speed counter 0 must be used.

2 • Enable the high-speed counter.

• Select the Use high speed counter Check Box for high-speed counter 0 and select the input setting on the Built-in Input Tab Page of the PLC Setup using the CX-Programmer.

3 Read the frequency by executing the PRV instruc-tion.

Item Specifications

Number of frequency mea-surement inputs

1 input (high-speed counter 0 only)

Frequency measurement range

High-speed counter 0:Differential phase inputs: 0 to 50 kHzAll other input modes: 0 to 100 kHz

Note If the frequency exceeds the maximum value, the maximum value will be stored.

Measurement method Execution of the PRV instruction

Stored data Unit Hz

Output data range

Differential phase input: 0000 0000 to 0000 C350 hex All other input modes: 0000 0000 to 000186A0 hex

Selecting the high-speed countermode and assigning terminals

High-speed counter allocation

PLC Setup

Ladder programming

Execute PRV instruction in a cyclic task

@PRV#0010#0013D100

15 0

D100

D101 Present frequency data upper bytes

Execution condition

C1: Port specifier (example for high-speed counter input 0)C2: Control data for reading frequency (10-ms sampling)S: First destination word

Present frequency data lower bytes High-speed counter frequency

that was read

Page 204: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-14 CP1E CPU Unit Software User’s Manual(W480)

13-3 High-speed Counter Interrupts

High-speed counter interrupts can be used with any model of CP1E CPU Unit.

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 zonecomparison). An interrupt task between 0 and 15 can be allocated with an instruction.

13-3-1 Overview

Target value comparison Range comparison

The specified interrupt program can be started when the present value of the high-speed counter matches a target value.

The specified interrupt program can be started when the present value of the high-speed counter enters a set range.

END

END

Cycle

Rotary Encoder

Built-in input

Present position Present position matches set target value

Time

Interrupt task

Ladder diagramInterrupt occursCyclic tasks

(ladder programs)

I/O refresh

0

Instruction execution condition

CTBL instruction executed

High-speed Counter Unit

High-speed counter PV

Target value 1

Target value 2

Counting enabled

Time

Cyclic task execution

Cyclic task execution

Cyclic task execution

Interrupted Interrupted

Interrupt task execution

Interrupt task execution

0

Instruction execution condition

CTBL instruction executed

High-speed Counter Unit

High-speed counter PV

Target value 1

Target value 2

Counting enabled

Time

Cyclic task execution

Cyclic task execution

Cyclic task execution

Interrupted Interrupted

Interrupt task execution

Interrupt task execution

0

Instruction execution condition

CTBL instruction executed

High-speed Counter Unit

High-speed counter PV

Target value 1

Target value 2

Counting enabled

Time

Cyclic task execution

Cyclic task execution

Cyclic task execution

Interrupted Interrupted

Interrupt task execution

Interrupt task execution

0

Instruction execution condition

CTBL instruction executed

High-speed Counter Unit

High-speed counter PV

Target value 1

Target value 2

Counting enabled

Time

Cyclic task execution

Cyclic task execution

Cyclic task execution

Interrupted Interrupted

Interrupt task execution

Interrupt task execution

0

Instruction execution condition

CTBL instruction executedHigh-speed Counter Unit

High-speed counter PV

Target value

Counting enabled

Cyclic task execution

Cyclic task execution

Cyclic task execution

Interrupted Interrupted

Interrupt task execution

Interrupt task execution

Time

Page 205: CP1E CPU Unit Software Users Manual

13-15

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-3 Hig

h-sp

eed C

ou

nter In

terrup

ts

13

13-3-1 Overview

High-speed Counter Settings

Flow of Processing

1 The high-speed counter input setting can be set and terminals 00 to 05 on the 0CH terminal block can be used for high-speed counters.

High-speed counters 0 to 5 can be used for high-speed counter interrupts.

2 • Enable the required high-speed counters.• Select the Use high speed counter Check Box for

high-speed counters 0 to 5 and select the input setting on the Built-in Tab Page of the PLC Setup using the CX-Programmer.

3 • Set the comparison values for the high-speed counter and the interrupt tasks (0 to 15) to be started using the CTBL instruction.

• Start the comparison using the INI instruction.

• Write a program for interrupt tasks 0 to 15.

Single-phase

terminal

Two-phase terminal

Settings in PLC SetupInstruc-

tion

Specify operand N in the instruc-

tion to enable interrupts

Interrupt task number

00 on CIO 0 terminal block

00 on CIO 0 terminal block 01 on CIO 0 terminal block 04 on CIO 0 terminal block

Interrupt input settings on Built-in Input Tab Page

High-speed counter 0

Select Use Check Box.

CTBL instruc-tion

#0000 0 to 15 (Specified by user.)

01 on CIO 0 terminal block

02 on CIO 0 terminal block 03 on CIO 0 terminal block 05 on CIO 0 terminal block

High-speed counter 1

#0001 0 to 15 (Specified by user.)

02 on CIO 0 terminal block

− High-speed counter 2

#0002 0 to 15 (Specified by user.)

03 on CIO 0 terminal block

− High-speed counter 3

#0003 0 to 15 (Specified by user.)

04 on CIO 0 terminal block

− High-speed counter 4

#0004 0 to 15 (Specified by user.)

05 on CIO 0 terminal block

− High-speed counter 5

#0005 0 to 15 (Specified by user.)

Assigning high-speed counter numbers

PLC Setup

Ladder programming

Interrupt task

Execution of CTBL and INI instructions in a cyclic task

Selecting the high-speed counter input setting and assigning terminals

Page 206: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-16 CP1E CPU Unit Software User’s Manual(W480)

• A built-in input cannot be used as a normal input, interrupt input, or quick-response input if it is beingused as a high-speed counter input.

High-speed counters 0 to 5 can be used for high-speed counter interrupts.

Click the Built-in Input Tab and select the Use high-speed counter Check Box for high-speed counters 0to 5, and then set the counting mode, reset method, and input setting.

Refer to 2 PLC Setup in 13-1-2 Flow of Processing for details.

Restrictions

1 Assigning High-speed Counter Input Terminals

Input terminal blockSettings in PLC Setup

High-speed counter 0 to 5 settings on Built-in Input Tab Page

Termi-nal

block label

Terminal number

Use

Single-phase (incre-ment pulse input)

Two-phase (differen-tial phase× 4 or

up/down)

Two-phase (pulse/direction)

CIO 0 00 High-speed counter 0, increment input

High-speed counter 0, phase A or up input

High-speed counter 0, pulse input

01 High-speed counter 1, increment input

High-speed counter 0, phase B or down input

High-speed counter 1, pulse input

02 High-speed counter 2, increment input

Counter 1, phase A or up input

High-speed counter 0, direction

03 − High-speed counter 1, phase B or down input

High-speed counter 1, direction

04 High-speed counter 3, increment input

High-speed counter 0, phase Z or reset input

High-speed counter 0, reset input

05 High-speed counter 4, increment input

High-speed counter 1, phase Z or reset input

High-speed counter 1, reset input

06 High-speed counter 5, increment input

− −

2 PLC Setup

Page 207: CP1E CPU Unit Software Users Manual

13-17

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-3 Hig

h-sp

eed C

ou

nter In

terrup

ts

13

13-3-2 Target Value C

omaprison and R

ange Com

parison

Execute the instructions in the following order.

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 comparisontable 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 cycledthrough 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

3 Writing the Ladder Program

Register the compari-son table

Register the comparison table with the CTBL (COMPARISON ABLE LOAD) instruction.

Start comparison Start comparison with the CTBL (COMPARISON ABLE LOAD) or INI (MODE CONTROL) instruction.

Stop comparison Stop with the INI (MODE CONTROL) instruction.

13-3-2 Target Value Comaprison and Range Comparison

Target Value Comparison

No.0 No.1 No.5 No.8 No.0

High-speed counter PV

Comparison is executed according to the order of the values in the table.

Target value 4Target value 3

Target value 2

Target value 1

Interrupt task that is started NO.

Time

Comparison tableNumber of values = 4

Target value 1 (when counting up)Interrupt task = 0

Target value 2 (when counting up)Interrupt task = 1

Target value 3 (when counting up)Interrupt task = 5

Target value 4 (when counting up)Interrupt task = 8

Page 208: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-18 CP1E CPU Unit Software User’s Manual(W480)

Example 2

• 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 thePV is changed while the target value comparison operation is in progress.

Precautions for Correct UsePrecautions for Correct Use

When the count direction (incrementing/decrementing) changes at a PV that matches a targetvalue, 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.

No.1 No.5 No.8No.0

High-speed counter PV

Comparison is executed according to the order of the values in the table.

Target value 1Target value 2

Target value 3

Target value 4

Interrupt task that is started NO.

Time

Comparison tableNumber of values = 4

Target value 1 (when counting up)Interrupt task = 0

Target value 2 (when counting down)Interrupt task = 1

Target value 3 (when counting down)Interrupt task = 5

Target value 4 (when counting down)Interrupt task = 8

Target value 1

Target value 2

Match not recognized

Target value 1

Target value 2

Match Match

Match

Page 209: CP1E CPU Unit Software Users Manual

13-19

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-3 Hig

h-sp

eed C

ou

nter In

terrup

ts

13

13-3-2 Target Value C

omaprison and R

ange Com

parison

The maximum response frequencies of the high-speed counters are given in the following table.

Exceptions

• When using target matching, the total processing frequency for all high-speed counters must be 50 kHz or less.

• When using target matching, the interval between interrupts for target matches must be 1 ms orgreater.

• If the input setting is set to pulse plus direction inputs, the frequency must be 1 kHz or less whenreversing directions.

The specified interrupt task is executed when the high-speed counter PV is within the range defined bythe upper and lower limit values.

• The comparison conditions (upper and lower limits of the range) are registered in the comparisontable 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).

• 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.

ItemE-type CPU

UnitN-type CPU

Unit

High-speed counter 0

Incremental pulse 10kHz 100kHz

Up and down pulses

Pulse plus direction

Differential phase (×4) 5kHz 5kHz

High-speed counter 1

Incremental pulse 10kHz 100kHz

Up and down pulses 10kHz

Pulse plus direction

Differential phase (×4) 5kHz 5kHz

High-speed counter 2 Incremental pulse 10kHz 10kHz

High-speed counter 3 Incremental pulse

High-speed counter 4 Incremental pulse

High-speed counter 5 Incremental pulse

Range Comparison

No.2 No.1 No.1 No.2

High-speed counter PV

Comparison is executed regardless of the order of the ranges in the table.

Upper limit 1

Lower limit 1

Upper limit 2

Lower limit 2

Interrupt task to execute NO.

Time

Comparison tableUpper limit 1Lower limit 1

Interrupt task = 1Upper limit 2Lower limit 2

Interrupt task = 2

Page 210: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-20 CP1E CPU Unit Software User’s Manual(W480)

RestrictionsWhen more than one comparison condition is met in a cycle, the first interrupt task in the table willbe 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 comparisoncondition is met. The range comparison function can be useful when you just want to knowwhether 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 counterPV is within a registered range.

The CTBL instruction compares the PV of a high-speed counter (0 to 5) to target values or ranges andexecutes the corresponding interrupt task (0 to 15) when the specified condition is met.

Contents of the Comparison Table• Target-value Comparison Table

Depending on the number of target values in the table, the target-value comparison table requiresa continuous block of 4 to 19 words.

• Range Comparison TableThe range comparison table requires a continuous block of 30 words for comparison conditions 1to 6 require 5 words each (two words for the upper range value, two words for the lower rangevalue, and one word for the interrupt task number).

COMPARISON TABLE LOAD Instruction: CTBL

Operand Settings

C1 High-speed counter num-ber

#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-son table word

Specifies the first word address of the comparison table, which is described below.

@CTBLC1C2S

Execution condition

C1: High-speed counter numberC2: Control dataS: First comparison table word

Page 211: CP1E CPU Unit Software Users Manual

13-21

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-3 Hig

h-sp

eed C

ou

nter In

terrup

ts

13

13-3-2 Target Value C

omaprison and R

ange Com

parison

The INI instruction is used for the following items.

• Starting and stopping comparison with the high-speed counter comparison tableUse the CTBL instruction to register the target value or range comparison table before using INI tostart or stop comparison.

Note The INI instruction is not required for normal applications of interrupt functions.

• Changing the PV of a High-speed Counter

Example 1: Target Value ComparisonIn this example, high-speed counter 0 operates in linear mode and starts interrupt task 10 when thePV reaches 30,000 (0000 7530 hex) and starts interrupt task 11 when the PV reaches 20,000 (00004E20 hex).

(1)Set high-speed counter 0 in the PLC Setup's Built-in Input Tab.

(2)Set the target-value comparison table in words D10000 to D10003.

MODE CONTROL Instruction: INI

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 new PV

S contains the first word of the new PV when C is set to #0002 (change the PV).

Item Setting

High-speed counter 0 Use counter

Counting mode Linear mode

Circular Max. Count −Reset method Software reset

Input Setting Up/Down inputs

Word Setting Function

D10000 #0002 Number of target values = 2

D10001 #7530 Rightmost 4 digits of the target value 1 data (30000) Target value = 30,000(0000 7530 hex)D10002 #0000 Leftmost 4 digits of the target value 1 data (30000)

D10003 #000A Target value 1

Bit 15: 0 (incrementing)

Bits 0 to 7: A hex (interrupt task number 10)

D1004 #4E20 Rightmost 4 digits of the target value 2 data (20000) Target value = 20,000(0000 4E20 hex)D1005 #0000 Leftmost 4 digits of the target value 2 data (20000)

D1006 #800B Target value 2

Bit 15: 1 (decrementing)

Bits 0 to 07: B hex (interrupt task number 11)

@INIC1C2S

Execution condition

C1: Port specifierC2: Control dataS: First word of new PV

Page 212: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-22 CP1E CPU Unit Software User’s Manual(W480)

(3)Create the programs for interrupt tasks 10 and 11. Always put an END instruction at the pro-gram's last address.

(4)Use the CTBL instruction to start the comparison operation with high-speed counter 0 and inter-rupt tasks 10 and 11.

(5)OperationWhen execution condition W0.00 turns ON, the comparison starts with high-speed counter 0.

When the PV of high speed counter 0 reaches 30,000, cyclic task execution is interrupted, and inter-rupt task 10 is executed.

When the PV of high speed counter 0 reaches 20,000, cyclic task execution is interrupted, and inter-rupt task 11 is executed.

When interrupt task 10 or 11 execution has been completed, execution of the interrupted cyclic taskresumes.

Example 2: Range ComparisonIn this example, high-speed counter 1 operates in circular (ring) mode and starts interrupt task 12when 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

CTBL#0000#0000D1000

W0.00

Use high-speed counter 0.Register a target-value comparison table and start comparison operation.

First comparison table word.

W0.00

0

30,000 (7530 Hex)

0.00

20,000 (4E20 Hex)

High-speed counter 0 PV (in A270 and A271)

Counting enabled

Cyclic task execution

Cyclic task execution

Cyclic task execution

Processing interrupted

Processing interrupted

Interrupt task 10 execution

Interrupt task 11 execution

Page 213: CP1E CPU Unit Software Users Manual

13-23

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-3 Hig

h-sp

eed C

ou

nter In

terrup

ts

13

13-3-2 Target Value C

omaprison and R

ange Com

parison

(2)Set the range comparison table starting at word D20000. Even though range 1 is the only rangebeing used, all 30 words must still be dedicated to the range comparison table.

(3)Create the program for interrupt task 12. Always put an END instruction at the program’s lastaddress.

(4) Use the CTBL instruction to start the comparison operation with high-speed counter 1 and inter-rupt task 12.

Word Setting Function

D2000 #61A8 Rightmost 4 digits of range 1 lower limit

Lower limit value: 25,000

D2001 #0000 Leftmost 4 digits of range 1 lower limit

D2002 #639C Rightmost 4 digits of range 1 upper limit

Upper limit value: 25,500

D2003 #0000 Leftmost 4 digits of range 1 upper limit

D2004 #000C Range 1 interrupt task number = 12 (C hex)

D2005

to

D2008

All

#0000

Range 2 lower and upper limit val-ues(Not used and don't need to be set.)

Range 2 settings

D2009 #FFFF Disables range 2.~

D2014

D2019

D2024

#FFFF Set the fifth word for ranges 3 to 5 (listed at left) to #FFFF to disable those ranges.

~

D2025

to

D2028

All

#0000

Range 6 lower and upper limit val-ues (Not used and don't need to be set.)

Range 6 settings

D2029 #FFFF Disables the range.

W0.00

@CTBL#0001#0001D2000

Use high-speed counter 1.Register a range comparison table and start comparison operation.

First comparison table word.

Page 214: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-24 CP1E CPU Unit Software User’s Manual(W480)

(5) Operation

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 inter-rupted, and interrupt task 12 is executed.

When interrupt task 12 execution is completed, execution of the interrupted cyclic task resumes.

W0.00

0.02

High-speed counter 1 PV (in A272 and A273)

Lower limit: 25,000 (61A8 hex)

Upper limit: 25,500 (639C hex)

Counting enabled

Cyclic task execution

Cyclic task execution

Cyclic task execution

Processing interrupted

Processing interrupted

Interrupt task 12 execution

Interrupt task 12 execution

Page 215: CP1E CPU Unit Software Users Manual

13-25

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-4 Au

xiliary Area B

its and

Wo

rds U

sed w

ith H

igh

-speed

Co

un

ters

13

13-4 Auxiliary Area Bits and Words Used with High-speed Counters

Bits and Words Allocated in the Auxiliary Area

ContentsHigh-speed

counter 0

High-speed

counter 1

High-speed

counter 2

High-speed

counter 3

High-speed

counter 4

High-speed

counter 5

High-speed counter PV storage words

Leftmost 4 digits A271 A273 A317 A319 A323 A325

Rightmost 4 digits A270 A272 A316 A318 A322 A324

Range Comparison Condition Met Flags

Range 1 Compari-son Condition Met Flag (ON for match.)

A274.00 A275.00 A320.00 A321.00 A326.00 A327.00

Range 2 Compari-son Condition Met Flag (ON for match.)

A274.01 A275.01 A320.01 A321.01 A326.01 A327.01

Range 3 Compari-son Condition Met Flag (ON for match.)

A274.02 A275.02 A320.02 A321.02 A326.02 A327.02

Range 4 Compari-son Condition Met Flag (ON for match.)

A274.03 A275.03 A320.03 A321.03 A326.03 A327.03

Range 5 Compari-son Condition Met Flag (ON for match.)

A274.04 A275.04 A320.04 A321.04 A326.04 A327.04

Range 6 Compari-son Condition Met Flag (ON for match.)

A274.05 A275.05 A320.05 A321.05 A326.05 A327.05

Comparison In-progress Flags

ON when a com-parison operation is being executed for the high-speed counter.

A274.08 A275.08 A320.08 A321.08 A326.08 A327.08

Overflow/Underflow Flags

ON when an over-flow or underflow has occurred in the high-speed counter’s PV.

A274.09 A275.09 A320.09 A321.09 A326.09 A327.09

Count Direc-tion Flags

0: Decrementing1: Incrementing

A274.10 A275.10 A320.10 A321.10 A326.10 A327.10

Page 216: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-26 CP1E CPU Unit Software User’s Manual(W480)

13-5 Application Example of High-speed Counter Interrupt

Using a Rotary Encoder to Measure Positions

High-speed Counting for a Built-in InputA high-speed counter input can be used by connecting a rotary encoder to a built-in input. A CP1ECPU Unit is equipped with more than one high-speed counter input, making it possible to controldevices for multiple axes with a single PLC.

High-speed counters can be used for high-speed processing, using either target value comparisonor range comparison to create interrupts. Interrupt tasks are executed when the counter valuereaches a specific target value or range.

A sheet feeder is controlled to feed constant lengths in a given direction, e.g., for vacuum packing offood products.

While the pulse count is between 3,500 and 3,550, normal stop position output (CIO 100.02) will beON. If the pulse count exceeds 3550, the error stop position output (CIO 100.03) will turn ON.

Functions Used

Operation Overview

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

Number of pulses counted by high-speed counter (A270)

(Pulses)

The High-speed Counter Reset Bit (A531.00) is turned ON in the ladder program as soon a operation starts.

355035003000

Page 217: CP1E CPU Unit Software Users Manual

13-27

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-5 Ap

plicatio

n E

xamp

le of H

igh

-speed

Co

un

ter Interru

pt

13

Wiring Example

Precautions for Correct UsePrecautions for Correct Use

Use the external power supply for input devices only. (Do not use it to power output devices.)

System Configuration

Encoder (power supply: 24 VDC)

Example: E6B2-CWZ6CNPN open-collector output

Phase ABlack

White Phase B

Orange Phase Z

Brown

Blue

100 to 240 VAC

24 VDC power supply

Start motor

Motor running: CIO 100.00

Motor low speed output: CIO 100.01

Example: Inverter

CP1E-N20DR-A

Error stop position output: CIO 100.03 (indicator)

Normal stop position output: CIO 100.02 (indicator)

Page 218: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-28 CP1E CPU Unit Software User’s Manual(W480)

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.

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 To apply changes made to the PLC Setup, cycle the power to the PLC.

Page 219: CP1E CPU Unit Software Users Manual

13-29

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-5 Ap

plicatio

n E

xamp

le of H

igh

-speed

Co

un

ter Interru

pt

13

In this example, comparison instructions are used to compare counter values. The program can be cre-ated easily simply by using comparison instructions to compare counter values.

Ladder Program Based on the counter value, the motor is started, decelerated, and stopped.

Programming Example 1

Motor start

Motor run

Motor stop

High-speed Counter Reset Bit

Motor run

Motor stop

Motor low speed

When the present value of the high-speed counter (A270) reaches 3000 (0BB8 hex), the motor is changed to low speed.

When the present value of the high-speed counter (A270) reaches 3500 (0DAC hex), the motor is stopped.

After the motor stops, the stop position is checked.

Motor stop Motor start

Motor stopped

Motor stopped

Normal stop position

Error stop position

The stop position is normal if the present value of the high-speed counter (A270) is between 3500 (0DAC hex) and 3550 (0DDE hex).

The stop position is in error if the present value of the high-speed counter (A270) is greater than 3550 (0DDE hex).

Page 220: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-30 CP1E CPU Unit Software User’s Manual(W480)

In this example, the CTBL (COMPARISON TABLE LOAD) instruction is used to create an interruptwhen 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.

When the PV of the high-speed counter matches target value 1 (3000), interrupt task 04 is executed.

Programming Example 2

Motor start

Reset with motor stopped

High-speed Counter 0 Reset Bit

Specifies high-speed counter 0Specifies comparision with target values and starts comparisonFirst word of comparision table

Turns ON motor run output

After motor stops, the stop position is checked.

Motor stopped Normal stop position

Error stop position

The stop position is normal if the present value of the high-speed counter (A270) is between 3500 (0DAC hex) and 3550 (0DDE hex).

The stop position is in error if the present value of the high-speed counter (A270) is greater than 3550 (0DDE hex).

Interrupt task 04

Turns ON the motor low speed output

Page 221: CP1E CPU Unit Software Users Manual

13-31

13 High-speed Counters

CP1E CPU Unit Software User’s Manual(W480)

13-5 Ap

plicatio

n E

xamp

le of H

igh

-speed

Co

un

ter Interru

pt

13

When the present vale of the high-speed counter matches target value 2 (3500), interrupt task 05 isexecuted.

DM Area Setup The comparison table for the CTBL (COMPARISON TABLE LOAD) instruction is set in D600 throughD606.

Word Value Contents

D600 0002 Number of target values: 2

D601 0BB8 Target value 1: 3000 BCD (BB8 hex)

D602 0000

D603 0004 Target value 1: Interrupt task No.4

D604 0DAC Target value 2: 3500 BCD (DAC hex)

D605 0000

D606 0005 Target value 2: Interrupt task No.5

Interrupt task 05

Turns OFF the motor run output

Turns OFF the motor low speed output

Turns OFF the motor stopped output

Page 222: CP1E CPU Unit Software Users Manual

13 High-speed Counters

13-32 CP1E CPU Unit Software User’s Manual(W480)

Page 223: CP1E CPU Unit Software Users Manual

14-1CP1E CPU Unit Software User’s Manual(W480)

14

This section describes positioning functions such as trapezoidal control, jogging, andorigin searches.

14-1 Overview and Flow of Processing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-314-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3

14-1-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-4

14-1-3 Pulse Output Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-8

14-2 Trapezoidal Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-914-2-1 Determine the Pulse Output Port, Output Method, and Output Waveform . . . 14-9

14-2-2 Relative Pulse Outputs and Absolute Pulse Outputs . . . . . . . . . . . . . . . . . . . 14-9

14-2-3 Operations Affecting the Origin Status (Defined/Undefined Status) . . . . . . . 14-11

14-2-4 Programming Example for Trapezoidal Control . . . . . . . . . . . . . . . . . . . . . . 14-11

14-3 Jogging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1314-3-1 Determine the Pulse Output Port and Pulse Output Method . . . . . . . . . . . . 14-13

14-3-2 Pulse Waveform and Applicable Instructions . . . . . . . . . . . . . . . . . . . . . . . . 14-13

14-3-3 Programming Example for Jogging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14

14-4 Performing Origin Searches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1614-4-1 Origin Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-16

14-4-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-17

14-4-3 Setting the Pulse Output Port and Pulse Output Method . . . . . . . . . . . . . . . 14-17

14-4-4 Settings in PLC Setup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-20

14-4-5 Applicable Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-22

14-4-6 Details on the Origin Search Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-23

14-4-7 Origin Search Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-30

14-5 Returning to the Origin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-33

14-6 Changing/Reading the Pulse Output Present Value . . . . . . . . . . . . . . . . 14-3414-6-1 Changing the Present Value of the Pulse Output . . . . . . . . . . . . . . . . . . . . . 14-34

14-6-2 Reading the Present Value of a Pulse Output . . . . . . . . . . . . . . . . . . . . . . . 14-34

14-7 Auxiliary Area Bits and Words Used with Pulse Outputs . . . . . . . . . . . . 14-36

14-8 Pulse Output Application Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-3714-8-1 Example 1: Cutting Long Material Using Fixed Feeding. . . . . . . . . . . . . . . . 14-37

Pulse Outputs

Page 224: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-2 CP1E CPU Unit Software User’s Manual(W480)

14-8-2 Example 2: Vertically Conveying PCBs (Multiple Progressive Positioning) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-40

14-8-3 Example 3: Feeding Wrapping Material: Interrupt Feeding . . . . . . . . . . . . . . 14-45

14-9 Precautions When Using Pulse Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . 14-48

14-10Pulse Output Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5314-10-1 Continuous Mode (Speed Control). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-53

14-10-2 Independent Mode (Positioning) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-55

Page 225: CP1E CPU Unit Software Users Manual

14-3

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-1 Overview

and

Flow

of P

rocessin

g

14

14-1-1 Overview

14-1 Overview and Flow of Processing

Pulse outputs can be used only with the CP1E N-type CPU Unit.

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 possibleto perform origin searches or origin returns.

Positioning is performed with a servomotor or stepping motor in the following configuration.

14-1-1 Overview

Built-in output

Pulse output

Servo Drive (or stepping driver)

Servomotor (or stepping motor)

Trapezoidal control

Frequency (speed)

Frequency (speed)

Frequency (speed)

Travel distance

Time

Travel distance

Time

Travel distance

Time

Jogging

Origin search

ORG

PLS2

SPED

ACC

CP1E

·Trapezoidal control with a PLS2 instruction

·Jogging with a SPED instruction

·Jogging with an ACC instruction

Pulse output

Pulse output PV in Auxiliary Area

Servo Drive (or stepping driver)

Origin proximity input

CW limit input

CCW limit input

·Origin search with ORG instruction

Origin input (phase-Z)

(Positioning completed)

Error counter reset

Page 226: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-4 CP1E CPU Unit Software User’s Manual(W480)

Pulse Output MethodThe following pulse output plus a direction output can be used as the pulse output method.

Pulse Output Port Number and Output TerminalsThe following terminals can be used for pulse outputs according to the pulse output method.

14-1-2 Flow of Processing

1 You can set the pulse output method, pulse output 0 or 1, and whether to use terminals 00 and 02, or 01 and 03 on the 100CH terminal block for pulse out-puts

2 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.

3 Execute instructions related to pulse outputs.

1 Setting the Pulse Output Method, Setting the Pulse Output Port Number, Assigning Pulse Output Terminals, and Wiring

Output terminal block

When a pulse output instruction (SPED, ACC, PLS2, or ORG) is executed

Other functions that cannot be used at the same time

Terminal block label

Terminal number

Pulse output methodNormal output PWM output

CW/CCW Pulse plus direction

CIO 100 00 Not possible. 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 −

Setting the pulse output method, setting the pulse output port number, assigning pulse output terminals, and wiring

PLC Setup

Ladder programming

Cyclic task, interrupt task

CW CCW

Pulses

Direction Output ON Output OFF

Page 227: CP1E CPU Unit Software Users Manual

14-5

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-1 Overview

and

Flow

of P

rocessin

g

14

14-1-2 Flow

of Processing

Origin SearchesUse the following input and output terminals for origin searches.

• Input Terminals

• Output Terminals

Pulse Output Wiring

Input terminal block Setting in PLC SetupOther functions that cannot be used at the same

time

Terminal block label

Terminal number

Enable origin searches for pulse outputs 0 and 1

Normal inputs

Interrupt inputs

Quick-response

Inputs

High-speed countersettings

Single-phase (increment

pulse input)

CIO 0 06 Pulse 0, Origin input signal Normal input 6

Interrupt input 6

Quick-response input 6

High-speed counter 5

07 Pulse 1, Origin input signal Normal input 7

Interrupt input 7

Quick-response input 7

: :

10 Pulse 0, Origin proximity input signal

Normal input 10

− − −

11 Pulse 1, Origin proximity input signal

Normal input 11

− − −

Output terminal block Setting in PLC Setup

Other functions that cannot be

used at the same time

Terminal block label

Terminal number

Enable origin searches for pulse outputs 0 and 1

Normal outputs

CIO 100 04 Pulse 0, Error counter reset output Normal output 4

05 Pulse 1, Error counter reset output Normal output 5

PULS

PULS

SGN

SGN

(+)

(+)

(-)

(-)

+ -

CP1E CPU Unit built-in output terminals

Pulse output

Direction output

24-VDC power supply

Servo Drive for 24-VDC input

Instruction pulse mode = feed pulse and forward/reverse signal

Page 228: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-6 CP1E CPU Unit Software User’s Manual(W480)

To perform an origin search or to use a Limit Input Signal as an input to a function other than originsearch, set the parameters on the Pulse Output 0 and Pulse Output 1 Tab Pages in the PLC Setup.

Pulse Output 0 or 1 Tab Page

Note The power supply must be restarted after the PLC Setup is transferred in order to enable the pulse outputsettings.

Origin Searches

Refer to 14-4-4 Settings in PLC Setup

Origin Returns

Refer to 14-4-4 Settings in PLC Setup

2 PLC Setup

Item Setting Description

Base Settings

Undefined Origin

Hold When a Limit Input Signal is input, the pulse output is 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 Operation

Search Only The CW/CCW Limit Input Signal is used for origin searches only.

Always The CW/CCW Limit Input Signal is used by functions other than origin search.

Limit Input SignalNC Select when using NC contacts for the Limit Input Signal.

NO Select when using NO contacts for the Limit Input Signal.

Search/Return Ini-tial Speed

Set the motor’s starting speed when performing an origin search. Specified in pulses per second (pps).

Speed CurveSpecify the acceleration/deceleration curve.

Trapezoidal only Accelerates and decelerates linearly.

Page 229: CP1E CPU Unit Software Users Manual

14-7

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-1 Overview

and

Flow

of P

rocessin

g

14

14-1-2 Flow

of Processing

The pulse outputs are used by executing pulse control instructions in the ladder program.

Applicable InstructionsThe following instructions are used.

Outputting to the Auxiliary Area Using the OUT InstructionThe OUT instruction in the ladder program is used to write signals received from the CW limit sensorand CCW limit sensor connected to normal inputs to the Auxiliary Area bits.

Bits Written in the Auxiliary Area

3 Executing Pulse Control Instructions in a Ladder Program

Purpose Overview Instruction Reference

Jogging Without acceler-ation and decel-eration

Performs pulse output control without acceleration or deceleration.

SPED: SPEED OUTPUT

Refer to 5-3

With acceleration and deceleration

Performs trapezoidal pulse output control with the same acceleration and deceleration rates.

ACC: ACCELERATION CONTROL

Performing trapezoidal con-trol

Performs trapezoidal pulse output control with independent accelera-tion and deceleration rates. (The number of pulses can be set.)

PLS2: PULSEOUTPUT

Refer to 5-2

Performing origin searches Actually moves the motor with pulse outputs and defines the machine ori-gin based on the Origin Proximity Input and Origin Input signals.

ORG: ORIGIN SEARCH

Refer to 5-4

Performing origin returns Returns to the origin position from any position.

ORG: ORIGIN SEARCH

Refer to 14-2

Changing or reading the pulse output PV

Changes the PV of the pulse output. (This operation defines the origin location.)

INI: MODECONTROL

Refer to 14-7-1

Reads the PV of the pulse output. PRV: HIGH-SPEED COUNTER PV READ

Refer to 14-7-2

Auxiliary AreaName

Word Bit

A540 08 Pulse Output 0 CW Limit Input Signal Signals must be received from exter-nal sensors connected to normal inputs and then written to the Auxil-iary Area by the user program.

09 Pulse Output 0 CCW Limit Input Signal

A541 08 Pulse Output 1 CW Limit Input Signal

09 Pulse Output 1 CCW Limit Input Signal

Normal input from CW limit sensor

CW Limit Input Signal A540.08 or A541.08

Normal input from CCW limit sensor

CCW Limit Input Signal A540.09 or A541.09

Page 230: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-8 CP1E CPU Unit Software User’s Manual(W480)

14-1-3 Pulse Output Specifications

Item Specifications

Output mode Continuous mode (for speed control) or independent mode (for position con-trol)

Positioning (independent mode) instruc-tions

PULS and SPED, PULS and ACC, or PLS2

Speed control (continuous mode) instructions

SPED or ACC

Origin (origin search and origin return) instructions

ORG

Output frequency 1 Hz to 100 kHz (1 Hz units), two pulse outputs

Frequency acceleration and decelera-tion rates

Set in increments of 1 Hz for acceleration/deceleration rates from 1 to 65,635 Hz (every 4 ms).

The acceleration and deceleration rates can be set independently only with the PLS2 instruction.

Changing SVs during instruction execu-tion

The target frequency, acceleration/deceleration rate, and target position can be changed.

Duty factor Fixed at 50%

Pulse output method Pulse + direction inputs (CW/CCW inputs 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(2147483648 to 2147483647)

Pulse output PV’s relative/absolute coordinate specifications

Absolute coordinates are specified automatically when the origin location has 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-tions

The pulse type can be specified with an operand in the PULS or PLS2 instruc-tion.

Note The absolute pulse specification can be used when absolute coordiates are specified for the pulse output PV, i.e. the origin location has been defined.The absolute pulse specification cannot be used when relative coordinates are specified, i.e. the origin location is undefined. An instruc-tion 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)

The PVs are refreshed during regular I/O refreshing.

Page 231: CP1E CPU Unit Software Users Manual

14-9

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-2 Trapezo

idal C

on

trol

14

14-2-1 Determ

ine the Pulse O

utput Port, O

utput Method, and O

utput Waveform

14-2 Trapezoidal Control

This section describes how to use pulse outputs with trapezoidal acceleration and deceleration whenusing the PLS2 instruction.

Specify pulse output 0 or 1 in the instruction operands.

Specify the pulse + direction method in the instruction operands.

Specify the output waveform in the instruction operands.

Selecting Relative or Absolute CoordinatesThe 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.

14-2-1 Determine the Pulse Output Port, Output Method, and Output Waveform

Pulse Output Port

Pulse Output Method

Output Waveform

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 pulses

Relative coordinates: 0000 0000 to 7FFF FFFF hex (Incre-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)

14-2-2 Relative Pulse Outputs and Absolute Pulse Outputs

ConditionsOrigin has been

defined by an origin search

Origin has been defined by executing the INI instruction

to change the PV

Origin undefined (Origin search has not been performed and PV has not been changed with the

INI instruction.)

Pulse output PV’s coordinate

system

Absolute coordinates Relative coordinates

Target frequency

Starting frequency

Acceleration rate

Specified number of pulses

Deceleration rate

Page 232: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-10 CP1E CPU Unit Software User’s Manual(W480)

Relationship between the Coordinate System and Pulse SpecificationThe 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 thePULS or PLS2 instruction is executed.

Pulse outputspecified in PULS

or PLS2

Relative coordinate system Absolute coordinate system

Origin undefined:The No-origin Flag will be ON in this case.

Origin defined:The No-origin Flag will be OFF in this case.

Relative pulsespecification

Positions the system to another position relative to the present position.

Number of movement pulses = Number of pulses setting

The pulse output PV after instruction execution = Number of movement pulses = Number of pulses setting

Note The pulse output PV is reset to 0 just before pulses are output. After that, the specified number of pulses is output.

The following example shows the number of pulses setting = 100 counterclockwise.

Pulse output PV range:8000 0000 to 7FFF FFFF hexNumber of pulses setting range:0000 0000 to 7FFF FFFF hex

The pulse output PV after instruction execution = PV + Number of movement pulses.

The following example shows the num-ber of pulses setting = 100 counterclock-wise.

Pulse output PV range:8000 0000 to 7FFF FFFF hexNumber of pulses setting range:0000 0000 to 7FFF FFFF hex

Absolute pulse specification

The absolute pulse specification cannot be used when the origin location is undefined, i.e., when the system is operating in the relative coordinate system. An instruction execution error will occur.

Positions the system to an absolute position relative to the origin.The num-ber of movement pulses and movement direction are calculated automatically from the present position (pulse output PV) and target position.

The following example shows the num-ber of pulses setting = +100.

Number of movement pulses = Number of pulses setting − Pulse output PV when instruction is executedThe 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 hexNumber of pulses setting range:8000 0000 to 7FFF FFFF hex

100

=

Number of pulses setting

Number of movement pulses

Target positionPulse output PV

Present position=0

0

100

Number of pulses setting=

Number of movement pulses

Target positionOrigin

Present positionPulse output PV

+100

0

+200

Number of pulses setting=

Number of movement pulses

Target position=Number of pulses setting

Origin

Present positionPulse output PV

Page 233: CP1E CPU Unit Software Users Manual

14-11

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-2 Trapezo

idal C

on

trol

14

14-2-3 Operations A

ffecting the Origin S

tatus (Defined/U

ndefined Status)

The following table shows the operations that can affect the origin status (origin defined or undefined),such as changing the operating mode and executing certain instructions.

The No-origin Flag will be ON when the corresponding pulse output’s origin is undefined and OFF whenthe origin is defined.

When the start input (CIO 0.00) goes ON, this example program outputs 600,000 pulses from pulseoutput 0 to turn the motor.

PLS2

PLC SetupThere are no settings that need to be made in the PLC Setup.

14-2-3 Operations Affecting the Origin Status (Defined/Undefined Status)

Current status PROGRAM mode RUN mode or MONITOR mode

Operation Origin defined Origin undefined Origin defined Origin undefined

Operating mode change

Switch to RUN or MONITOR

Origin becomes undefined.

Origin continues to be undefined.

− −

Switch to PROGRAM

− − Origin continues to be defined.

Origin continues to be undefined.

Instructionexecution

Origin search performed by ORG

− − Origin becomes defined.

Origin becomes defined.

PV changed by INI

− − Origin continues to be defined.

Origin becomes defined.

The Pulse Output Reset Bit turns ON.

Origin becomes undefined.

Origin continues to be undefined.

Origin becomes undefined.

Origin continues to be undefined.

14-2-4 Programming Example for Trapezoidal Control

Specifications and Operation

Applicable Instructions

Preparations

0.00

200Hz/4ms

100Hz

50,000 Hz

300Hz/4ms

Target frequency

Starting frequency

Start input

Acceleration rate

Number of output pulses600,000 pulses

Deceleration rate

Page 234: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-12 CP1E CPU Unit Software User’s Manual(W480)

DM Area Settings• Settings for PLS2 Instruction (D0 to D7)

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 reducedautomatically, i.e., triangular control will be performed.In some cases where the accelerationrate is substantially greater than the deceleration rate, the operation will not be true triangularcontrol. The motor will be operated at a constant speed for a short time between the accelera-tion and deceleration.

Setting Address Data

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 pulses D4 #27C0

D5 #0009

Starting frequency: 100 Hz D6 #0064

D7 #0000

Ladder Program

#0001#0100

D0D6

0.00

END(001)

@PLS2

Start input← Pulse output 1

← Starting frequency← Target frequency, number of pulses setting← Specifies Pulse + Direction output method, CW, and relative pulses

Page 235: CP1E CPU Unit Software Users Manual

14-13

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-3 Jog

gin

g

14

14-3-1 Determ

ine the Pulse O

utput Port and P

ulse Output M

ethod

14-3 Jogging

Jogging can be performed by using the SPED and ACC instructions. This section describes the stepsfor jogging.

Specify pulse output 0 or 1 with the instruction operands.

Specify the pulse + direction method in the instruction operands. (Pulse plus direction inputs must be

used.)

Start pulse output without acceleration or deceleration using the SPED (SPEED OUTPUT) instruction.Set the target frequency of the SPED instruction to 0 Hz to stop the pulse output.

Start pulse output with acceleration or deceleration using the ACC (ACCELERATION CONTROL)instruction. Set the target frequency of the ACC instruction to 0 Hz to stop the pulse output.

14-3-1 Determine the Pulse Output Port and Pulse Output Method

Pulse Output Port

Pulse Output Method

14-3-2 Pulse Waveform and Applicable Instructions

Low-speed Jogging (Pulse Output without Acceleration or Deceleration)

Target frequency Starting pulse output: 1 Hz to 100 kHz (in increments of 1 kHz)

Stopping pulse output: 0 Hz

Direction specification Set to CW or CCW.

Mode specification Set to continuous mode.

High-speed Jogging (Pulse Output with Acceleration or Deceleration)

Target frequency Starting pulse output: 1 Hz to 100 kHz (in increments of 1 kHz)

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.

Target frequency

Pulse output started Pulse output stopped

Target frequency

Pulse output started Pulse output stopped

Acceleration and deceleration rate

Page 236: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-14 CP1E CPU Unit Software User’s Manual(W480)

The following example shows jogging without acceleration or deceleration executed using a SPEDinstruction. 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.

The example shows jogging with acceleration and deceleration executed using an ACC instruction. It isused for high-speed jogging.

• Clockwise high-speed jogging will be executed from pulse output 1 while CIO 0.04 is ON.

• Counterclockwise high-speed jogging will be executed from pulse output 1 while CIO 0.05 is ON.

PLC SetupThere are no settings that need to be made in the PLC Setup.

DM Area Settings• Settings to Control Speed while Jogging (D0 to D1 and D10 to D15)

14-3-3 Programming Example for Jogging

Specifications and Operation

Preparations

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 (Not used.)

D13 #0064

Target frequency (stop): 0 Hz D14 #0000

D15 #0000

1,000Hz Target frequency

CW low-speed jogging (CIO 0.00)

CCW low-speed jogging (CIO 0.01)

100,000Hz100Hz/4ms

100Hz/4ms

Target frequency

CW high-speed jogging (CIO 0.04)

CCW high-speed jogging (CIO 0.05)

Acceleration/deceleration rate

Acceleration/deceleration rate

Page 237: CP1E CPU Unit Software Users Manual

14-15

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-3 Jog

gin

g

14

14-3-3 Program

ming E

xample for Jogging

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 bespecified in the PLS2 instruction.

Ladder Program

SPED#0001#0100

D0

0.00

SET W0.00

A281.04

SPED

SPED

SPED

#0001#0100#0000

W0.00

RSET W0.00

0.00

#0001#0110

D0

0.01

SET W0.01

A281.04

#0001#0110#0000

W0.01

RSET W0.01

0.01

ACC

#0001

#0100D10

0.04

SET W0.02

A281.04

ACC

#0001

#0100D13

W0.02

RSET W0.02

0.04

ACC

#0001

#0110D10

0.05

SET W0.03

A281.04

ACC

#0001

#0110

D13

W0.03

RSET W0.03

0.05

END

Low-speed CW Start

Low-speed CW Start

Pulse Output in Progress

Pulse Output in Progress

Pulse Output in Progress

Pulse Output in Progress

Low-speed CW output in progress

Low-speed CCW StartLow-speed CCW output in progress

High-speed CW Start

High-speed CW Start

Low-speed CCW Start

High-speed CW output in progress

High-speed CCW Start

High-speed CCW StartHigh-speed CCW output in progress

← Pulse output 1← Specifies Pulse + Direction output method, CW, and continuous mode.← Target frequency

← Specifies Pulse + Direction output method, CW, and continuous mode.← Acceleration/deceleration rate and target frequency

← Pulse output 1← Specifies Pulse + Direction output method, CCW, and continuous mode.← Acceleration/deceleration rate and target frequency

← Target frequencyz← Specifies Pulse + Direction output method, CCW, and continuous mode.← Pulse output 1

← Pulse output 1

Page 238: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-16 CP1E CPU Unit Software User’s Manual(W480)

14-4 Performing Origin Searches

When the ORG instruction executes an origin search, it outputs pulses to actually move the motor anddefines 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-Zsignal 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 highspeed, and run at that speed until the origin proximity position is detected. After the Origin ProximityInput is detected, the motor is decelerated to the origin search low speed and run at that speed until theorigin position is detected. The motor is stopped at the origin position.

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.

14-4-1 Origin Searches

1

0

1

0

Origin Proximity Input Signal

Origin Input Signal

Pulse frequency

Origin search acceleration rate

Origin search high speed

Deceleration point

Origin search deceleration rate

Origin search low speed

Origin search initial speed

Start

Execution of ORG

Decelerate from high to low speed

Indicated by the Origin Proximity Input Signal

Stop

Indicated by the Origin Input Signal

Time

(Example for reversal mode 1 and method 0 (described later))

Page 239: CP1E CPU Unit Software Users Manual

14-17

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-2 Flow

of Processing

Specify pulse output 0 or 1 in the instruction operands.

Specify the pulse + direction method in the instruction operands. (Pulse plus direction outputs must beused.)

Connections for Pulse Output 0

14-4-2 Flow of Processing

1You can set the pulse output method, output pulse 0 or 1, and whether to use terminals 00 and 01, or 02 and 03 on the 100CH terminal block for pulse outputs.

2 Set the origin search parameters in the Pulse Output 0 and Pulse Output 1 Tab Pages of the PLC Setup using the CX-Programmer.

3 • Output the status of the Limit Signal Inputs and Positioning Completed Signal to Auxil-iary Area bits.

• Execute ORG.Specify an origin search.

14-4-3 Setting the Pulse Output Port and Pulse Output Method

Pulse Output Port

Pulse Output Method

Connecting the Servo Drive and External Sensors

Terminal block

Addresses Signal

Origin search

Terminal block label

Terminal number Operating mode 0 Operating mode 1 Operating mode 2

CIO 100 00 CIO 100.00 stored in A276 and A277.

Pulse Connect to Servo Drive’s pulse input (PULS).

02 CIO 100.02 Direction Connect to Servo Drive’s direction input (SIGN).

Normal input The external signal must be received as an input and the input status must be written to A540.08 in the ladder program.

CW limitsensor

Connect sensor to a normal input terminal.

Normal input The external signal must be received as an input and the input status must be written to A540.09 in the ladder program.

CCW limit sensor

Connect sensor to a normal input terminal.

CIO 0 06 CIO 0.06 Origin input signal

Connect to open-collector output from sensor or other device.

Connect to the phase-Z signal from the Servo Drive.

Connect to the phase-Z signal from the Servo Drive.

10 CIO 0.10 Origin Proxim-ity Input

Connect to sensor.

CIO 100 04 CIO 100.04 Error counter reset output

Not used. Connect to error counter reset (ECRST) of the Servo Drive.

Normal input The external signal must be received as an input and the input status must be written to A540.10 in the ladder program.

Positioning completed input

Not used. Connect the Posi-tioning Completed Signal (INP) from the Servo Drive to a normal input ter-minal.

Setting the pulse output method, setting the pulse output port number, assigning pulse output terminals, and wiring

PLC Setup

Ladder program

Cyclic task, interrupt task

Page 240: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-18 CP1E CPU Unit Software User’s Manual(W480)

Connections for Pulse Output 1

Use the following cables to connect to an OMRON Servo Drive.

Set the Servo Drive’s command pulse mode to feed pulse and forward/reverse signals because themethod of pulse output from a CP1E CPU Unit is pulse + direction.

Terminal block

Addresses Signal

Origin search

Terminal block label

Terminal number

Operating mode 0 Operating mode 1 Operating mode 2

CIO 100 01 CIO 100.01 stored in A278 and A279

Pulse Connect to Servo Drive’s pulse input (PULS).

03 CIO 100.03 Direction Connect to Servo Drive’s direction input (SIGN).

Normal input The external signal must be received as an input and the input status must be written to A541.08 in the ladder program.

CW limit sensor

Connect sensor to a normal input terminal.

Normal input The external signal must be received as an input and the input status must be written to A541.09 in the ladder program.

CCW limit sensor

Connect sensor to a normal input terminal.

CIO 0 07 CIO 0.07 Origin Input Signal

Connect to open-collector output from sensor or other device.

Connect to the phase-Z signal from the Servo Drive.

Connect to the phase-Z signal from the Servo Drive.

11 CIO 0.11 Origin Prox-imity Input

Connect to sensor.

CIO 100 05 CIO 100.05 Error counter reset output

Not used. Connect to error counter reset (ECRST) of the Servo Drive.

Normal input The external signal must be received as an input and the input status must be written to A541.10 in the ladder program.

Positioning completed input

Not used. Connect the Posi-tioning Completed Signal (INP) from the Servo Drive to a normal input ter-minal.

Connecting to OMRON Servo Drives

OMRON Servo DriveCable model: Indicates the cable length

(1m or 2m)

SmartStep2 Series (pulse string input) R7A-CPB S

SmartStep A Series (pulse string input) R88A-CPU S

SmartStep Junior (pulse string input) R7A-CPZ S

W Series (pulse string input) R88ACPW S

G Series (pulse string input) R88A-CPG S

Page 241: CP1E CPU Unit Software Users Manual

14-19

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-3 Setting the P

ulse Output P

ort and Pulse O

utput Method

Example: Connecting to a SmartStep2-series Servo Drive

Operating Mode 1

R7A-CPB S Cables for SmartStep2-series Servo Drives

10126-3000PE Connector Plug (3M)

10326-52A0-008 Connector Plug (3M)

AWG24 × 13P UL20276 Cable

Each twisted pair has wires of the same color and number of marks.

No. Wire color (mark color) Symbol1 Orange (Red 1) +24VIN2 Orange (Black 1) RUN3 Gray (Red 1) RESET4 Gray (Black 1) ECRST/VSEL25 White (Red 1) GSEL/VZERO/TLSEL6 White (Black 1) GESEL/VSEL17 Yellow (Red 1) NOT8 Yellow (Black 1) POT9 Pink (Red 1) /ALM10 Pink (Black 1) INP/TGON11 Orange (Red 2) BKIR12 Orange (Black 2) WARN13 Gray (Red 2) OGND14 Gray (Black 2) GND15 White (Red 2) +A16 White (Black 2) -A17 Yellow (Black 2) +B18 Yellow (Red 2) -B19 Pink (Red 2) +Z20 Pink (Black 2) -Z21 Orange (Red 3) Z22 Gray (Red 3) +CW/+PULS/+FA23 Gray (Black 3) -CW/-PULS/-FA24 White (Red 3) +CCW/+SIGN/+FB25 White (Black 3) -CCW/-SIGN/-FB26 Orange (Black 3) FG

+CCW

-CCW

+24VINECRST

GNDZ

RUNRESET

0GND/ALM

FG

X1

XB

DC24VX1

DC24V

BKIR

+CW

-CW

2kΩ

2kΩ

PIN

22

23

24

25

1

4

14

21

2

3

13

9

11

26

XW2-34G

XW2Z-J-B28

Output terminal block

Pulse output 0

CW output (CIO 100.00)

CCW output (CIO 100.01)

Error counter reset output 0 (CIO 100.04)

Origin search start switch (CIO 0.00)

Emergency stop switch (CIO 0.01)

PCB storage completed (CIO 0.03)

Stocker movement completed (CIO 0.04)

COM (CIO100)

Move stocker (CIO 100.02)

PCB storage enabled (CIO 100.03)

Input terminal block

Pulse 0 origin input signal (CIO 0.06)

COM

Pulse 0 origin proximity input signal (CIO 0.10)

Connector-Terminal Block Conversion Unit

Signal

Servo Drive RUN input

Servo Drive alarm reset input

SmartStep2

Page 242: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-20 CP1E CPU Unit Software User’s Manual(W480)

R7A-CPZ S Cables for SmartStep Junior Servo Drives

To perform an origin search or to use a Limit Input Signal as an input to a function other than originsearch, set the parameters on the Pulse Output 0 and Pulse Output 1 Tab Pages in the PLC Setup.

Pulse Output 0 or 1 Tab Page

No. Wire / mark colors Symbol1 Orange/Red (-) +CW/PULS2 Orange/Black (-) -CW/PULS3 Light gray/Red (-) +CCW/SIGN4 Light black/Black (-) -CCW/SIGN5 White/Red (-) +24VIN6 Yellow/Black (-) RUN7 White/Black (-) OGND8 Pink/Red (-) +ECRST9 Pink/Black (-) -ECRST

10 Orange/Red (--) Z11 Orange/Black (--) ZCOM12 Light gray/Red (--) /ALM13 Light gray/Black (--) BKIR14 Yellow/Red (-) INP

14-4-4 Settings in PLC Setup

Item Selection DescriptionBase Settings

Undefined Origin Hold When a Limit Input Signal is input, the pulse output is 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 Operation

Search Only The CW/CCW Limit Input Signal is used for origin 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 contacts for the Limit Input Signal.

NO Select when using NO contacts for the Limit Input Signal.

Search/ReturnInitial Speed

Set the motor’s starting speed when performing an origin search. Specified in units of pulses per second (pps).

Speed Curve Specify the acceleration/deceleration curve.Trapezoidal only Accelerates and decelerates linearly.

Page 243: CP1E CPU Unit Software Users Manual

14-21

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-4 Settings in P

LC S

etup

Item Selection DescriptionOrigin searches

Use origin search

Select this check box to use origin searches.

Search Direc-tion

Set the direction for detecting the Origin Input Signal. An origin search is performed so 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 Method

Set one of the following three methods to determine the parameters related to theOrigin 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 InputSignal. 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 Proximity Input Signal.

SearchOperation

Select one of the following two modes for the origin search operation pattern.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 Mode

This parameter determines the I/O signals that are used for origin search.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, even at the expense of position-ing accuracy.

Mode 2 In this mode, the Positioning Completed Signal from the Servo Drive is used. Use this mode when you want highpositioning accuracy.

Origin Input Signal

Specifies the type of Origin Input Signal (NC or NO).NC Sets a normally closed Origin Input Signal.NO Sets a normally open Origin Input Signal.

Proximity Input Signal

Specifies the type of Origin Proximity Input Signal (NC or NO).NC Sets a normally closed Origin Proximity Input Signal.NO Sets a normally open Origin Proximity Input Signal.

Origin Search High Speed

Sets the motor’s target speed when the origin search is executed. Specify the speed in the number of pulses per second (pps).

Setting range: 1 to 100 pps

Note The origin search will not be performed in these cases:Origin search high speed ≤ Origin search proximityspeedOrigin search proximity speed ≤ Origin search initialspeedOrigin Search

Proximity Speed

Sets the motor’s speed after the Origin Proximity Input Signal is detected. Specify the speed in the number of pulses per second (pps).

Origin Com-pensation

After the origin has been defined, the origin com-pensation can be set to compensate for a shift in the Proximity Sensor’s ON position, motor replacement, or other change.

Setting range: ~2,147,483,648 to 2,147,483,647 pulses

Note Once the origin has been detected in an origin search,the number of pulses specified in the origin compensa-tion is output, the present position is reset to 0, and thepulse output’s No-origin Flag is turned OFF.

Page 244: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-22 CP1E CPU Unit Software User’s Manual(W480)

Note 1 The power supply must be restarted after the PLC Setup is transferred in order to enable thepulse output settings.

2 Only the Origin Input Signal type can be changed while the power is turned ON. Other param-eters are updated when operation is started.

The OUT instruction is used in the ladder program to write signals received from the CW limit sensorand CCW limit sensor connected to normal inputs to the Auxiliary Area bits.

Item Selection DescriptionOrigin searches

Origin Search Acceleration Rate

Sets the motor’s acceleration rate when the origin search is executed. Specify the amount to increase the speed (Hz) per 4-ms interval.

Setting range: 1 to 65,535 Hz/4 ms

Origin Search Deceleration Rate

Sets the motor’s deceleration rate when the origin search function is decelerating. Specify the amount to decrease the speed (Hz) per 4-ms interval.

Setting range: 1 to 65,535 Hz/4 ms

Positioning Monitor Time

When the operating mode is set to mode 2, this setting 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.

Setting range: 0 to 9,999 ms

Note The actual monitoring time will be the Position-ing Monitor Time rounded up to the nearest 10-ms unit + 10 ms max. If the Positioning Monitor Time is set to 0, the func-tion 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.)

Origin Return

Origin Return Target Speed

Sets the motor’s target speed when the origin return is executed. Specify the speed in the number of pulses per second (pps).

Setting range: 1 to 100 pps

Origin Return Acceleration Rate

Sets the motor’s acceleration rate when the origin return operation starts. Specify the amount to increase the speed (Hz) per 4-ms interval.

Setting range: 1 to 65,535 Hz/4 ms

Origin Return Deceleration Rate

Sets the motor’s deceleration rate when the origin return function is decelerating. Specify the amount to decrease the speed (Hz) per 4-ms interval.

Setting range: 1 to 65,535 Hz/4 ms

14-4-5 Applicable Instructions

Outputting to the Auxiliary Area Using the OUT Instruction

Normal input from CW limit sensor

CW Limit Input Signal A540.08 or A541.08

Normal input from CCW limit sensor

CCW Limit Input Signal A540.09 or A541.09

Page 245: CP1E CPU Unit Software Users Manual

14-23

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-6 Details on the O

rigin Search F

unction

Bits Written in the Auxiliary Area

Execute the ORG instruction in the ladder program to perform an origin search with the specifiedparameters.

The operating mode parameter specifies the kind of I/O signals that are used in the origin search.

Note There are stepping motor drivers that are equipped with a Positioning Completed Signal like a servomotor.Operating modes 1 and 2 can be used with these stepping motor drivers.

Auxiliary AreaName

Word Bit

A540 08 Pulse Output 0 CW Limit Input Signal Signals received from external sen-sors connected to normal inputs must be written to the Auxiliary Area bits in the user program.

09 Pulse Output 0 CCW Limit Input Signal

A541 08 Pulse Output 1 CW Limit Input Signal

09 Pulse Output 1 CCW Limit Input Signal

ORIGIN SEARCH Instruction: ORG

14-4-6 Details on the Origin Search Function

Operating Mode

I/O signal Mode 0 Mode 1 Mode 2

Driver Stepping motor*1 Servomotor

Operation Origin Input Signal

Inputs signals are arranged so deceleration starts when the Origin Proximity Input Signal is received and then the Origin Input Signal is 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.

Even if an Origin Input Signal is received during deceleration, it is ignored. After the motor has reached the origin search proximity speed and the Origin Input Signal is received, the motor stops, com-pleting the origin search process.

Positioning Completed Signal

The Positioning Completed Signal from the driver is not connected. (See note.)

The Positioning Com-pleted Signal from the driver is not connected.

Use this mode when you want to reduce the pro-cessing time, even at the expense of positioning accuracy.

After detecting the origin, the origin search pro-cess is not completed until the Positioning Completed Signal is received.

Use this mode when you want high positioning accuracy.

ORG

C1

C2

C1:Port specifierPulse output 0: #0000Pulse output 1: #0001C2:Control dataOrigin search and pulse + direction output method: #0100

Page 246: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-24 CP1E CPU Unit Software User’s Manual(W480)

The use of an error counter reset output and positioning completed input depends on the mode asdescribed in the following table.

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 originsearch 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 (errorcode 0202) will be generated. In this case, the motor will decelerate to a stop.

I/O signal Mode 0 Mode 1 Mode 2

Origin InputSignal

Connected to the open-collector output from a sen-sor or other device.

Connected to the phase-Z signal from the Servo Drive.

Connected to the phase-Z signal from the Servo Drive.

Error counter reset output

Not used.(The origin search operation is completed when the origin is detected.)

Connected to the error counter reset of the Servo Drive.

Connected to the error counter reset of the Servo Drive.

Positioningcompleted input

Not used. Not used. Connected to the Position-ing Completed Signal from the Servo Drive.

Operations Detecting the Origin during Deceleration from High Speed

CCW CW

1

0

1

0

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Original pulse output pattern

Starts when ORG is executed Origin Input Signal Error (error code 0202)

OFFON Origin input turns ON during deceleration

Page 247: CP1E CPU Unit Software Users Manual

14-25

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-6 Details on the O

rigin Search F

unction

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 CounterReset Signal will be output for about 20 to 30 ms.

When the Origin Proximity Input Signal is received, the motor will begin decelerating from the originsearch high speed to the origin search proximity speed. In this operating mode, the motor will stop atthe Origin Input Signal after deceleration is completed.

Operating Mode 1 with Origin Proximity Input Signal Reverse (Origin Detection Method Setting = 0)

The Origin Input Signal can be detected immediately after the Origin Proximity Input Signal turnsOFF 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.)

1

0

1

0

Origin Input Signal (phase-Z signal)

Pulse output

Error Counter Reset Signal

Approx. 20 to 30 ms

CCW

CCW

CW

CW

1

0

1

0

Origin Proximity Input Signal

Origin Input Signal (phase-Z signal)

Pulse output

Verify that the Origin Proximity Input Signal’s dog setting is long enough (longer than the deceleration time.)

Origin Input Signal is ignored during deceleration

Motor stopped by an Origin Input Signal received after deceleration

Starts when ORG is executed

Starts when ORG is executed

Stop

Ideal time for the Origin Proximity Input Signal to go OFF

(Settings when the deceleration time is short)

Stop (*1)

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 Signal.

*1

Page 248: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-26 CP1E CPU Unit Software User’s Manual(W480)

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 OriginInput Signal is detected during deceleration.

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) fromthe Servo Drive is used. Connect the Positioning Completed Signal from the Servo Drive to a normalinput (origin search 0 to 3 input).

If origin compensation is not being applied, the Positioning Completed Signal is checked after theError Counter Reset Output. If origin compensation is being applied, the Positioning Completed Sig-nal is checked after the compensation operation is completed.

1

0

1

0

CCW

CCW

CW

CW

Origin Proximity Input Signal

Origin Input Signal (phase-Z signal)

Pulse output

(The deceleration time is relatively long in this case.)

(The deceleration time is relatively short in this case.)

Origin Input Signal is ignored during deceleration

Motor stopped by an Origin Input Signal received after deceleration

Motor stopped by an Origin Input Signal received after deceleration

Starts when ORG is executed

Starts when ORG is executed

Stop

Stop

1

0

1

0

Pulse output

Error Counter Reset Output

Positioning Completed Signal

Stop

Time

Page 249: CP1E CPU Unit Software Users Manual

14-27

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-6 Details on the O

rigin Search F

unction

Origin Detection Method 0: Origin Proximity Input Signal Reversal Required

Origin Detection Method 1: Origin Proximity Input Signal Reversal Not Required

Origin Detection Method 2: Origin Proximity Input Signal Not Used

Origin Search Operation Setting

1

0

1

0

CCW CW

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Deceleration starts when Origin Proximity Input Signal turns ON.

After the Origin Proximity Input Signal turns ON and then OFF, the motor is stopped when the Origin Input Signal turns ON.

Initial speed

Acceleration

High speed for origin search

Deceleration

Proximity speed for origin search

Start when ORG is executed Stop

1

0

1

0

CCW CW

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Deceleration starts when Origin Proximity Input Signal turns ON.

Initial speed

Acceleration

High speed for origin search

Deceleration

Proximity speed for origin search

Start when ORG is executed Stop

After the Origin Proximity Input Signal turns ON, the motor is stopped when the Origin Input Signal turns ON.

1

0Origin Input Signal

Pulse output

Initial speed

Acceleration

Start when ORG is executed Stop

Proximity speed for origin search

Deceleration starts when Origin Proximity Input Signal turns ON.

Page 250: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-28 CP1E CPU Unit Software User’s Manual(W480)

The following examples show how the operation patterns are affected by the origin detection methodand 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.

Using Reversal Mode 1

Operation Patterns for Origin Search Operating Mode and Origin Detection Method Settings

Origin search operation

Origin detection methodReversal mode 1

0: Origin Proximity Input Signal reversal required.(Recommended method)

1: Origin Proximity Input Signal reversal not required.

2: Origin Proximity Input Signal not used.

1

01

0

CCW

CCW

CCW

CW

CW

CW

Origin Proximity Input Signal

Origin Input Signal

Pulse outputHigh speed for origin search

Proximity speed for origin search

Start

Start

Start

Stop

Stop

Stop

CW Limit Input Signal (See note.)

Note When the Limit Input Signal is received, the motor stops without deceleration, reverses direction, and accelerates.

1

01

0

CCW

CCW

CCW

CW

CW

CW

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Note When the Limit Input Signal is received, the motor stops without deceleration, reverses direction, and accelerates.

Start

Start

Start

Stop

Stop

Stop

CW Limit Input Signal (See note.)

1

0

CCW

CCW

CCW

CW

CW

CW

Origin Input Signal

Pulse outputProximity speed for origin search

Start

Start

Start

Stop

Stop

Stop

CW Limit Input Signal (See note.)

Note When the direction of operation is reversed, it is reversed immediately without deceleration or acceleration.

Page 251: CP1E CPU Unit Software Users Manual

14-29

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-6 Details on the O

rigin Search F

unction

Using Reversal Mode 2

Origin search operation

Origin detection methodReversal mode 2

0: Origin Proximity Input Signal reversal required.

1: Origin Proximity Input Signal reversal not required.

2: Origin Proximity Input Signal not used.

1

0

1

0

CCW

CCW

CCW

CW

CW

CW

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Start Stop

Start

Stop

Start

CW Limit Input Signal (See note.)

Limit stop (error code:0200)

Note When the Limit Input Signal is received, the motor stops without deceleration.

1

0

1

0

CCW

CCW

CCW

CW

CW

CW

Origin Proximity Input Signal

Origin Input Signal

Pulse output

Start Stop

Stop

Start

Start

CW Limit Input Signal (See note.)

Limit stop (error code:0200)

Note When the Limit Input Signal is received, the motor stops without deceleration.

1

0

CCW

CCW

CCW

CW

CW

CW

Origin Input Signal

Pulse outputProximity speed for origin search

Start Stop

Stop Start

Start

CW Limit Input Signal (See note.)

Limit stop (error code:0201)

Note When the Limit Input Signal is received, the motor stops without deceleration.

Page 252: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-30 CP1E CPU Unit Software User’s Manual(W480)

Connect a Servo Drive and execute an origin search based on the Servomotor’s built-in encoder phase-Z signal and an Origin Proximity Input Signal.

Conditions

System Configuration

Applicable InstructionsORG

Any instruction, such as the OUT instruction, that can write the status of CIO 0.00 to A541.08 andthe status of CIO 0.01 to A541.09.

I/O Allocations (CP1E-N40/30/20DT - )• Inputs

14-4-7 Origin Search Examples

• Operating mode: 1 Uses the Servomotor encoder’s phase-Z signal as the Origin Input Signal.

• Origin search operation setting: 1 Sets reverse mode 1. Reverses direction when the Limit Input Signal is input in the origin search direction.

• Origin detection method: 0 Reads the Origin Input Signal after the Origin Input Signal turns ON and then turns OFF.

• Origin search direction: CW direction

Input terminalNameTerminal

block labelTerminal number

CIO 0 00 CW limit sensorThe status of CIO 0.00 is written to A541.08 in the ladder program using an OUT instruction.

01 CCW limit sensorThe status of CIO 0.01 is written to A541.09 in the ladder program using an OUT instruction.

06 Pulse Output 0 Origin Input Signal

10 Pulse Output 0 Origin Proximity Input Signal

CW limit sensor

Origin proximity input sensor

Workpiece CCW limit sensor Servomotor

Encoder

CIO 0.10: Origin proximity input sensorCIO 0.00: CW limit sensorCIO 0.01: CCW limit sensor

Servomotor Driver

CIO 0.06: Servomotor encoder’s phase-Z origin input

Pulse output from built-in output OUT0

Page 253: CP1E CPU Unit Software Users Manual

14-31

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-4 Perfo

rmin

g O

rigin

Search

es

14

14-4-7 Origin S

earch Exam

ples

• Outputs

Operation

Pulse Output Tab 0 Page in PLC Setup

Output terminal

NameTerminal block label

Terminal number

CIO 100 00 Pulse Output 0 CW output

01 Pulse Output 0 CCW output

Function Setting (example)

BaseSettings

Undefined Origin Hold

Limit Input Signal Operation Search Only

Limit Input Signal NO

Origin Search/Return Initial Speed

100 pps

Speed Curve Trapezoid

Origin searches

Use define origin operation Use

Origin Search Direction CW

Origin Detection Method Method 0

Origin Search Operation Inverse 1

Operation Mode Mode 1

Origin Input Signal NO

Origin Proximity Input Signal NO

Origin Search High Speed 2,000 pps

Origin Search Proximity Speed 1,000 pps

Origin Compensation Value 0

Origin Search Acceleration Ratio (Rate)

50(Hz/4 ms)

Origin Search Deceleration Ratio (Rate)

50(Hz/4 ms)

0

1

CW

0

1

100.00/100.01

CCW

Pulse Output 0

Pulse Output 0

Pulse Output 0

Origin Proximity Input 0.10

Origin Signal Input 0.06

Pulse frequency

Origin search acceleration rate

Origin search initial speed

Origin search high speed Origin search deceleration rate

Execution of ORG starts:Origin search starts

Stop

Origin search proximity speed

Page 254: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-32 CP1E CPU Unit Software User’s Manual(W480)

Ladder Diagram

ORG

#0000

#0100

0.00

0.01

A540.08

A540.09

CW limit sensor CW Limit Input Signal

CCW limit sensor CCW Limit Input Signal

Execution condition

Origin search 0: #0000

Origin search and pulse + direction method: #0100

Page 255: CP1E CPU Unit Software Users Manual

14-33

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-5 Retu

rnin

g to

the O

rigin

14

14-5 Returning to the Origin

An origin return operation moves the motor to the origin position from any other position. The originreturn 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.

The various origin return parameters are set on the Pulse Output 0 Tab Page in the PLC Setup.

Origin Return Parameters

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.

Origin Return

PLC Setup

Name Setting Setting range

Base Settings

Search/ReturnInitial Speed

Sets the motor’s starting speed when theorigin search is executed. Specify the speed in the number of pulses per second (pps).

1 to 100 kHz

Origin Return

Speed Sets the motor’s target speed when theorigin return is executed. Specify the speed in the number of pulses per second (pps).

1 to 100 pps

Acceleration Ratio (Rate)

Sets the motor’s acceleration rate when the origin return operation starts. Specify the amount to increase the speed (Hz) per 4-ms interval.

1 to 65,535(Hz/4ms)

Deceleration Ratio (Rate)

Sets the motor’s deceleration rate when the origin return function is decelerating. Specify the amount to decrease the speed (Hz) per 4-ms interval.

1 to 65,535(Hz/4ms)

Executing an Origin Return

Pulse frequency

Origin returninitial speed

Start

Started by executing ORG

Origin returnacceleration rate

Origin return target speed Origin returndeceleration rate

StopTime

ORG

C1

C2 C2:Control dataOrigin return and Pulse + Direction output method: #1100

C1:Port specifierPulse output 0: #0000Pulse output 1: #0001

Page 256: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-34 CP1E CPU Unit Software User’s Manual(W480)

14-6 Changing/Reading the Pulse Output Present Value

The present value of the pulse output can be changed by using the INI instruction. To define the presentvalue as the origin, set the pulse output PV to 0 using the INI instruction.

Example: Setting the Present Position as the Origin

The present value of a pulse output can be read in the following two ways.

The PV that is stored in the following words can be read using the MOVL instruction or other instruc-tions.

14-6-1 Changing the Present Value of the Pulse Output

Operands Settings

C1 Port specifier #0000 Pulse output 0

#0001 Pulse output 1

C2 Control data #0002 Changes PV

#0003 Stops pulse output

S First word with new PV

Store the new PV starting from this word when changing the PV(i.e., when C = #0002).

14-6-2 Reading the Present Value of a Pulse Output

• Value refreshed at the I/O refresh timing: Read PV from Auxiliary Area.

• Value updated when an instruction is executed: Read PV by executing a PRV instruction.

Reading the PV Refreshed at the I/O Refresh Timing

Read PV Auxiliary Area words

Pulse 0 A277 (upper digits) and A276 (lower digits)

Pulse 1 A279 (upper digits) and A278 (lower digits)

INI instruction executed

Example: 0

Origin return

Pulse outputPV

New origin Present origin

#0000

#0002

D100

D100

D101

@INI

15 0#0 0 0 0

#0 0 0 0

Execution condition

C1: Port specifier (example for pulse output 0)C2: Control data (example for changing PV)S:First word with new PV

Page 257: CP1E CPU Unit Software Users Manual

14-35

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-6 Ch

ang

ing

/Read

ing

the P

ulse O

utp

ut P

resent V

alue

14

14-6-2 Reading the P

resent Value of a P

ulse Output

Reading the Pulse Output PV with a PRV Instruction

Reading the Value When an Instruction Is Executed

#0000

#0002

D100

D100

D101

@PRV

15 0

Pulse output PV that was read

C1: Port specifier (example for pulse output 0)

C2: Control data (example for reading PV)

S: First destination word

Present value data lower bytes

Present value data upper bytes

Execution condition

Page 258: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-36 CP1E CPU Unit Software User’s Manual(W480)

14-7 Auxiliary Area Bits and Words Used with Pulse Outputs

Auxiliary Area Allocations

Name Description ValuesPulse output

0Pulse output

1

Pulse Output PV Storage Words

PV range: 8000 0000 to 7FFF FFFF hex~ (2,147,483,648 to 2,147,483,647)

Leftmost 4 digits A277 A279

Rightmost 4 digits A276 A278

Pulse Output Reset Bit

The pulse output PV will be cleared when this bit is turned ON.

0: Not cleared.

1: Clear PV.

A540.00 A541.00

CW Limit Input Signal Flag

This flag shows the status of the CW Limit Input Signal, which is used in the origin search.

Note The status of the signal from theCW limit input sensor connected toa normal input must be written toA540.08 or A541.08.

ON when turned ON from an external input.

A540.08 A541.08

CCW Limit Input Signal Flag

This flag shows the status of the CCW Limit Input Signal, which is used in the ori-gin search.

Note The status of the signal from theCCW limit input sensor connectedto a normal input must be written toA540.0 or A541.09.

ON when turned ON from an external input.

A540.09 A541.09

Positioning com-pleted input signal

This flag shows the status of the position-ing completed input signal, which is used in the origin search.

Note The status of the Positioning Com-pleted Signal from the Servo Driveconnected to a normal input mustbe written to A540.10 or A541.10.

ON when turned ON from an external input.

A540.10 A541.10

Accel/Decel Flag ON when pulses are being output accord-ing to an ACC or PLS2 instruction and the output frequency is being changed in steps (accelerating or decelerating).

0: Constant speed

1: Accelerating or decel-erating

A280.00 A281.00

Overflow/UnderflowFlag

ON when an overflow or underflow has occurred in the pulse output PV.

0: Normal

1: Overflow or underflow

A280.01 A281.01

Output Amount Set Flag

ON when the number of output pulses has been set with the PULS instruction.

0: No setting

1: Setting made

A280.02 A281.02

Output Completed Flag

ON when the number of output pulses set with the PULS/PLS2 instruction has been output.

0: Output not completed.

1: Output completed.

A280.03 A281.03

Output In-progress Flag

ON when pulses are being output from the pulse output.

0: Stopped

1: Outputting pulses.

A280.04 A281.04

No-origin Flag ON when the origin has not been defined for the pulse output.

0: Origin defined.

1: Origin undefined.

A280.05 A281.05

At-origin Flag ON when the pulse output PV matches the origin (0).

0: Not stopped at origin.

1: Stopped at origin.

A280.06 A281.06

Output Stopped Error Flag

ON when an error occurred while output-ting pulses in the origin search function.

0: No error

1: Stop error occurred.

A280.07 A281.07

Stop Error Code When a Pulse Output Stop Error occurs, the error code is stored in that pulse out-puts corresponding Stop Error Code word.

--- A444 A445

Page 259: CP1E CPU Unit Software Users Manual

14-37

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-1 Exam

ple 1: Cutting Long M

aterial Using F

ixed Feeding

14-8 Pulse Output Application Examples

OutlineIn this example, first jogging is used to position the material and then fixed-distance positioning isused to feed the material.

System Configuration

Operation

1 The workpiece is set at the starting position using the Jogging Switch Input (CIO 0.00).

2 The workpiece is fed the specified distance (relative) using the Positioning Switch Input (CIO

0.01).

3 When feeding has been completed, the cutter is activated using the Cutter Start Output (CIO

100.02).

4 Feeding is started again when the Cutter Finished Input (CIO 0.02) turns ON.

5 The feeding/cutting operation is repeated for the number of times specified for the counter (C0,

100 times).

6 When the operation has been completed, the Cutting Operation Finished Output (CIO 100.03) is

turned ON.

The feeding operation can be canceled and stopped at any point using the Emergency Switch Input(CIO 0.03).

14-8-1 Example 1: Cutting Long Material Using Fixed Feeding

Specifications and Operation

CWJogging

1000Hz(03E8)

10000Hz(2710Hex)

50000(C350)

Acceleration/deceleration: 1000Hz/4ms(03E8Hex)

Fixed-distance feeding

Material cut with cutter

Material cut with cutter

Material cut with cutter

OUT 100.03

IN 0.02

IN 0.00

IN 0.01

IN 0.03

OUT 100.02

Cutter finished

Cutter start

Pulse output (CW/CCW)

Cut operation finished

Jogging switch

Positioning switch

Emergency stop switch

*Normal I/O other than pulse outputs are used for I/O.

Page 260: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-38 CP1E CPU Unit Software User’s Manual(W480)

SPED

PLS2

PLC SetupThere are no settings that need to be made in the PLC Setup.

DM Area Settings• Speed Settings for Jogging (D0 to D3)

• Settings for PLS2 for Fixed-distance Feeding (D10 to D20)

Applicable Instructions

Preparations

Setting details Address Data

Target frequency: 1,000 Hz D0 #03E8

D1 #0000

Target frequency: 0000 Hz D2 #0000

D3 #0000

Setting details Address Data

Acceleration rate: 1,000 Hz/4 ms D10 #03E8

Deceleration rate: 1,000 Hz/4 ms D11 #03E8

Target frequency: 10,000 Hz D12 #2710

D13 #0000

Number of output pulses: 50,000 pulses

D14 #C350

D15 #0000

Starting frequency: 0000 Hz D16 #0000

D17 #0000

Counter setting: 100 times D20 #0100

Page 261: CP1E CPU Unit Software Users Manual

14-39

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-1 Exam

ple 1: Cutting Long M

aterial Using F

ixed Feeding

• The PLS2 instruction uses a relative pulse setting. This enables operation even if the origin is notdefined.The present position in A276 (lower 4 digits) and A277 (upper 4 digits) is set to 0 before pulse outputand then contains the specified number of pulses.

• The ACC instruction can be used instead of the SPED instruction for the jog operation. If ACC isused, acceleration/deceleration can be included in the jog operation.

Ladder Program

Additional Information

Jog Operation

0.00

Jogging Switch

0.00

Jogging Switch

A280.04

A280.03

A280.03

Pulse Output In-Progress Flag

W0.00

Jogging Flag

Fixed-distance Feed0.01

0.01

0.02

Positioning Switch

Cutter Finished

Pulse Output Completed Flag

Pulse Output Completed Flag

Counting Feed Operations

Positioning Switch

C0000

0.03

Emergency Stop Switch

SPED

#0000

#0100

D0

SPED

#0000

#0100

D2

SET W0.00

RSET W0.00

Target frequency: 1000Hz

Jogging Flag

Target frequency: 0Hz

Jogging Flag

@PLS2

#0000

#0100

D10

D16

100.02

100.03

Cutter activated

CNT

0000

D20

Cutting Operation Finished

INI

#0000

#0003

0

Page 262: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-40 CP1E CPU Unit Software User’s Manual(W480)

OutlinePCBs with components mounted are stored in a stocker.

When a stocker becomes full, it is moved to the conveyance point.

Operation PatternAn origin search is performed.

Fixed-distance positioning is repeated.

The system is returned to the original position.

14-8-2 Example 2: Vertically Conveying PCBs (Multiple Progressive Positioning)

Specifications and Operation

From mounter

Stocker conveyance position

Positioning Operation for Vertical Conveyor

Return to start

CWCCW

Origin search

CWCCW

Originproximity

10,000 (2710 Hex)

50,000 Hz(C350 Hex)

CCW limit

Origin (servo phase Z)

Fixed-distance positioning repeated

CW limit

PCB storage completed

PCB storage enabled

Stocker moved

Stocker movement completed

Acceleration/deceleration: 1,000 Hz/4 ms (03E8 hex)

Page 263: CP1E CPU Unit Software Users Manual

14-41

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-2 Exam

ple 2: Vertically C

onveying PC

Bs (M

ultiple Progressive P

ositioning)

Wiring Example Using SmartStep A-series Servo Drive

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.02) and only the conveyor is lowered (absolute

positioning) when stoker movement is completed (CIO 0.04).

The operation can be canceled and pulse output stopped at any point using the Emergency SwitchInput (CIO 0.01).

Emergency Stop Switch (CIO 0.01)

PCB Storage Completed (CIO 0.03)

PCB Storage Enabled (CIO 100.03)

SmartStep A-seriesServo Drive

R88A-CPU00Sand resistor

Stocker Moved (CIO 100.02)

Stocker Movement Completed

(CIO 0.04)

Origin Search Start Switch (CIO 0.00)

1

2

5

6

8

13

14

18

10

35

34

7

+CW

-CW

+ECRST

-ECRST

INP

33 ZCOM

32 Z

+24VIN

RUN

RESET

OGND

ALMCOM

ALM

FG

X1

XB

24-VDCX1

24-VDCBKIR

Pulse output (CIO 100.00)

Direction output (CIO 100.02)

4

3 +CCW

-CCW

1.6kΩ

1.6kΩ

1.6kΩ

CP1E N-type CPU Unit

Output terminal block

Pulse output 0

Servo Drive RUN input

Servo Drive alarm reset input

SmartStep A-series Servo Drive

R88A-CPU00S

Hood

Error counter reset output 0 (CIO 100.04)

24-VDC input terminal (+)

24-VDC input terminal (-)

COM (CIO 100)

Move stocker (CIO 100.02)

PCB storage enabled (CIO 100.03)

Input terminal block

Pulse 0 origin input signal (CIO 0.06)

COM

Pulse 0 origin input signal (CIO 0.10)

Origin search start switch (CIO 0.00)

Emergency stop switch (CIO 0.01)

PCB storage completed (CIO 0.03)

Stocker movement completed (CIO 0.04)

Page 264: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-42 CP1E CPU Unit Software User’s Manual(W480)

PLC Setup

* The origin search enable setting is read from the PLC Setup when the power supply is turned ON.

DM Area Settings• Settings for PLS2 for Fixed-distance Positioning (D0 to D7)

• Settings for PLS2 to Return to Start (D10 to D17)

• Number of Repeats of Fixed-distance Positioning Operation (D20)

Preparations

Setting

Enable origin search function for pulse output 0.

Setting 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

Setting details Address Data

Acceleration rate: 300 Hz/4 ms D10 #012C

eceleration rate: 200 Hz/4 ms D11 #00C8

Target frequency: 50,000 Hz D12 #C350

D13 #0000

Number of output pulses: 10,000 × 15 pulses D14 #49F0

D15 #0002

Starting frequency: 100 Hz D16 #0064

D17 #0000

Setting details Address Data

Number of repeats of fixed-distance positioning operation (number of PCBs in stocker)

D20 #0015

Page 265: CP1E CPU Unit Software Users Manual

14-43

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-2 Exam

ple 2: Vertically C

onveying PC

Bs (M

ultiple Progressive P

ositioning)

Ladder Program

0.00

0.03

Jog Operation

Origin searchstart switch

W0.00

W0.00

W0.01

W0.01

W0.01

W0.05

W0.03

W0.02

W0.02

W0.02

W0.03W0.04

W0.04

W0.04

W0.09

Origin searchin progress

Origin searchcompleted

Origin searchcompleted

PCB stored

100.03

100.03

PCB storage enabled

PositioningLift 10,000 pulses (relative) at a time

Lift positioningcompleted

Lift positioning completed

Lift positioningin progress

A280.03

Pulse Output Completed Flag

Counter for number of lifts (number of PCBs stored)

Lower positioningcompleted

No-origin Flag

Lift positioning start

Lift positioning start

Lift positioning start

PCB storage completed

A280.05

Origin search in progress

Origin search completed

PCB storage enabled

Lift positioning in progress

Lift positioning completed

@PLS2

#0000

#0100

D0

D6

CNT

0000

#0100

ORG

#0000

#0100

Page 266: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-44 CP1E CPU Unit Software User’s Manual(W480)

A540.08

When the stocker is not full (C0 = OFF), store PCB,and repeat lift positioning after PCB storage is completed.

W0.04

Lift positioningcompleted

Lift positioningcompleted

C0000

W0.04

W0.06 W0.07

W0.05

W0.06C0000

Stocker full

Stocker full

When the stocker is full (C0 = ON), move the stocker,and start lower positioning after stocker movement is completed.

100.02

100.02

Stocker moved Lower positioning

Stocker movingoutput

0.04

Stocker movement completed

PositioningLower to "0" position (absolute pulses)

W0.09

W0.09

W0.07

W0.07

W0.08

W0.08

Lower positioningcompleted

Lower positioningstart

Lower positioningin progress

A280.03

Pulse Output Completed Flag

Emergency stop (Pulse output stopped)

Repeat limit input settingsLimit inputs are allocated to external sensors using the following programming.

Emergency stop switch

0.01

0.05

0.07

Built-in input

Built-in input

A540.09

CW Limit Input Signal Flag

CCW Limit Input Signal Flag

Lower positioning completed

Lower positioning in progress

Lower positioning

PCB stored

Stocker moving output

Stocker moved

@PLS2

#0000

#0101

D10

D16

@INI

#0000

#0003

0

Page 267: CP1E CPU Unit Software Users Manual

14-45

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-3 Exam

ple 3: Feeding W

rapping Material: Interrupt F

eeding

Feeding Wrapping Material in a Vertical Pillow Wrapper

Operation PatternSpeed control is used to feed wrapping material to the initial position. When the marker sensor inputis received, fixed-distance positioning is performed before stopping.

Operation

1 Speed control is used to feed wrapping material to the initial position when the Start Switch (CIO

0.00) is activated.

2 When the Marker Sensor Input (CIO 0.04) is received, the PLS2 instruction is executed in inter-

rupt task 2.

3 Fixed-distance positioning is executed with the PLS2 instruction before stopping.

4 An emergency stop is executed to stop pulse output with the Emergency Stop input (CIO 0.01).

14-8-3 Example 3: Feeding Wrapping Material: Interrupt Feeding

Specifications and Operation

Start switch (CIO 0.00)

Emergency stop switch (CIO 0.01)

Pulse output

Marker sensor(Built-in input 0.04)

Speedcontrol

Positioncontrol

10,000 Hz(2710 Hex) 500 Hz/4ms

(01F4 Hex)

Speed controlPosition control5,000 (1388 hex)pulses output before stopping.

PLS2 is executed ininput interrupt task.

Marker sensor input(0.04)

Page 268: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-46 CP1E CPU Unit Software User’s Manual(W480)

PLC Setup

Note The interrupt input setting is read from the PLC Setup when the power supply is turned ON.

DM Area Settings• Speed Control Settings to Feed Wrapping Material to Initial Position

• Positioning Control Settings for Wrapping Material

Preparations

Setting

Enable using built-in input IN0 as an interrupt input.

Setting Address Data

Acceleration/deceleration rate: 500 Hz/4 ms

D0 #03E8

Target frequency: 10,000 Hz D1 #2710

D2 #0000

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 pulses

D14 #1388

D15 #0000

Starting frequency: 0 Hz D16 #0000

D17 #0000

Page 269: CP1E CPU Unit Software Users Manual

14-47

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-8 Pu

lse Ou

tpu

t Ap

plicatio

n E

xamp

les

14

14-8-3 Exam

ple 3: Feeding W

rapping Material: Interrupt F

eeding

Cyclic Task Program (Executed at Startup)

Program for Interrupt Task 2

Ladder Program

P_First Cycle

Enabling Input Interrupt 0 (IN0)

First Cycle Flag

Feeding Material with Speed Control

0.00 W0.01

W0.00

Material feed start

Material feed start

Material positioningcompleted

Pulse OutputCompleted Flag

Pulse outputin progress

A280.03 A280.04

Emergency Stop

0.01

Emergency stop switch

W0.00

W0.01

Material being fed

Material positioning completed

@ACC

#0000

#0100

D0

MSKS

100

#0

@INI

#0000

#0003

0

@PLS2

#0000

#0100

D10

D16

Interrupt Task for Master Sensor Input IN0Starting interrupt feed

P_ON

Always ON Flag

Page 270: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-48 CP1E CPU Unit Software User’s Manual(W480)

14-9 Precautions When Using Pulse Outputs

When operating with the absolute pulse specification, the movement direction is selected automaticallybased on the relationship between the pulse output PV when the instruction is executed and the speci-fied target position. The direction (CW/CCW) specified in an ACC or SPED instruction is not effective.

Pulse outputs will stop when either the CW or CCW Limit Input Signals turns ON. It is also possible toselect whether or not the defined origin will be cleared when a CW or CCW Limit Input Signal turns ONfor an origin search or other pulse output function.

The CP1E CPU Unit’s pulse output frequency is determined by dividing the source clock frequency (32 MHz) by an integer ratio. Consequently, there may be a slight difference between the set frequencyand the actual frequency, and that difference increases as the frequency increases. The actual fre-quency can be calculated from the following equations.

Pulse Output System

Equations

Movement Direction When Specifying Absolute Pulses

Using CW/CCW Limit Inputs for Pulse Output Functions Other than Origin Searches

Difference between Set Frequencies and Actual Frequencies

32MHz

Integer dividing ratio calculated from user’s set frequency

Source clock Frequency divider

Output pulses (actual frequency)

Actual frequency (Hz)=INTSource clock frequency

Dividing ratio

Dividing ratio=INTSource clock frequency × 2 + Set frequency

Set frequency (Hz) × 2

The INT function extracts an integer from the fraction. The non-integer remainder is rounded.

Page 271: CP1E CPU Unit Software Users Manual

14 - 49

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-9 Precau

tion

s Wh

en U

sing

Pu

lse Ou

tpu

ts

14

Differences between Set Frequencies and Actual Frequencies

The following tables show when a second pulse control instruction can be started if a pulse controloperation is already being executed.

A second independent-mode positioning instruction can be started if an independent-mode positioninginstruction is being executed, and a second continuous-mode speed control instruction can be started ifa continuous-mode speed control instruction is being executed. Operation cannot be switched betweenthe independent and continuous modes, although a PLS2 instruction can be executed while a ACCinstruction (continuous mode) is being executed.

It is possible to start another operation during acceleration/deceleration and start another positioninginstruction during positioning.

Source clock frequency: 32 MHz

Set frequency (kHz) Actual frequency (kHz)

99.844 to 100.000 100.000

99.534 to 99.843 99.688

: :

50.040 to 50.117 50.078

49.961 to 50.039 50.000

49.889 to 49.960 49.921

: :

10.002 to 10.004 10.003

9.999 to 10.001 10.000

9.995 to 9.998 9.996

Combinations of Pulse Control Instructions

Instruction being executed

Instruction being started( :Can be executed. :Error occurs.)

INISPED

(Indepen-dent)

SPED (Contin-uous)

ACC (Inde-

pendent)

ACC (Contin-uous)

PLS2 ORG

SPED (Independent) (*1) (*3)

SPED (Continuous) (*2) (*5)

ACC(Continuous)

Steady speed (*4) (*6)

Accelerating or decelerating

(*4) (*6)

ACC(Continuous)

Steady speed (*5) (*7)

Accelerating or decelerating

(*5) (*7)

PLS2 Steady speed (*4) (*8)

Accelerating or decelerating

(*4) (*8)

ORG Steady speed

Accelerating or decelerating

*1 SPED (Independent) to SPED (Independent)

• The number of output pulses cannot be changed.

• The frequency can be changed.

• The output mode cannot be switched.

*2 SPED (Continuous) to SPED (Continuous)

• The frequency can be changed.

• The output mode cannot be switched.

Page 272: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-50 CP1E CPU Unit Software User’s Manual(W480)

The CP1E CPU Unit’s pulse output function performs a basic error check before starting to outputpulses (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 maystop the pulse output.

If an error occurs that stops pulse output, the pulse output’s Output Stopped Error Flag will be turnedON and the Pulse Output Stop Error Code will be written to Error Code word. Use these flags and errorcodes to identify the cause of the error.

The Pulse Output Stop Errors will not affect the CPU Unit’s operating status. (The Pulse Output StopErrors do not cause a fatal or non-fatal error in the CPU Unit.)

*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.

• The output mode cannot be switched.

*4 ACC (Independent) to ACC (Independent) or PLS2 to ACC (Independent)

• The number of output pulses cannot be changed.

• The frequency can be changed.

• The acceleration/deceleration rate can be changed. (The rate can even be changedduring acceleration or deceleration.)

• The output mode cannot be switched.

*5 SPED (Continuous) to ACC (Continuous) or ACC (Continuous) to ACC (Continuous)

• The frequency can be changed. (The target frequency can even be changed duringacceleration or deceleration.)

• The acceleration/deceleration rate can be changed. (The rate can even be changedduring acceleration or deceleration.)

• The output mode cannot be switched.

*6 ACC (Independent) to PLS2

• The number of output pulses can be changed. (The setting can even be changedduring acceleration or deceleration.)

• The frequency can be changed. (The target frequency can even be changed duringacceleration or deceleration.)

• The acceleration/deceleration rate can be changed. (The rate can even be changedduring acceleration or deceleration.)

• The output mode cannot be switched.

*7 ACC (Continuous) to PLS2

• The frequency can be changed. (The target frequency can even be changed duringacceleration or deceleration.)

• The acceleration/deceleration rate can be changed. (The rate can even be changedduring acceleration or deceleration.)

• The output mode cannot be switched.

*8 PLS2 to PLS2

• The number of output pulses can be changed. (The setting can even be changedduring acceleration or deceleration.)

• The frequency can be changed. (The target frequency can even be changed duringacceleration or deceleration.)

• The acceleration/deceleration rate can be changed. (The rate can even be changedduring acceleration or deceleration.)

• The output mode cannot be switched.

Origin Search Error Processing

Page 273: CP1E CPU Unit Software Users Manual

14-51

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-9 Precau

tion

s Wh

en U

sing

Pu

lse Ou

tpu

ts

14

Related Auxiliary Area Flags

Pulse Output Stop Error Codes

FunctionPulse

output 0Pulse

output 1Output Stopped Error Flags

ON when an error occurred while outputting pulses in the origin search function.

0: No error

1: Stop error occurred.

A280.07 A281.07

Stop Error Codes

When a Pulse Output Stop Error occurs, the error code is stored in that pulse outputs corresponding Stop Error Code word.

A444 A445

Error nameError code

Likely cause Corrective actionOperation after

errorCW Limit Stop Input Signal

0100 Stopped due to a CW limit sig-nal input.

Move in the CCW direction. Immediate stop

No effect on other portCCW Limit

Stop Input Sig-nal

0101 Stopped due to a CCW limit sig-nal input.

Move in the CW direction.

No Origin Prox-imity Input Sig-nal

0200 The parameters indicate that the Origin Proximity Input Signal is being used, but a Origin Proxim-ity Input Signal was not received during the origin search.

Check the wiring of the Origin Proximity Input Signal as well as the PLC Setup’s Origin Proximity Input Signal Type setting (NC or NO) and execute the origin search again. Turn the power supply OFF and then ON if the signal type setting was changed.

No effect on other port

No Origin Input Signal

0201 The Origin Input Signal was not received during the origin search.

Check the wiring of the Origin Input Signal as well as the PLC Setup’s Origin Input Signal Type setting (NC or NO) and execute the ori-gin search again. Turn the power supply OFF and then ON if the signal type setting was changed.

Origin Input Signal Error

0202 During an origin search in oper-ating mode 0, the Origin Input Signal was received during the deceleration started after the Origin Proximity Input Signal was received.

Take one or both of the following steps so that the Origin Input Signal is received after deceleration is completed.

• Increase the distance between the Origin Proximity Input Signal sensor and Origin Input Signal sensor.

• Decrease the difference between the origin search’s high speed and proximity speed settings.

Decelerates to a stop.

No effect on other port

Limit Inputs in Both Directions

0203 The origin search cannot be performed because the limit sig-nals for both directions are being input simultaneously.

Check the wiring of the limit signals in both directions as well as the PLC Setup’s Limit Signal Type setting (NC or NO) and execute the origin search again. Turn the power sup-ply OFF and then ON if the signal type set-ting was changed.

Operation will not start.

No effect on other port

Simultaneous Origin Proximity and Limit Inputs

0204 The Origin Proximity Input Sig-nal and the Limit Input Signal in the search direction are being input simultaneously during an origin search.

Check the wiring of the Origin Proximity Input Signal and the Limit Input Signal. Also check the PLC Setup’s Origin Proximity Input Signal Type and Limit Signal Type settings (NC or NO) and then execute the origin search again. Turn the power supply OFF and then ON if a signal type setting was changed.

Immediate stop

No effect on other port

Limit Input Sig-nal Already Being Input

0205 • When an origin search in one direction is being performed, the Limit Input Signal is already being input in the ori-gin search direction.

• When a non-regional origin search is being performed, the Origin Input Signal and the Limit Input Signal in the oppo-site direction (from the search direction) are being input simultaneously.

Check the wiring of the Limit Input Signal and the PLC Setup’s I/O settings. Also check the PLC Setup’s Limit Signal Type setting (NC or NO) and then execute the origin search again. Turn the power supply OFF and then ON if the signal type setting was changed.

Immediate stop

No effect on other port

Page 274: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-52 CP1E CPU Unit Software User’s Manual(W480)

Error nameError code

Likely cause Corrective actionOperation after

errorOrigin Proximity Input Signal Origin Reverse Error

0206 • When an origin search with reversal at the limit is being performed, the Limit Input Sig-nal in the search direction was input while the Origin Proxim-ity Input Signal was reversing.

• 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 was input while the Origin Input Signal was reversing.

Check the installation positions of the Origin Proximity Input Signal, Origin Input Signal, and Limit Input Signal as well as the PLC Setup’s I/O settings. Also check the PLC Setup’s Signal Type settings (NC or NO) for each input signal and then execute the origin search again. Turn the power supply OFF and then ON if a signal type setting was changed.

Immediate stop

No effect on other port

Positioning Timeout Error

0300 The Servo Drive’s Positioning Completed Signal does not come ON within the Positioning Monitor Time specified in the PLC Setup.

Adjust the Positioning Monitor Time setting or Servo system gain setting. Check the Positioning Completed Signal wiring, correct it if necessary, and then execute the origin search again.

Decelerates to a stop.

No effect on other port

Page 275: CP1E CPU Unit Software Users Manual

14-53

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-10 Pu

lse Ou

tpu

t Details

14

14-10-1 Continuous M

ode (Speed C

ontrol)

14-10Pulse Output Details

The CP1E 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 speed control.

The following operations can be performed in Continuous Mode by combining instructions.

14-10-1 Continuous Mode (Speed Control)

Starting a Pulse Output

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Output with specified speed

Changing the speed (fre-quency) in one step

Outputs pulses at a specifiedfrequency.

SPED(Continuous)

• Port• Pulse + direction

• Continuous

• Target frequency

Output with specified acceleration and speed

Accelerating the speed(frequency) at a fixed rate

Outputs pulses and changes the frequency at a fixed rate.

ACC(Continuous)

• Port• Pulse + direction

• Continuous

• Acceleration/deceleration rate

• Target frequency

Changing Settings

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Change speed in one step

Changing the speed during operation

Changes the frequency (higher or lower) of the pulse output in one step.

SPED(Continuous)

↓SPED(Continuous)

• Port• Continuous

• Target frequency

Change speed smoothly

Changing the speed smoothly during operation

Changes the frequency from the present fre-quency at a fixed rate. The frequency can be acceler-ated or decel-erated.

ACC or SPED(Continuous)

↓ACC(Continuous)

• Port• Continuous

• Target frequency

• Acceleration/deceleration rate

Pulse frequency

Target frequency

Execution of SPED

Time

Pulse frequency

Target frequency

Execution of ACC

Time

Acceleration/deceleration rate

Pulse frequency

Target frequency

Present frequency

Execution of SPED

Time

Pulse frequency

Target frequency

Present frequency

Execution of ACC

Time

Acceleration/decelerationrate

Page 276: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-54 CP1E CPU Unit Software User’s Manual(W480)

* 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 stopimmediately.

Changing the speed in a polyline curve during operation

Changes the acceleration or deceleration rate during acceleration or deceleration.

ACC(Continuous)

↓ACC(Continuous)

• Port

• Continuous• Target frequency

• Acceleration/deceleration rate

Change direction

Not supported.

Change pulse output method

Not supported.

Stopping a Pulse Output

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Stop pulse output

Immediate stop Stops the pulse output immediately.

SPED or ACC(Continuous)

↓INI

• Port

• Stop pulseoutput

Stop pulse output

Immediate stop Stops the pulse output immediately.

SPED or ACC(Continuous)

↓SPED(Continuous)

• Port• Continuous

• Targetfrequency=0

Stop pulse output smoothly

Decelerate to a stop

Decelerates the pulse out-put to a stop.*

SPED or ACC(Continuous)

↓ACC(Continuous)

• Port• Continuous

• Targetfrequency=0

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Pulse frequency

Target frequency

Present frequency

Execution of ACC

Execution of ACCExecution of ACC

Time

Acceleration/deceleration rate n

Acceleration/deceleration rate 2Acceleration/decelerationrate 1

Pulse frequency

Presentfrequency

Execution of INI

Time

Pulse frequency

Presentfrequency

Execution of SPED

Time

Pulse frequency

Presentfrequency

Execution of ACC

TimeTargetfrequency=0

Acceleration/deceleration rate (Rate set at the start of the operation.)

Page 277: CP1E CPU Unit Software Users Manual

14-55

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-10 Pu

lse Ou

tpu

t Details

14

14-10-2 Independent Mode (P

ositioning)

The following operations can be performed in Independent Mode by combining instructions.

14-10-2 Independent Mode (Positioning)

Starting a Pulse Output

OperationExample

applicationFrequency changes Description

Procedure

Instruc-tion

Settings

Output with specified speed

Positioning without accel-eration or deceleration

Starts outputting pulses at the speci-fied frequency and stops immediately when the specified number of pulses has been output.*1

Note The target position (spec-ified number of pulses) cannot be changed dur-ing position-ing.

PULS

↓SPED(Indepen-dent)

• Number of pulses

• Relative or absolute pulse speci-fication

• Port

• Pulse + Direction

• Independent• Target fre-

quency

Simple trape-zoidal control

Positioning with trapezoi-dal accelera-tion and deceleration (Same rate used for accel-eration and deceleration; no starting speed)The number of pulses cannot be changed during posi-tioning.

Accelerates and decelerates at the same fixed rate and stops immediately when the specified number of pulses has been output.

PULS

↓ACC(Indepen-dent)

• Number of pulses

• Relative or absolute pulse speci-fication

• Port

• Pulse + Direction

• Independent

• Accelera-tion and decelera-tion rate

• Target fre-quency

Complex trapezoidal control

Positioning with trapezoi-dal accelera-tion and deceleration (Separate rates used for acceleration and decelera-tion; starting speed)

The number of pulses can be changed dur-ing position-ing.

Accelerates and decelerates at a fixed rates. The pulse output is stopped when the specified number of pulses has been output.*1

Note The target position (spec-ified number of pulses) can be changed during posi-tioning.

PLS2 • Number of pulses

• Relative or absolute pulse speci-fication

• Port

• Pulse + Direction

• Accelera-tion rate

• Decelera-tion rate

• Target fre-quency

• Starting fre-quency

Pulse frequency

Targetfrequency

Execution of SPED

Time

Specified number of pulses (Specified with PULS)

Outputs the specified number of pulses and then stops.

Time

Pulse frequency

Target frequency

Acceleration/deceleration rate

Specified number of pulses (Specified with PULS)

Outputs the specified number of pulses and then stops.

Execution of ACC

Execution of PLS2

Time

Acceleration rate

Targetfrequency

Starting frequency

Deceleration rate

Specified number of pulses

Target frequency reached

Deceleration pointOutput stops

Stop frequency

Pulse frequency

Page 278: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-56 CP1E CPU Unit Software User’s Manual(W480)

*1 Triangular ControlIf the specified number of pulses is less than the number required just to reach the target frequency and returnto zero, the function will automatically reduce the acceleration/deceleration time and perform triangular control(acceleration and deceleration only.) An error will not occur.

Changing Settings

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Change speed in one step

Changing the speed in one step during oper-ation

SPED can be exe-cuted during posi-tioning to change (raise or lower) the pulse output fre-quency in one step.The target position (specified number of pulses) is not changed.

PULS

↓SPED(Independent)

↓SPED(Independent)

• Number of pulses

• Relative or absolute pulse speci-fication

• Port• Pulse +

Direction• Indepen-

dent• Target fre-

quency

Change speed smoothly (with accelera-tion rate = decelera-tion rate)

Changing the target speed (fre-quency) during posi-tioning(accelera-tion rate = decelera-tion rate)

ACC can be exe-cuted during posi-tioning to change the acceleration/deceleration rate and target fre-quency.

The target position (specified number of pulses) is not changed.

PULS

↓ACC(Independent)

↓ACC(Independent)

• Number of pulses

• Relative or absolute pulse speci-fication

• Port

• Pulse + Direction

• Indepen-dent

• Accelera-tion/decel-eration rate

• Target fre-quency

Pulse frequency

Target frequency

Execution of ACC

Time

Specified number of pulses (Specified with PULS)

Pulse frequency

Target frequency

Execution of PLS2

Specified number of pulses (Specified with PLS2)

Time

Pulse frequency

New target frequency

Target frequency

Execution of SPED (independent mode)

SPED (independent mode) executed again to change the target frequency. (The target position is not changed.)

Time

Specified number of pulses (Specified with PULS.)

Number of pulses specified with PULS does not change.

Pulse frequency

New target frequency

Target frequency

Time

Specified number of pulses (Specified with PULS.)

Number of pulses specified with PULS does not change.

Execution of ACC (independent mode)

ACC (independent mode) executed again to change the target frequency. (The target position is not changed, but the acceleration/deceleration rate is changed.)

Acceleration/deceleration rate

Page 279: CP1E CPU Unit Software Users Manual

14-57

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-10 Pu

lse Ou

tpu

t Details

14

14-10-2 Independent Mode (P

ositioning)

Change speed smoothly (with unequal accelera-tion and decelera-tion rates)

Changing the target speed (fre-quency) during posi-tioning(different accelera-tion and decelera-tion rates)

PLS2 can be exe-cuted during posi-tioning to change the acceleration rate, deceleration rate, and target fre-quency.

Note To prevent the target position from being changed intentionally, the original target posi-tion must be specified in absolute coordinates.

PULS

↓ACC (Independent)

↓PLS2

• Number of pulses

• Relative or absolute pulse speci-fication

• Port• Pulse +

Direction• Accelera-

tion rate• Decelera-

tion rate• Target fre-

quency

• Starting fre-quency

PLS2

↓PLS2

Change targetposition

Change the target posi-tion during

PLS2 can be exe-cuted during posi-tioning to change the target position (number of pulses).

Note When the tar-get position cannot be changed without main-taining the same speed range, an error will occur and the original oper-ation will con-tinue to the original tar-get position.

PULS

↓ACC(Independent)

↓PLS2

• Number of pulses

• Relative or absolute pulse speci-fication

• Port• Pulse +

Direction • Accelera-

tion rate• Decelera-

tion rate• Target fre-

quency• Starting fre-

quency

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Pulse frequency

New target frequency

Target frequency

Execution of ACC (independent mode)

PLS2 executed to change the target frequency and acceleration/deceleration rates.(The target position is not changed. The original target position is specified again.)

Time

Acceleration/deceleration rate

Specified number of pulses (Specified with PULS.)

Pulse frequency

Target frequency

Execution of PLS2

PLS2 executed to change the target position.(The target frequency and a cceleration/deceleration rates are not changed.)

Time

Acceleration/deceleration rate

Secified number of pulses

Number of pulses changed with PLS2.

Page 280: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-58 CP1E CPU Unit Software User’s Manual(W480)

OperationExample applica-

tionFrequency changes Description

Procedure

Instruc-tion

Settings

Change target posi-tion and speed smoothly

Change the target position and target speed (fre-quency) during positioning (multiple start func-tion)

PLS2 can be executed during positioning to change the target position (number of pulses), acceleration rate, decel-eration rate, and target frequency.

Note When the settings cannot be changed without maintaining the same speed range, an error will occur and the origi-nal operation will continue to the orig-inal target position.

PULS

↓ACC (Indepen-dent)

↓PLS2

• Number of pulses

• Relative or absolute pulse spec-ification

• Port

• Pulse + Direction

• Accelera-tion rate

• Decelera-tion rate

• Target fre-quency

• Starting frequency

Change the accel-eration and decelera-tion rates during positioning (multiple start func-tion)

PLS2 can be executed during positioning (accel-eration or deceleration) to change the acceleration rate or deceleration rate.

PLS2

↓PLS2

• Number of pulses

• Accelera-tion rate

• Decelera-tion rate

Change direction

Change the direc-tion during positioning

PLS2 can be executed during positioning with absolute pulse specifica-tion to change to absolute pulses and reverse direc-tion.

PULS

↓ACC (Indepen-dent)

↓PLS2

• Number of pulses

• Absolute pulse spec-ification

• Port• Pulse +

Direction • Accelera-

tion rate• Decelera-

tion rate• Target fre-

quency• Starting

frequency

PLS2

↓PLS2

Change pulse out-put method

Not supported.

Pulse frequency

New target frequency

Target frequency

Execution of PLS2

PLS2 executed to change the target position, target frequency, and acceleration/deceleration rates

Time

Acceleration/deceleration rate

Specified number of pulses

Number of pulses changed with PLS2.

Pulse frequency

New target frequency

Target frequency

Execution of PLS2

Execution of PLS2

Execution of PLS2 #N

Execution of PLS2

Time

Acceleration/deceleration rate 3

Acceleration/deceleration rate 2Acceleration/deceleration rate 1

Acceleration/deceleration rate n

Number of pulses specified by PLS2 #N.

Pulse frequency

Targetfrequency

Execution of PLS2

Execution of PLS2

Time

Secified number of pulses

Change of direction at the specified deceleration rate

Number of pulses (position) changed by PLS2

Page 281: CP1E CPU Unit Software Users Manual

14-59

14 Pulse Outputs

CP1E CPU Unit Software User’s Manual(W480)

14-10 Pu

lse Ou

tpu

t Details

14

14-10-2 Independent Mode (P

ositioning)

Stopping a Pulse Output

OperationExample

applicationFrequency changes Description

Procedure

Instruction Settings

Stop pulse output (Number of pulses set-ting is not reserved.)

Immediate stop

Stops the pulse output immedi-ately and clears the number of output pulses setting.

PULS

↓ACC or SPED (Independent)

↓INI

• Stop pulse output

PLS2

↓INI

Stop pulse output(Number of pulses set-ting is not preserved.)

Immediate stop

Stops the pulse output immedi-ately and clears the number of output pulses setting.

PULS

↓SPED(Independent)

↓SPED

• Port

• Indepen-dent

• Target fre-quency = 0

Stop sloped pulse out-put smoothly. (Number of pulses set-ting is not preserved.)

Decelerate to a stop

Decelerates the pulse output to a stop.

Note ACC started the opera-tion, the original acceler-ation/deceleration rate will remain in effect.If SPED started the oper-ation, the accelera-tion/deceleration rate will be invalid and the pulse output will stop immedi-ately.

PULS

↓ACC or SPED (Independent)

↓ACC(Independent)

• Port

• Indepen-dent

• Target fre-quency = 0

PLS2

↓ACC(Independent)

Pulse frequency

Present frequency

Execution of SPED

Execution of INI

Time

Pulse frequency

Present frequency

Execution of SPED

Execution of SPED

Time

Pulse frequency

Present frequency

Target frequency=0

Original acceleration/deceleration rate

Execution of ACC

Time

Page 282: CP1E CPU Unit Software Users Manual

14 Pulse Outputs

14-60 CP1E CPU Unit Software User’s Manual(W480)

Switching from Continuous Mode (Speed Control) to Independent Mode (Positioning)

Example application

Frequency changes DescriptionProcedure

Instruction Settings

Change from speed control to fixed dis-tance posi-tioning during operation

PLS2 can be executed during a speed control operation started with ACC to change to position-ing operation.

Note An error will occur if a constant speed cannot be achieved after switching the mode. If this hap-pens, the instruction execution will be ignored and the pre-vious operation will be continued.

ACC(Continuous)

↓PLS2

• Port• Acceleration

rate• Deceleration

rate• Target fre-

quency• Number of

pulses

Note The start-ing fre-quency is ignored.

Fixed dis-tance feed interrupt

Time

Targetfrequency

Execution of ACC(continuous)

Execution of PLS2

Pulse frequency

Outputs the number of pulses specified in PLS2 (Both relative and absolute pulse specification can be used.)

Pulse frequency

Time

Presentfrequency

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

Page 283: CP1E CPU Unit Software Users Manual

15-1CP1E CPU Unit Software User’s Manual(W480)

15

This section describes the variable-duty-factor pulse outputs.

15-1 Variable-duty-factor Pulse Outputs (PWM Outputs) . . . . . . . . . . . . . . . . . 15-215-1-1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

PWM Outputs

Page 284: CP1E CPU Unit Software Users Manual

15 PWM Outputs

15-2 CP1E CPU Unit Software User’s Manual(W480)

15-1 Variable-duty-factor Pulse Outputs (PWM Outputs)

PWM outputs can be used only with the CP1E N-type CPU Unit.

A PWM (Pulse Width Modulation) pulse can be output with a specified duty factor. The duty factor is theratio of the pulse’s ON time and OFF time in one pulse cycle. Use the PWM instruction to generate vari-able-duty-factor pulses from a built-in output. The duty factor can be changed during pulse output.

Application example:

• Controlling temperature on a time-proportional basis using the variable-duty-factor output.

• Controlling the brightness of lighting.

* The frequency can be set up to 6553.5 Hz in the PWM instruction, but the duty factor accuracy declines signifi-cantly at high frequencies because of limitations in the output circuit at high frequencies.

15-1-1 Overview

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 Pulse with variable duty factor (PWM)

Duty factor:50%

100%

50%

75%

15%

Duty factor:15%

Duty factor:75%

Built-in output

Variable-duty-factor output

Period is determinedby frequency

Page 285: CP1E CPU Unit Software Users Manual

15-3

15 PWM Outputs

CP1E CPU Unit Software User’s Manual(W480)

15-1 Variab

le-du

ty-factor P

ulse O

utp

uts (P

WM

Ou

tpu

ts)

15

15-1-1 Overview

The following terminals can be used for pulse outputs according to the pulse output method.

Specifications and OperationWhen 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, PWMoutput 0 is stopped.

Instructions UsedPWM

INI

Preparations• PLC Setup

There are no settings that need to be made in the PLC Setup.

• DM Area Settings

• PWM Operand Settings (F and D)

Flow of Processing

1 Terminal 01 on terminal block 100CH is used for PWM output 0.

2 • The PWM instruction is used to control PWM outputs.

• PWM outputs are stopped with the INI instruction.

Pulse Output Port Number and Pulse Output Terminals

Output terminal blockSpecifications made with PWM instruction

Other functions that cannot be used at the same time

Terminal block label

Terminal number

Pulse output methodNormal output

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

Ladder Program Example with PWM Outputs

Setting pulse output port,assigning pulse output terminals,and wiring.

Ladderprogramming

Cyclic task,interrupt task.

Start input (CIO 0.00)

Frequency: 2,000 Hz, 500 µs

Stop input (CIO 0.01)

Duty factor: 40%, 200 µs

Page 286: CP1E CPU Unit Software Users Manual

15 PWM Outputs

15-4 CP1E CPU Unit Software User’s Manual(W480)

Ladder Diagram

Setting Operand Data

Frequency: 2,000 Hz D0 #4E20

Duty factor: 40% D1 #0190

@PWM#1000

D0D1

END(001)

#1000#0003D10

0.00

0.01

Start input

Stop input

←PWM output 0 (Duty factor in increments of 0.1%, Frequency in increments of 0.1 Hz)←Frequency setting←Duty factor setting

←PWM output 0←Stops pulse output←Not used.

@INI

Page 287: CP1E CPU Unit Software Users Manual

16-1CP1E CPU Unit Software User’s Manual(W480)

16

This section describes communications with Programmable Terminals (PTs) withoutusing communications programming, no-protocol communications with general compo-nents, and connections with a Modbus-RTU Easy Master, Serial PLC Link, and hostcomputer.

16-1 Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-316-1-1 Types of CPU Units and Serial Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3

16-1-2 Overview of Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-4

16-1-3 Built-in RS-232C Port for N-type CPU Units . . . . . . . . . . . . . . . . . . . . . . . . . 16-516-1-4 Optional Serial Communications Board for N-type CPU Units

with 30 or 40 I/O Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-6

16-2 Wiring for Serial Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-916-2-1 Recommended RS-232C Wiring Example . . . . . . . . . . . . . . . . . . . . . . . . . . 16-916-2-2 Recommended RS-422A/485 Wiring Examples . . . . . . . . . . . . . . . . . . . . . 16-10

16-2-3 Converting the Built-in RS-232C Port to RS-422A/485 . . . . . . . . . . . . . . . . 16-11

16-2-4 Reducing Electrical Noise for External Wiring . . . . . . . . . . . . . . . . . . . . . . . 16-14

16-3 Program-free Communications with Programmable Terminals . . . . . . 16-1516-3-1 OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1516-3-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-16

16-3-3 PLC Setup and PT System Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-16

16-3-4 Wiring Examples for PTs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-17

16-4 No-protocol Communications with General Components . . . . . . . . . . . 16-1916-4-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-1916-4-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-20

16-4-3 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-20

16-4-4 Device Wiring Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2116-4-5 Related Auxiliary Area Bits and Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-23

16-5 Modbus-RTU Easy Master Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-2416-5-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-24

16-5-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-24

16-5-3 DM Fixed Allocation Words for the Modbus-RTU Easy Master . . . . . . . . . . 16-2516-5-4 Programming Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-27

16-6 Serial PLC Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3316-6-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-33

16-6-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-34

Serial Communications

Page 288: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-2 CP1E CPU Unit Software User’s Manual(W480)

16-6-3 PLC Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-34

16-6-4 Wiring Example for PLCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-35

16-6-5 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3716-6-6 Example Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-42

16-7 Connecting the Host Computer (Not Including Support Software) . . . . 16-4416-7-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-44

16-7-2 Flow of Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-44

Page 289: CP1E CPU Unit Software Users Manual

16-3

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-1 Serial C

om

mu

nicatio

ns

16

16-1-1 Types of CP

U U

nits and Serial P

orts

16-1 Serial Communications

Serial communications can be used only with the CP1E N-type CPU Unit.

N-type CPU Unit• CPU Units with 20 I/O Points have one built-in RS-232C port. There are no option slots.

• CPU Units with 30 or 40 I/O Points have one built-in RS-232C port and one option slot. An RS-232C or RS-422A/485 Option Board can be mounted for serial communications.

E-type CPU UnitThere is no serial port.

16-1-1 Types of CPU Units and Serial Ports

NS-series PT or NP-series PT

1:N NT Link

General component

No-protocolcommunications

Modbus-RTU EasyMaster communications

Inverter

Host computer (A Programming Device is not required.)

Host Link

Standard built-in RS-232C port

CPU with 20I/O Points

CP1E N-typeCPU Unit

One Option Board for serial communications (CP1W-

CIF01 RS-232C Option Board, CP1W-CIF11 RS-

422A/485 Option Board, or CP1W-CIF12 RS-

422A/485 Option Board) can be mounted in the

option slot.

Standard built-in RS-232C port

CP1E N-typeCPU Unit

CPU Unit with 30 or 40 I/O Points

Connected devices Connected devices

NS-series PT or NP-series PT

1:N NT Link

General component

Inverter

No-protocolcommunications

Modbus-RTU EasyMaster communications

Host computer (A ProgrammingDevice is not required.)

Host Link

* Serial PLC Links cannot be usedon two ports at the same time.

CP-series PLCor CJ1M PLC CP-series PLC or CJ1M PLC

Serial PLC Links*Serial PLC Links*

Page 290: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-4 CP1E CPU Unit Software User’s Manual(W480)

The CP1E CPU Units support the following types of serial communications.

16-1-2 Overview of Serial Communications

Connected devices DescriptionCommunications

protocolBuilt-in

RS-232COptional

serial port

Programmable Terminal Data can be exchanged with PTs without using a communi-cations program in the CPU Unit.

Note Only one PT can be con-nected when using a 1:N NT Link. It is not possible to connect two PTs.

1:N NT Links (Host Link is also supported.)

OK OK

General component Communicates with general devices, such as barcode readers, with an RS-232C or RS-422A/485 port without a command-response format. The TXD and RXD instructions are executed in the ladder pro-gram in the CPU Unit to trans-mit data from the transmission port or read data in the recep-tion port.

No-protocol communications

OK OK

Modbus-RTU slave devices, such as invert-ers (Modbus-RTU Easy Master)

Data can be easily exchanged with general devices that sup-port Modbus-RTU slave func-tionality (such as inverters) and are equipped with an RS-232C port or RS-422A/485 port.

Modbus-RTU Easy Master Function

OK OK

Data links between CPU Units Data links can be created for up to nine CP-series or CJ1M CPU Units, including one Poll-ing Unit and up to eight Polled Units. Up to 10 words can be shared per Unit. PTs set for 1:N NT Links can also be included as Polled Units in the same network.

Note A PT cannot be included in the Serial PLC Links.

Serial PLC Links OK OK

CP1E

RS-232C

NS/NP-series PT

NT Link

CP1E

RS-232C or RS-422A/485

General device withserial communications

CP1E

RS-232C or RS-422A/485

RS-422A/485 Option Board

Inverter

RS-422A/485

CP1E CPU Unit Polling UnitRS-422A/485 Option Board

Shared data

CP1E CPU Unit Polled Unit CP1L CPU Unit Polled Unit

Page 291: CP1E CPU Unit Software Users Manual

16-5

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-1 Serial C

om

mu

nicatio

ns

16

16-1-3 Built-in R

S-232C

Port for N

-type CP

U U

nits

RS-232C Connector

Connected devices DescriptionCommunications

protocolBuilt-in

RS-232COptional

serial port

Host computers PLC data can be read by the host computer or written to the PLC from the computer. The host computer sends a Host Link command (C Mode) or a FINS command to the CPU Unit to read/write I/O memory, change the operating mode, or to force-set/reset bits in the CPU Unit.

Note Connecting to the CX-Programmer is not possi-ble with this protocol.Use the USB port.

Host Link OK OK

16-1-3 Built-in RS-232C Port for N-type CPU Units

Pin Abbr. Signal nameSignal

direction

1 FG Frame ground −

2 SD(TXD) Send data Output

3 RD(RXD) Receive data Input

4 RS(RTS) Request to send Output

5 CS(CTS) Clear to send Input

6 5V Power supply −

7 DR(DSR) Data set ready Input

8 ER(DTR) Data terminal ready Output

9 SG(0V) Signal ground −

Connector hood

FG Frame Ground −

RS-232C

Computer(Not including the CX-Programmer and other Support Software.)

Host Link

5

6

1

9

Page 292: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-6 CP1E CPU Unit Software User’s Manual(W480)

The Option Board can be mounted in the option slot of a CP1E N-type CPU Unit with 30 or 40 I/OPoints.

When mounting an Option Board, first remove the slot cover. Grasp both of the cover’s up/down locklevers at the same time to unlock the cover, and then pull the cover out.

Then to mount the Option Board, check the alignment and firmly press it in until it snaps into place.

Precautions for Correct UsePrecautions for Correct Use

Always turn OFF the power supply to the PLC before mounting or removing an Option Board.

16-1-4 Optional Serial Communications Board for N-type CPU Units with 30 or 40 I/O Points

Model number PortMaximum trans-mission distance

Connection method

CP1W-CIF01 One RS-232C port 15m Connector (D-sub, 9 pin female)

CP1W-CIF11 One RS-422A/485 port (not isolated)

50m Terminal block (using ferrules)

CP1W-CIF12 One RS-422A/485 port (isolated)

500m Terminal block (using ferrules)

CP1W-CIF01 RS-232C Option Board

CP1E N-type CPU Unit with 30 or 40 I/O Points

CP1W-CIF01 RS-232C Option Board

CP1W-CIF11/12 RS-422A/485 Option Board

COMM

Front BackCommunications

Status Indicator

CPU Unit Connector

RS-232C Connector

Page 293: CP1E CPU Unit Software Users Manual

16-7

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-1 Serial C

om

mu

nicatio

ns

16

16-1-4 Optional S

erial Com

munications B

oard for N-type

CP

U U

nits with 30 or 40 I/O

Points

RS-232C Connector

RS-422A/485 Terminal Block

Pin Abbr. Signal nameSignal

direction

1 FG Frame ground −

2 SD(TXD) Send data Output

3 RD(RXD) Receive data Input

4 RS(RTS) Request to send Output

5 CS(CTS) Clear to send Input

6 5V Power supply −

7 DR(DSR) Data set ready Input

8 ER(DTR) Data terminal ready Output

9 SG(0V) Signal ground −

Connector hood

FG Frame ground −

CP1W-CIF11/CIF12 RS-422A/485 Option Board

5

6

1

9

COMM

Front Back

RS-422A/485 Connector

RDA- RDB+ SDA- SDB+ FG

CPU Unit Connector

DIP Switch for Operation Settings

LED Communications Status Indicator

RDB+

RDA-

SDA- SDB+

FG

Tighten the terminal block screws toa torque of 0.28 N·m.

Page 294: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-8 CP1E CPU Unit Software User’s Manual(W480)

DIP Switch for Operation Settings

*1 Set both pins 2 and 3 to either ON (2-wire) or OFF (4-wire).

*2 To disable the echo-back function, set pin 5 to ON (RS control enabled).

*3 When connecting to a device on the N side in a 1: N connection with the 4-wire method, set pin 6 to ON (RScontrol enabled). Also, when connecting by the 2-wire method, set pin 6 to ON (RS control enabled).

Pin Settings

1 ON ON (both ends) Terminating resistance selection

OFF None

2 ON 2-wire 2-wire or 4-wire selection*1

OFF 4-wire

3 ON 2-wire 2-wire or 4-wire selection*1

OFF 4-wire

4 − − Not used.

5 ON RS control enabled RS control selection for RD*2

OFF RS control disabled (Data always received.)

6 ON RS control enabled RS control selection for SD*3

OFF RS control disabled (Data always received.)

1 2 3 4 5 6

O N

Page 295: CP1E CPU Unit Software Users Manual

16-9

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-2 Wirin

g fo

r Serial C

om

mu

nicatio

ns

16

16-2-1 Recom

mended R

S-232C

Wiring E

xample

16-2 Wiring for Serial Communications

Serial communications can be used only with the CP1E N-type CPU Unit.

We recommend the following wiring methods for RS-232C, especially in environment prone to noise.

1 Always use shielded twisted-pair cables as communications cables.

Recommended RS-232C Cables

2 Combine signal wires and SG (signal ground) wires in a twisted-pair cable. At the same time,

bundle the SG wires to the connectors on Option Board and the remote device.

3 Connect the shield of the communications cable to the hood (FG) of the RS-232C connector on

the Option Board. At the same time, ground the ground (GR) terminal of the CPU Unit to 100 Ωor less.

A connection example is shown below.

Example: Twisted-pair Cable Connecting SD-RD, RD-SD, and SG-SG Terminals in Host Link Mode

The following cables can be used for this connection.

Note The hood (FG) is internally connected to the ground terminal (GR) on the CPU Unit. Therefore, FG is grounded by grounding the power supply ground terminal (GR). Although there is conduc-tivity between the hood (FG) and pin 1 (FG), connect the shield to both the hood and pin 1 to reduce the con-tact resistance between the shield and FG and thus provide better noise resistance.

16-2-1 Recommended RS-232C Wiring Example

Recommended RS-232C Wiring Examples

Model Manufacturer

UL2464 AWG28×5P IFS-RVV-SB (UL product)AWG28×5P IFVV-SB (non-UL product)

Fujikura Ltd.

UL2464-SB (MA) 5P×28AWG (7/0.127) (UL product) CO-MA-VV-SB 5P×28AWG (7/0.127) (non-UL product)

Hitachi Cable, Ltd.

Length Model

2m XW2Z-200S-CV

5m XW2Z-500S-CV

123456789

CDRDSDERSGDRRSCSCI

123456789

FGSDRDRSCS5VDRERSG

CPU Unit DOS/V computer

Signal SignalPin Pin

RS-232C interface

RS-232C interface

D-sub, 9-pin connector (male) D-sub, 9-pin connector (female)

SG signal wires

Bundle the SG wires

Aluminum foil

XM2S-0911-E

Page 296: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-10 CP1E CPU Unit Software User’s Manual(W480)

Refer to A-4 Wiring for Serial Communications in the CP1E Hardware User’s Manual (Cat. No.W479) for connector wiring methods.

Use the following wiring methods for RS-422A/485 to maintain transmission quality.

1 Use shielded twisted-pair cables as communications cables.

Recommended RS-422A/485 Cables

2 Connect the shield of the communications cable to the FG terminal on the RS-422A/485 Option

Board. Also ground the ground (GR) terminal of the CPU Unit to 100 Ω or less.

Precautions for Correct UsePrecautions for Correct Use

Always ground the shield only at the RS-422A/485 Option Board end. Grounding both ends ofthe shield may damage the device due to the potential difference between the ground terminals.

Connection examples are shown below.

2-Wire and 4-Wire ConnectionsThe transmission circuits for 2-wire and 4-wire connections are different, as shown in the followingdiagram.

Precautions for Correct UsePrecautions for Correct Use

• Use the same type of transmission circuit (2-wire or 4-wire) for all nodes.

• Do not use 4-wire connections when the 2/4-wire switch on the Board is set to 2-wire.

16-2-2 Recommended RS-422A/485 Wiring Examples

Model Manufacturer

CO-HC-ESV-3P×7/0.2 Hirakawa Hewtech Corp.

RS-232C Option BoardGround to 100Ω or less

Power supply ground terminal

Example of 4-Wire Connections

Example of 2-Wire Connections

2/4-wire switch (DPDT)

Option Board

2/4-wire switch (DPDT)

Option Board Not connectedOther Unit Other UnitOther UnitOther Unit

Page 297: CP1E CPU Unit Software Users Manual

16-11

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-2 Wirin

g fo

r Serial C

om

mu

nicatio

ns

16

16-2-3 Converting the B

uilt-in RS

-232C P

ort to RS

-422A

/485

Wiring Example: 1:1 ConnectionsTwo-wire Connections

Four-wire Connections

Use the following Conveter or Link Adapter to convert a built-in RS-232C port to an RS-422A port for aCP1E N-type CPU Unit.

• CJ1W-CIF11 RS-422A Converter: Maximum distance 50 m, convertible to RS-422A or RS-485.

• NT-AL001 RS-232C/RS-422A Link Adapter: Maximum distance 500 m, convertible to RS-422A only.

The CJ1W-CIF11 RS-422A Converter is used to convert an RS-232C port to RS-422A/485. It is directlyconnected to the built-in RS-232C port of the CP1E CPU Unit. The Conveter is not isolated, so themaximum distance for RS-422A/485 is 50 m.

Electrical Specifications• RS-422A/485 Terminal Block

16-2-3 Converting the Built-in RS-232C Port to RS-422A/485

CJ1W-CIF11 RS-422A Converter

Signal

RDA-

RDB+

SDA-

SDB+

FG

SDA-SDB+RDA-RDB+

FG

34125

FG

A(–)B(+)

CP1E N-type CPU UnitRS-422A/485 Option Board

Pin Signal Signal

Shield

Remote device

SDA-SDB+RDA-RDB+

FG

34125

RDARDBSDASDBFG

CP1E N-type CPU UnitRS-422A/485 Option Board

Pin Signal Signal

Shield

Remote device

RDA- RDB+ SDA- SDB+ FG

RDA- RDB+ SDA- SDB+ FG

Page 298: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-12 CP1E CPU Unit Software User’s Manual(W480)

• RS-232C Connector

Note The hood and the connector hood to which it is connected will have the same electrical potential.

DIP Switch for Operation Settings

*1 Set both pins 2 and 3 to either ON (2-wire) or OFF (4-wire).

*2 To disable the echo-back function, set pin 5 to ON (RS control enabled).

*3 When connecting to a device on the N side in a 1: N connection with the 4-wire method, set pin 6 to ON (RScontrol enabled). Also, when connecting by the 2-wire method, set pin 6 to ON (RS control enabled).

Dimensions

Pin Signal

1 FG

2 RD

3 SD

4 CS

5 RS

6 +5V

7,8 NC

9 SG(0V)

Hood NC (See note.)

Pin Settings ON OFF

1 Terminating resistance selection

Terminating resistance connected (both ends of transmission path)

Terminating resistance not connected

2 2-wire or 4-wire selection*1 2-wrire 4-wire

3 2-wire or 4-wire selection*1 2-wrire 4-wire

4 Not used. − −

5 RS control selection for RD*2

RS control enabled RS control disabled (Data always received.)

6 RS control selection for SD*3

RS control enabled RS control disabled (Data always sent.)

+5V 6

– 7

– 8

SG(0V) 9

1 FG

2 RD

3 SD

4 CS

5 RS

RS-232C port Connector pin arrangement

5.8 38.8

34.0

18.2

Page 299: CP1E CPU Unit Software Users Manual

16-13

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-2 Wirin

g fo

r Serial C

om

mu

nicatio

ns

16

16-2-3 Converting the B

uilt-in RS

-232C P

ort to RS

-422A

/485

The NT-AL001 RS-232C/RS-422A Link Adapter is used to connect devices with RS-232C terminalsand devices with RS-422A terminals. A cable is used to connect the built-in RS-232C port of the CP1ECPU Unit. The Link Adapter is isolated, so the maximum distance for RS-422A is 500 m.

DIP Switch SettingThe NT-AL001 RS-232C/RS-422A Link Adapter has a DIP switch for setting RS-422A/485 commu-nications conditions. When connecting the Serial Communications Option Board, refer to the DIPswitch settings shown in the following table.

*1 When connecting to a CP-series CPU Unit, turn OFF pin 5 and turn ON pin 6.

Application Example

Note The following cables can be used for this connection.

It is recommended that one of these cables be used to connect the RS-232C port on the Option Boardto the NT-AL001 RS-232C/RS-422 Link Adapter.

NT-AL001 RS-232C/RS-422A Link Adapter

Pin Function Factory setting

1 Not used. Always set this pin to ON. ON

2 Built-in terminating resistance setting

ON: Connects terminating resistance.

OFF: Disconnects terminating resistance.

ON

3 2/4-wire setting

2-wire: Set both pins to ON.

4-wire: Set both pins to OFF.

OFF

4 OFF

5 Transmission mode*1

Constant transmission: Set both pins to OFF.

Transmission performed when CS signal in RS-232C interface is at high level:

Set pin 5 to OFF and pin 6 to ON.

Transmission performed when CS signal in RS-232C interface is at low level:

Set pin 5 to ON and pin 6 to OFF.

ON

6 OFF

Length Model

70cm XW2Z-070T-1

2m XW2Z-200T-1

NT-AL001

32456789

RDSDRSCS+5VDRERSGFG

43651

SDASDBRDARDBGRD

RDARDBSDASDB

RS-422

RDARDBSDASDB

SDRDRSCS+5VDRERSGFG

23456789

FG

RS-232C

CP1E N-type CPU UnitBuilt-in RS-232C Port or RS-232C Option Board

Pin Signal Pin Signal PinSignal Signal

ShieldHood Hood

Remote device

Signal

Remote device

(See note)

Page 300: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-14 CP1E CPU Unit Software User’s Manual(W480)

Wiring for the Recommended Cables (XW2Z-070T-1 and XW2Z-200T-1)

Precautions for Correct UsePrecautions for Correct Use

Connecting this cable to other devices can damage them.

The XW2Z- 0T-1 Connecting Cables for the NT-AL001 Link Adapter uses special wiring forthe DS and RS signals. Do not use these signals with other devices; they may be damaged.

Note The hood (FG) is internally connected to the ground terminal (GR) on the CPU Unit. There-fore, FG is grounded by grounding the ground terminal (GR) on the power supply terminalblock.

Always turn ON the terminating resistance if the node is at the end of the RS-422A/485 transmissionpath.

Observe the following precautions when wiring communications cables.

• When multi-conductor signal cable is being used, avoid using I/O wires and other control wires in thesame cable.

• If wiring racks are running in parallel, allow at least 300 mm between them.

• If the I/O wiring and power cables must be placed in the same duct, they must be shielded from eachother using grounded steel sheet metal.

16-2-4 Reducing Electrical Noise for External Wiring

132456789

FGSD

SDRDRD

RSCS+5VDRERSGFG

RSCS+5VDRERSGFG

123456789

Pin Signal PinSignal

SYSMAC PLC NT-AL001 end (inside NT-AL001)

Hood Hood

Loopback

Loopback

*Arrows indicate signal directions

Wiring with XW2Z-0T -1 (10 conductors)

Not used.

Shield

Communications cables

Low-current cables

PLC power supply and general control circuit wiring

Power lines

300 mm min.

Ground to 100 Ω or less.

Control cables

Power cables300 mm min.

Communications cables

PLC power supply and general control circuit wiring Power lines

200 mm min.

Ground to 100 Ω or less.

Steel sheet metal

Page 301: CP1E CPU Unit Software Users Manual

16-15

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-3 Pro

gram

-free Co

mm

un

ication

s with

Pro

gram

mab

le Termin

als

16

16-3-1 OV

ER

VIE

W

16-3 Program-free Communications with Programmable Terminals

Programmable Terminal communications can be used only with the CP1E N-type CPU Unit.

Communications without special communications programming is possible between a CP1E CPU Unitand a Programmable Terminal (PT) by using the 1:N NT Link protocol. The CP1E CPU Unit and PTmust be connected 1:1. The serial communications mode is set to 1:N NT Link.

Connectable Programmable Terminals (PTs)

High-speed NT Links (115,200 bps) can be used with NS-series, NP-series, or NT-series PTs.

Precautions for Correct UsePrecautions for Correct Use

Communications are not possible for CP1E CPU Units using the 1:1 NT Link protocol.

More than one PT cannot be connected to a CP1E CPU Unit even if the 1:N NT Link protocol isused. If more than one PT is connected, communications will be performed with only one of thePTs. It cannot be predetermined with PT will be communicated with.

16-3-1 OVERVIEW

CP1E N-type CPU Unit

RS-232C1:N NT Link

PT: NS, NP, or NT31/631 V3

Page 302: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-16 CP1E CPU Unit Software User’s Manual(W480)

Set the parameters in the PLC Setup and the PT’s System Menu.

Click the Serial Port 1 or Serial Port 2 Tab in the PLC Settings Dialog Box.

16-3-2 Flow of Processing

CP1E CPU Unit PT (e.g. NS-series)

1

2

3

4

5

16-3-3 PLC Setup and PT System Menu

PLC Setup

Connect the CP1E CPU Unit and external devices using the RS-232C or RS-422A/485 ports.

CX-Designer

Transfer the PLC Setup.

NS-series PTSystem Menu

Set the same communications settings in the CP1E CPU Unit’s PLC Setup and in the NS-series PT.

PLC Setup

Select Serial Port 1 or Serial Port 2 in the PLC Setup of the CP1E CPU Unit using the CX-Programmer. Set the serial communications mode to NT Link (1:N), set the baud rate, and set the highest unit number to at least 1.

Create a project using the CX-Designer and select Serial Port A or Serial Port B in the communications settings.

Transfer screenTransfer screen data created using the CX-Designer to the NS-series PT.

Check the communications settings in the NS-series PT on the Comm Settings Tab Page in the system menu.

Page 303: CP1E CPU Unit Software Users Manual

16-17

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-3 Pro

gram

-free Co

mm

un

ication

s with

Pro

gram

mab

le Termin

als

16

16-3-4 Wiring E

xamples for P

Ts

Serial Port 1 or Serial Port 2 Tab Page

Set the PT as follows:

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

System 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.)

Select Host Link in the serial communications mode settings of the CP1E N-type CPU Unit and set allother communications parameters to the same values as the other company’s display device.

• Communications Mode: NT Link (1:N, N = 1 Unit only)

• OMRON Cables with Connectors: XW2Z-200T-1: 2 m

XW2Z-500T-1: 5 m

Parameter Setting

Communica-tions Settings

Select the Custom Option and set the baud rate to 115,200 (same as the 1:N NT Link High-speed Mode). It is not necessary to change the format setting.

Mode Select NT Link (1:N).

NT/PC Link Max.

If only one NS-series PT (unit number 0) is connected, set this parameter to 1. In any other case, select the highest unit number (1 to 7) of the connected NS-series PTs.

PT System Menu

Connection with Other Company’s Display Devices

16-3-4 Wiring Examples for PTs

Connecting a PT and a PLC 1:1 with RS-232C Ports

1

2

3

4

5

6

7

8

9

FG

SD

RD

RS

CS

5V

SG

1

2

3

4

5

6

7

8

9

FG

FG

SD

RD

RS

CS

5V

DR

ER

SG

CP1E N-type CPU Unit PT

D-sub, 9-pin connector (male)D-sub, 9-pin connector (male)

PinSignal Pin Signal

Hood Hood

Built-in RS-232C port

RS-232C interface

Page 304: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-18 CP1E CPU Unit Software User’s Manual(W480)

• Communications mode: NT Link (1:N, N = 8 max.)

Note More than two NP-series PTs cannot be connected.

Wiring Example

Precautions for Correct UsePrecautions for Correct Use

RS-485 ports with 2-wire connections are used for connections between NS-series or NP-seriesPTs and OMRON Temperature Controllers. Do not use them for connections with PLCs. For aPLC connection, use RS-422A ports with 4-wire connections.

Connecting PTs and a PLC 1:N with RS-422A/485 Port Using 4-wire, RS-422A Communications

CP1W-CIF11 or CP1W-CIF12RS-422A/485 Option Board

CP1E N-type CPU Unit

NS-series PT(Unit No. 0)

NS-series PT(Unit No. 1)

NS-AL002 RS-422A Conversion Unit

NS-AL002 RS-422A Conversion Unit

1:N NT Link

CP1ERS-422A/485 Option Board DIP switch for operation settings

SW1SW2SW3SW4

SW1SW2SW3SW4SW5SW6

RD

A-

RD

B+

SD

A-

SD

B+

F6 RD

A-

RD

B+

SD

A-

SD

B+

F6

RD

A-

RD

B+

SD

A-

SD

B+

F6

Terminating resistance ON/OFF

2/4-wire selection switch

2/4-wire selection switch

Not used

RD control

SD control

ON

OFF (4-wire connection)

OFF (4-wire connection)

OFF

OFF

OFF

RS/CS control or always ON

2/4-wire selection switch

2/4-wire selection switch

Terminating resistance ON/OFF

ON (RS/CS flow control)

OFF (4-wire connection)

OFF (4-wire connection)

OFF

ON (RS/CS flow control)

OFF (4-wire connection)

OFF (4-wire connection)

ON

NS-series PT(Unit No. 0)

NS-series PT (Unit No. 1) NS-AL002

DIP SW setting

Page 305: CP1E CPU Unit Software Users Manual

16-19

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-4 No

-pro

toco

l Co

mm

un

ication

s with

Gen

eral Co

mp

on

ents

16

16-4-1 Overview

16-4 No-protocol Communications with General Components

Non-protocol communications can be used only with the CP1E N-type CPU Unit.

CP1E CPU Units and general devices with serial communications ports can be used for no-protocolcommunications.

No-protocol communications enable sending and receiving data using the TRANSMIT (TXD) andRECEIVE (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.

No-protocol communications are used to send data in one direction to or from general external devicesthat 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 oroutput data to a printer.

The following table lists the no-protocol communication functions supported by CP1E PLCs.

16-4-1 Overview

Communica-tions

Transfer direction

Method Max.

amount of data

Frame format Other functions

Start code End code

Data transmission

PLC → External device

Execution of TXD in the ladder program

256 bytes Yes: 00 to FF hexNo: None

Yes: 00 to FF hex or CR+LFNo: None (The amount of data to receive is specified between 1 and 256 bytes when no end code is specified.)

• Send delay time (delay between TXD execution and sending data from specified port): 0 to 99,990 ms (unit: 10 ms)

• Controlling RS and ER signals

Data reception

External device → PLC

Execution of RXD in the ladder program

256 bytes Monitoring CS and DR signals

CP1E N-type CPU Unit

Sending/receiving data

TXD or RXD

RS-232C or RS422A/485

General component (e.g., barcode reader)

Page 306: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-20 CP1E CPU Unit Software User’s Manual(W480)

Click the Serial Port 1 or Serial Port 2 Tab in the PLC Settings Dialog Box.

Serial Port 1 or Serial Port 2 Tab Page

16-4-2 Flow of Processing

1 Connect the CP1E CPU Unit and external device using RS-232C or RS-422A/485 ports.

2 Select Serial Port 1 or Serial Port 2 in the PLC Setup and transfer the PLC Setup from the CX-Programmer to the CP1E CPU Unit. (Set the serial communications mode to RS-232C, and set the communications conditions.)

3 • PLC to External device: Execute the TXD instruction.• External device to PLC: Execute the RXD instruction.

16-4-3 PLC Setup

Parameter Setting

Communications Settings

Set the communications settings to the same values as the connected device.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.

Wiring communications

PLC Setup

Ladder Program

Cyclic tasks

Interrupt tasks

Page 307: CP1E CPU Unit Software Users Manual

16-21

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-4 No

-pro

toco

l Co

mm

un

ication

s with

Gen

eral Co

mp

on

ents

16

16-4-4 Device W

iring Exam

ples

Connecting RS-232C Ports 1:1 • Connections to E5CK Controller

Connecting RS-422A/485 Ports 1:N with 2-wire Connections

16-4-4 Device Wiring Examples

Connecting Devices with Built-in RS-232C Communications 1:1

1

2

3

4

5

7

8

9

FG

SD

RD

RS

CS

DR

ER

SG

13

14

1

SD

RD

SG

RS-232C: Terminal

Terminal No.

CP1E N-type CPU UnitBuilt-in RS-232C Port orRS-232C Option Board

Signal Pin

D-sub, 9-pin connector (male)

RS-232C ShieldOMRON E5CK Controller

Signal

34125

SDA-SDB+RDA-RDB+

FG

A(-)B(+)

A(-)B(+)

CP1E N-type CPU Unit

Pin

Terminal

RS-422A/485 Option Board

Signal

Device supporting RS-422A/485 communications (2-wire)

Device supporting RS-422A/485 communications (2-wire)

Signal RS-422A/485 interface

RS-422A/485 interface

Signal

Page 308: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-22 CP1E CPU Unit Software User’s Manual(W480)

Connecting RS-422A/485 Ports 1:N with 4-wire Connections

34125

SDA-SDB+RDA-RDB+

FG

ShieldRS-232C

FGSDRDRSCS

DRERSG

12345678

GRDSG

SDBSDARDBRDACSBCSA

123456789

RS-232RS-422

NCSDRDRSCS5VDRERSG

RDA

RDB

SDA

SDB

Terminal

NT-AL001

(+)5V(−)Power

CP1E N-type CPU Unit

RS-422A/485 Option Board

Signal Pin

4-wire Terminating Resistance ON

Terminal

Device supporting RS-422A/485 Communications

RS-422A/485 interface

Signal

Pin Signal PinSignal

Shield

D-sub, 9-pin connector (male)

Device supporting RS-422A/485 Communications

Signal

RS-232C interface

DIP Switch Settings Pin 1: ON Pin 2: ON (terminating resistance) Pin 3: OFFPin 4: OFFPin 5: OFFPin 6: ON

Page 309: CP1E CPU Unit Software Users Manual

16-23

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-4 No

-pro

toco

l Co

mm

un

ication

s with

Gen

eral Co

mp

on

ents

16

16-4-5 Related A

uxiliary Area B

its and Words

16-4-5 Related Auxiliary Area Bits and Words

Address Name Details

A392.04 Built-in RS-232C Port Communications

Error Flag

• Turns ON when a communications error occurs at the built-in RS-232C port. (Disabled in NT link mode.)

• Turns ON when a timeout error, overrun error, framing error, parity error, or BCC error occurs in Modbus-RTU Easy Master Mode.

A392.05 Built-in RS-232C Port Send Ready Flag (No-protocol mode)

ON when the built-in RS-232C port is able to send data in no-protocol mode.

A392.06 Built-in RS-232C Port Reception

Completed Flag(No-protocol mode)

ON when the RS-232C port has completed the reception in no-protocol mode.

• When the number of bytes was 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.

A392.07 Built-in RS-232C Port Reception

Overflow Flag (No-protocol mode)

ON when a data overflow occurred during reception through the built-in RS-232C port in 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 Option Port Communications

Error Flag

• ON when a communications error has occurred at the serial option port. (Not valid in NT Link mode.)

• ON when a timeout error, overrun error, framing error, parity error, or BCC error occurs in Modbus-RTU Easy Master mode.

A392.13 Serial Option Port Send Ready Flag (No-protocol Mode)

ON when the serial option port is able to send data in no-protocol mode.

A392.14 Serial Option Port

Reception Completed

Flag (No-protocol Mode)

• ON when the serial option port has completed the reception in no-protocol mode. When the number of bytes was 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.

A392.15 Serial Option Port

Reception Overflow Flag (No-protocol Mode)

• ON when a data overflow occurred during reception through the serialoption port in no-protocol mode.

A393.00 to A393.07

Built-in RS-232C Port

PT Communications Flags

• The corresponding bit will be ON when the built-in RS-232C port is com-municating with a PT in NT Link. Bits 0 to 7 correspond to units 0 to 7.

A393.00 to A393.15

Built-in RS-232C Port

Reception Counter (No-protocol Mode)

• Indicates (in binary) the number of bytes of data received when the built-in RS-232C port is in no-protocol mode.

• The start code and end code are not included.

A394.00 to A394.07

Serial Option Port Commu-nicating with PTF lags

• The corresponding bit will be ON when the serial option port is communicating with a PT in NT link mode.Bits 0 to 7 correspond to units 0 to 7.

A394.00 to A394.15

Serial Option Port

Reception Counter (No-protocol Mode)

• Indicates (in binary) the number of bytes of data received when the serial option port is in no-protocol mode.

• The start code and end code are not included.

Page 310: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-24 CP1E CPU Unit Software User’s Manual(W480)

16-5 Modbus-RTU Easy Master Function

The Modbus-RTU Easy Master Function can be used only with the CP1E N-type CPU Unit.

Using the Modbus-RTU Easy Master enables easy control of Modbus-compatible slaves, such asinverters, using serial communications. The serial communications mode is set to Modbus-RTU EasyMaster.

Modbus-RTU commands can be sent simply by turning ON a software switch after setting the Modbusslave 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.

16-5-1 Overview

16-5-2 Flow of Processing

1 Connect the CP1E CPU Unit and Modbus-RTU Slave using RS-422A/485 ports.

2 Select Serial Port 1 or Serial Port 2 in the PLC Setup and transfer the PLC Setup from the CX-Programmer to the CP1E CPU Unit. (Set the serial communications mode to RS-232C, and set the communications conditions.)

3 • Set the Modbus-RTU frame in the DM Fixed Allocation Words.

• Turn ON the Modbus-RTU Master Execution Bit (A640.00 or A641.00).

Modbus-RTU

15 08 07 00

D1200 --

D1201 --

D1202

D1203Communications are easily achieved by simply turning ON A641.00 after setting the Modbus-RTU command in the DM fixed allocation words.

Modbus-RTU Master Execution Bit for Port 1 A641.00

CP1E N-type CPU Unit

Slave address

Slave address

Slave address Function code

Function code

Function code Communications data

Communications data

Communications data

OMRON Inverters3G3JX, 3G3MX, 3G3RX, 3G3JV, 3G3MV, or 3G3RV

Number of communications data bytes

Wiring communications

PLC Setup

Ladder Program

Cyclic tasks

Interrupt tasks

Page 311: CP1E CPU Unit Software Users Manual

16-25

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-5 Mo

dbu

s-RT

U E

asy Master F

un

ction

16

16-5-3 DM

Fixed A

llocation Words for the M

odbus-RT

U

Easy M

aster

DM fixed allocation words and Auxiliary Area words are allocated for the Modbus-RTU Easy Masteraccording to the CPU Unit type and connected port as shown below.

DM Fixed Allocation Words

16-5-3 DM Fixed Allocation Words for the Modbus-RTU Easy Master

CP1E CPU Unit serial port DM fixed allocation words Auxiliary Area bits

CP1E N-type CPU Unit with 20 I/O Points

Built-in RS-232C port D01300 to D01399 A640.00 to A640.02

CP1E N-type CPU Unit with 30 or 40 I/O Points

Built-in RS-232C port D01200 to D01299 A641.00 to A641.02

Serial option port D01300 to D01399 A640.00 to A640.02

Word

Bits Contents

Built-in RS-232C

port of CP1E N-type CPU Unit with 30

or 40 I/O Points

Serial option port of CP1E N-type CPU Unit with 30 or 40

I/O Points

Built-in RS-232C port of CP1E N-type

CPU Unit with 20 I/O Points

D01200 D01300 00 to 07 Command Slave address (00 to F7 hex)

08 to 15 Reserved (Always 00 hex.)

D01201 D01301 00 to 07 Function code

08 to 15 Reserved (Always 00 hex.)

D01202 D01302 00 to 15 Number of communications data bytes (0000 to 005E hex)

D01203 to D01249

D01303 to D01349 00 to 15 Communications data (94 bytes maximum)

D01250 D01350 00 to 07 Response Slave address (00 to F7 hex)

08 to 15 Reserved (Always 00 hex.)

D01251 D01351 00 to 07 Function code

08 to 15 Reserved

D01252 D01352 00 to 07 Error code

( See error codes in the following table. )

08 to 15 Reserved (Always 00 hex.)

D01253 D01352 00 to 15 Number of response bytes (0000 to 03EA hex)

D01254 to D01299

D01354 to D01399 00 to 15 Response data (92 bytes maximum)

Page 312: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-26 CP1E CPU Unit Software User’s Manual(W480)

Error Codes

Related Auxiliary Area Words and Bits The Modbus-RTU command set in the DM fixed allocation words for the Modbus-RTU Easy Masteris automatically sent when the Modbus-RTU Master Execution Bit is turned ON. The results (normalor error) will be given in corresponding flags.

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 error

The Modbus-RTU Easy Master function was executed when the serial communications mode was not the Serial Gateway Mode.

80 hex Response timeout A response was not received from the server.

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 code

The function code in the response is different from the one in the 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.

Word Bit Port Contents

A640 02 Serial option port of CP1E N-type CPU Unit with 30 or 40 I/O Points

Built-in RS-232C port of CP1E N-type CPU Unit with 20 I/O Points

Modbus-RTU Master Execution Error Flag

ON: Execution error.

OFF: Execution normal or still in progress.

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-232C port of CP1E N-type CPU Unit with 30 or 40 I/O Points

Modbus-RTU Master Execution Error Flag

ON: Execution error.

OFF: Execution normal or still in progress

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.

Page 313: CP1E CPU Unit Software Users Manual

16-27

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-5 Mo

dbu

s-RT

U E

asy Master F

un

ction

16

16-5-4 Program

ming E

xamples

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 thethread is constant.

The target speed is changed according to inputs from multiple contacts. Acceleration and decelerationare controlled using the acceleration and deceleration of an inverter.

The CP1E and OMRON 3G3MV Inverter are connected using RS-485 for frequency and start/stop con-trol.

16-5-4 Programming Examples

Wiring Examples

Constant thread speed

Fast rotation Slow rotation

Speed

Stopped

Contact A Contact B Contact C Contact Z

CP1W-CIF11/12RS-422A/485 Option Board

CP1E N-type CPU Unitwith 30 I/O Points

CP1W-CIF11/12

50 m max.

SymbolControl circuit terminal block (communications terminals)

Page 314: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-28 CP1E CPU Unit Software User’s Manual(W480)

CP1W-CIF11/12 SettingsSet the DIP switch as shown in the following table

3G3MV SettingsSet the DIP switch as follows:

• SW2, pin 1 : ON (terminating resistance connected) Terminating resistance for RS422/485 communicationsThen, set the following parameters.

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

No. Name Setting Description

n003 RUN command selection 2 RS-422/485 communications is enabled.

n004 Frequency reference selection 6 Frequency reference through RS-422/RS-485

n019 Acceleration time 1 5.0 Acceleration time in seconds

n020 Deceleration time 1 5.0 Deceleration time in seconds

n151 RS-422/485 communications timeover detection selection

1 Detect timeouts, detect fatal errors, and the Inverter decelerates to a stop using deceleration time 1 (default).

n152 RS-422/485 communications frequency reference/display unit selection

1 Select the unit for communications of frequency references and frequency monitoring data. Unit: 0.01Hz (default).

n153 RS-422/485 communications Slave address

1 Slave address (unit number), unit number 1

n154 RS-422/485 baud rate selection 2 Communications baud rate: 9,600 bps (default)

n155 RS-422/485 parity selection 0 Even parity

n156 RS-422/485 send wait time 10 Sets the response wait time for request messages received from the master. 10 ms (default).

n157 RS-422/485 RTS control selection 0 RTS control enabled (default)

(Back)

CPU Unit connectorDIP switch for operation settings

Page 315: CP1E CPU Unit Software Users Manual

16-29

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-5 Mo

dbu

s-RT

U E

asy Master F

un

ction

16

16-5-4 Program

ming E

xamples

PLC SetupClick the Serial Port 1 or Serial Port 2 Tab in the PLC Settings Dialog Box.

Serial Port 1 or Serial Port 2 Tab Page

Parameter Settings

Communications Settings

Set the Modbus communications settings to match those of the Inverter.

If the Inverter is set to 4,800 bps, one stop bit, and no parity, select the Custom Option and set the baud rate to 4,800. Set the format to 7,1,N.

Mode Select Modbus Easy Master.

Response Monitoring Time

Set the default value of 0×100 ms.

Page 316: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-30 CP1E CPU Unit Software User’s Manual(W480)

Programming Example

Contact A

Contact B

Contact C

Contact Z

Stop operation when communications starts.RUN command (0: Stop)Frequency reference:00.00Hz

RUN command (1: Start)Frequency reference: 60.00Hz(1770 Hex)

RUN command (1: Start)Frequency reference: 55.00Hz(157C Hex)

RUN command (1: Start)Frequency reference: 50.00Hz(1388 Hex)

Frequency reference: 00.00HzRUN command (0: Stop)

Start and continue Modbus communications from1 second after turning ON the power supply.

Modbus-RTU Master Execution Bit

Modbus-RTU Master Execution Normal Flag

Page 317: CP1E CPU Unit Software Users Manual

16-31

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-5 Mo

dbu

s-RT

U E

asy Master F

un

ction

16

16-5-4 Program

ming E

xamples

Flags for Modbus-RTU Easy Master for Serial Port 1)

(A)Turn ON A640.00 (Execution Bit) to send command data stored starting at D1200. For details, referto DM Area Data on the next page.

(B)When a command has been sent successfully, A640.01 (Execution Normal Flag) will turn ON, andthe response data will be stored starting from D1250.

(C)If a communications error occurs, A640.02 (Execution Error Flag) will turn ON, and the error codewill be stored in D1252.

WordsBits Setting

Serial Port 1

D1200 00 to 07 Command Slave address (00 to F7 hex)

08 to 15 Reserved (Always 00 hex.)

D1201 00 to 07 Function code

08 to 15 Reserved (Always 00 hex.)

D1202 00 to 15 Number of communications data bytes (0000 to 005E hex)

D1203 to D1249 00 to 15 Communications data (94 bytes max.)

WordsBits Setting

Serial Port 1

D1250 00 to 07 Response Slave address (00 to F7 hex)

08 to 15 Reserved (Always 00 hex.)

D1251 00 to 07 Function code

08 to 15 Reserved

D1252 00 to 07 Error code

08 to 15 Reserved (Always 00 hex.)

D1253 00 to 15 Number of response bytes (0000 to 03EA hex)

D1254 to D1299 00 to 15 Response data (92 bytes max.)

A640.00 Execution Bit

A640.01 Execution Normal Flag

A640.02 Execution Error Flag

Page 318: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-32 CP1E CPU Unit Software User’s Manual(W480)

DM Area Data• DM Fixed Allocation Words for Modbus-RTU Easy Master

DM Area data in words D1201 to D1205 are set before the execution of the ladder program.D1206 and D1207 do not need to be set. They are modified by MOV instructions, and are used tochange, start, and stop frequency references.

• RUN Command (Register 0001) Allocation and Details for Inverter 3G3MV

For this example, only the RUN command (bit 00) will be used.

• 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.

Bit No. Setting

0 RUN command (1: Start)

1 Normal/reverse rotation (1: Reversed)

2 External error (1: EF0)

3 Error reset (1: Error reset)

4 Multifunction input 1 (1: ON)

5 Multifunction input 2 (1: ON)

6 Multifunction input 3 (1: ON)

7 Multifunction input 4 (1: ON)

8 Multifunction input 5 (1: ON)

9 Multifunction input 6 (1: ON)

10 Multifunction input 7 (1: ON)

11 to 15 (Not used.)

Serial Port 1: Command

Setting

Address

Value

Slave address

Functioncode

Communicationsdata bytes

Communications data: D1203 to D1249 (maximum)94 bytes (47 words) max.

(Hex) Inverter slave address: 1 hex

Inverter data write: 10 hex

Use the 9 bytes from the upper byte of D1203 to the upper byte of D1207

Register number for starting data write: 0001 (Specifies to start writing data to Inverter starting at register 0001.)

Number of registers written: 2 (data for registers 0001 and 0002)

Attached data size in bytes: 4 (4 bytes from lower byte of D32305 to upper byte of D32307)

Data for starting register (e.g. set 0001 hex for register 0001 (RUN command, see below))

Data for next reigister (e.g. set 60.0 Hz (0258 hex) for register 0002 (frequency reference))

Page 319: CP1E CPU Unit Software Users Manual

16-33

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-1 Overview

16-6 Serial PLC Links

Serial PLC Links can be used only with the CP1E N-type CPU Unit.

Serial PLC Links enable exchanging data between CP1E N-type CPU Units, CP1E/CP1H CPU Units,or CJ1M CPU Units without using special programming. The serial communications mode is set toSerial PLC Links. Up to 9 PLCs can be linked.

Connecting CP1E, CP1L, CP1H, or CJ1M CPU Units 1:N (8 Nodes Maximum)

Connecting CP1E, CP1L, CP1H, or CJ1M CPU Units 1:1

Precautions for Correct UsePrecautions for Correct Use

With the CP1E CPU Units, a Programmable Terminal (PT) cannot be included in a Serial PLCLink.

16-6-1 Overview

Configuration

RS-422A/485

CP1E N-type CPU Unit (Polling Unit)

RS-422A/485 Option Board

Shared data

CP1E N-typeCPU Unit(Polled Unit)

CJ1M CPU Unit (Polled Unit)

CP1LCPU Unit(Polled Unit)

8 nodes maximum

CP1E N-typeCPU Unit(Polling Unit)

RS-232C or RS422A/485Shared data

CP1E or CP1L CPU Unit (Polled Unit)

Page 320: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-34 CP1E CPU Unit Software User’s Manual(W480)

Precautions for Correct UsePrecautions for Correct Use

Both serial ports cannot be used for PLC Links at the same time.

If both serial ports are set for PLC Links (either as polling or polled nodes), a PLC Setup settingerror (nonfatal error) will occur and the PLC Setup Setting Error Flag (A402.10) will turn ON.

16-6-2 Flow of Processing

1 Connect the CP1E CPU Unit and Modbus-RTU Slave Unit using RS-422A/485 ports.

2 Set Serial Port 1 or Serial Port 2 in the PLC Setup and transfer the PLC Setup from the CX-Programmer to the CP1E CPU Unit. (Set the serial communications mode to Serial PC Link (Master) or Serial PC Link (Slave) and set the communications conditions, link words, and PLC Link method.)

3

16-6-3 PLC Setup

Settings at the Polling Unit

Wiring communications

PLC Setup

Start communications

Page 321: CP1E CPU Unit Software Users Manual

16-35

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-4 Wiring E

xample for P

LCs

Serial Port 1 or Serial Port 2 Tab Page

Serial Port 1 or Serial Port 2 Tab Page

This section provides connection examples for using Serial PLC Links.

The communications mode setting used here is PC Link (Slave) or PC Link (Master).

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, two stop bits, and even parity, select the Custom Option, set the baud rate to 115200. Set the for-mat to 7,2,E.

Mode Select PC Link (Master).

Link Words Set to 10 (default) for the Master only. 10 words (default)

PC Link Mode Select All or Masters.

NT/PC Link Max. Set the highest unit number of the connected slaves.

Settings at the Polled Unit

Parameter Setting

Communications Settings Set the communications settings to match those of the connected PLC. If the connected PLC is set to 115,200 bps, two stop bits, and even par-ity, select the Customer Option and set the baud rate to 115200. Set the format to 7,2,E.

Mode Select PC Link (Master) or PC Link (Slave).

PLC Link Unit No. Set the unit number (0 to 7).

16-6-4 Wiring Example for PLCs

Serial PLC Link Connection Examples

Page 322: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-36 CP1E CPU Unit Software User’s Manual(W480)

Connecting an RS-422A Converter

Note The CP1W-CIF11 is not isolated, so the total transmission distance for the whole transmission path is 50 m max. If the total transmission distance is greater than 50 m, use the NT-AL001, which is isolated, and do not use the CJ1W-CIF11. If the NT-AL001 is used, the total transmission distance for the whole transmission path is 500 m max.

Connection with an RS-232C PortRS-232C connection is also possible when using a Serial PLC Link to connect two CP1E CPUUnits.

• Wiring Example Using RS-422A/485 Ports with RS-422A, 4-wire Connections

CP1E N-type CPU Unit (Polling Unit)

Built-in RS-232C Port

CJ1W-CIF11 RS-422A Converter

CJ1W-CIF11 RS-422A Converter

CP1L CPU Unit (Polled Unit No.0)

RS-422A/485 Option Board

Serial PLC Link (Total transmission length: 50 m max.)

CJ1M CPU Unit (Polled Unit No.1)

RS-232C port built into CPU Unit

Signal Pin

1

2

3

4

5

6

7

8

9

Pin

1

2

3

4

5

6

7

8

9

FG

SD

RD

RS

CS

5V

DR

ER

SG

Signal

FG

SD

RD

RS

CS

5V

DR

ER

SG

RS

232C

-

RS

232C

-

CP1E N-type CPU UnitBuilt-in RS-232C Port or RS-232C Option Port

CP1E N-type CPU UnitBuilt-in RS-232C Port or RS-232C Option Port

1 2 3 4 5

RD

A-

RD

B+

SD

A-

SD

B+

FG

1 2 3 4 5

RD

A-

RD

B+

SD

A-

SD

B+

FG

1 2 3 4 5

RD

A-

RD

B+

SD

A-

SD

B+

FG

CP1E N-type CPU Unit (Polling Unit)Built-in RS-232C portCJ1W-CIF11 RS-422A ConverterDIP switch Pin No. 1: ON (With termination resistance.) Pin No. 2: OFF (4-wire type) Pin No. 3: OFF (4-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: OFF (No RS control for SD.)

CP1E N-type CPU Unit (Polled Unit No. 0)

CP1W-CIF11 RS-422A/485 Option Board DIP switch Pin No. 1: OFF (No termination resistance.) Pin No. 2: OFF (4-wire type) Pin No. 3: OFF (4-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: ON (With RS control for SD.)

CJ1M CPU Unit (Polled Unit No. 1)

CJ1W-CIF11 RS-422A Converter DIP switch Pin No. 1: OFF (No termination resistance.) Pin No. 2: OFF (4-wire type) Pin No. 3: OFF (4-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: ON (With RS control for SD.)

RS-422A/485 interface RS-422A/485 interface RS-422A/485 interface

Sig

nal

Sig

nal

Sig

nal

Pin Pin Pin

Shield

Page 323: CP1E CPU Unit Software Users Manual

16-37

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-5 Specifications

• Wiring Example Using RS-422A/485 Ports with RS-485, 2-wire Connections

Serial PLC Links can be used for both built-in RS-232C ports and serial option ports for N-type CPUUnits with 30 or 40 I/O Points. However, two serial ports cannot be used simultaneously for Serial PLCLinks.

16-6-5 Specifications

Item Specifications

Applicable PLCs CP1E, CP1H, CP1L, CJ1M

Baud rate 9,600 bps, 38,400 bps, 115,200 bps

Applicable serial ports Built-in RS-232C ports and serial option portsBoth ports cannot be used for Serial PLC Links at the same time. If both 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 or RS-232C Option Board.

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 (A PT can be placed on the same network in an 1:N NT Link, but it must be counted as one of the 8 Polled Units.)

Link methods (data refresh methods)

Complete link method or Polling Unit link method

Pin 1 2 3 4 5

Sig

nal

RD

A-

RD

B+

SD

A-

SD

B+

FG

Pin 1 2 3 4 5

Sig

nal

RD

A-

RD

B+

SD

A-

SD

B+

FG

Pin 1 2 3 4 5

Sig

nal

RD

A-

RD

B+

SD

A-

SD

B+

FG

Shield

CP1E N-type CPU UnitBuilt-in RS-232C portCJ1W-CIF11 RS-422A Converter DIP switch Pin No. 1: ON (With termination resistance.) Pin No. 2: ON (2-wire type) Pin No. 3: ON (2-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: ON (With RS control for SD.)

CP1L N-type CPU Unit (Polled Unit No. 0)

CP1W-CIF11 RS-422A/485 Option Board DIP switch Pin No. 1: OFF (No termination resistance.) Pin No. 2: ON (2-wire type) Pin No. 3: ON (2-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: ON (With RS control for SD.)

CJ1M CPU Unit (Polled Unit No. 1)

CJ1W-CIF11 RS-422A Converter DIP switch Pin No. 1: ON (With termination resistance.) Pin No. 2: ON (2-wire type) Pin No. 3: ON (2-wire type) Pin No. 4: OFF Pin No. 5: OFF (No RS control for RD.) Pin No. 6: ON (With RS control for SD.)

RS-422A/485 interface RS-422A/485 interface RS-422A/485 interface

Page 324: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-38 CP1E CPU Unit Software User’s Manual(W480)

The following two methods can be used to refresh data.

• Complete link method

• Polling Unit link method

Complete LinkThe data from all nodes in the Serial PLC Links are reflected in both the Polling Unit and the PolledUnits.

The only exceptions are the address allocated to the connected PT’s unit number and the addressesof Polled Units that are not present in the network. These data areas are undefined in all nodes.

Example: Complete Link Method, Highest Unit Number: 3In the following diagram, Polled Unit No. 2 is either a PT or is a Unit not present in the network, sothe area allocated for Polled Unit No. 2 is undefined in all nodes.

Example for Ten Link Words (Maximum Number of Words) Each CPU Unit (either CP1E, CP1H, or CJ1M) sends data to the same words in all other CPU Unitsfor the Polling Unit and all Polled Units. Data is sent between the words that are allocated to the Poll-ing Unit and Polled Units according to unit numbers.

Data Refresh Methods

Pol l ing Uni t

Local area

Polled Unit No. 0

Polled Unit No. 1

Polled Unit No. 3

Undefined

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Pol led Uni t No. 0

Polled Unit No. 1

Polled Unit No. 3

Undefined

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Polled Unit No. 0

Pol led Uni t No. 1

Polled Unit No. 3

Undefined

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Polled Unit No. 0

Polled Unit No. 1

Pol led Uni t No. 3

Undefined

(Not used)

(Not used)

(Not used)

(Not used)

CP1E CPU Unit(Polling Unit)

CP1E CPU Unit(Polled Unit No. 0)

Serial PLC Link Words Serial PLC Link Words Serial PLC Link WordsSerial PLC Link Words

No.0

No.1

No.2

No.3

No.4

No.5

No.6

No.7

No.0

No.1

No.2

No.3

No.4

No.5

No.6

No.7

No.0

No.1

No.2

No.3

No.4

No.5

No.6

No.7

No.0

No.1

No.2

No.3

No.4

No.5

No.6

No.7

CP1L CPU Unit (Polled Unit No. 1)

Example: CJ1M CPU Unit (Polled Unit No. 2)

CIO 200 to 209

CIO 210 to 219

CIO 220 to 229

CIO 230 to 239

CIO 240 to 249

CIO 250 to 259

CIO 260 to 269

CIO 270 to 279

CIO 280 to 289

CIO 200 to 209

CIO 210 to 219

CIO 220 to 229

CIO 230 to 239

CIO 240 to 249

CIO 250 to 259

CIO 260 to 269

CIO 270 to 279

CIO 280 to 289

CIO 3100 to 3109

CIO 3110 to 3119

CIO 3120 to 3129

CIO 3130 to 3139

CIO 3140 to 3149

CIO 3150 to 3159

CIO 3160 to 3169

CIO 3170 to 3179

CIO 3180 to 3189

CIO 3100 to 3109

CIO 3110 to 3119

CIO 3120 to 3129

CIO 3130 to 3139

CIO 3140 to 3149

CIO 3150 to 3159

CIO 3160 to 3169

CIO 3170 to 3179

CIO 3180 to 3189

Page 325: CP1E CPU Unit Software Users Manual

16-39

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-5 Specifications

Polling Unit Link MethodThe data for all the Polled Units in the Serial PLC Links are reflected in the Polling Unit only, andeach 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 Unitdata are the same in each Polled Unit, allowing data to be accessed using common ladder program-ming.

The areas allocated for the unit numbers of the PT or Polled Units not present in the network areundefined in the Polling Unit only.

Example: Polling Unit Link Method, Highest Unit Number: 3 In the following diagram, Polled Unit No. 2 is a PT or a Unit not participating in the network, so thecorresponding area in the Polling Unit is undefined.

Example for Ten Link Words (Maximum Number of Words) The CPU Unit that is the Polling Unit (either CP1E, CP1L, or CJ1M) sends its data (CIO 200 to CIO209) to the same words (CIO 200 to CIO 209) in all other CPU Units. The Polled Units (either CP1E, CP1L, or CJ1M) send their data (CIO 210 to CIO 219) to consecutivesets of 10 words in the Polling Unit.

Polling Unit

Local area

Polled Unit No. 0

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Polled Unit No. 0

Polled Unit No. 1

Polled Unit No. 3

Undefined

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Polled Unit No. 1

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

Polling Unit

Local area

Polled Unit No. 3

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

(Not used)

No.0

No.1

No.2

No.3

No.4

No.5

No.6

No.7

CP1E CPU Unit (Polling Unit)

Serial PLC Link Words Serial PLC Link WordsSerial PLC Link Words Serial PLC Link Words

CP1E CPU Unit (Polled Unit No. 0)

CP1L CPU Unit (Polled Unit No. 1)

Example: CJ1M CPU Unit (Polled Unit No. 2)

CIO 200 to 209

CIO 210 to 219

CIO 200 to 209

CIO 210 to 219

CIO 3100 to 3109

CIO 3110 to 3119

CIO 3100 to 3109

CIO 3110 to 3119

CIO 220 to 229

CIO 230 to 239

CIO 240 to 249

CIO 250 to 259

CIO 260 to 269

CIO 270 to 279

CIO 280 to 289

Page 326: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-40 CP1E CPU Unit Software User’s Manual(W480)

Allocated Words• Complete Link Method

• Polling Unit Link Method

Address Link words 1 word 2 words 3 words to 10 words

CIO 200

Serial PLC Link Area

Polling Unit CIO 200 CIO 200 to 201

CIO 200 to 202

CIO 200 to 209

Polled Unit No. 0

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 1

CIO 202 CIO 204 to 205

CIO 206 to 208

CIO 220 to 229

Polled Unit No. 2

CIO 203 CIO 206 to 207

CIO 209 to 211

CIO 230 to 239

Polled Unit No. 3

CIO 204 CIO 208 to 209

CIO 212 to 214

CIO 240 to 249

Polled Unit No. 4

CIO 205 CIO 210 to 211

CIO 215 to 217

CIO 250 to 259

Polled Unit No. 5

CIO 206 CIO 212 to 213

CIO 218 to 220

CIO 260 to 269

Polled Unit No. 6

CIO 207 CIO 214 to 215

CIO 221 to 223

CIO 270 to 279

Polled Unit No. 7

CIO 208 CIO 216 to 217

CIO 224 to 226

CIO 280 to 289

CIO 299 Not used. CIO 209 to 299

CIO 218 to 299

CIO 227 to 299

CIO 290 to 299

Address Link words 1 word 2 words 3 words to 10 words

CIO 200

Serial PLCLink Words

Polling Unit CIO 200 CIO 200 to 201

CIO 200 to 202

CIO 200 to 209

Polled Unit No. 0

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 1

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 2

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 3

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 4

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 5

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 6

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

Polled Unit No. 7

CIO 201 CIO 202 to 203

CIO 203 to 205

CIO 210 to 219

CIO 299 Not used. CIO 202 to 299

CIO 204 to 299

CIO 206 to 299

CIO 220 to 299

Page 327: CP1E CPU Unit Software Users Manual

16-41

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-5 Specifications

Related Auxiliary Area Bits and Words• Built-in RS-232C Port

*1 In the same way as for the existing 1:N NT Link, the status (communicating/not communicating) of PTs inSerial PLC Links can be checked from the Polling Unit (CPU Unit) by reading the Built-in RS-232C Port Com-municating with PT Flag (A394.00 to A394.07 for unit numbers 0 to 7) or the Serial Option Port Communicatingwith PT Flag (A393.00 to A393.07 for unit numbers 0 to 7).

• Related Auxiliary Area Bits and Words for Serial Option Port

*1 In the same way as for the existing 1:N NT Link, the status (communicating/not communicating) of PTs inSerial PLC Links can be checked from the Polling Unit (CPU Unit) by reading the Built-in RS-232C Port Com-municating with PT Flag (A394.00 to A394.07 for unit numbers 0 to 7) or the Serial Option Port Communicatingwith PT Flag (A393.00 to A393.07 for unit numbers 0 to 7).

Name Address Details Read/write Refresh timing

Built-in RS-232C Port Communicating with

PT Flags*1

A394.00 to A394.07

When built-in RS-232C port is being used in NT link mode, the bit corresponding to the Unit perform-ing communications will be ON. Bits 00 to 07 correspond to unit num-bers 0 to 7, respectively.ON: CommunicatingOFF: Not communicating

Read • Cleared when power is turned ON.

• Turns ON the bit corresponding to the unit number of the PT/Polled Unit that is communicating via built-in RS-232C port in NT link mode or Serial PLC Link mode.

• Bits 00 to 07 correspond to unit numbers 0 to 7, respectively.

Built-in RS-232C Port Restart Bit

A526.01 Turn ON this bit to restart built-in RS-232C port.

Read/write • Cleared when power is turned ON.

• Turn ON to restart built-in RS-232C port, (except when communicating in peripheral bus mode).

Note The bit is automatically turned OFF by the system when restart processing has been completed.

Built-in RS-232C Port Error Flags

A528.08 to A528.15

When an error occurs at built-in RS-232C port, the corresponding error bit is turned ON. Bit 08: Not used. Bit 09: Not used. Bit 10: Parity error Bit 11: Framing error Bit 12: Overrun errorBit 13: Timeout error Bit 14: Not used.Bit 15: Not used.

Read/write • Cleared when power is turned ON.

• When an error occurs at built-in RS-232C port, the corresponding error bit is turned ON.

• The flag is automatically turned OFF by the system when built-in RS-232C port is restarted.

• Disabled during peripheral bus mode.

• In NT link mode, only bit 05 (timeout error) is enabled.

• In Serial PLC Link mode, only the following bits are enabled.Errors at the Polling Unit:Bit 05: Timeout errorErrors at Polled Units:Bit 05: Timeout errorBit 04: Overrun errorBit 03: Framing error

Name Address Details Read/write Refresh timing

Serial Option PortCommunicating

with PT Flags*1

A393.00 to A393.07

When serial option port is being used in NT link mode, the bit corre-sponding to the Unit performing communications will be ON. Bits 00 to 07 correspond to unit numbers 0 to 7, respectively.ON: CommunicatingOFF: Not communicating

Read • Cleared when power is turned ON.

• Turns ON the bit corresponding to the unit number of the PT/Polled Unit that is communicating via serial option port in NT link mode or Serial PLC Link mode.

• Bits 00 to 07 correspond to unit numbers 0 to 7, respectively.

Serial Option Port Error Flags

A528.00 to A528.07

When an error occurs at serial option port, the correspondingerror bit is turned ON. Bit 00: Not used.Bit 01: Not used.Bit 02: Parity errorBit 03: Framing errorBit 04: Overrun errorBit 05: Timeout errorBit 06: Not used.Bit 07: Not used.

Read/Write • Cleared when power is turned ON.

• When an error occurs at serial option port, the cor-responding error bit is turned ON.

• The flag is automatically turned OFF by the system when serial option port is restarted.

• Disabled during peripheral bus mode.

• In NT link mode, only bit 05 (timeout error) is enabled.

• In Serial PLC Link mode, only the following bits are enabled.Errors at the Polling Unit:Bit 05: Timeout errorErrors at Polled Units:Bit 05: Timeout errorBit 04: Overrun errorBit 03: Framing error

Page 328: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-42 CP1E CPU Unit Software User’s Manual(W480)

The present temperature information is exchanged between the boilers. This information is used toadjust the temperature control of one boiler depending on the status of the other boilers and for moni-toring individual boilers.

Wiring Example

CP1W-CIF11 RS422/485 Option Board DIP Switch Settings

16-6-6 Example Application

Operation

No. SettingsPolling

UnitPolled

Unit No. 0Polled

Unit No. 1Description

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

3 2-wire or 4-wire selection ON ON ON 2

4 − OFF OFF OFF Always OFF

5 RS control selection for RD OFF OFF OFF Control enabled

6 RS control selection for SD ON ON ON Control disabled

Boiler A Boiler B Boiler C

Boiler A: CP1E (Polling Unit)

CP1E N-type CPU Unit

CP1E N-type CPU Unit

CP1E N-type CPU Unit

CP1W-CIF11 RS-422A/485 Option Board

CP1W-CIF11 RS-422A/485 Option Board

CP1W-CIF11 RS-422A/485 Option Board

CP1W-TS101 Temperature Sensor Unit

CP1W-TS101 Temperature Sensor Unit

CP1W-TS101 Temperature Sensor Unit

Two Pt100 Sensor Inputs Two Pt100 Sensor Inputs Two Pt100 Sensor Inputs

CIO 2, CIO 3 CIO 2, CIO 3 CIO 2, CIO 3

Boiler B: CP1E (Polled Unit No. 0) Boiler C: CP1E (Polled Unit No. 1)

CPU Unit connectorDIP switch for operationsettings

(Back)

Page 329: CP1E CPU Unit Software Users Manual

16-43

16 Serial Communications

CP1E CPU Unit Software User’s Manual(W480)

16-6 Serial P

LC

Lin

ks

16

16-6-6 Exam

ple Application

PLC Setup

Programming ExampleData in the Serial PLC Link Areas are transferred using data links by the Serial PLC Link and withoutusing any special programming. The ladder program is used to transfer the data that needs to belinked to the data link area.

Ladder Diagram

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 PLC Link (Polling Unit) PLC link (Polled Unit)

Link words 10 (default) − −

PLC Link method All links − −

NT/PC Link Max. 1 − −

PLC link polled unit no. − 0 1

Boiler ACP1L (Polling Unit)

Boiler BCP1L (Polled Unit No.1)

Boiler CCP1L (Polled Unit No. 0)

Input Bits Input Bits Input Bits

A_Temperature data 0A_Temperature data 1

A_Temperature data 0A_Temperature data 1

B_Temperature data 0B_Temperature data 1

C_Temperature data 0C_Temperature data 1

A_Temperature data 0A_Temperature data 1

B_Temperature data 0B_Temperature data 1

C_Temperature data 0C_Temperature data 1

A_Temperature data 0A_Temperature data 1

B_Temperature data 0B_Temperature data 1

C_Temperature data 0C_Temperature data 1

B_Temperature data 0B_Temperature data 1

C_Temperature data 0C_Temperature data 1

Output Bits Output Bits Output Bits

CIO 0CIO 1CIO 2CIO 3

CIO 100

CIO 200CIO 201

CIO 209CIO 210CIO 211

CIO 219CIO 220CIO 221

CIO 299

Serial PLC Link Areas

Boiler ACP1E N-type CPU Unit (polling unit)

Transfer CIO 2 and CIO 3 to CIO 200 and CIO 201 using a BLOCK TRANSFER instruction.

Boiler BCP1E N-type CPU Unit (Polled Unit No. 0)

Transfer CIO 2 and CIO 3 to CIO 210 and CIO 211 using a BLOCK TRANSFER instruction.

Boiler CCP1E N-type CPU Unit (Polled Unit No. 1)

Transfer CIO 2 and CIO 3 to CIO 220 and CIO 221 using a BLOCK TRANSFER instruction

Page 330: CP1E CPU Unit Software Users Manual

16 Serial Communications

16-44 CP1E CPU Unit Software User’s Manual(W480)

16-7 Connecting the Host Computer (Not Including Support Software)

Host computers can be connected using this method only with the CP1E N-type CPU Unit.

Commands are sent from a host computer (not including Support Software) to the CP1E CPU Unit toread and write data. The serial communications mode is set to Host Link.

Precautions for Correct UsePrecautions for Correct Use

Support Software such as the CX-Programmer cannot use the Host Link protocol. Use USBinstead.

Refer to the SYSMAC CS/CJ-series Communications Commands Reference Manual (Cat. No. W342) for information on Host Link and FINS commands.

16-7-1 Overview

Command flow Command typeCommunica-tions method

Configuration Application Remarks

Host computer

→ PLC

-

Host link command

(C Mode)

Create frame in the host computerand send the command to the PLC. Receive the response.

Directly connect the host com-puter in a 1:1 or 1:N system.

Use this method when communicatingprimarily from the host com-puter to the PLC.

FINS command (with Host Link header andterminator) sent.

Directly connect the host com-puter in a 1:1 system or 1:N system.

Use these methods when communicatingprimarily from the host com-puter to PLCs in the network.

The FINS com-mand must be placed between a Host Link header and ter-minator and then sent by the host computer.

16-7-2 Flow of Processing

1 Connect the computer and CP1E CPU Unit using RS-232C ports.

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 CP1E CPU Unit.

2

Send the following commands from the host computer.

• C-mode commands

• FINS commands

3

Host link commandOR

Command

FINS

Host Linkheader

Host Link terminator

OR

Command

Communications wiring

PLC Setup

Program from host

Page 331: CP1E CPU Unit Software Users Manual

17-1CP1E CPU Unit Software User’s Manual(W480)

17

This section describes PID temperature control, analog adjusters, the minimum cycletime setting, clock functions, memory management functions, security functions, anddebugging.

17-1 PID Temperature Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-217-1-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2

17-1-2 Application Procedure for PID Temperature Control . . . . . . . . . . . . . . . . . . . 17-3

17-1-3 Ladder Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-4

17-2 Analog Adjusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-717-2-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-717-2-2 Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7

17-3 Minimum Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-817-3-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-8

17-3-2 Setting the Minimum Cycle Time in PLC Setup . . . . . . . . . . . . . . . . . . . . . . . 17-8

17-4 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-917-4-1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9

17-5 Startup Settings and Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1117-5-1 Holding Settings for Operating Mode Changes and at Startup . . . . . . . . . . 17-11

17-5-2 Setting the Power OFF Detection Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1317-5-3 Disabling Power Interruption Processing in the Program . . . . . . . . . . . . . . . 17-14

17-6 17-1517-6-1 17-15

17-7 Security Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1617-7-1 Ladder Program Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16

17-8 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1917-8-1 Forced Set/Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19

17-8-2 Online Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-19

17-8-3 Storing the Stop Position at Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-1917-8-4 Failure Alarm Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-20

Other Functions

Page 332: CP1E CPU Unit Software Users Manual

17 Other Functions

17-2 CP1E CPU Unit Software User’s Manual(W480)

17-1 PID Temperature Control

PID temperature control can be used with any model of CP1E CPU Unit.

The CP1E CPU Unit supports PID instructions with the autotuning function. Ladder programs can bewritten to perform PID temperature control.

Additional Information

Sampling Cycle

The sampling cycle set for a PIDAT instruction is between 10 ms to 99.99 s in increments of10 ms. The actual calculation cycle is determined by the relationship with cycle time.

Refer to the Instruction Reference Manual (Cat. No. W483) for details.

17-1-1 Overview

• Temperature input: Input from Temperature Sensor Unit to words in the Input Area.

• PID control: Execute using the PIDAT instruction in ladder program.

The PIDAT instruction is used in combination with the TPO instruction (TIME-PROPOR-TIONAL 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.

SSR

PIDAT

S

C

D

TPO

S

C

R

PID

CP1E

S: Input word

C: First parameter word

D: Output word

S: Input word

C: First parameter word

R: Pulse output bit

Temperature Sensor Unit

Model with Thermocouple: CP1W-TS001/002

Model with Platinum Resistance Thermometer: CP1W-TS101/102

Ladder program

Time-proportional

transistor output

Temperature Sensor

Page 333: CP1E CPU Unit Software Users Manual

17-3

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-1 PID

Temp

erature C

on

trol

17

17-1-2 Application P

rocedure for PID

Tem

perature Control

Temperature Sensor Unit• Setting the Temperature Range

Set the temperature range with the rotary switch on the front panel of the Temperature SensorUnit. If the rotary switch is set to 1 for a CP1W-TS001 Temperature Sensor Unit, the temperaturerange is 0.0 to 500.0°C.

• Temperature Data Storage FormatTemperature data is automatically stored in words in the Input Area allocated to the TemperatureInput 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 afactor of 10 and converted to a hexadecimal number without a sign, then stored as binarydata.

Example: 500.0°C multiplied by 10 is 5000 decimal. This is converted to 1388 in hexadecimal andstored.

• If the temperature is negative, it is stored as signed hexadecimal.

Example: -200°C is stored as FF38 hex.

PIDAT InstructionThe PIDAT instruction treats the PV as unsigned hexadecimal data (#0000 to #FFFF hex). Signeddata cannot be used, so if the temperature range includes negative values, apply scaling with theAPR instruction.

Automatically Executing Autotuning When PIDAT Is ExecutedTo automatically autotune the PID constants, turn ON the AT Command Bit when the PIDAT instruc-tion is executed.

17-1-2 Application Procedure for PID Temperature Control

1 Set the temperature range with the rotary switch on the front panel.

2 • Connect the temperature sensor to the Tempera-ture Sensor Unit.

• Connect the SSR to the transistor output.

3 Set parameters with the MOV instruction or other instructions.

4 Execute the PIDAT instruction.

5 Execute autotuning for the PID constants.

6 Start PID control.

Inputting the Temperature Sensor’s PV to PID Instructions

Autotuning Procedure

Setting the Temperature Sensor Unit

Wiring I/O

Setting PIDAT and TPO instructions parameters

Executing the PIDAT instruction

Autotuning

Starting PID control

Page 334: CP1E CPU Unit Software Users Manual

17 Other Functions

17-4 CP1E CPU Unit Software User’s Manual(W480)

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. TurnON bit 15 of C+9 (AT Command Bit).

2 Turn ON the PIDAT instruction’s input condition.

3 The PID 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), andderivative constant (C+3) calculated by autotuning will be stored and PID control will be started.

Executing Autotuning for Other Conditions When PIDAT Is ExecutedHere, the AT Command Bit is left OFF when the PID instruction is being executed. Later it is turnedON 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 inC+2, the derivative constant in C+3, and the input range in bits 08 to 11 of C+6. Turn ON bit 15of 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) willturn 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.

• A K thermocouple is used for the temperature input. Use a CP1W-TS001 Temperature Sensor Unit(thermocouple input).

• 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 PIDconstants calculated by autotuning.

17-1-3 Ladder Programming Example

System Configuration

100.00 COM -

Inputs connected to terminalblocks 0CH and 1CH

CP1E N-type CPU Unit with 30 I/O Points

Transistor output

Inputs connected to terminal block 2CH

CP1W-TS001 Temperature Sensor Unit

Temperature input terminals

Stored in CIO 2 in the Input Area

Control device (SSR)

Controlled device

Heater

K thermocouple

+

Page 335: CP1E CPU Unit Software Users Manual

17-5

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-1 PID

Temp

erature C

on

trol

17

17-1-3 Ladder Program

ming E

xample

The CP1W-TS001 Temperature Sensor Unit is used with input type of K 0.0 to 500.0°C (set the rotaryswitch to 1). The values 0.0 to 500.0°C are multiplied by a factor of 10 to account for the decimal pointand converted to hexadecimal data without a sign (0000 to 1388 hex) and stored in CIO 2 in the InputArea.

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 startedand the PID constants are calculated from the results from changing the manipulated variable.After AT has been completed, PID control is executed according to the calculated PID constantsset in D101 to D103. The manipulated variable is output to D200. The manipulated variable inD200 is divided by the manipulated variable range using the TPO instruction. This value is treatedas the duty factor, which is converted to a time-proportional output and output to CIO100.00 as apulse output.

• When W0.00 turns OFF, PID is stopped and CIO100.00 is turned OFF.

The CP1W-TS001 Temperature Sensor Unit is used with an input type of K -200 to 1300°C (set therotary switch to 0). The decimal values -200 to 1300°C are converted to signed hexadecimal data (FF38to 0514 hex) and stored in CIO 2 in the Input Area.

Ladder Programming Example for an Input Range of 0.0 to 500.0°C for a K Thermocouple

Ladder Programming Example for an Input Range of -200 to 1300°C for a K Thermocouple

S

C

D

PIDAT

2

D100

D200

TPO

S D200

C D300

D 100.00

RSET

100.00

W1.00

W1.00

W0.00

C:D100

C+1:D101

C+2:D102

C+3:D103

C+4:D104

C+5:D105

C+6:D106

C+7:D107

C+8:D108

C+9:D109

C+10:D110

C+11:D111

C+40:D140

~

C:D300

C+1:D301

C+2:D302

C+3:D303

C+4:D304

C+6:D306

&1600&1&1&1&100#0002#0395#0000#0000#8000#000A

#0313

&2000

&0

&0

Limit-cycle Hysteresis = 0.10%(approximately 0.8˚C)

PV

MV

MV

Pulseoutput

Set value: 160˚C

Proportional band: 0.1%

Integral time: 0.1 s

Derivative time: 0.1 s

Sampling period: 1 sReverse operation (bit 00: OFF)/PID constants updated each time a sample is taken while the input condition is ON (bit 01: ON)/2-PID parameter α = 0.65 (bits 04 to 15: #000 hex)

Input/Output: 13 bits (bits 00 to 03, 08 to 11: #3 hex)/Integral and derivative constants: Time designation (bits 04 to 07: #9 hex)/MV limit control: No (bit 12: OFF)

AT execution (bit 15: ON)/AT Calculation Gain = 1.00 (bits 0 to 11: #000 hex)

When AT is completed, the contents of D109 is automatically overwritten by #0000 hex and the calculated PID constants are input to D101 to 103.

MV range: 13 bits (bits 0 to 3: #3 hex)/Input type: MV (bits 4 to 7: #1 hex), always read input (bit 8 to 11: #3 hex), output limit disabled (bits 12 to 15: #0 hex)

Control cycle: 20.00 s

No upper output limit

No lower output limit

Work Area

Work Area

~

Page 336: CP1E CPU Unit Software Users Manual

17 Other Functions

17-6 CP1E CPU Unit Software User’s Manual(W480)

However, the PIDAT instruction can only handle unsigned hexadecimal data as the PV. The value isthus 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.

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 startedand 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 PIDconstants 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 istreated as the duty factor which is converted to a time-proportional output and output toCIO100.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 inputrange (#0 to #1FFF hex). The set values must be input according to the scaled PV. For example, ifthe PV is 160°C, it is set as [8191/(1300+200)] × (160+200) = 1966].

PIDAT

S D600

C D100

D D200

TPO

S D200

C D300

D 100.00

RSET

100.00

W1.00

W1.00

W0.00

C:D100 &1966

C+1:D101 &1

C+2:D102 &1

C+3:D103 &1

C+4:D104 &100

C+5:D105 #0002

C+6:D106 #0395

C+7:D107 #0000

C+8:D108

C+9:D109

C+10:D110 #0005

C+11:D111

C+40:D140

C:D300 #0313

C+1:D301 &2000

C+2:D302 &0

C+3:D303 &0

C+4:D304

C+6:D306

APR

S 2

C D500

D D600

C:D500 #0800

C+1:D501 #FF38

C+2:D502 #0000

C+3:D503 #0514

C+4:D504 #1FFF

#0000

#8000

Pulse output Work Area

Work Area

PV

Scale PV to within #0000 to #1FFF hex

MV

MV

Specify 16-bit signed data (bit 11: 1, bit 10: OFF)/Number of coordinates in data table: 1 (bits 0 to 7: #00 hex)

Minimum manipulated variable input: -200 decimal (#FF38 hex)Minimum value in PID input range: #0000 hexMaximum manipulated variable input: 1300 decimal (#0514 hex)Maximum value in PID input range: #1FFF hex

Set value: 160˚C (set as calculated value: 1966)

Proportional band: 0.1%

Integral time: 0.1 s

Derivative time: 0.1 s

Sampling period: 1 s

Reverse operation (bit 00: OFF)/PID constants updated each time a sample is taken while the input condition is ON (bit 01: ON)/2-PID parameter α = 0.65 (bits 04 to 15: #000 hex)

Input/Output: 13 bits (bits 00 to 03, 08 to 11: #3 hex)/Integral and derivative constants: Time designation (bits 04 to 07: #9 hex)/Manipulated variable limit control: No (bit 12: 0)

AT execution (bit 15: 1)/AT Calculation Gain = 1.00(bits 0 to 11: #000 hex)

Limit-cycle Hysteresis = 0.05% (approximately 0.8˚C)

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.

Manipulated variable range: 13 bits (bits 0 to 3: #3 hex)/Input type: Manipulated variable (bits 4 to 7: #1 hex), always read input (bit 8 to 11: #3 hex)/Output limit disabled (bits 12 to 15: #0 hex)

Control cycle: 20.00 s

No upper output limit

No lower output limit

~~

Page 337: CP1E CPU Unit Software Users Manual

17-7

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-2 An

alog

Ad

justers

17

17-2-1 Overview

17-2 Analog Adjusters

The analog adjusters can be used with any model of CP1E CPU Unit.

By turning one of the analog adjusters on the CP1E CPU Unit with a Phillips screwdriver, the PV in theAuxiliary Area can be changed to any value within a range of 0 to 255. The PVs are in the followingwords.

Analog adjuster 1: A642

Analog adjuster 1: A643

Any change to a set value is reflected in the next cycle.

Setting the value for timer T100 in A642 makes it possible to use T100 as a variable timer with a rangeof 0 to 25.5 s (0 to 255).

Precautions for Correct UsePrecautions for Correct Use

Set values from the analog adjuster may vary with changes in the ambient temperature and thepower supply voltage. Do not use it for applications that require highly precise set values.

17-2-1 Overview

17-2-2 Application Example

Phillips screwdriver

Analog adjuster

TIMX

0100

A642T0100

100.00

Start condition

Page 338: CP1E CPU Unit Software Users Manual

17 Other Functions

17-8 CP1E CPU Unit Software User’s Manual(W480)

17-3 Minimum Cycle Time

The minimum cycle time function can be used with any model of CP1E CPU Unit.

A minimum cycle time can be set for a CP1E CPU Unit. Variations in I/O response times can be elimi-nated by repeating the program within the minimum cycle time.

This setting is effective only when the actual cycle time is shorter than the minimum cycle time setting.If the actual cycle time is longer than the minimum cycle time setting, the actual cycle time will remainunchanged.

A minimum cycle time can be set between 0.1 and 32,000 ms in increments of 0.1 ms in the PLC Setup.

When using the CX-Programmer for CP1E, set the minimum cycle time (Constant Cycle Time) on theTimings Tab Page.

17-3-1 Overview

17-3-2 Setting the Minimum Cycle Time in PLC Setup

END

Cycle

Cyclic tasks (ladder programs)

I/O refresh

A minimum (or fixed) cycle time can be set

Minimum cycletime (effective)

Minimum cycletime (effective)

Minimum cycletime (effective)

Actual cycle time Actual cycle time Actual cycle time

A minimum (or fixed) cycle time can be set

A minimum (or fixed) cycle time can be set

Minimum cycle time (effective)

Actual cycle time Actual cycle time Actual cycle time

Page 339: CP1E CPU Unit Software Users Manual

17-9

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-4 Clo

ck

17

17-4-1 Overview

17-4 Clock

The clock can be used only with the CP1E N-type CPU Unit.

The clock function can be used only with CP1E N-type CPU Units.

The current data is stored in the following words in the Auxiliary Area.

Additional Information

The clock cannot be used if a battery is not installed or the battery voltage is low.

If a Battery is not installed and the clock cannot be used because the power supply has been dis-connected for longer than the I/O memory backup time, A509.13 (the I/O Memory Previous Cor-ruption or Clock Stopped Flag (held at startup)) will turn ON.

17-4-1 Overview

Name Address Function

Clock data A351 to A354 The seconds, minutes, hour, day or 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

Page 340: CP1E CPU Unit Software Users Manual

17 Other Functions

17-10 CP1E CPU Unit Software User’s Manual(W480)

Related Auxiliary Area Bits and Words

Time-related Instructions

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 ON (year, month, day of month, hour, minutes, and seconds). The times are progressively older from number 1 to number 10.

Power ON Clock Data 2 A723 to A725

Power ON Clock Data 3 A726 to A728

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 A743 to A734

Power ON Clock Data 9 A732 to A746

Power ON Clock Data 10 A747 to A749

I/O Memory Previous Corruption or Clock Stopped Flag (Held at startup.)

A509.13 Latched ON if the power is interrupted for longer than I/O memory backup time. This means the clock cannot be used.

This flag will remain OFF until the user turns it ON.

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).

User Program Date A90 to A93 The time when the ladder programs were last over-written (year, month, day of month, hour, minutes, seconds, and day of week).

Parameter Date A94 to A97 The time when the parameters were last overwrit-ten (year, month, day of month, hour, minutes, sec-onds, and day of week).

Name Mnemonic Function

HOURS TO SECONDS

SEC Converts time data in hours/minutes/seconds format to an equiva-lent time in seconds only.

SECONDS TO HOURS

HMS Converts seconds data to an equivalent time in hours/minutes/sec-onds format.

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 specified source words.

Page 341: CP1E CPU Unit Software Users Manual

17-11

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-5 Startu

p S

etting

s and

Main

tenan

ce

17

17-5-1 Holding S

ettings for Operating M

ode C

hanges and at Startup

17-5 Startup Settings and Maintenance

Starting Program Execution Turn ON the IOM Hold Bit (A500.12) to retain all data in I/O memory (see note) when the CPU Unitis changed from PROGRAM mode to RUN/MONITOR mode to start program execution.

Stopping Program ExecutionIf the IOM Hold Bit (A500.12) is ON, all data in I/O memory will also be retained when the CPU Unitis changed from RUN/MONITOR mode to PROGRAM mode to stop program execution.

The following I/O memory areas are not retained: CIO Area (I/O bits), Work Area, Timer CompletionFlags, and Timer PVs.

Related Auxiliary Area Bits and Words

When the IOM Hold Bit is ON, all outputs from Output Units will be retained when program executionstops.

When the program starts again, outputs will have the same status that they had before the programwas stopped. (When the IOM Hold Bit is OFF, the status of the outputs will be cleared before instruc-tions are executed.)

In order for all data in I/O memory to be retained when the PLC is turned ON, the IOM Hold Bit(A500.12) must be ON and it must be protected in the PLC Setup.

17-5-1 Holding Settings for Operating Mode Changes and at Startup

Operating Mode Changes

Name Address Description

IOM Hold Bit A500.12 Turn ON this bit to retain the status of the I/O memory when shifting from PROGRAM to RUN or MONITOR mode or vice versa.

ON: I/O memory status retained when changing the operating mode.

OFF: I/O memory status cleared when changing the operating mode.

PLC Power ON

I/O memoryPROGRAM mode

MONITOR or RUN mode

RetainedAreas not normally retained, e.g., CIO Area

MONITOR or RUN mode

Retained

PROGRAM mode

I/O memory

Areas not normally retained, e.g., CIO Area

Power turned ONRetained

I/O memory

Areas not normally retained, e.g., CIO Area

Page 342: CP1E CPU Unit Software Users Manual

17 Other Functions

17-12 CP1E CPU Unit Software User’s Manual(W480)

Related Auxiliary Area Bits and Words

PLC Setup Setting When using the CX-Programmer for CP1E, select the IOM Hold Bit Check Box in the Startup HoldArea on the Startup Tab Page to make the setting.

Precautions for Correct UsePrecautions for Correct Use

The data in I/O memory is cleared if a power interruption lasts longer than the I/O memorybackup time (50 hours for an E-type CPU Unit and 40 hours for an N-type CPU Unit) even if thestartup hold settings that are described above are made.

Name Address Description

IOM Hold Bit A500.12 Turn this bit ON to retain the status of the I/O Memory when shifting from PROGRAM to RUN or MONITOR mode or vice versa.

ON: I/O memory status retained when changing the operating mode.

OFF: I/O memory status cleared when changing the operating mode.

Page 343: CP1E CPU Unit Software Users Manual

17-13

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-5 Startu

p S

etting

s and

Main

tenan

ce

17

17-5-2 Setting the P

ower O

FF

Detection T

ime

It is possible to increase how much of a delay there will be from when the power supply voltage dropsbelow 85% of the rated value (or below 80% for DC) to the confirmation of a power interruption.

By default, an AC power interruption of 10 ms or longer (2 ms or longer for a DC power interruption) willbe detected about 10 to 25 ms (2 to 5 ms for DC power supplies) after the power supply voltage dropsbelow 85% of the minimum rated value (80% for DC power supplies). After the delay, operation will stop,and power OFF interrupt task will be executed if one has been created. There is a setting in the PLCSetup that can extend this time.

PLC Setup Setting When using the CX-Programmer for CP1E, make the setting in the Power Off detection time Field onthe Timings Tab Page.

17-5-2 Setting the Power OFF Detection Time

Page 344: CP1E CPU Unit Software Users Manual

17 Other Functions

17-14 CP1E CPU Unit Software User’s Manual(W480)

Areas of the program can be protected from power OFF interrupts so that they will be executed beforethe CPU Unit is reset even if the power supply is interrupted. This is achieved by using the DISABLEINTERRUPTS (DI) and ENABLE INTERRUPTS (EI) instructions.

This function can be used with instructions that must be executed as a group, e.g., so that executiondoes not start with intermediate stored data the next time power is turned ON.

Procedure1) Set the Disable Setting for Power OFF Interrupts in A530 to A5A5 hex to enable disabling Power OFF

Interrupts.

2) Enable disabling Power OFF Interrupts in the PLC Setup (this is the default setting).

3) Use the DI instruction to disable interrupts before the program section to be protected and then usethe EI instruction to enable interrupts after the section.All instructions between the DI and EI instructions will be completed before the Power OFF Interruptis executed even if a power interruption occurs while executing the instructions between the DI andEI instructions.

Related Auxiliary Area Bits and Words

17-5-3 Disabling Power Interruption Processing in the Program

Name Address Description

Disabling Power Interruption Processing in the Program

A530 Enables using the DI instruction to disable power OFF interrupt processing (except for execution of the Power OFF Interrupt Task) until the EI instruction is executed.

A5A5 hex: Enables using the DI instruction to disable power OFF interrupt processing.Any other value: Disables using the DI instruction to disable power OFF interrupt pro-cessing.

These instructions are executed

DI

EI

Disables interrupt processing

Execution condition

Power interruption confirmed

Interrupt processing enabled and CPU Unit reset

DI

EI

Power supply voltage < 85% of rated voltage (less than 80% for DC power)

Power interruption confirmed

CPU Unit reset (forced end)

Instructions between DI and EI executed Stopped

Power OFF detection time + Power OFF detection delay

10 ms - Power OFF detection delay (Power OFF confirmation time)

Page 345: CP1E CPU Unit Software Users Manual

17-15

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-6

17

17-6-1

17-6

17-6-1

Page 346: CP1E CPU Unit Software Users Manual

17 Other Functions

17-16 CP1E CPU Unit Software User’s Manual(W480)

17-7 Security Functions

This section describes how to set read protection, write protection, and operation protection for programming.

ÅB

With the CX-Programmer for CP1E, it is possible to set read protection using a password for eachPLC.

When the program is read-protected using a password, it is not possible to display or edit any of theladder programs using the CX-Programmer for CP1E unless the password is entered in the DisablePassword Dialog Box from the CX-Programmer for CP1E.

This enables improved security for PLC data in equipment.

Protection Procedure

17-7-1 Ladder Program Protection

Read Protection

1 Go online and select PLC - Protection - Release Password. The Release Read Protection

Dialog Box will be displayed.

2 Enter the registered password.

If the password is incorrect, the message shown on the right will be displayed, and protec-tion will not be released.

Page 347: CP1E CPU Unit Software Users Manual

17-17

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-7 Secu

rity Fu

nctio

ns

17

17-7-1 Ladder Program

Protection

Auxiliary Area Bits Related to Password Protection

With the CP1E, it is possible to set write protection for ladder programs and PLC Setup settings byusing A500.11 in the Auxiliary Area.

Additional Information

This function is equivalent to write protection using the DIP switch on the CPU Units in the CS/CJSeries and the CP-series CP1H and CP1HL CPU Units.

Procedure• To enable writing at any time, turn ON A500.11 with an OUT instruction using the Always ON Flag

(P_ON) in the input condition. You can also turn ON A500.11 using a SET instruction. The status of A500.11 is retained when the power supply is cycled or when the operating mode is changed.

• To set write protection only when it is required, turn ON/OFF A500.11 from the CX-Programmer for CP1E.

Related Auxiliary Area Bits and Words

NameBit

address Description

Status after mode

change

Startup hold

settings

UM Read Protection Status

A99.00 Indicates whether or not all ladder programs in a PLC are read-protected.

OFF: UM read protection is not set.

ON: UM read protection is set.

Hold Hold

Ladder Program Write Protection

Name Address Description Status

after mode change

Startup hold

settings

User Memory Write Protect Bit

A500.11 This bit specifies whether user memory and PLC Setup settings are to be write-protected.

ON: User memory write-protected

OFF: User memory not write-protected

Hold Hold

Page 348: CP1E CPU Unit Software Users Manual

17 Other Functions

17-18 CP1E CPU Unit Software User’s Manual(W480)

The manufacturing lot number is stored in words A310 and A311 in the Auxiliary Area of a CP1E Byusing these words in the Auxiliary Area, it is possible to generate a fatal error and disable using ladderprogramming with a PLC that has a different manufacturing lot number. The manufacturing lot numbercannot be changed by the user.

• The manufacturing lot number is five digits. The leftmost two digits are stored in A311 and the right-most three digits are stored in A310.

• X, Y, and Z in manufacturing lot numbers will be converted to 10, 11, and 12, respectively, and stored.

Ladder Program Example • Generating a Fatal Error If the Manufacturing Lot Number Is Not 23905

• Generating a Fatal Error If the Manufacturing Lot Number Is Not ***05

• Generating a Fatal Error If the Manufacturing Lot Number Is Not 23Y**

Ladder Program Operation Protection (Checking the Manufacturing Lot Number)

A311 CH A310 CH

Manufacturing Lot Number (five digits)

ANDL(610)A310

#00FFFFFFD0

FALS(007)1

D100

A200.11 (First Cycle Flag)

<> L(306)D0

#050923

ANDL(610)A310

#00FF0000D0

FALS(007)1

D100

A200.11 (First Cycle Flag)

<> L(306)D0

#50000

ANDL(610)A310

#0000FFFFD0

FALS(007)1

D100

A200.11 (First Cycle Flag)

<> L(306)D0

#1123

Page 349: CP1E CPU Unit Software Users Manual

17-19

17 Other Functions

CP1E CPU Unit Software User’s Manual(W480)

17-8 Debu

gg

ing

17

17-8-1 Forced S

et/Reset

17-8 Debugging

The CX-Programmer for CP1E can be used to force-set (turn ON) or force-reset (turn OFF) specifiedbits in the CIO Area, Auxiliary Area or Holding Area, as well as timer and counter Completion Flags.Forced status will take priority over status output from the program or status from I/O refreshing.

This status cannot be overwritten by instructions.

It will be retained regardless of the status of the program or external inputs until it is cleared from theCX-Programmer for CP1E.

Force-set/reset operations are used to control the status of inputs and outputs during trial operation orto control specific conditions during debugging.

Force-set/reset operations can be executed in either MONITOR or PROGRAM mode.

They cannot be used in RUN mode.

Bits in the following areas can be force-set and force-reset.

CIO Area (I/O bits and Serial PLC Link Bits), Work Area, Timer/Counter Completion Flag Areas, andHolding Area.

The Online Editing function is used to add to or change part of a program in a CPU Unit directly fromthe CX-Programmer for CP1E when the CPU Unit is in MONITOR or PROGRAM mode. One or moreprogram sections can be added or changed at a time from the CX-Programmer for CP1E.

The function is designed for minor program changes without stopping the CPU Unit.

Online editing is possible simultaneously from more than one computer running the CX-Programmer forCP1E as long as different tasks are edited.

The type of task and the current task number when a task stops execution due to a program error willbe stored as shown below.

Task Number When Program Stopped (A294)

This information makes it easier to determine where the fatal error occurred.

When a fatal error is cleared, the Program Error Task will be cleared.

The program address where task operation stopped is stored in A298 (rightmost bits of the programaddress) and in A299 (leftmost bits of the program address).

17-8-1 Forced Set/Reset

17-8-2 Online Editing

17-8-3 Storing the Stop Position at Errors

Type A294

Cyclic task Always 0000 hex for CPIE

Interrupt task (including extra cyclic task)

8000 to 80FF hex (correspond to interrupt task numbers 0 to 255)

Page 350: CP1E CPU Unit Software Users Manual

17 Other Functions

17-20 CP1E CPU Unit Software User’s Manual(W480)

The FAL and FALS instructions generate user-defined errors.

FAL generates a non-fatal error and FALS generates a fatal error that stops program execution.

When a user-defined error condition (i.e., executions condition) are met, the Failure Alarm instruction(FAL or FAL) will be executed.

17-8-4 Failure Alarm Instructions

Page 351: CP1E CPU Unit Software Users Manual

19-1CP1E CPU Unit Software User’s Manual(W480)

19

This section describes the cycle time of a CP1E CPU Unit.

19-1 Monitoring the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-219-1-1 Monitoring the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2

19-2 Computing the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-319-2-1 CPU Unit Operation Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3

19-2-2 Cycle Time Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-4

19-2-3 Functions Related to the Cycle Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5

19-2-4 I/O Refresh Times for PLC Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7

19-2-5 Cycle Time Calculation Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

19-2-6 Increase in Cycle Time for Online Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8

19-2-7 I/O Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-9

19-2-8 Interrupt Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-11

19-2-9 Serial PLC Link Response Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-13

19-2-10 Pulse Output Start Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-13

19-2-11 Pulse Output Change Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-14

CPU Unit Cycle Time

Page 352: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-2 CP1E CPU Unit Software User’s Manual(W480)

19-1 Monitoring the Cycle Time

The average, maximum, and minimum cycle times can be monitored when the CX-Programmer forCP1E is connected online to a CPU Unit.

While connected online to the PLC, the average cycle time is displayed in the status bar when the CPUUnit is in any mode other than PROGRAM mode.

Select PLC Information - Cycle Time from the PLC Menu.

The following PLC Cycle Time Dialog Box will be displayed.

The average (mean), maximum, and minimum cycle times will be displayed in order from the top.

Click the Reset Button to recalculate and display the cycle time values.

Additional Information

The cycle time average value (= present value) and maximum value are stored in the followingAuxiliary Area words.

• Average cycle time (= present value) (0.1-ms increments): A264 (lower bytes) and A265(upper bytes)

• Average Cycle Time (0.01-ms increments): A266 (lower digits) and A267 (upper digits)

• Maximum Cycle Time (0.1-ms increments): A262 (lower bytes) and A263 (upper bytes)

19-1-1 Monitoring the Cycle Time

Monitoring the Average Value

Monitoring Maximum and Minimum Values

Page 353: CP1E CPU Unit Software Users Manual

19-3

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-1 CP

U U

nit Operation F

lowchart

19-2 Computing the Cycle Time

The CPU Unit processes data in repeating cycles from the overseeing processing up to peripheral servicing as shown in the following diagram.

19-2-1 CPU Unit Operation Flowchart

Power ON

Check OK?

End of program?

Sets error flags

Calculates cycle time

I/O refresh I/O r

efre

sh

Peripheral servicing

NO

YES

Error

Normal

Checks Unit connection status

Checks hardware and user program memory

ERR/ALM indicator ON or flashing?

Flashing (non-fatal error)

Lit (fatal error)

User program executed

Waits until the set cycle time has elapsed

Sta

rtup

initi

aliz

atio

nO

vers

eein

g pr

oces

sing

Pro

gram

exe

cutio

nC

ycle

tim

e ca

lcul

atio

n PLC

cyc

le ti

me

Per

iphe

ral

serv

icin

g

Page 354: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-4 CP1E CPU Unit Software User’s Manual(W480)

The cycle time depends on the following conditions.

• Type and number of instructions in the user program (cyclic tasks and all interrupt tasks for which theexecution conditions have been satisfied)

• Type and number of CP-series Expansion Units and Expansion I/O Units

• Minimum (constant) cycle time setting in the PLC Setup

• Use of peripheral USB and serial ports

• Fixed peripheral servicing time in the PLC Setup

Precautions for Correct UsePrecautions for Correct Use

When the mode is switched from MONITOR mode to RUN mode, the cycle time will be extendedby 10 ms (this will not, however, cause a cycle time exceeded error).

The cycle time is the total time required for the PLC to perform the operations given in the followingtables.

Cycle time = (1) + (2) + (3) + (4) + (5)

(1) Overseeing

(2) Program Execution

(3) Cycle Time Calculation for Minimum Cycle Time

(4) I/O Refreshing

19-2-2 Cycle Time Overview

OperationProcessing time and

fluctuation cause

Checks the I/O bus and user memory, checks for battery errors, etc.

0.4 ms

OperationProcessing time and

fluctuation cause

Executes the instructions in the user program. The time required is the total of the executions times for all instructions.

Total instruction execution time.

Operation Processing time and fluctuation cause

Waits for the specified cycle time to elapse when a minimum (constant) cycle time has been set in the PLC Setup.

Calculates the cycle time.

When a minimum cycle time is not set, the time for step 3 is approximately 0.

When a minimum cycle time is set, the time for step 3 is the preset fixed cycle time minus the actual cycle time ((1) + (2) + (4) + (5)).

OperationProcessing time and fluctuation

cause

CPU Unit built-in I/O

CP-series Expansion Units and Expansion I/O Units.

Outputs from the CPU Unit to the actual outputs are refreshed first for each Unit, and then inputs.

I/O refresh time for each Unit multiplied by the number of Units used.

Page 355: CP1E CPU Unit Software Users Manual

19-5

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-3 Functions R

elated to the Cycle T

ime

(5) Peripheral Servicing

Set the minimum cycle time to a non-zero value to eliminate inconsistencies in I/O responses by repeat-edly executing the program with a consistent cycle time.

A minimum cycle time can be set in the PLC Setup between 1 and 32,000 ms in 1-ms increments.

This setting is effective only when the actual cycle time is shorter than the minimum cycle time setting.If the actual cycle time is longer than the minimum cycle time setting, the actual cycle time will remainunchanged.

Operation Processing time and fluctuation cause

Services peripheral USB port.

If a uniform peripheral servicing time hasn’t been set in the PLC Setup for this servicing, 8% of the previous cycle’s cycle time (calcu-lated in step (3)) will be allowed for peripheral servicing.

If a uniform peripheral servicing time has been set in the PLC Setup, servicing will be performed for the set time.

Servicing will be performed for at least 0.1 ms, however, whether the peripheral servicing time is set or not.

If the ports are not connected, the servicing time is 0 ms.

Services serial port.

Services communications ports.

If a uniform peripheral servicing time hasn’t been set in the PLC Setup for this servicing, 8% of the previous cycle’s cycle time (calcu-lated in step (3)) will be allowed for peripheral servicing.

If a uniform peripheral servicing time has been set in the PLC Setup, servicing will be performed for the set time.

Servicing will be performed for at least 0.1 ms, however, whether the peripheral servicing time is set or not.

If no communications ports are used, the servicing time is 0 ms.

Services built-in flash memory access.

If a uniform peripheral servicing time hasn’t been set in the PLC Setup for this servicing, 8% of the previous cycle’s cycle time (calcu-lated in step (3)) will be allowed for peripheral servicing.

If a uniform peripheral servicing time has been set in the PLC Setup, servicing will be performed for the set time.

Servicing will be performed for at least 0.1 ms, however, whether the peripheral servicing time is set or not.

If there is no access, the servicing time is 0 ms.

19-2-3 Functions Related to the Cycle Time

Minimum Cycle Time

Minimum cycle time (When setting is

effective.)

Minimum cycle time (When setting is

effective.)

Minimum cycle time (When setting is

effective.)

Actual cycle time

Actual cycle time

Actual cycle time

Minimum cycle time Minimum cycle time

Actual cycle time Actualcycle time

Actual cycle time

Minimum cycle time (When setting is effective.)

Page 356: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-6 CP1E CPU Unit Software User’s Manual(W480)

PLC Setup

If the cycle time exceeds the maximum cycle time setting, the CPU Unit will stop operation. The Cycle Time Too Long Flag (A401.08) will turn ON to indicate that the maximum cycle time has been exceeded.

PLC Setup

Related Auxiliary Area Flags

The actual maximum cycle time is stored in A262 and A263 and the present cycle time is stored inA264 and A265 every cycle.

Related Auxiliary Area Flags

The average cycle time for the past eight cycles can be read from the CX-Programmer.

Additional Information

The following method is effective in reducing the cycle time.Use JMP-JME instructions to skip instructions that do not need to be executed.

Name Description Default

Constant Cycle Time 0000 to 7D00 hex: 1 to 32,000 ms in 1-ms increments

0000 hex: Variable cycle time

Watch Cycle Time

Name Description Default

Watch Cycle Time enable setting 0: Default (1 s)1: User setting

0000 hex: Watch cycle time of 1 s

Watch Cycle Time setting

(Valid only when bit 15 is set to 1 to indicate a user setting.)

001 to FA0 hex: 10 to 40,000 ms (10-ms increments)

Name Word Description

Cycle Time Too Long Flag

A401.08 Turns ON if the present cycle time exceeds the Watch Cycle Time set in the PLC Setup.

Monitoring the Cycle Time

Name Word Description

Maximum Cycle Time A262 and A263

These words contain the maximum cycle time since the start of PLC opera-tion in 32-bit binary. The value is updated every cycle. The value will be in the following range. 0 to 429,496,729.5 ms (0 to FFFF FFFF hex) in 0.1-ms incrementsThe lower bytes are stored in A262 and the upper bytes are stored in A263.

Present Cycle Time A264 and A265

These words contain the present cycle time in 32-bit binary. The value is updated every cycle. The value will be in the following range.

0 to 429,496,729.5 ms (0 to FFFF FFFF hex) in 0.1-ms incrementsThe lower bytes are stored in A264 and the upper bytes are stored in A265.

Page 357: CP1E CPU Unit Software Users Manual

19-7

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-4 I/O R

efresh Tim

es for PLC

Units

I/O Refresh Times for CP-series Expansion Units and Expansion I/O Units

Additional Information

The I/O refresh time for the built-in I/O of the CPU Unit is included in overseeing processing.

19-2-4 I/O Refresh Times for PLC Units

Unit name Model numbers I/O refresh time per UnitExpansion I/O Units CP1W-40EDR

CPM1A-40EDR

0.39ms

CP1W-40EDT

CPM1A-40EDT

0.39ms

CP1W-40EDT1

CPM1A-40EDT1

0.39ms

CP1W-32ER

CP1W-32ET

CP1W-32ET1

0.33ms

CP1W-20EDR1

CPM1A-20EDR1

0.18ms

CP1W-20EDT

CPM1A-20EDT

0.18ms

CP1W-20EDT1

CPM1A-20EDT1

0.18ms

CP1W-16ER

CPM1A-16ER

0.25ms

CP1W-16ET

CP1W-16ET1

0.25ms

CP1W-8ED

CPM1A-8ED

0.13ms

CP1W-8ER

CPM1A-8ER

0.08ms

CP1W-8ET

CPM1A-8ET

0.08ms

CP1W-8ET1

CPM1A-8ET1

0.08ms

Analog Input Unit CP1W-AD041

CPM1A-AD041

0.61ms

Analog Output Unit CP1W-DA041

CPM1A-DA041

0.33ms

Analog I/O Units CP1W-MAD11

CPM1A-MAD11

0.32ms

Temperature Sensor Unit CP1W-TS001

CPM1A-TS001

0.25ms

CP1W-TS002

CPM1ATS002

0.52ms

CP1W-TS101

CPM1A-TS101

0.25ms

CP1W-TS102

CPM1A-TS102

0.52ms

CompoBus/S I/O Link Unit CP1W-SRT21 0.21ms

Page 358: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-8 CP1E CPU Unit Software User’s Manual(W480)

The following example shows the method used to calculate the cycle time when only CP-series Expan-sion I/O Units are connected to a CP1E CPU Unit.

Conditions

Calculation Example

When online editing is executed to change the program from the CX-Programmer while the CPU Unit isoperating in MONITOR mode, the CPU Unit will momentarily suspend operation while the program isbeing changed.

The period of time that the cycle time is extended is determined by the following conditions.

• Number of steps changed

• Type of editing operations (insert/delete/overwrite)

• The actual instructions that are edited

The cycle time extension for online editing is negligibly affected by the size of task programs.

If the maximum program size for a task is 8K steps, the online editing cycle time extension will be as fol-lows:

When editing online, the cycle time will be extended according to the editing that is performed.

Note When there is one task, online editing is processed all in the cycle time following the cycle in which onlineediting is executed (written). When there are multiple tasks (the cyclic task and interrupt tasks), online editingis separated, so that for n tasks, processing is executed over n to n × 2 cycles max.

19-2-5 Cycle Time Calculation Example

Item Description

CP1E CPU Unit 40-point I/O Unit

CP1W-40EDR

1 Unit

Ladder diagram 5K steps LD instructions: 2.5K steps

OUT instructions: 2.5K steps

Peripheral USB port connection Yes or no

Minimum cycle time processing None

Serial port connection None

Other peripheral servicing None

Process name Equation

Processing time

Peripheral USB port connected

Peripheral USB port not

connected

(1)Overseeing −

(2)Program execution 0.55µs×2,500+1.1µs×2,500

(3)Cycle time calculation (Minimum cycle time not set.)

(4)I/O refreshing 0.39 ms

(5)Peripheral servicing (Only peripheral USB port connected)

Cycle time (1)+(2)+(3)+(4)+(5)

19-2-6 Increase in Cycle Time for Online Editing

CPU Unit Increase in cycle time for online editing

CP1E CPU Unit Maximum: 16 ms, Normal: 12 ms (for a program size of 8K steps)

Page 359: CP1E CPU Unit Software Users Manual

19-9

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-7 I/O R

esponse Tim

e

The I/O response time is the time it takes from when an input turns ON, the data is recognized by theCPU Unit, and the ladder programs are executed, up to the time for the result to be output to an outputterminal.

The length of the I/O response time depends on the following conditions.

• Timing of Input Bit turning ON.

• The cycle time

Minimum I/O Response TimeThe I/O response time is shortest when data is retrieved immediately before I/O refresh of the CPUUnit.

The minimum I/O response time is calculated as follows:

Note The input and output ON delays depend on the type of terminals used on the CPU Unit or the model numberof the Unit being used.

Maximum I/O Response TimeThe I/O response time is longest when data is retrieved immediately after I/O refresh period of the CPU Unit.

The maximum I/O response time is calculated as follows:

19-2-7 I/O Response Time

Minimum I/O response time = Input ON delay + Cycle time + Output ON delay

Maximum I/O response time = Input ON delay + (Cycle time × 2) + Output ON delay

Inputs:

Outputs:

:I/O refresh

Input ON response time

Cycle time Cycle time

Output ON delay

Minimum I/OResponse Time

(Status read to the CPU Unit.):

Instruction execution

Instruction execution

Inputs:

Outputs:

:I/O refresh

Input ON response time

Cycle time Cycle time

Output ON delay

Minimum I/O Response Time

(Status read to the CPU Unit.):

Instruction execution

Instruction execution

Instruction execution

Page 360: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-10 CP1E CPU Unit Software User’s Manual(W480)

Calculation ExampleConditions:

Input ON delay: 1 ms (normal input 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 response times can be set in the PLC Setup.

Increasing the response time reduces the effects of chattering and noise. Decreasing the responsetime allows reception of shorter input pulses, (but the pulse width must be longer than the cycle time).

PLC Setup

Input Response Times

Name Description Setting Default

Input Constant Settings Input Constants 00 hex: 8 ms

10 hex: 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

00 hex (8 ms)

Input response timeInput response time

I/O refresh I/O refresh

Inputs Inputs

CPU Unit CPU Unit

Pulses shorter than the input response time are not received

Page 361: CP1E CPU Unit Software Users Manual

19-11

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-8 Interrupt Response T

ime

Interrupt Response Time for Input Interrupt TasksThe interrupt response time for input interrupt tasks is the time taken from when a built-in input hasturned 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.

* The wait time occurs when there is competition with other interrupts. As a guideline, the wait time will be 6 to 169 µs.

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 interruptinputs turns ON.Input interrupts, however, are not executed during execution of other interrupt tasks even if the input interruptconditions are satisfied. Instead, the input interrupts are executed in order of priority after the current inter-rupt task has completed execution and the software interrupt response time has elapsed.

The interrupt response time of input interrupt tasks is calculated as follows:

Input interrupt response time = Input ON delay + Software interrupt response time

19-2-8 Interrupt Response Time

Item Interrupt response time Counter interrupts

Hardware interrupt response time Upward differentiation: 50 µs −Downward differentiation: 50 µs −

Software interrupt response time Minimum: 134 µs Minimum: 134 µs

Maximum: 336 µs + Wait time* Maximum: 336 µs + Wait time*

Input ON response time

Inputs:

(Interrupt signalacknowledged.):

Interrupt taskexecution:

Software interrupt response time

Cycle execution task execution (main program):

Interrupt response time for input interrupt task

Ladder program execution time

Return time from input interrupt task

Ready to acknowledge next interrupt signal

The time from when execution of the input interrupt task is completed until execution of the cycle execution task is resumed is 60 µs.

Page 362: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-12 CP1E CPU Unit Software User’s Manual(W480)

Interrupt Response Time for Scheduled Interrupt TasksThe interrupt response time for scheduled interrupt tasks is the time taken from after the scheduledtime 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 80 µs in the time to the first scheduled interrupt (0.5 ms min.).

Note Scheduled interrupt tasks can be executed during execution of the ladder program (even while an instructionis 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 processingtime.Scheduled interrupts, however, are not executed during execution of other interrupt tasks even if the interruptconditions are satisfied. Instead, the interrupts are executed in order of priority after the current interrupt taskhas completed execution and the software interrupt response time has elapsed.

Internal timer:

Scheduledinterrupt task:

Scheduled interrupt time

Software interrupt response time

Page 363: CP1E CPU Unit Software Users Manual

19-13

19 CPU Unit Cycle Time

CP1E CPU Unit Software User’s Manual(W480)

19-2 Co

mp

utin

g th

e Cycle T

ime

19

19-2-9 Serial P

LC Link R

esponse Perform

ance

The response times for CPU Units connected via a Serial PLC Link (polling unit to polled unit or polledunit to polling unit) can be calculated as shown below.

If a PT is in the Serial PLC Link, however, the amount of communications data will not be fixed and thevalues will change.

The pulse output start time is the time required from executing a pulse output instruction until pulses areoutput externally.

This time depends on the pulse output instruction that is used and operation that is performed.

19-2-9 Serial PLC Link Response Performance

• 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-ing polled unit nodes

The number of polled units to which links have been established within the maximum unit number set in the polling unit.

Number of non-participating polled unit nodes

The number of polled units not participating in the links within the maximum unit number set in the polling unit.

Communications cycle time (ms)

Polled unit communications time × Number of participating polled unit nodes + 10 × Number of non-participating polled unit nodes.

Polled unit communications time (ms)

• Communications time set to Standard:0.4 + 0.286 × ((No. of polled units + 1) × No. of link words × 2 + 12)

• Communications time set to Fast:0.4 + 0.0955 × ((No. of polled units + 1) × No. of link words × 2 + 12)

19-2-10 Pulse Output Start Time

Pulse output instruction Start time

SPED: continuous ?µs

SPED: independent ?µs

ACC: continuous ?µs

ACC: independent, trapezoidal ?µs

ACC: independent, triangular ?µs

PLS2: trapezoidal ?µs

PLS2: triangular ?µs

Start timeInstructionexecution

Pulse output

Page 364: CP1E CPU Unit Software Users Manual

19 CPU Unit Cycle Time

19-14 CP1E CPU Unit Software User’s Manual(W480)

The pulse output change response time is the time for any change made by executing an instructionduring pulse output to actually affect the pulse output operation.

19-2-11 Pulse Output Change Response Time

Pulse output instruction Change response time

INI: immediate stop 63 µs + 1 pulse output time

SPED: immediate stop 63 µs + 1 pulse output time

ACC: deceleration stop 1 control cycle (4 ms) minimum, 2 control cycles (8 ms) maximumPLS2: deceleration stop

SPED: speed change

ACC: speed change

PLS2: target position change in reverse direction

PLS2: target position change in same direction at same speed

PLS2: target position change in same direction at different speed

Page 365: CP1E CPU Unit Software Users Manual

A-1

pp

CP1E CPU Unit Software User’s Manual(W480)

Ap

p

A-1 Summary of Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2

A-2 A-12

A-3 CP1E CPU Unit Instruction Execution Times and Number of Steps . . . . A-13

A-4 Ladder Programming Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-25A-4-1 Shutter Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-25

A-5 Comparison with the CP1L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-29A-5-1 Differences between CP1E and CP1L . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-29

Appendices

Page 366: CP1E CPU Unit Software Users Manual

Appendices

A-2 CP1E CPU Unit Software User’s Manual(W480)

A-1 Summary of Instructions

There are 200 types of instructions can be used by CP1E.The following table lists the instructions by function. Refer to the reference pages for thedetail of each instruction.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Sequence Input Instruc-tions

LOAD LD - Indicates a logical start and creates an ON/OFF execution condition based on the ON/OFF status of the specified operand bit.@LD -

%LD -

!LD -

!@LD -

!%LD -

LOAD NOT LD NOT - Indicates a logical start and creates an ON/OFF execution condition based on the reverse of the ON/OFF status of the specified operand bit.@LD NOT -

%LD NOT -

!LD NOT -

!@LD NOT -

!%LD NOT -

AND AND - Takes a logical AND of the status of the specified operand bit and the current execution condition.@AND -

%AND -

!AND -

!@AND -

!%AND -

AND NOT AND NOT - Reverses the status of the specified operand bit and takes a logical AND with the current execution condition.@AND NOT -

%AND NOT -

!AND NOT -

!@AND NOT -

!%AND NOT -

OR OR - Takes a logical OR of the ON/OFF status of the specified operand bit and the current execution condition.@OR -

%OR -

!OR -

!@OR -

!%OR -

OR NOT OR NOT - Reverses the status of the specified bit and takes a logical OR with the current execution condition.@OR NOT -

%OR NOT -

!OR NOT -

!@OR NOT -

!%OR NOT -

AND LOAD AND LD - Takes a logical AND between logic blocks.

OR LOAD OR LD - Takes a logical OR between logic blocks.

NOT NOT 520 Reverses the execution condition.

CONDITION ON UP 521 UP(521) turns ON the execution condition for one cycle when the execution condition goes from OFF to ON.

CONDITION OFF DOWN 522 DOWN(522) turns ON the execution condition for one cycle when the execution condition goes from ON to OFF.

Page 367: CP1E CPU Unit Software Users Manual

A-3

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-1 S

um

mary o

f Instru

ction

sA

pp

Sequence Output Instructions

OUTPUT OUT - Outputs the result (execution condition) of the logical processing to the speci-fied bit.!OUT -

OUTPUT NOT OUT NOT - Reverses the result (execution condition) of the logical processing, and outputs it to the specified bit.!OUT NOT -

TR Bits TR - TR bits are used to temporarily retain the ON/OFF status of execution condi-tions in a program when programming in mnemonic code.

KEEP KEEP 011 Operates as a latching relay.

!KEEP

DIFFERENTIATEUP

DIFU 013 DIFU(013) turns the designated bit ON for one cycle when the execution condi-tion goes from OFF to ON (rising edge).!DIFU

DIFFERENTIATEDOWN

DIFD 014 DIFD(014) turns the designated bit ON for one cycle when the execution condi-tion goes from ON to OFF (falling edge).!DIFD

SET SET - SET turns the operand bit ON when the execution condition is ON.

@SET -

%SET -

!SET -

!@SET -

!%SET -

RESET RSET - RSET turns the operand bit OFF when the execution condition is ON.

@RSET -

%RSET -

!RSET -

!@RSET -

!%RSET -

MULTIPLE BIT SET SETA 530 SETA(530) turns ON the specified number of consecutive bits.

@SETA

MULTIPLE BIT RESET

RSTA 531 RSTA(531) turns OFF the specified number of consecutive bits.

@RSTA

SINGLE BIT SET SETB 532 SETB(532) turns ON the specified bit in the specified word when the execution condition is ON.

Unlike the SET instruction, SETB(532) can be used to set a bit in a DM or EM word.

@SETB

!SETB

!@SETB

SINGLE BIT RESET RSTB 533 RSTB(533) turns OFF the specified bit in the specified word when the execu-tion condition is ON.

Unlike the RSET instruction, RSTB(533) can be used to reset a bit in a DM or EM word.

@RSTB

!RSTB

!@RSTB

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 368: CP1E CPU Unit Software Users Manual

Appendices

A-4 CP1E CPU Unit Software User’s Manual(W480)

Sequence Control Instructions

END END 001 Indicates the end of a program.

NO OPERATION NOP 000 This instruction has no function. (No processing is performed for NOP(000).)

INTERLOCK IL 002 Interlocks all outputs between IL(002) and ILC(003) when the execution condi-tion for IL(002) is OFF.

INTERLOCK CLEAR

ILC 003 All outputs between IL(002) and ILC(003) are interlocked when the execution condition for IL(002) is OFF.

MULTI-INTERLOCKDIFFERENTIATIONHOLD

MILH 517 When the execution condition for MILH(517) is OFF, the outputs for all instruc-tions between that MILH(517) instruction and the next MILC(519) instruction are interlocked.

MULTI-INTERLOCKDIFFERENTIATIONRELEASE

MILR 518 When the execution condition for MILR(518) is OFF, the outputs for all instruc-tions between that MILR(518) instruction and the next MILC(519) instruction are interlocked.

MULTI-INTERLOCKCLEAR

MILC 519 Clears an interlock started by an MILH(517) or MILR(518) with the same inter-lock number.

JUMP JMP 004 When the execution condition for JMP(004) is OFF, program execution jumps directly to the first JME(005) in the program with the same jump number.

JUMP END JME 005 Indicates the end of a jump initiated by JMP(004) or CJP(510).

CONDITIONAL JUMP

CJP 510 The operation of CJP(510) is the basically the opposite of JMP(004). When the execution condition for CJP(510) is ON, program execution jumps directly to the first JME(005) in the program with the same jump number.

FOR LOOP FOR 512 The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.

NEXT LOOP NEXT 513 The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.

BREAK LOOP BREAK 514 Programmed in a FOR-NEXT loop to cancel the execution of the loop for a given execution condition. The remaining instructions in the loop are processed as NOP(000) instructions.

Timer and Counter Instructions

HUNDRED-MS TIMER

TIM - TIM/TIMX(550) operates a decrementing timer with units of 0.1-s.

TIMX 550

TEN-MS TIMER TIMH 015 TIMH(015)/TIMHX(551) operates a decrementing timer with units of 10-ms.

TIMHX 551

ONE-MS TIMER TMHH 540 TMHH(540)/TMHHX(552) operates a decrementing timer with units of 1-ms.

TMHHX 552

ACCUMULATIVE TIMER

TTIM 087 TTIM(087)/TTIMX(555) operates an incrementing timer with units of 0.1-s.

TTIMX 555

LONG TIMER TIML 542 TIML(542)/TIMLX(553) operates a decrementing timer with units of 0.1-s.

TIMLX 553

COUNTER CNT - CNT/CNTX(546) operates a decrementing counter.

CNTX 546

REVERSIBLE COUNTER

CNTR 012 CNTR(012)/CNTRX(548) operates a reversible counter.

CNTRX 548

RESET TIMER/ COUNTER

CNR/@CNR

545 CNR(545)/CNRX(547) resets the timers or counters within the specified range of timer or counter numbers.

CNRX/@CNRX

547

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 369: CP1E CPU Unit Software Users Manual

A-5

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-1 S

um

mary o

f Instru

ction

sA

pp

Comparison Instructions

Symbol Comparison = , <> , < , <= , > , >=

300∼

328

Symbol comparison instructions compare two values and create an ON execu-tion condition when the comparison condition is true.

Time Comparison LD, AND, OR+=DT

341 Time comparison instructions compare two BCD time values and create an ON execution condition when the comparison condition is true.

LD, AND, OR+<>DT

342

LD, AND, OR+<DT

343

LD, AND, OR+<=DT

344

LD, AND, OR+>DT

345

LD, AND, OR+>=DT

346

UNSIGNED COMPARE

CMP 020 Compares two unsigned binary values (constants and/or the contents of speci-fied words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.!CMP

DOUBLE UNSIGNED COMPARE

CMPL 060 Compares two double unsigned binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.

SIGNED BINARY COMPARE

CPS 114 Compares two signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.!CPS

DOUBLE SIGNED BINARY COMPARE

CPSL 115 Compares two double signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.

TABLE COMPARE TCMP 085 Compares the source data to the contents of 16 words and turns ON the corre-sponding bit in the result word when the contents are equal.@TCMP

UNSIGNED BLOCK COMPARE

BCMP 068 Compares the source data to 16 ranges (defined by 16 lower limits and 16 upper limits) and turns ON the corresponding bit in the result word when the source data is within the range.

@BCMP

AREA RANGE COMPARE

ZCP 088 Compares the 16-bit unsigned binary value in CD (word contents or constant) to the range defined by LL and UL and outputs the results to the Arithmetic Flags in the Auxiliary Area.

DOUBLE AREA RANGE COMPARE

ZCPL 116 Compares the 32-bit unsigned binary value in CD and CD+1 (word contents or constant) to the range defined by LL and UL and outputs the results to the Arithmetic Flags in the Auxiliary Area.

Data Move-ment Instruc-tions

MOVE MOV 021 Transfers a word of data to the specified word.

@MOV

!MOV

!@MOV

DOUBLE MOVE MOVL/@MOVL

498 Transfers two words of data to the specified words.

MOVE NOT MVN/@MVN

022 Transfers the complement of a word of data to the specified word.

MOVE BIT MOVB/@MOVB

082 Transfers the specified bit.

MOVE DIGIT MOVD/@MOVD

083 Transfers the specified digit or digits. (Each digit is made up of 4 bits.)

MULTIPLE BIT TRANSFER

XFRB/@XFRB

062 Transfers the specified number of consecutive bits.

BLOCK TRANSFER XFER/@XFER

070 Transfers the specified number of consecutive words.

BLOCK SET BSET/@BSET

071 Copies the same word to a range of consecutive words.

DATA EXCHANGE XCHG/@XCHG

073 Exchanges the contents of the two specified words.

SINGLE WORD DISTRIBUTE

DIST/@DIST

080 Transfers the source word to a destination word calculated by adding an offset value to the base address.

DATA COLLECT COLL/@COLL

081 Transfers the source word (calculated by adding an offset value to the base address) to the destination word.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 370: CP1E CPU Unit Software Users Manual

Appendices

A-6 CP1E CPU Unit Software User’s Manual(W480)

Data Shift Instructions

SHIFT REGISTER SFT 010 Operates a shift register.

REVERSIBLESHIFT REGISTER

SFTR/@SFTR

084 Creates a shift register that shifts data to either the right or the left.

WORD SHIFT WSFT/@WSFT

016 Shifts data between St and E in word units.

ARITHMETIC SHIFT LEFT

ASL/@ASL

025Shifts the contents of Wd one bit to the left.

ARITHMETIC SHIFT RIGHT

ASR/@ASR

026 Shifts the contents of Wd one bit to the right.

ROTATE LEFT ROL/@ROL

027 Shifts all Wd bits one bit to the left including the Carry Flag (CY).

ROTATE RIGHT ROR/@ROR

028 Shifts all Wd bits one bit to the right including the Carry Flag (CY).

ONE DIGIT SHIFT LEFT

SLD/@SLD

074 Shifts data by one digit (4 bits) to the left.

ONE DIGIT SHIFT RIGHT

SRD/@SRD

075 Shifts data by one digit (4 bits) to the right.

SHIFT N-BITS LEFT NASL/@NASL

580 Shifts the specified 16 bits of word data to the left by the specified number of bits.

DOUBLE SHIFT N-BITS LEFT

NSLL/@NSLL

582 Shifts the specified 32 bits of word data to the left by the specified number of bits.

SHIFT N-BITS RIGHT

NASR/@NASR

581 Shifts the specified 16 bits of word data to the right by the specified number of bits.

DOUBLE SHIFT N-BITS RIGHT

NSRL/@NSRL

583 Shifts the specified 32 bits of word data to the right by the specified number of bits.

Increment/Decrement Instructions

INCREMENT BINARY

++/@++

590 Increments the 4-digit hexadecimal content of the specified word by 1.

DOUBLE INCRE-MENT BINARY

++L/@++L

591 Increments the 8-digit hexadecimal content of the specified words by 1.

DECREMENT BINARY

--/@--

592 Decrements the 4-digit hexadecimal content of the specified word by 1.

DOUBLE DECRE-MENT BINARY

--L/@--L

593 Decrements the 8-digit hexadecimal content of the specified words by 1.

INCREMENT BCD ++B/@++B

594 Increments the 4-digit BCD content of the specified word by 1.

DOUBLE INCRE-MENT BCD

++BL/@++BL

595 Increments the 8-digit BCD content of the specified words by 1.

DECREMENT BCD --B/@--B

596 Decrements the 4-digit BCD content of the specified word by 1.

DOUBLE DECRE-MENT BCD

--BL/@--BL

597 Decrements the 8-digit BCD content of the specified words by 1.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 371: CP1E CPU Unit Software Users Manual

A-7

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-1 S

um

mary o

f Instru

ction

sA

pp

Symbol Math Instructions

SIGNED BINARY ADD WITHOUT CARRY

+/@+

400 Adds 4-digit (single-word) hexadecimal data and/or constants.

DOUBLE SIGNED BINARY ADD WITHOUT CARRY

+L/@+L

401 Adds 8-digit (double-word) hexadecimal data and/or constants.

SIGNED BINARY ADD WITH CARRY

+C/@+C

402 Adds 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).

DOUBLE SIGNED BINARY ADD WITH CARRY

+CL/@+CL

403 Adds 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).

BCD ADD WITHOUT CARRY

+B/@+B

404 Adds 4-digit (single-word) BCD data and/or constants.

DOUBLE BCD ADD WITHOUT CARRY

+BL/@+BL

405 Adds 8-digit (double-word) BCD data and/or constants.

BCD ADD WITH CARRY

+BC/@+BC

406 Adds 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).

DOUBLE BCD ADD WITH CARRY

+BCL/@+BCL

407 Adds 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).

SIGNED BINARY SUBTRACT WITHOUT CARRY

-/@-

410 Subtracts 4-digit (single-word) hexadecimal data and/or constants.

DOUBLE SIGNED BINARY SUBTRACT WITH-OUT CARRY

-L/@-L

411 Subtracts 8-digit (double-word) hexadecimal data and/or constants.

SIGNED BINARY SUBTRACT WITH CARRY

-C/@-C

412 Subtracts 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).

DOUBLE SIGNED BINARY WITH CARRY

-CL/@-CL

413 Subtracts 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).

BCD SUBTRACT WITHOUT CARRY

-B/@-B

414 Subtracts 4-digit (single-word) BCD data and/or constants.

DOUBLE BCD SUBTRACT WITHOUT CARRY

-BL/@-BL

415 Subtracts 8-digit (double-word) BCD data and/or constants.

BCD SUBTRACT WITH CARRY

-BC/@-BC

416 Subtracts 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).

DOUBLE BCD SUBTRACT WITH CARRY

-BCL/@-BCL

417 Subtracts 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).

SIGNED BINARY MULTIPLY

∗/@∗

420 Multiplies 4-digit signed hexadecimal data and/or constants.

DOUBLE SIGNED BINARY MULTIPLY

∗L/@∗L

421 Multiplies 8-digit signed hexadecimal data and/or constants.

BCD MULTIPLY ∗B/@∗B

424 Multiplies 4-digit (single-word) BCD data and/or constants.

DOUBLE BCD MULTIPLY

∗BL/@∗BL

425 Multiplies 8-digit (double-word) BCD data and/or constants.

SIGNED BINARY DIVIDE

/@/

430 Divides 4-digit (single-word) signed hexadecimal data and/or constants.

DOUBLE SIGNED BINARY DIVIDE

/L @/L

431 Divides 8-digit (double-word) signed hexadecimal data and/or constants.

BCD DIVIDE /B @/B

434 Divides 4-digit (single-word) BCD data and/or constants.

DOUBLE BCD DIVIDE

/BL @/BL

435 Divides 8-digit (double-word) BCD data and/or constants.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 372: CP1E CPU Unit Software Users Manual

Appendices

A-8 CP1E CPU Unit Software User’s Manual(W480)

Conversion Instructions

BCD TO BINARY BIN/@BIN

023 Converts BCD data to binary data.

DOUBLE BCD TO DOUBLE BINARY

BINL/@BINL

058 Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary) data.

BINARY TO BCD BCD/@BCD

024 Converts a word of binary data to a word of BCD data.

DOUBLE BINARY TO DOUBLE BCD

BCDL/@BCDL

059 Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD data.

2’S COMPLEMENT NEG/@NEG

160 Calculates the 2' complement of a word of hexadecimal data.

DATA DECODER MLPX/@MLPX

076 Reads the numerical value in the specified digit (or byte) in the source word, turns ON the corresponding bit in the result word (or 16-word range), and turns OFF all other bits in the result word (or 16-word range).

DATA ENCODER DMPX/@DMPX

077 FInds the location of the first or last ON bit within the source word (or 16-word range), and writes that value to the specified digit (or byte) in the result word.

ASCII CONVERT ASC/@ASC

086 Converts 4-bit hexadecimal digits in the source word into their 8-bit ASCII equivalents.

ASCII TO HEX HEX/@HEX

162 Converts up to 4 bytes of ASCII data in the source word to their hexadecimal equivalents and writes these digits in the specified destination word.

Logic Instruc-tions

LOGICAL AND ANDW/@ANDW

034 Takes the logical AND of corresponding bits in single words of word data and/or constants.

DOUBLE LOGICAL AND

ANDL/@ANDL

610 Takes the logical AND of corresponding bits in double words of word data and/or constants.

LOGICAL OR ORW/@ORW

035 Takes the logical OR of corresponding bits in single words of word data and/or constants.

DOUBLE LOGICAL OR

ORWL/@ORWL

611 Takes the logical OR of corresponding bits in double words of word data and/or constants.

EXCLUSIVE OR XORW/@XORW

036 Takes the logical exclusive OR of corresponding bits in single words of word data and/or constants.

DOUBLE EXCLU-SIVE OR

XORL/@XORL

612 Takes the logical exclusive OR of corresponding bits in double words of word data and/or constants.

COMPLEMENT COM/@COM

029 Turns OFF all ON bits and turns ON all OFF bits in Wd.

DOUBLE COMPLEMENT

COML/@COML

614 Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1.

Special Math Instructions

ARITHMETIC PRO-CESS

APR/@APR

069 Calculates the sine, cosine, or a linear extrapolation of the source data.

BIT COUNTER BCNT/@BCNT

067 Counts the total number of ON bits in the specified word(s).

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 373: CP1E CPU Unit Software Users Manual

A-9

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-1 S

um

mary o

f Instru

ction

sA

pp

Floating-point Math Instruc-tions

FLOATING TO 16-BIT

FIX/@FIX

450 Converts a 32-bit floating-point value to 16-bit signed binary data and places the result in the specified result word.

FLOATING TO32-BIT

FIXL/@FIXL

451 Converts a 32-bit floating-point value to 32-bit signed binary data and places the result in the specified result words.

16-BIT TO FLOATING

FLT/@FLT

452 Converts a 16-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.

32-BIT TOFLOATING

FLTL/@FLTL

453 Converts a 32-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.

FLOATINGPOINTADD

+F/@+F

454 Adds two 32-bit floating-point numbers and places the result in the specified result words.

FLOATINGPOINTSUBTRACT

-F/@-F

455 Subtracts one 32-bit floating-point number from another and places the result in the specified result words.

FLOATING-POINT MULTIPLY

∗F/@∗F

456 Multiplies two 32-bit floating-point numbers and places the result in the speci-fied result words.

FLOATING-POINT DIVIDE

/F @/F

457 Divides one 32-bit floating-point number by another and places the result in the specified result words.

FLOATING SYMBOLCOMPARISON

=F 329 Compares the specified single-precision data (32 bits) or constants and creates an ON execution condition if the comparison result is true. Three kinds of sym-bols can be used with the floating-point symbol comparison instructions: LD (Load), AND, and OR.

<>F 330

<F 331

<=F 332

>F 333

>=F 334

FLOATING-POINT TO ASCII

FSTR/@FSTR

448 Converts the specified single-precision floating-point data (32-bit decimal- point or exponential format) to text string data (ASCII) and outputs the result to the destination word.

ASCII TO FLOATING-POINT

FVAL/@FVAL

449 Converts the specified text string (ASCII) representation of single-precision floating-point data (decimal-point or exponential format) to 32-bit single-preci-sion floating-point data and outputs the result to the destination words.

Table Data Processing Instructions

SWAP BYTES SWAP/@SWAP

637 Switches the leftmost and rightmost bytes in all of the words in the range.

FRAME CHECKSUM

FCS/@FCS

180 Calculates the ASCII FCS value for the specified range.

Data Control Instructions

PID CONTROLWITH AUTOTUN-ING

PIDAT 191 Executes PID control according to the specified parameters. The PID constants can be auto-tuned with PIDAT(191).

TIME-PROPOR-TIONAL OUTPUT

TPO 685 Inputs the duty ratio or manipulated variable from the specified word, converts the duty ratio to a time-proportional output based on the specified parameters, and outputs the result from the specified output.

SCALING SCL/@SCL

194 Converts unsigned binary data into unsigned BCD data according to the speci-fied linear function.

SCALING 2 SCL2/@SCL2

486 Converts signed binary data into signed BCD data according to the specified linear function. An offset can be input in defining the linear function.

SCALING 3 SCL3/@SCL3

487 Converts signed BCD data into signed binary data according to the specified linear function. An offset can be input in defining the linear function.

AVERAGE AVG 195 Calculates the average value of an input word for the specified number of cycles.

Subroutine Instructions

SUBROUTINECALL

SBS/@SBS

091 Calls the subroutine with the specified subroutine number and executes that program.

SUBROUTINEENTRY

SBN 092 Indicates the beginning of the subroutine program with the specified subroutine number.

SUBROUTINERETURNI

RET 093 Indicates the end of a subroutine program.

Interrupt Control Instructions

SET INTERRUPTMASK

MSKS/@MSKS

690 Sets up interrupt processing for I/O interrupts or scheduled interrupts.

CLEARINTERRUPT

CLI/@CLI

691 Clears or retains recorded interrupt inputs for I/O interrupts or sets the time to the first scheduled interrupt for scheduled interrupts.

DISABLE INTERRUPTS

DI/@DI

693 Disables execution of all interrupt tasks except the power OFF interrupt.

ENABLE INTERRUPTS

EI 694 Enables execution of all interrupt tasks that were disabled with DI(693).

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 374: CP1E CPU Unit Software Users Manual

Appendices

A-10 CP1E CPU Unit Software User’s Manual(W480)

High-speed Counter and Pulse Output Instructions

MODE CONTROL INI/@INI

880 INI(880) is used to start and stop target value comparison, to change the present value (PV) of a high-speed counter, to change the PV of an interrupt input (counter mode), to change the PV of a pulse output, or to stop pulse out-put.

HIGH-SPEEDCOUNTER PVREAD

PRV/@PRV

881 PRV(881) is used to read the present value (PV) of a highspeed counter, pulse output, or interrupt input (counter mode).

COMPARISONTABLE LOAD

CTBL/@CTBL

882 CTBL(882) is used to perform target value or range comparisons for the present value (PV) of a high-speed counter.

SPEED OUTPUT SPED/@SPED

885 SPED(885) is used to specify the frequency and perform pulse output without acceleration or deceleration.

SET PULSES PULS/@PULS

886 PULS(886) is used to set the number of pulses for pulse output.

PULSE OUTPUT PLS2/@PLS2

887 PLS2(887) is used to set the pulse frequency and acceleration/deceleration rates, and to perform pulse output with acceleration/deceleration (with different acceleration/deceleration rates). Only positioning is possible.

ACCELERATIONCONTROL

ACC/@ACC

888 ACC(888) is used to set the pulse frequency and acceleration/deceleration rates, and to perform pulse output with acceleration/deceleration (with the same acceleration/deceleration rate). Both positioning and speed control are possible.

ORIGIN SEARCH ORG/@ORG

889 ORG(889) is used to perform origin searches and returns.

PULSE WITH

VARIABLE DUTY

FACTOR

PWM/@PWM

891 PWM(891) is used to output pulses with a variable duty factor.

Step Instructions

STEP START SNXT 009 SNXT(009) is used in the following three ways:

(1)To start step programming execution.

(2)To proceed to the next step control bit.

(3)To end step programming execution.

STEP DEFINE STEP 008 STEP(008) functions in following 2 ways, depending on its position and whether or not a control bit has been specified.

(1)Starts a specific step.

(2)Ends the step programming area (i.e., step execution).

Basic I/O Unit Instructions

I/O REFRESH IORF/@IORF

097 Refreshes the specified I/O words.

7-SEGMENTDECODER

SDEC/@SDEC

078 Converts the hexadecimal contents of the designated digit(s) into 8-bit, 7-seg-ment display code and places it into the upper or lower 8-bits of the specified destination words.

DIGITAL SWITCHINPUT

DSW 210 Reads the value set on an external digital switch (or thumbwheel switch) con-nected to an Input Unit or Output Unit and stores the 4-digit or 8-digit BCD data in the specified words.

MATRIX INPUT MTR 213 Inputs up to 64 signals from an 8 ⋅ 8 matrix connected to an Input Unit and Output Unit (using 8 input points and 8 output points) and stores that 64-bit data in the 4 destination words.

7-SEGMENT DIS-PLAY OUTPUT

7SEG 214 Converts the source data (either 4-digit or 8-digit BCD) to 7-segment display data, and outputs that data to the specified output word.

Serial Com-munications Instructions

TRANSMIT TXD/@TXD

236 Outputs the specified number of bytes of data from the RS-232C port built into the CPU Unit or the serial port of a Serial Communications Board (version 1.2 or later).

RECEIVE RXD/@RXD

235 Reads the specified number of bytes of data from the RS-232C port built into the CPU Unit or the serial port of a Serial Communications Board (version 1.2 or later).

Clock Instructions

CALENDAR ADD CADD/@CADD

730 Adds time to the calendar data in the specified words.

CALENDARSUBTRACT

CSUB/@CSUB

731 Subtracts time from the calendar data in the specified words.

CLOCKADJUSTMENT

DATE/@DATE

735 Changes the internal clock setting to the setting in the specified source words.

Failure Diagnosis Instructions

FAILURE ALARM FAL/@FAL

006 Generates or clears user-defined non-fatal errors.

SEVERE FAILURE ALARM

FALS 007 Generates user-defined fatal errors.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 375: CP1E CPU Unit Software Users Manual

A-11

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-1 S

um

mary o

f Instru

ction

sA

pp

Other Instructions

SET CARRY STC/@STC

040 Sets the Carry Flag (CY).

CLEAR CARRY CLC/@CLC

041 Turns OFF the Carry Flag (CY).

EXTEND MAXIMUMCYCLE TIME

WDT/@WDT

094 Extends the maximum cycle time, but only for the cycle in which this instruction is executed.

Instrucion Type

Instruction MnemonicFUNNo.

Function Page

Page 376: CP1E CPU Unit Software Users Manual

Appendices

A-12 CP1E CPU Unit Software User’s Manual(W480)

A-2

Page 377: CP1E CPU Unit Software Users Manual

A-13

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

A-3 CP1E CPU Unit Instruction Execution Times and Number of Steps

The following table lists the execution times for all instructions that are supported by the CPU Units.

The total execution time of instructions within one whole user program is the process time for programexecution when calculating the cycle time (See note.).

Note User programs are allocated tasks that can be executed within cyclic tasks and interrupt tasksthat satisfy interrupt conditions.

Execution times for most instructions differ depending on the CPU Unit used and the conditions whenthe instruction is executed.

The execution time can also vary when the execution condition is OFF.

The following table also lists the length of each instruction in the Length (steps) column. The number ofsteps required in the user program area for each instructions depends on the instruction and the oper-ands used with it.

The number of steps in a program is not the same as the number of instructions.

Note 1 Most instructions are supported in differentiated form (indicated with ↑, ↓, @, and %).Specifying differentiation will increase the execution times by the following amounts.

(unit:s)

2 Use the following time as a guideline when instructions are not executed.

SymbolCP1E CPU Unit

CPU

↑ or ↓ +0.5

@ or % +0.5

CP1E CPU Unit

CPU

0.05 ∼ 0.30

Page 378: CP1E CPU Unit Software Users Manual

Appendices

A-14 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in the fol-lowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Sequence Input Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

LOAD LD − 1

!LD − 2 Increase for immediate refresh

LOAD NOT LD NOT − 1

!LD NOT − 2 Increase for immediate refresh

AND AND − 1

!AND − 2 Increase for immediate refresh

AND NOT AND NOT − 1

!AND NOT − 2 Increase for immediate refresh

OR OR − 1

!OR − 2 Increase for immediate refresh

OR NOT OR NOT − 1

!OR NOT − 2 Increase for immediate refresh

AND LOAD AND LD − 1

OR LOAD OR LD − 1

NOT NOT 520 1

CONDITION ON UP 521 3

CONDITION OFF DOWN 522 4

Sequence Output Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

OUTPUT OUT − 1

!OUT − 2 Increase for immediate refresh

OUTPUT NOT OUT NOT − 1

!OUT NOT − 2 Increase for immediate refresh

KEEP KEEP 011 1

DIFFERENTIATE UP DIFU 013 2

DIFFERENTIATE DOWN DIFD 014 2

SET SET − 1

!SET − 2 Increase for immediate refresh

RESET RSET − 1 Word specified

!RSET − 2 Increase for immediate refresh

MULTIPLE BIT SET SETA 530 4 With 1-bit set

With 1,000-bit set

MULTIPLE BIT RESET RSTA 531 4 With 1-bit reset

With 1,000-bit reset

SINGLE BIT SET SETB 532 2

!SETB 3 Increase for immediate refresh

SINGLE BIT OUTPUT RSTB 534 2

!RSTB 3 Increase for immediate refresh

Page 379: CP1E CPU Unit Software Users Manual

A-15

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Sequence Control Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

END END 001 1

NO OPERATION NOP 000 1

INTERLOCK IL 002 1

INTERLOCK CLEAR ILC 003 1

MULTI-INTERLOCK

DIFFERENTIATION HOLD

MILH 517 3 During interlock

Not during interlock and interlock not set

Not during interlock and interlock set

MULTI-INTERLOCK

DIFFERENTIATION RELEASE

MILR 518 3 During interlock

Not during interlock and interlock not set

Not during interlock and interlock set

MULTI-INTERLOCK CLEAR MILC 519 2 Interlock not cleared

Interlock cleared

JUMP JMP 004 2

JUMP END JME 005 2

CONDITIONAL JUMP CJP 510 2 When JMP condition is satisfied

FOR LOOP FOR 512 2 Designating a constant

BREAK LOOP BREAK 514 1

NEXT LOOP NEXT 513 1 When loop is continued

When loop is ended

Timer and Counter Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

TIMER TIM - 3

TIMX 550 When loop is continued

COUNTER CNT - 3

CNTX 546 When loop is continued

HIGH-SPEED TIMER TIMH 015 3

TIMHX 551 When loop is continued

ONE-MS TIMER TMHH 540 3

TMHHX 552

ACCUMULATIVE TIMER TTIM 087 3

When resetting

When interlocking

TTIMX 555 3

When resetting

When interlocking

LONG TIMER TIML 542 4

When interlocking

TIMLX 553 4

When interlocking

REVERSIBLE COUNTER CNTR 012 3

CNTRX 548

RESET TIMER/ COUNTER CNR 545 3 When resetting 1 word

When resetting 1,000 words

CNRX 547 3 When resetting 1 word

When resetting 1,000 words

Page 380: CP1E CPU Unit Software Users Manual

Appendices

A-16 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Comparison Instructions

Instruction MnemonicFUNNo.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

Input Comparison Instructions

(unsigned)

LD,AND,OR+= 300 4

LD,AND,OR+<> 305

LD,AND,OR+< 310

LD,AND,OR+<= 315

LD,AND,OR+> 320

LD,AND,OR+>= 325

Input Comparison Instructions

(double, unsigned)

LD,AND,OR+=+L 301 4

LD,AND,OR+<>+L 306

LD,AND,OR+<+L 311

LD,AND,OR+<=+L 316

LD,AND,OR+>+L 321

LD,AND,OR+>=+L 326

Input Comparison Instructions

(signed)

LD,AND,OR+=+S 302 4

LD,AND,OR+<>+S 307

LD,AND,OR+<+S 312

LD,AND,OR+<=+S 317

LD,AND,OR+>+S 322

LD,AND,OR+>=+S 327

Input Comparison Instructions

(double, signed)

LD,AND,OR+=+SL 303 4

LD,AND,OR+<>+SL 308

LD,AND,OR+<+SL 313

LD,AND,OR+<=+SL 318

LD,AND,OR+>+SL 323

LD,AND,OR+>=+SL 328

Time Comparison Instructions =DT 341 4

<>DT 342 4

<DT 343 4

<=DT 344 4

>DT 345 4

>=DT 346 4

COMPARE CMP 020 3

!CMP 020 7 Increase for immediate refresh

DOUBLE COMPARE CMPL 060 3

SIGNED BINARY COMPARE CPS 114 3

!CPS 114 7 Increase for immediate refresh

DOUBLE SIGNED BINARY

COMPARE

CPSL 115 3

TABLE COMPARE TCMP 085 4

UNSIGNED BLOCK COMPARE BCMP 068 4

AREA RANGE COMPARE ZCP 088 3

DOUBLE AREA RANGE

COMPARE

ZCPL 116 3

Page 381: CP1E CPU Unit Software Users Manual

A-17

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

Data Movement Instructions

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Data Movement Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

MOVE MOV 021 3

!MOV 021 7 Increase for immediate refresh

DOUBLE MOVE MOVL 498 3

MOVE NOT MVN 022 3

MOVE BIT MOVB 082 4

MOVE DIGIT MOVD 083 4

MULTIPLE BIT TRANSFER XFRB 062 Transferring 1 word

Transferring 1,000 words

BLOCK TRANSFER XFER 070 4 Transferring 1 word

Transferring 1,000 words

BLOCK SET BSET 071 4 Setting 1 word

Setting 1,000 words

DATA EXCHANGE XCHG 073 3

SINGLE WORD DISTRIBUTE DIST 080 4

DATA COLLECT COLL 081 4

Data Shift Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SHIFT REGISTER SFT 010 3 Shifting 1 word

Shifting 1,000 words

REVERSIBLE SHIFT REGISTER SFTR 084 4 Shifting 1 word

Shifting 1,000 words

WORD SHIFT WSFT 016 4 Shifting 1 word

Shifting 1,000 words

ARITHMETIC SHIFT LEFT ASL 025 2

ARITHMETIC SHIFT RIGHT ASR 026 2

ROTATE LEFT ROL 027 2

ROTATE RIGHT ROR 028 2

ONE DIGIT SHIFT LEFT SLD 074 3 Shifting 1 word

Shifting 1,000 words

ONE DIGIT SHIFT RIGHT SRD 075 3 Shifting 1 word

Shifting 1,000 words

SHIFT N-BITS LEFT NASL 580 3

DOUBLE SHIFT NBITS LEFT NSLL 582 3

SHIFT N-BITS RIGHT NASR 581 3

DOUBLE SHIFT NBITS RIGHT NSRL 583 3

Page 382: CP1E CPU Unit Software Users Manual

Appendices

A-18 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Increment/Decrement Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

INCREMENT BINARY ++ 590 2

DOUBLE INCREMENT BINARY ++L 591 2

DECREMENT BINARY -- 592 2

DOUBLE DECREMENT BINARY --L 593 2

INCREMENT BCD ++B 594 2

DOUBLE INCREMENT BCD ++BL 595 2

DECREMENT BCD --B 596 2

DOUBLE DECREMENT BCD --BL 597 2

Symbol Math Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SIGNED BINARY ADD WITHOUT CARRY + 400 4

DOUBLE SIGNED BINARY ADD WITHOUT CARRY +L 401 4

SIGNED BINARY ADD WITH CARRY +C 402 4

DOUBLE SIGNED BINARY ADD WITH CARRY +CL 403 4

BCD ADD WITHOUT CARRY +B 404 4

DOUBLE BCD ADD WITHOUT CARRY +BL 405 4

BCD ADD WITH CARRY +BC 406 4

DOUBLE BCD ADD WITH CARRY +BCL 407 4

SIGNED BINARY SUBTRACT WITHOUT CARRY - 410 4

DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY -L 411 4

SIGNED BINARY SUBTRACT WITH CARRY -C 412 4

DOUBLE SIGNED BINARY SUBTRACT WITH CARRY -CL 413 4

BCD SUBTRACT WITHOUT CARRY -B 414 4

DOUBLE BCD SUBTRACT WITHOUT CARRY -BL 415 4

BCD SUBTRACT WITH CARRY -BC 416 4

DOUBLE BCD SUBTRACT WITH CARRY -BCL 417 4

SIGNED BINARY MULTIPLY ∗ 420 4

DOUBLE SIGNED BINARY MULTIPLY ∗L 421 4

BCD MULTIPLY ∗B 424 4

DOUBLE BCD MULTIPLY ∗BL 425 4

SIGNED BINARY DIVIDE / 430 4

DOUBLE SIGNED BINARY DIVIDE /L 431 4

BCD DIVIDE /B 434 4

DOUBLE BCD DIVIDE /BL 435 4

Page 383: CP1E CPU Unit Software Users Manual

A-19

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Conversion Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

BCD TO BINARY BIN 023 3

DOUBLE BCD TO DOUBLE BINARY

BINL 058 3

BINARY TO BCD BCD 024 3

DOUBLE BINARY TO

DOUBLE BCD

BCDL 059 3

2’S COMPLEMENT NEG 160 3

DATA DECODER MLPX 076 4 Decoding 1 digit (4 to 16)

Decoding 4 digits (4 to 16)

Decoding 1 digit (8 to 256)

Decoding 2 digits (8 to 256)

DATA ENCODER DMPX 077 4 Encoding 1 digit (16 to 4)

Encoding 4 digits (16 to 4)

Encoding 1 digit (256 to 8)

Encoding 2 digits (256 to 8)

ASCII CONVERT ASC 086 4 Converting 1 digit into ASCII

Converting 4 digits into ASCII

ASCII TO HEX HEX 162 4 Converting 1 digit

Logic Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

LOGICAL AND ANDW 034 4

DOUBLE LOGICAL AND ANDL 610 4

LOGICAL OR ORW 035 4

DOUBLE LOGICAL OR ORWL 611 4

EXCLUSIVE OR XORW 036 4

DOUBLE EXCLUSIVE OR XORL 612 4

COMPLEMENT COM 029 2

DOUBLE COMPLEMENT COML 614 2

Page 384: CP1E CPU Unit Software Users Manual

Appendices

A-20 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Special Math Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

ARITHMETIC PROCESS APR 069 4 Designating SIN and COS

Designating line-segment approximation

BIT COUNTER BCNT 067 4 Counting 1 word

Floating-point Math Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

FLOATING TO 16-BIT FIX 450 3

FLOATING TO 32-BIT FIXL 451 3

16-BIT TO FLOATING FLT 452 3

32-BIT TO FLOATING FLTL 453 3

FLOATING-POINT ADD +F 454 4

FLOATING-POINT SUBTRACT -F 455 4

FLOATING-POINT DIVIDE /F 457 4

FLOATING-POINT MULTIPLY ∗F 456 4

Floating Symbol Comparison LD,AND,OR+=F 329 3

LD,AND,OR+<>F 330

LD,AND,OR+<F 331

LD,AND,OR+<=F 332

LD,AND,OR+>F 333

LD,AND,OR+>=F 334

FLOATING- POINT TO ASCII FSTR 448 4

ASCII TO FLOATING-POINT FVAL 449 3

Table Data Processing Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SWAP BYTES SWAP 637 3 Swapping 1 word

Swapping 1,000 words

FRAME CHECKSUM FCS 180 4 For 1-word table length

For 1,000-word table length

Page 385: CP1E CPU Unit Software Users Manual

A-21

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Data Control Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

PID CONTROL WITH AUTOTUN-ING

PIDAT 191 4 Initial execution of PID processing

PID processing When sampling

PID processing When not sampling

Initial execution of autotuning

Autotuning when sampling

TIME-PROPORTIONAL OUTPUT TPO 685 4 OFF execution time

ON execution time with duty designation or displayed output limit

ON execution time with manipulated vari-able designation and output limit enabled

SCALING SCL 194 4

SCALING 2 SCL2 486 4

SCALING 3 SCL3 487 4

AVERAGE AVG 195 4 Average of an operation

Average of 64 operations

Subroutine Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SUBROUTINE CALL SBS 091 2

SUBROUTINE ENTRY SBN 092 2

SUBROUTINE RETURN RET 093 1

Interrupt Control Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SET INTERRUPT MASK MSKS 690 3 Set

Reset

CLEAR INTERRUPT CLI 691 3 Set

Reset

DISABLE INTERRUPTS DI 693 1

ENABLE INTERRUPTS EI 694 1

Page 386: CP1E CPU Unit Software Users Manual

Appendices

A-22 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

High-speed Counter and Pulse Output Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

MODE CONTROL INI 880 4 Starting high-speed counter comparison

Stopping high-speed counter comparison

Changing pulse output PV

Changing high-speed counter PV

Stopping pulse output

Stopping PWM(891) output

HIGH-SPEED COUNTER PV

READ

PRV 881 4 Reading pulse output PV

Reading high-speed counter PV

Reading pulse output status

Reading high-speed counter status

Reading PWM(891) status

Reading high-speed counter range comparison results

Reading frequency of high-speed counter 0

COUNTER FREQUENCY

CONVERT

PRV2 883 4

COMPARISON TABLE LOAD CTBL 882 4 Registering target value table and starting comparison for 1 target value

Registering target value table and starting comparison for 16 target values

Registering range table and starting com-parison

Only registering target value table for 1 target value

Only registering target value table for 16 target values

Only registering range table

SPEED OUTPUT SPED 885 4 Continuous mode

Independent mode

SET PULSES PULS 886 4

PULSE OUTPUT PLS2 887 5

ACCELERATION CONTROL ACC 888 4 Continuous mode

Independent mode

ORIGIN SEARCH ORG 889 3 Origin search

Origin return

PULSE WITH VARIABLE DUTYFACTOR

PWM 891 4

Page 387: CP1E CPU Unit Software Users Manual

A-23

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-3 C

P1E

CP

U U

nit In

structio

n E

xecutio

nT

imes an

d N

um

ber o

f Step

sA

pp

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Step Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

STEP DEFINE STEP 008 2 Step control bit ON

Step control bit OFF

STEP START SNXT 009 2

I/O Unit Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

I/O REFRESH IORF097 3

Refreshing 1 input word for CP1W Expansion Unit

Refreshing 1 output word for CP1W Expansion Unit

Refreshing 12 input words for CP1W Expansion Unit

Refreshing 12 output words for CP1W Expansion Unit

7-SEGMENT DECODER SDEC 078 4

MATRIX INPUT MTR 213 5 Data input value: 00

Data input value:FF

7-SEGMENT DISPLAY OUTPUT 7SEG 214 5 4 digits

8 digits

Serial Communications Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

TRANSMIT TXD 236 4 Sending 1 byte

Sending 256 bytes

RECEIVE RXD 235 4 Storing 1 byte

Storing 256 bytes

Page 388: CP1E CPU Unit Software Users Manual

Appendices

A-24 CP1E CPU Unit Software User’s Manual(W480)

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Note When a double-length operand is used, add 1 to the value shown in the length column in thefollowing table.

Clock Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

CALENDAR ADD CADD 730 4

CALENDAR SUBTRACT CSUB 731 4

CLOCK ADJUSTMENT DATE 735 2

Failure Diagnosis Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

FAILURE ALARM FAL 006 3 Recording errors

Deleting errors (in order of priority)

Deleting errors (all errors)

Deleting errors (individually)

SEVERE FAILURE ALARM FALS 007 3

Other Instructions

Instruction MnemonicFUN No.

Length (steps)

(See note)

ON executiontime(µs)

Conditions

SET CARRY STC 040 1

CLEAR CARRY CLC 041 1

EXTEND MAXIMUM CYCLE TIME WDT 094 2

Page 389: CP1E CPU Unit Software Users Manual

A-25

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-4 L

add

er Pro

gram

min

g E

xamp

leA

pp

A-4-1 S

hutter Control S

ystem

A-4 Ladder Programming Example

This example shows a ladder program that controls the following operation of a shutter control system.

A vehicle approaches the garage.

• If the headlights are flashed three times within five seconds in front of the garage, a sensor detectsthe light and sends a signal to open the shutter.

• There are also buttons that can be pressed to open, close, and stop the shutter.

• When the vehicle enters the garage, a sensor detects the vehicle and sends a signal to close theshutter.

• A button is pressed when the vehicle is going to exit the garage.

This section describes the configuration of the shutter control system.

The following control devices are used.

PLC• CP1E CPU Unit with 20 Points and AC Power Input

A-4-1 Shutter Control System

Shutter Operation

System Configuration

Page 390: CP1E CPU Unit Software Users Manual

Appendices

A-26 CP1E CPU Unit Software User’s Manual(W480)

Software and Hardware for Programming• CX-Programmer

• Personal computer

• USB cable (one A-type male connector and one B-type male connector)

Inputs• Button to open shutter: PB1

• Button to stop shutter: PB2

• Button to close shutter: PB3

• Sensor to detect vehicle: SEN1

• Sensor to detect headlights of vehicle: SEN2

• Limit switch that turns ON when shutter is opened all the way: LS1

• Limit switch that turns ON when shutter is closed all the way: LS2

Outputs• Contacts to activate motor to open shutter: MO1

• Contacts to activate motor to close shutter: MO2

Page 391: CP1E CPU Unit Software Users Manual

A-27

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-4 L

add

er Pro

gram

min

g E

xamp

leA

pp

A-4-1 S

hutter Control S

ystem

I/O bits in the CP1E CPU Unit are allocated to inputs and outputs.

Inputs

Outputs

I/O Allocations for a CP1E CPU Unit with 20 Points

For a CPU Unit with 20 I/O points, a total of 8 input bits are allocated to the input terminal block. Thebits that are allocated are input bits CIO 0.00 to CIO 0.07 (i.e., bits 00 to 11 in CIO 0).

In addition, a total of 6 output bits are allocated to the output terminal block. The bits that are allo-cated are output bits CIO 100.00 to CIO 100.05 (i.e., bits 00 to 05 in CIO 0).

The upper bits (bits 8 to 15) not used in the input words cannot be used as work bits. Only the bitsthat are not used in the output words (bits 06 to 15) can be used as work bits.

I/O Allocations for Shutter Control System

Device Input Address

Open Button PB1 CIO 0.00

Stop Button PB2 CIO 0.01

Close Button PB3 CIO 0.02

Vehicle sensor SEN1 CIO 0.03

Headlight sensor SEN2 CIO 0.04

Open limit sensor LS1 CIO 0.05

Closed limit sensor LS2 CIO 0.06

Device Output Address

Open motor MO1 CIO 100.00

Close motor MO2 CIO 100.01

CIO 0 (0.00~0.07)

8 inputs

8 outputs

CIO 100 (100.00~100.05)Output bits

Input bits

CIO 0

CIO 100

15 14 13 1112 09 08 07 06 05 04 02 01 000310

Can be used as work bits

Input bits: 8

Output bits: 8

Cannot be used

Allocated

Allocated

Page 392: CP1E CPU Unit Software Users Manual

Appendices

A-28 CP1E CPU Unit Software User’s Manual(W480)

The ladder program that controls the operation of a shutter control system in this example is shownbelow.

Writing the Ladder Program

Stop Button

P_First_Cycle First Cycle Flag

Open limitsensor

Close motor Open motor

Headlight sensor

Headlight sensor

Work bit

Work bit

Work bit

Timer

Timer

0.04

0.04

W0.00

W0.00

T0000

T0000

C0000

C0000

0.00

0.02 0.01 0.06 100.00 100.01

0.01 0.05 100.01 100.00

100.00

A200.11

Timer

Counters

Counters

Counters

Open Button

Stop Button Close limitsensor

Open motor Close motor

Vehicle sensor

Close Button

Open motor

Close motor

100.01

0.03

TIM

0000

#50

CNT

0000

#3

W0.00

Page 393: CP1E CPU Unit Software Users Manual

A-29

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-5 C

om

pariso

n w

ith th

e CP

1LA

pp

A-5-1 D

ifferences between C

P1E

and CP

1L

A-5 Comparison with the CP1L

The following table shows the differences between the CP1E CPU Units and CP1L CPU Units.

A-5-1 Differences between CP1E and CP1L

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Applicable Support Software CX-Programmer version 7.1 or higher

CX-Programmer for CP1E version 8.0

The CX-Programmer cannot be used.

PT Programming Console function

Supported. Not supported.

Force-setting/resetting bits is possible only from the CX-Programmer for CP1E version 8.0.

Not supported.

Force-setting/resetting bits is possible only from the CX-Programmer for CP1E version 8.0.

Programming Device con-nection port

USB port or Option Board USB port only USB port only

Note: A Programming Device cannot be connected to the RS-232C port.

Maximum program capacity CP1L L-type CPU Unit: 5K steps

CP1L M-type CPU Unit: 10K steps

(Not including comments, the symbol table, and pro-gram indexes.)

2K steps

(Not including comments, the symbol table, and pro-gram indexes.*)

* Program capacity restric-tions are different from those of the CP1L CPU Units.

8K steps

(Not including comments, the symbol table, and pro-gram indexes.*)

* Program capacity restric-tions are different from those of the CP1L CPU Units.

Maximum number of I/O points

10 to 180 points 20 to 160 points 20 to 160 points

Maximum number of Expan-sion Units and Expansion I/O Units that can be connected

CP1L L-type CPU Unit: 1

CP1L M-type CPU Unit: 3

CPU Unit with 20 I/O Points: None

CPU Unit with 30 or 40 I/O Points: 3

CPU Unit with 20 I/O Points: None

CPU Unit with 30 or 40 I/O Points: 3

Output types Relay or transistor outputs Only relays outputs Relay or transistor outputs

Power supply AC or DC power supply Only AC power supply Only AC power supply

DM Area capacity 10K words or 32K words 2K words

Of these, 1,500 words can be backed up to EEPROM.

8K words

Of these, 7000 words can be backed up to EEPROM.

Instruction execution time LD: 0.55 µsMOV: 4.1 µs

LD: 1.0µsMOV: 8µs

LD: 1.0µs

MOV: 8µs

Instruction set 500 instructions 200 instructions 200 instructions

Instructions The instructions listed at the right are not supported.

The following instructions are supported.

AHRLALTERNATE OUTPUT (ALT), MULTIWORD SHIFT REGISTER (XSFT), CHECK CODE (CDD), ABSOLUTE DRUM SEQUENCE (ADBD), HIGH-SPEED COUNTER ABSOLUTE DRUM SEQUENCE (ABSDL), INCREMENTAL DRUM SEQUENCE (INCD), RAMP SIGNAL (RAMP), HOUR METER (AHR), and DOUBLE HOUR METER (AHRL)

Refer to the following table CP1L Instructions Not Sup-ported by the CP1E for instructions that are not supported by the CP1E CPU Units.

Number of cyclic tasks 32 1 1

Page 394: CP1E CPU Unit Software Users Manual

Appendices

A-30 CP1E CPU Unit Software User’s Manual(W480)

CP1W-ME05M MemoryCassette

Applicable.

(The Memory Cassette can be used to back up program data, DM Area initial data, and other data from the built-in flash memory or to copy the data to another CP1L CPU Unit.)

Cannot be used. Cannot be used.

Terminal block CP1L-L: Not removable.

CP1L-M: Removable.

Not removable. Not removable.

Automatic transfer from Memory Cassette at startup

Supported. Not supported. Not supported.

Option Boards CP1L L-type CPU Unit: 1 Board

CP1L M-type CPU Unit: 2 Boards

Not supported. 1 Board

CP1W-DAM01 LCD Option Board

Applicable. Cannot be used. Cannot be used.

Built-in serialcommunications port

Not provided (an Option Board must be added).

Not provided. Provided.

DIP switch on front panel Provided. Not provided.

(UM write protections and status flag for DIP switch pin 3 are not supported.)

Not provided.

(UM write protections and status flag for DIP switch pin 3 are not supported.)

Battery Provided. (CJ1W-BAT01)

5 years (at ambienttemperature of 25ºC)

Built-in as standard feature.

Cannot be used. Sold separately(CP1W-BAT01)

5 years (at ambienttemperature of 25ºC)

Optional product.

Capacitor backup 5 minutes (at ambienttemperature of 25ºC)

50 hours (at ambienttemperature of 25ºC)

40 hours (at ambienttemperature of 25ºC)

Nonvolatile memory(backup memory)

Built-in flash memory

(Contains the user pro-grams, parameters, DM Area initial values, com-ment memory, and function block programs.)

Built-in EEPROM

(Contains the user pro-grams, parameters, con-tents of specified DM Area words, and comment mem-ory.)

Built-in EEPROM

(Contains the user pro-grams, parameters, con-tents of specified DM Area words, and comment mem-ory.)

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Page 395: CP1E CPU Unit Software Users Manual

A-31

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-5 C

om

pariso

n w

ith th

e CP

1LA

pp

A-5-1 D

ifferences between C

P1E

and CP

1L

I/O memory 1:1 Link Area (part of CIO Area)

Provided.

CIO 3000.00 to CIO 3063.15

Not provided (function is not supported).

Not provided (function is not supported).

Serial PLC Link Area (part of CIO Area)

Provided.

CIO 3100.00 to CIO 3189.15

Not provided. Provided.

CIO 200.00 to CIO 289.15

Work Area (W) 8,192 bits

W0.00 to W511.15

1,600 bits

W0.00 to W99.15

1,600 bits

W0.00 to W99.15

Holding Area (H)

24,576 bits

H0.00 to H1535.15

800 bits

H0.00 to H49.15

800 bits

H0.00 to H49.15

Bits allocated to function blocks

Provided.

H512 to H1535

Not provided (function is not supported).

Not provided (function is not supported).

Timers 4,096 timers

T0 to T4095

256 timers

T0 to T256

256 timers

T0 to T256

Counters 4,096 counters

C0 to C4095

256 counters

C0 to C256

256 counters

C0 to C256

DM Area 32K words

D0 to D32767

(All the data from the DM Area can be backed up to flash memory as initialvalues for use at startup.

The data is backed up when power is interrupted and then restored to RAM the next time power is turned ON (DM Area Initialization Function.)

2K words

D0 to D2047

(Of these, the 1,500 words from D0 to D1499 can be backed up to EEPROM.

The data is backed up when power is interrupted and then restored to RAM the next time power is turned ON.)

8K words

D0 to D8191

(Of these, the 7,000 words from D0 to D6999 can be backed up to EEPROM.

The data is backed up when power is interrupted and then restored to RAM the next time power is turned ON.)

Task Flag Area Provided. Not provided. Not provided.

Index Registers (IR)

Provided. Not provided. Not provided.

Data Registers (DR)

Provided. Not provided. Not provided.

Changing the PV refreshing format (BCD or binary) for timers/counters

Supported. Different instructions are used in the same way as for the CJ2 CPU Units.

Different instructions are used in the same way as for the CJ2 CPU Units.

Function block source Supported. Not supported. Not supported.

Function block and STlanguage support

Provided. Not provided. Not provided.

Address offsets Not supported. Supported ( in the same way as for the CJ2 CPU Units).

Supported ( in the same way as for the CJ2 CPU Units).

Number of subroutines 256 128 128

Jump numbers 256 128 128

Trace Memory Provided. Not provided. Not provided.

Clock (RTC) Provided. Not provided. Provided.

Analog adjusters 1 2 2

External analog setting input Provided. Not provided. Not provided.

Quick-response inputs Provided (6 inputs) Provided (6 inputs) Provided (6 inputs)

Input interrupts Provided (6 inputs) Provided (6 inputs) Provided (6 inputs)

Scheduled interrupts Provided (2 interrupts) Provided (1 interrupt) Provided (1 interrupt)

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Page 396: CP1E CPU Unit Software Users Manual

Appendices

A-32 CP1E CPU Unit Software User’s Manual(W480)

High-speed counterinterrupts

Provided (256 interrupts) Provided (16 interrupts) Provided (16 interrupts)

Bits allocated to interrupt inputs and quick-response inputs

CIO 0.04 to CIO 0.09 CIO 0.02 to CIO 0.07 CIO 0.02 to CIO 0.07

Number of interrupt tasks 256 16 16

No.Interrupt task numbers Interrupt inputs: 2 and 3

Input interrupts (direct mode or counter mode):140 to 145

High-speed counterinterrupts: 0 to 255

Interrupt inputs: 1

Input interrupts (direct modeonly; counter mode is not supported): 2 to 7

High-speed counterinterrupts: 0 to 15

Interrupt inputs: 1

Input interrupts (direct modeonly; counter mode is not supported): 2 to 7

High-speed counterinterrupts: 0 to 15

High-speed counter inputs(pulse input methods)

Increment, up/down, or pulse plus direction inputs: 100 kHz×4 counters

Differential phases (4×): 50 kHz×2 counters

Up/down or pulse plus direc-tion inputs: 10 kHz×2 counters

Increment input: 10 kHz×6 counters

(Internal direction bit added for single-phase mode.)

Differential phases (4×): 5 kHz×2 counters

Up/down inputs: 100 kHz×1 counter, 10 kHz×1 counter

Pulse plus direction inputs: 100 kHz×2 counters

Increment input: 100 kHz×2 counters, 10 kHz×4 counters

(Internal direction bit added for single-phase mode.)

Differential phases (4×): 5 kHz×1 counter

High-speed Counter Gate Flag

Provided. Not provided. Not provided.

Frequency measurement

Supported. Supported. Supported.

Measuring rota-tion speed and accumulative rotations

Supported. Not supported. Not supported.

Pulseoutputs

Origin searches Supported. Not supported (because CPU Units with transistor outputs are not provided, only those with relay out-puts).

Supported.

S-curve accel-eration and deceleration

Supported. Not supported.

CW/CCW Supported. Not supported (pulse + direction only)

Changing the target position/speed during position control or speed con-trol

Supported. Supported only for target position.

The target speed cannot be changed.

PWM outputs(variable-duty-factor outputs)

2 outputs Not supported (because CPU Units with transistor outputs are not provided, only those with relay out-puts).

1 output

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Page 397: CP1E CPU Unit Software Users Manual

A-33

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-5 C

om

pariso

n w

ith th

e CP

1LA

pp

A-5-1 D

ifferences between C

P1E

and CP

1L

Battery-free operation If power is interrupted for more than 5 minutes without a Battery, only the data in the built-in flash memory will be retained.

DM Area data after opera-tion, Holding Area data, and counter values (flags, PV) will not be retained.

Operation is always battery free.

If power is interrupted for more than 50 hours, only the data in the built-in EEPROM will be retained.

Specified words in the DM Area can also be backed up.

If power is interrupted for more than 40 hours without a Battery, only the data in the built-in EEPROM will be retained.

Specified words in the DM Area can also be backed up.

Power supply to external devices (service power)

CPU Units with AC power input provide a DC power output.

CPU Units with 20 Points with AC power input do not provide a DC power output. CPU Units with 30 or 40 Points provide a DC power output.

CPU Units with 20 Points with AC power input do not provide a DC power output. CPU Units with 30 or 40 Points provide a DC power output.

Program transfer by task from CX-Programmer for CP1E version 8.0

Supported. Not supported. Not supported.

Program protection

Read protection from the CX-Pro-grammer

Supported.

(Read protection can be set by task.)

Supported. Supported.

Write protection using a DIP switch

Supported. Write protection is possible using the User Memory Write Protect Bit (A500.11).

Write protection is possible using the User Memory Write Protect Bit (A500.11).

Enabling and disabling over-writing programsfrom the CX-Pro-grammer

Supported. Not supported. Not supported.

Enabling and disabling pro-gram backup to a Memory Cas-sette

Supported. Not supported. Not supported.

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Page 398: CP1E CPU Unit Software Users Manual

Appendices

A-34 CP1E CPU Unit Software User’s Manual(W480)

Serial communicationsprotocols

Host Link,1:N NT Link, No-protocol, Serial PLC Link, and Modbus-RTU Easy Master (A serial gateway is used internally.)

Not supported. Host Link,1:N NT Link, No-protocol, Serial PLC Link, and Modbus-RTU Easy Master (A serial gateway is used internally.)

− − Note 1 CX-One (e.g., CX-Programmer) con-nection is not possi-ble using the Host Link protocol. Unsolicited commu-nications are not supported for the Host Link protocol.

2 Only one PT can be connected for the 1:N NT Link protocol. SPMA (screen data transfer via a PLC) is not possible using the 1:N NT Link protocol.

3 PTs cannot partici-pate in the Serial PLC Links.

4 A serial gateway is provided for the Modbus-RTU Easy Master.

The following are supported: serial gateway (functions for communications with OMRON components (SAP/Smart FB) including Modbus-RTU Easy Master), toolbus, 1:1 NT Link, 1:1 Link, PT Programming Con-sole function with anNS-series PT.

Not supported. The following are not sup-ported: serial gateway (func-tions for communications with OMRON components (SAP/Smart FB)), toolbus, 1:1 NT Link, 1:1 Link, PT Programming Console func-tion with an NS-series PT.

Inverter positioningfunctions

Supported. Not supported. Not supported.

Item CP1L CPU Units CP1E E-type CPU Units CP1E N-type CPU Units

Page 399: CP1E CPU Unit Software Users Manual

A-35

Appendices

CP1E CPU Unit Software User’s Manual(W480)

A-5 C

om

pariso

n w

ith th

e CP

1LA

pp

A-5-1 D

ifferences between C

P1E

and CP

1L

CP1L Instructions That Are Not Supported by the CP1E

Classification MnemonicSequence Input Instruc-tions

• LD TST

• LD TSTN

• AND TST

• AND TSTN

• OR TST

• OR TSTN

• ITST

• OUTBSequence Control Instructions

• CJPN

• JMP0

• JME0Timer and Counter Instructions

• MTIM/MTIMX

Comparison Instructions • MCMP

• BCMP2Data Movement Instruc-tions

• MVNL

• XCGL

• MOVRWData Shift Instructions • ASFT

• ASLL

• ASRL

• ROLL

• RLNC

• RLNL

• RORL

• RRNC

• RRNL

• NSFL

• NSFRSymbol Math Instructions • *U

• *UL

• /U

• /ULConversion Instructions • NEGL

• SIGN

• LINE

• COLM

• BINS

• BISL

• BCDS

• BDSL

• GRYLogic Instructions • XNRW

• XNRLSpecial Math Instructions • ROTB

• ROOT

• FDIVFloating-point Math Instructions

• RAD

• DEG

• SIN

• COS

• TAN

• ASIN

• ACOS

• ATAN

• SQRT

• EXP

• LOG

• PWRDouble-precision Float-ing-point Instructions

• FIXD

• FIXLD

• DBL

• DBLL

Classification Mnemonic

Double-precision Float-ing-point Instructions

• +D

• -D

• *D

• /D

• RADD

• DEGD

• SIND

• COSD

• TAND

• ASIND

• ACOSD

• ATAND

• SQRTD

• EXPD

• LOGD

• PWRD

• LD, AND, OR + =D, <>D, <D, <=D, >D, or >=D

Table Data Processing Instructions

• SSET

• PUSH

• FIFO

• LIFO

• DIM

• SETR

• GETR

• SRCH

• MAX

• MIN

• SUM

• SNUM

• SREAD

• SWRIT

• SINS

• SDEL

Data Control Instructions • PID

• LMT

• BAND

• ZONE

Subroutine Instructions • MCRO

• GSBS

• GSBN

• GRET

Interrupt Control Instruc-tions

• MSKR

Basic I/O Unit Instruc-tions

• IORD

• IOWR

• TKY

• HKY

Serial Communications Instructions

• PMCR

• TXDU

• RXDU

• STUP

Network Instructions • SEND

• RECV

• CMND

• EXPLT

• EGATR

• ESATR

• ECHRD

• ECHWR

Classification Mnemonic

Display Instructions • MSG

• SCH

• SCTRL

Clock Instructions • SEC

• HMS

Debugging Instructions • TRSM

Failure Diagnosis Instructions

• FPD

Other Instructions • CCS

• CCL

• FRMCV

• TOCV

Block Programming Instructions

• BPRG

• BEND

• BPPS

• BPRS

• EXIT(NOT)

• IF (NOT)

• ELSE

• IEND

• WAIT(NOT)

• TIMW(BCD)

• TIMWX(binary)

• CNTW(BCD)

• CNTWX(binary)

• TMHW(BCD)

• TMHWX(binary)

• LOOP

• LEND(NOT)

Text String Processing Instructions

• MOV$

• +$

• LEFT$

• RGHT$

• MID$

• FIND$

• LEN$

• RPLC$

• DEL$

• XCHG$

• CLR$

• INS$

• =$, <>$, <$, <=$,>$, >=$

Task Control Instructions • TKON

• TKOF

Model Conversion Instructions

• XFERC

• DISTC

• COLLC

• MOVBC

• BCNTC

Page 400: CP1E CPU Unit Software Users Manual

Appendices

A-36 CP1E CPU Unit Software User’s Manual(W480)