OMRON CP1E - Programmable Controllers

CP1E - Programmable Controllers OMRON - Free user manual and instructions

Find the device manual for free CP1E OMRON in PDF.

📄 467 pages English EN Download 💬 AI Question
Notice OMRON CP1E - page 2
View the manual : Français FR English EN
Pick your language and provide your email: we'll send you a specifically translated version.

User questions about CP1E OMRON

0 question about this device. Answer the ones you know or ask your own.

Ask a new question about this device

The email remains private: it is only used to notify you if someone responds to your question.

No questions yet. Be the first to ask one.

Download the instructions for your Programmable Controllers in PDF format for free! Find your manual CP1E - OMRON and take your electronic device back in hand. On this page are published all the documents necessary for the use of your device. CP1E by OMRON.

USER MANUAL CP1E OMRON

INSTRUCTIONS REFERENCE MANUAL

OMRON

OMRON, 2009

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior written permission of OMRON.

No patent liability is assumed with respect to the use of the information contained herein. Moreover, because OMRON is constantly striving to improve its high-quality products, the information contained in this manual is subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained in this publication.

SYSMAC CP Series

CP1E-E□D□-□

CP1E-N□D□-□

CP1E-NA□□D□-□

CP1E CPU Unit

Instructions Reference Manual

Revised December 2009

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.

Intended Audience

This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent).

  • Personnel in charge of installing FA systems
  • Personnel in charge of designing FA systems
  • Personnel in charge of managing FA systems and facilities

Applicable Products

- CP-series CP1E CPU Units

Basic Models CP1E-E□D□-□

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

Application Models CP1E-N/NA□D□-□

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

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.

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.

OMRON CP1E - CP1E CPU Unit Manuals - 1

Manual Configuration

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

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

SectionContents
Section 1 Summary of InstructionsThis section provides a summary of instructions used with a CP1E CPU Unit.
Section 2 InstructionThis section describes the functions, operands and sample programs of the instructions that are supported by a CP1E CPU Unit.
Section 3 Instruction Execution Times and Number of StepsThis section provides the execution times for all instructions used with a CP1E CPU Unit.
Section 4 Monitoring and Computing the Cycle TimeThis section describes how to monitor and calculate the cycle time of a CP1E CPU Unit that can be used in the programs.
AppendicesThe appendices provide a list of instructions by Mnemonic and ASCII code table for the CP1E CPU Unit.

CP1E CPU Unit Software User's Manual (Cat. No. W480)

SectionContents
Section 1 OverviewThis section gives an overview of the CP1E, describes its application procedures.
Section 2 CPU Unit MemoryThis section describes the types of internal memory in a CP1E CPU Unit and the data that is stored.
Section 3 CPU Unit OperationThis section describes the operation of a CP1E CPU Unit.
Section 4 Programming ConceptsThis section provides basic information on designing ladder programs for a CP1E CPU Unit.
Section 5 I/O MemoryThis section describes the types of I/O memory areas in a CP1E CPU Unit and the details.
Section 6 I/O AllocationThis section describes I/O allocation used to exchange data between the CP1E CPU Unit and other units.
Section 7 PLC SetupThis section describes the PLC Setup, which are used to perform basic settings for a CP1E CPU Unit.
Section 8 Overview and Allocation of Built-in FunctionsThis section lists the built-in functions and describes the overall application flow and the allocation of the functions.
Section 9 Quick-response InputsThis section describes the quick-response inputs that can be used to read signals that are shorter than the cycle time.
Section 10 InterruptsThis section describes the interrupts that can be used with CP1E PLCs, including input interrupts and scheduled interrupts.
Section 11 High-speed CountersThis section describes the high-speed counter inputs, high-speed counter interrupts, and the frequency measurement function.
Section 12 Pulse OutputsThis section describes positioning functions such as trapezoidal control, jogging, and origin searches.
Section 13 PWM OutputsThis section describes the variable-duty-factor pulse (PWM) outputs.
Section 14 Serial CommunicationsThis section describes communications with Programmable Terminals (PTs) without using communications programming, no-protocol communications with general components, and connections with a Modbus-RTU Easy Master, Serial PLC Link, and host computer.
Section 15 Analog I/O FunctionThis section describes the built-in analog function for NA-type CPU Units.
Section 16 Built-in FunctionsThis section describes PID temperature control, clock functions, DM backup functions, security functions.
Section 17 Operating the Program- ming DeviceThis section describes basic functions of the CX-Programmer, such as using the CX-Programmer to write ladder programs to control the CP1E CPU Unit, to transfer the programs to the CP1E CPU Unit, and to debug the programs.
AppendicesThe appendices provide lists of programming instructions, the Auxiliary Area, cycle time response performance, PLC performance at power interruptions.

CP1E CPU Unit Hardware User's Manual (Cat. No. W479)

SectionContents
Section 1 Overview and Specifica-tionsThis section gives an overview of the CP1E, describes its features, and provides its specifications.
Section 2 Basic System Configura-tion and DevicesThis section describes the basic system configuration and unit models of the CP1E.
Section 3 Part Names and FunctionsThis section describes the part names and functions of the CPU Unit, Expansion I/O Units, and Expansion Units in a CP1E PLC.
Section 4 Programming DeviceThis section describes the features of the CX-Programmer used for pro-gramming and debugging PLCs, as well as how to connect the PLC with the Programming Device by USB.
Section 5 Installation and WiringThis section describes how to install and wire CP1E Units.
Section 6 TroubleshootingThis 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-tionThis section describes periodic inspections, the service life of the Battery, and how to replace the Battery.
Section 8 Using Expansion Units and Expansion I/O UnitsThis section describes application methods for Expansion Units.
AppendicesThe appendices provide information on dimensions, wiring diagrams, and wiring serial communications for the CP1E.

Manual Structure

Page Structure and Icons

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

OMRON CP1E - Page Structure and Icons - 1
This illustration is provided only as a sample and may not literally appear in this manual.

Special Information

Special information in this manual is classified as follows:

OMRON CP1E - Special Information - 1

Precautions for Safe Use

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

OMRON CP1E - Special Information - 2

Precautions for Correct Use

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

OMRON CP1E - Special Information - 3

Additional Information

Additional information to increase understanding or make operation easier.

OMRON CP1E - Special Information - 4

References to the location of more detailed or related information.

Terminology and Notation

TermDescription
E-type CPU UnitA 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 UnitAn application model of CPU Unit that supports connections to Programmable Terminals, inverters, and servo drives. Application models of CPU Units are called “N-type CPU Units” in this manual.
NA-type CPU UnitAn application model of CPU Unit that supports built-in analog and connections to Programmable Terminals, inverters, and servo drives. Application models of CPU Units with built-in analog are called “NA-type CPU Units” in this manual.
CX-ProgrammerA programming device that applies for programming and debugging PLCs. The CX-Programmer includes the Micro PLC Edition CX-Programmer (CX-One Lite), the CX-Programmer (CX-One) and the CX-Programmer for CP1E. This manual describes the unique applications and functions of the Micro PLC Edition CX-Programmer version 9.03 or higher CX-Programmer for CP1E. “CX-Programmer” refers to the Micro PLC Edition CX-Programmer version 9.03 or higher CX-Programmer for CP1E in this manual. Note E20/30/40 and N20/30/40 CPU Units are supported by CX-Programmer version 8.2 or higher. E10/14, N14/60 and NA20 CPU Units are supported by CX-Programmer version 9.03 or higher.

Sections in this Manual

OMRON CP1E - Sections in this Manual - 1

CONTENTS

Introduction 1
CP1E CPU Unit Manuals 2
Manual Structure 5
Safety Precautions 15
Precautions for Safe Use 18
Regulations and Standards 19
Related Manuals 20

Section 1 Summary of Instructions 1-1

1-1 Summary of Instructions 1-2

Section 2 Instructions 2-1

Notation and Layout of Instruction Descriptions 2-2
Sequence Input Instructions 2-5

LD/LD NOT 2-7
AND/AND NOT 2-9
OR/OR NOT 2-11
AND LD/OR LD 2-13
NOT 2-16
UP/DOWN 2-17

Sequence Output Instructions 2-18

OUT/OUT NOT 2-18
TR 2-20
KEEP 2-21
DIFU 2-25
DIFD 2-27
SET/RSET 2-29
SETA/RSTA 2-31
SETB/RSTB 2-33

Sequence Control Instructions 2-35

END 2-38
NOP 2-39
IL/ILC 2-40
MILH/MILR/MILC 2-44
JMP/CJP/JME 2-53
FOR/NEXT 2-56
BREAK 2-59

Timer and Counter Instructions 2-60

TIM/TIMX 2-66
TIMH/TIMHX 2-69
TMHH/TMHHX 2-72
TTIM/TTIMX 2-74
TIML/TIMLX 2-77
CNT/CNTX 2-80

CNTR/CNTRX 2-83

CNR/CNRX 2-86

Comparison Instructions 2-88

= , < >, <, <=, >, >= 2-88

= DT, < > DT, < DT, <= DT, > DT, >= DT 2-91

CMP/CMPL 2-95

CPS/CPSL 2-98

TCMP 2-101

BCMP 2-103

ZCP/ZCPL 2-105

Data Movement Instructions 2-108

MOV/MOVL/MVN 2-108

MOVB 2-111

MOVD 2-113

XFRB 2-115

XFER 2-117

BSET 2-119

XCHG 2-121

DIST 2-123

COLL 2-125

Data Shift Instructions 2-127

SFT 2-127

SFTR 2-129

WSFT 2-131

ASL 2-133

ASR 2-134

ROL 2-135

ROR 2-137

SLD/SRD 2-139

NASL/NSLL 2-141

NASR/NSRL 2-144

Increment/Decrement Instructions 2-147

++/++L 2-147
--/--L 2-150
+ + B / + + BL 2-153
--B/--BL 2-156

Symbol Math Instructions 2-158

+/+L 2-158
+C/+CL 2-160
+B/+BL 2-162
+BC/+BCL 2-164
-/-L 2-166
-C/-CL 2-170
-B/-BL 2-172
-BC/-BCL 2-175
^ 水 / ^ 水 L 2-177
^B / ^BL 2-179
/,/L 2-181
/B, /BL 2-183

Conversion Instructions 2-185

BIN/BINL 2-185
BCD/BCDL 2-187
NEG 2-189
MLPX 2-191
DMPX 2-196
ASC 2-201
HEX 2-205

Logic Instructions 2-210

ANDW/ANDL 2-210
ORW/ORWL 2-212

XORW/XORL 2-214

COM/COML 2-216

Special Math Instructions 2-218

APR 2-218

BCNT 2-227

Floating-point Math Instructions 2-229

FIX/FIXL 2-233

FLT/FLTL 2-235

+F,-F,*F,/F 2-237

= F, < > F, < F, <= F, >F, >= F 2-241

FSTR 2-244

FVAL 2-249

Table Data Processing Instructions 2-253

SWAP 2-253

FCS 2-255

Data Control Instructions 2-257

PIDAT 2-257

TPO 2-269

SCL 2-276

SCL2 2-280

SCL3 2-284

AVG 2-287

Subroutines Instructions 2-290

SBS 2-290

SBN/RET 2-295

Interrupt Control Instructions 2-298

MSKS 2-300

CLI 2-303

DI 2-306

EI 2-307

High-speed Counter/Pulse Output Instructions 2-308

INI 2-308

PRV 2-311

CTBL 2-315

SPED 2-319

PULS 2-323

PLS2 2-325

ACC 2-331

ORG 2-336

PWM 2-339

Step Instructions 2-341

SNXT/STEP 2-342

Basic I/O Unit Instructions 2-352

IORF 2-352

SDEC 2-354

DSW 2-357

MTR 2-361

7SEG 2-365

Serial Communication Instructions 2-369

TXD 2-369

RXD 2-374

Clock Instructions 2-380

CADD/CSUB 2-380

DATE 2-385

Failure Diagnosis Instructions 2-387

FAL 2-387

FALS 2-393

Other Instructions 2-398

STC/CLC 2-398

WDT 2-399

Section 3 Instruction Execution Times and Number of Steps ... 3-1

3-1 CP1E CPU Unit Instruction Execution Times and Number of Steps 3-2

Section 4 Monitoring and Computing the Cycle Time. 4-1

4-1 Monitoring the Cycle Time. 4-2

4-1-1 Monitoring the Cycle Time 4-2

4-2 Computing the Cycle Time 4-3

4-2-1 CPU Unit Operation Flowchart 4-3
4-2-2 Cycle Time Overview 4-4
4-2-3 I/O Refresh Times for PLC Units 4-5
4-2-4 Cycle Time Calculation Example 4-6
4-2-5 Increase in Cycle Time for Online Editing 4-6

Section A Appendices .A-1

Alphabetical List of Instructions by Mnemonic. A-2

Revision History . Revision-1

Read and Understand this Manual

Please 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 NONINFRINGEMENT, 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 WARRANTYES, 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.

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.

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.

Safety Precautions

Definition of Precautionary Information

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

OMRON CP1E - Definition of Precautionary Information - 1

OMRON CP1E - Definition of Precautionary Information - 2

Precautions for Safe Use

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

Precautions for Correct Use

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

Symbols

The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precaution for electric shock.
The circle and slash symbol indicates operations that you must not do. The specific operation is shown in the circle and explained in text.
The filled circle symbol indicates operations that you must do. The specific operation is shown in the circle and explained in text. This example shows a general precaution for something that you must do.
The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a general precaution.
The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precaution for hot surfaces.

Caution

Be sure to sufficiently confirm the safety at the destination when you transfer the program or I/O memory or perform procedures to change the I/O memory.

Devices connected to PLC outputs may incorrectly operate regardless of the operating mode of the CPU Unit.

OMRON CP1E - Caution - 1

With an E-type CPU Unit or with an N/NA-type CPU Unit without a Battery, the contents of the DM Area (D) *, Holding Area (H), the Counter Present Values (C), the status of Counter Completion Flags (C), and the status of bits in the Auxiliary Area (A) related to clock functions may be unstable when the power supply is turned ON.

*This does not apply to areas backed up to EEPROM using the DM backup function. If the DM backup function is being used, be sure to use one of the following methods for initialization.

  1. Clearing All Areas to All Zeros

Select the Clear Held Memory (HR/DM/CNT) to Zero Check Box in the Startup Data Read Area in the PLC Setup.

  1. Clearing Specific Areas to All Zeros or Initializing to Specific Values Make the settings from a ladder program.

If the data is not initialized, the unit or device may operate unexpectedly because of unstable data.

OMRON CP1E - Caution - 2

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.

OMRON CP1E - Caution - 3

The DM Area (D), Holding Area (H), Counter Completion Flags (C), and Counter Present Values (C) will be held by the Battery if a Battery is mounted in a CP1EN/NA□□D□-□ CPU Unit. When the battery voltage is low, however, I/O memory areas that are held (including the DM, Holding, and Counter Areas) will be unstable. The unit or device may operate unexpectedly because of unstable data.

Use the Battery Error Flag or other measures to stop outputs if external outputs are performed from a ladder program based on the contents of the DM Area or other I/O memory areas.

OMRON CP1E - Caution - 4

Sufficiently check safety if I/O bit status or present values are monitored in the Ladder Section Pane or present values are monitored in the Watch Pane.

If bits are set, reset, force-set, or force-reset by inadvertently pressing a shortcut key, devices connected to PLC outputs may operate incorrectly regardless of the operating mode.

OMRON CP1E - Caution - 5

Program so that the memory area of the start address is not exceeded when using a word address or symbol for the offset.

For example, write the program so that processing is executed only when the indirect specification does not cause the final address to exceed the memory area by using an input comparison instruction or other instruction.

If an indirect specification causes the address to exceed the area of the start address, the system will access data in other areas, and unexpected operation may occur.

OMRON CP1E - Caution - 6

Set the temperature range according to the type of temperature sensor connected to the Unit.

Temperature data will not be converted correctly if the temperature range does not match the sensor.

OMRON CP1E - Caution - 7

Do not set the temperature range to any values other than those for which temperature ranges are given in the following table.

An incorrect setting may cause operating errors.

OMRON CP1E - Caution - 8

Precautions for Safe Use

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

- Handling

  • To initialize the DM Area, back up the initial contents for the DM Area to backup memory using one of the following methods.

  • Set the number of words of the DM Area to be backed up starting with D0 in the Number of CH of DM for backup Box in the Startup Data Read Area.

  • Include programming to back up specified words in the DM Area to built-in EEPROM by turning ON A751.15 (DM Backup Save Start Bit).

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

  • The ladder program and parameter area data in the CP1E CPU Units are backed up in the built-in EEPROM backup memory. The BKUP indicator will light on the front of the CPU Unit when the backup operation is in progress. Do not turn OFF the power supply to the CPU Unit when the BKUP indicator is lit. The data will not be backed up if power is turned OFF and a memory error will occur the next time the power supply is turned ON.
  • With a CP1E CPU Unit, data memory can be backed up to the built-in EEPROM backup memory. The BKUP indicator will light on the front of the CPU Unit when backup is in progress. Do not turn OFF the power supply to the CPU Unit when the BKUP indicator is lit. If the power is turned OFF during a backup, the data will not be backed up and will not be transferred to the DM Area in RAM the next time the power supply is turned ON.
  • Before replacing the battery, supply power to the CPU Unit for at least 30 minutes and then complete battery replacement within 5 minutes. Memory data may be corrupted if this precaution is not observed.
  • The equipment may operate unexpectedly if inappropriate parameters are set. Even if the appropriate parameters are set, confirm that equipment will not be adversely affected before transferring the parameters to the CPU Unit.
  • Before starting operation, confirm that the contents of the DM Area is correct.
  • After replacing the CPU Unit, make sure that the required data for the DM Area, Holding Area, and other memory areas has been transferred to the new CPU Unit before restarting operation.
  • Do not attempt to disassemble, repair, or modify any Units. Any attempt to do so may result in malfunction, fire, or electric shock.
  • Confirm that no adverse effect will occur in the system before attempting any of the following. Not doing so may result in an unexpected operation.

  • Changing the operating mode of the PLC (including the setting of the startup operating mode).

  • Force-setting/force-resetting any bit in memory.
  • Changing the present value of any word or any set value in memory.

- External Circuits

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

Regulations and Standards

Trademarks

SYSMAC is a registered trademark for Programmable Controllers made by OMRON Corporation.

CX-One is a registered trademark for Programming Software made by OMRON Corporation.

Windows is a registered trademark of Microsoft Corporation.

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

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

Manual nameCat. No.Model numbersApplicationContents
SYSMAC CP Series CP1E CPU Unit Instru- tions Reference Manual (this manual)W483CP1E-EO□D□-□ CP1E-N□D□-□ CP1E-NA□D□-□To learn program- ming instructions in detailDescribes each programming instruction in detail. When programming, use this manual together with the CP1E CPU Unit Software User's Man- ual (Cat. No. W480).
SYSMAC CP Series CP1E CPU Unit Soft- ware User's ManualW480CP1E-EO□D□-□ CP1E-N□D□-□ CP1E-NA□D□-□To learn the software specifications of the CP1E PLCsDescribes 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 ManualW479CP1E-EO□D□-□ CP1E-N□D□-□ CP1E-NA□D□-□To learn the hard- ware specifications of the CP1E PLCsDescribes 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).
CS/CJ/CP/NSJ Series Communications Com- mands Reference Man- ualW342CS1G/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□V1To learn communica- tions commands for CS/CJ/CP/NSJ- series Controllers in detailDescribes 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. It does not cover commands addressed to other Units or ports (e.g., serial communications ports on CPU Units, communications ports on Serial Communications Units/Boards, and other Communica- tions Units).
SYSMAC CP Series CP1L/CP1E CPU Unit Introduction ManualW461CP1L-L10D□-□ CP1L-L14D□-□ CP1L-L20D□-□ CP1L-M30D□-□ CP1L-M40D□-□ CP1L-M60D□-□ CP1E-EO□D□-□ CP1E-NO□D□-□ CP1E-NA□D□-□To learn the basic setup methods of the CP1L/CP1E PLCsDescribes the following information for CP1L/CP1E PLCs. • Basic configuration and component names • Mounting and wiring • Programming, data transfer, and debugging using the CX-Programmer • Application program examples

1

Summary of Instructions

This section provides a summary of instructions used with a CP1E CPU Unit.

1-1 Summary of Instructions 1-2

1-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 the detail of each instruction.

Instruion TypeInstructionMnemonicFUN No.FunctionPage
Sequence Input Instru-tionsLOADLD-Indicates a logical start and creates an ON/OFF execution condition based on the ON/OFF status of the specified operand bit.2-7
@LD-
%LD-
!LD-
!@LD-
!%LD-
LOAD NOTLD 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.2-7
@LD NOT-
%LD NOT-
!LD NOT-
!@LD NOT-
!%LD NOT-
ANDAND-Takes a logical AND of the status of the specified operand bit and the current execution condition.2-9
@AND-
%AND-
!AND-
!@AND-
!%AND-
AND NOTAND NOT-Reverses the status of the specified operand bit and takes a logical AND with the current execution condition.2-9
@AND NOT-
%AND NOT-
!AND NOT-
!@AND NOT-
!%AND NOT-
OROR-Takes a logical OR of the ON/OFF status of the specified operand bit and the current execution condition.2-11
@OR-
%OR-
!OR-
!@OR-
!%OR-
OR NOTOR NOT-Reverses the status of the specified bit and takes a logical OR with the current execution condition.2-11
@OR NOT-
%OR NOT-
!OR NOT-
!@OR NOT-
!%OR NOT-
AND LOADAND LD-Takes a logical AND between logic blocks.2-13
OR LOADOR LD-Takes a logical OR between logic blocks.2-13
NOTNOT520Reverses the execution condition.2-16
CONDITION ONUP521UP(521) turns ON the execution condition for one cycle when the execution condition goes from OFF to ON.2-17
CONDITION OFFDOWN522DOWN(522) turns ON the execution condition for one cycle when the execution condition goes from ON to OFF.2-17
Instruction TypeInstructionMnemonicFUN No.FunctionPage
Sequence Output InstructionsOUTPUTOUT-Outputs the result (execution condition) of the logical processing to the speci-fied bit.2-18
!OUT-
OUTPUT NOTOUT NOT-Reverses the result (execution condition) of the logical processing, and outputs it to the specified bit.2-18
!OUT NOT-
TR BitsTR-TR bits are used to temporarily retain the ON/OFF status of execution condi-tions in a program when programming in mnemonic code.2-20
KEEPKEEP011Operates as a latching relay.2-21
!KEEP
DIFFERENTIATE UPDIFU013DIFU(013) turns the designated bit ON for one cycle when the execution condi-tion goes from OFF to ON (rising edge).2-25
!DIFU
DIFFERENTIATE DOWNDIFD014DIFD(014) turns the designated bit ON for one cycle when the execution condi-tion goes from ON to OFF (falling edge).2-27
!DIFD
SETSET-SET turns the operand bit ON when the execution condition is ON.2-29
@ SET-
%SET-
!SET-
!@ SET-
!%SET-
RESETRSET-RSET turns the operand bit OFF when the execution condition is ON.2-29
@ RSET-
%RSET-
!RSET-
!@ RSET-
!%RSET-
MULTIPLE BIT SETSETA530SETA(530) turns ON the specified number of consecutive bits.2-31
@ SETA
MULTIPLE BIT RESETRSTA531RSTA(531) turns OFF the specified number of consecutive bits.2-31
@ RSTA
SINGLE BIT SETSETB532SETB(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 word.2-33
@ SETB
!SETB
!@ SETB
SINGLE BIT RESETRSTB533RSTB(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 word.2-33
@ RSTB
!RSTB
!@ RSTB
Sequence Control InstructionsENDEND001Indicates the end of a program.2-38
NO OPERATIONNOP000This instruction has no function. (No processing is performed for NOP(000).)2-39
INTERLOCKIL002Interlocks all outputs between IL(002) and ILC(003) when the execution condi-tion for IL(002) is OFF.2-40
INTERLOCK CLEARILC003All outputs between IL(002) and ILC(003) are interlocked when the execution condition for IL(002) is OFF.2-40
MULTI-INTERLOCK DIFFERENTIATION HOLDMILH517When 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.2-44
MULTI-INTERLOCK DIFFERENTIATION RELEASEMILR518When 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.2-44
MULTI-INTERLOCK CLEARMILC519Clears an interlock started by an MILH(517) or MILR(518) with the same inter-lock number.2-44
JUMPJMP004When 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.2-53
JUMP ENDJME005Indicates the end of a jump initiated by JMP(004) or CJP(510).2-53
CONDITIONAL JUMPCJP510The 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.2-53
FOR LOOPFOR512The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.2-56
NEXT LOOPNEXT513The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.2-56
BREAK LOOPBREAK514Programmed 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.2-59
Timer and Counter InstructionsHUNDRED-MS TIMERTIM-TIM/TIMX(550) operates a decrementing timer with units of 0.1-s.2-66
TIMX550
TEN-MS TIMERTIMH015TIMH(015)/TIMHX(551) operates a decrementing timer with units of 10-ms.2-69
TIMHX551
ONE-MS TIMERTMHH540TMHH(540)/TMHHX(552) operates a decrementing timer with units of 1-ms.2-72
TMHHX552
ACCUMULATIVE TIMERTTIM087TTIM(087)/TTIMX(555) operates an incrementing timer with units of 0.1-s.2-74
TTIMX555
LONG TIMERTIML542TIML(542)/TIMLX(553) operates a decrementing timer with units of 0.1-s.2-77
TIMLX553
COUNTERCNT-CNT/CNTX(546) operates a decrementing counter.2-80
CNTX546
REVERSIBLE COUNTERCNTR012CNTR(012)/CNTRX(548) operates a reversible counter.2-83
CNTRX548
RESET TIMER/ COUNTERCNR/ @CNR545CNR(545)/CNRX(547) resets the timers or counters within the specified range of timer or counter numbers.2-86
CNRX/ @CNRX547
Instruion TypeInstructionMnemonicFUN No.FunctionPage
Comparison InstructionsSymbol Comparison=, <>, <, <=, >, >=300 ~ 328Symbol comparison instructions compare two values and create an ON execu-tion condition when the comparison condition is true.2-88
Time ComparisonLD, AND, OR+=DT341Time comparison instructions compare two BCD time values and create an ON execution condition when the comparison condition is true.2-91
LD, AND, OR+=<>DT342
LD, AND, OR+=<>DT343
LD, AND, OR+=<DT344
LD, AND, OR+=<>DT345
LD, AND, OR+=<>DT346
UNSIGNED COMPARECMP020Compares 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.2-95
ICMP
DOUBLE UNSIGNED COMPARECMPL060Compares 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.2-95
SIGNED BINARY COMPARECPS114Compares two signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.2-98
ICPS
DOUBLE SIGNED BINARY COMPARECPSL115Compares 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.2-98
TABLE COMPARETCMP085Compares 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.2-101
@TCMP
UNSIGNED BLOCK COMPAREBCMP068Compares 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.2-103
@BCMP
AREA RANGE COMPAREZCP088Compares 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.2-105
DOUBLE AREA RANGE COMPAREZCPL116Compares 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.2-105
Data Move-ment Instruc-tionsMOVEMOV021Transfers a word of data to the specified word.2-108
@MOV
!MOV
!@MOV
DOUBLE MOVEMOVL/ @MOVL498Transfers two words of data to the specified words.2-108
MOVE NOTMVN/ @MVN022Transfers the complement of a word of data to the specified word.2-108
MOVE BITMOVB/ @MOVB082Transfers the specified bit.2-111
MOVE DIGITMOVD/ @MOVD083Transfers the specified digit or digits. (Each digit is made up of 4 bits.)2-113
MULTIPLE BIT TRANSFERXFRB/ @XFRB062Transfers the specified number of consecutive bits.2-115
BLOCK TRANSFERXFER/ @XFER070Transfers the specified number of consecutive words.2-117
BLOCK SETBSET/ @BSET071Copies the same word to a range of consecutive words.2-119
DATA EXCHANGEXCHG/ @XCHG073Exchanges the contents of the two specified words.2-121
SINGLE WORD DISTRIBUTEDIST/ @DIST080Transfers the source word to a destination word calculated by adding an offset value to the base address.2-123
DATA COLLECTCOLL/ @COLL081Transfers the source word (calculated by adding an offset value to the base address) to the destination word.2-125
Instruction TypeInstructionMnemonicFUN No.FunctionPage
Data Shift InstructionsSHIFT REGISTERSFT010Operates a shift register.2-127
REVERSIBLE SHIFT REGISTERSFTR/ @SFTR084Creates a shift register that shifts data to either the right or the left.2-129
WORD SHIFTWSFT/ @WSFT016Shifts data between St and E in word units.2-131
ARITHMETIC SHIFT LEFTASL/ @ASL025Shifts the contents of Wd one bit to the left.2-133
ARITHMETIC SHIFT RIGHTASR/ @ASR026Shifts the contents of Wd one bit to the right.2-134
ROTATE LEFTROL/ @ROL027Shifts all Wd bits one bit to the left including the Carry Flag (CY).2-135
ROTATE RIGHTROR/ @ROR028Shifts all Wd bits one bit to the right including the Carry Flag (CY).2-137
ONE DIGIT SHIFT LEFTSLD/ @SLD074Shifts data by one digit (4 bits) to the left.2-139
ONE DIGIT SHIFT RIGHTSRD/ @SRD075Shifts data by one digit (4 bits) to the right.2-139
SHIFT N-BITS LEFTNASL/ @NASL580Shifts the specified 16 bits of word data to the left by the specified number of bits.2-141
DOUBLE SHIFT N-BITS LEFTNSLL/ @NSLL582Shifts the specified 32 bits of word data to the left by the specified number of bits.2-141
SHIFT N-BITS RIGHTNASR/ @NASR581Shifts the specified 16 bits of word data to the right by the specified number of bits.2-144
DOUBLE SHIFT N-BITS RIGHTNSRL/ @NSRL583Shifts the specified 32 bits of word data to the right by the specified number of bits.2-144
Increment/ Decrement InstructionsINCREMENT BINARY++/ @++590Increments the 4-digit hexadecimal content of the specified word by 1.2-147
DOUBLE INCREASENMENT BINARY++L/ @++L591Increments the 8-digit hexadecimal content of the specified words by 1.2-147
DECREMENT BINARY--/ @--592Decrement the 4-digit hexadecimal content of the specified word by 1.2-150
DOUBLE DECREASENMENT BINARY--L/ @--L593Decrement the 8-digit hexadecimal content of the specified words by 1.2-150
INCREMENT BCD++B/ @++B594Increments the 4-digit BCD content of the specified word by 1.2-153
DOUBLE INCREASENMENT BCD++BL/ @++BL595Increments the 8-digit BCD content of the specified words by 1.2-153
DECREMENT BCD--B/ @--B596Decrement the 4-digit BCD content of the specified word by 1.2-156
DOUBLE DECREASENMENT BCD--BL/ @--BL597Decrement the 8-digit BCD content of the specified words by 1.2-156
Symbol Math InstructionsSIGNED BINARY ADD WITHOUT CARRY+/@+400Adds 4-digit (single-word) hexadecimal data and/or constants.2-158
DOUBLE SIGNED BINARY ADD WITHOUT CARRY+L/@+L401Adds 8-digit (double-word) hexadecimal data and/or constants.2-158
SIGNED BINARY ADD WITH CARRY+C/@+C402Adds 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).2-160
DOUBLE SIGNED BINARY ADD WITH CARRY+CL/@+CL403Adds 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).2-160
BCD ADD WITHOUT CARRY+B/@+B404Adds 4-digit (single-word) BCD data and/or constants.2-162
DOUBLE BCD ADD WITHOUT CARRY+BL/@+BL405Adds 8-digit (double-word) BCD data and/or constants.2-162
BCD ADD WITH CARRY+BC/@+BC406Adds 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).2-164
DOUBLE BCD ADD WITH CARRY+BCL/@+BCL407Adds 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).2-164
SIGNED BINARY SUBTRACT WITHOUT CARRY-/@-410Subtracts 4-digit (single-word) hexadecimal data and/or constants.2-166
DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY-L/@-L411Subtracts 8-digit (double-word) hexadecimal data and/or constants.2-166
SIGNED BINARY SUBTRACT WITH CARRY-C/@-C412Subtracts 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).2-170
DOUBLE SIGNED BINARY WITH CARRY-CL/@-CL413Subtracts 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).2-170
BCD SUBTRACT WITHOUT CARRY-B/@-B414Subtracts 4-digit (single-word) BCD data and/or constants.2-172
DOUBLE BCD SUBTRACT WITHOUT CARRY-BL/@-BL415Subtracts 8-digit (double-word) BCD data and/or constants.2-172
BCD SUBTRACT WITH CARRY-BC/@-BC416Subtracts 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).2-175
DOUBLE BCD SUBTRACT WITHOUT CARRY-BCL/@-BCL417Subtracts 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).2-175
SIGNED BINARY MULTIPLY*/@*420Multiplies 4-digit signed hexadecimal data and/or constants.2-177
DOUBLE SIGNED BINARY MULTIPLY*L/@*L421Multiplies 8-digit signed hexadecimal data and/or constants.2-177
BCD MULTIPLY*B/@*B424Multiplies 4-digit (single-word) BCD data and/or constants.2-179
DOUBLE BCD MULTIPLY*BL/@*BL425Multiplies 8-digit (double-word) BCD data and/or constants.2-179
SIGNED BINARY DIVIDE/@/430Divides 4-digit (single-word) signed hexadecimal data and/or constants.2-181
DOUBLE SIGNED BINARY DIVIDE/L@/L431Divides 8-digit (double-word) signed hexadecimal data and/or constants.2-181
BCD DIVIDE/B@/B434Divides 4-digit (single-word) BCD data and/or constants.2-183
DOUBLE BCD DIVIDE/BL@/BL435Divides 8-digit (double-word) BCD data and/or constants.2-183
Instruccion TypeInstructionMnemonicFUN No.FunctionPage
Conversion InstructionsBCD TO BINARYBIN/ @BIN023Converts BCD data to binary data.2-185
DOUBLE BCD TO DOUBLE BINARYBINL/ @BINL058Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary) data.2-185
BINARY TO BCDBCD/ @BCD024Converts a word of binary data to a word of BCD data.2-187
DOUBLE BINARY TO DOUBLE BCDBCDL/ @BCDL059Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD data.2-187
2'S COMPLEMENTNEG/ @NEG160Calculates the 2' complement of a word of hexadecimal data.2-189
DATA DECODERMLPX/ @MLPX076Reads 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).2-191
DATA ENCODERDMPX/ @DMPX077Flnds 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.2-196
ASCII CONVERTASC/ @ASC086Converts 4-bit hexadecimal digits in the source word into their 8-bit ASCII equivalents.2-201
ASCII TO HEXHEX/ @HEX162Converts up to 4 bytes of ASCII data in the source word to their hexadecimal equivalents and writes these digits in the specified destination word.2-205
Logic Instruc-tionsLOGICAL ANDANDW/ @ANDW034Takes the logical AND of corresponding bits in single words of word data and/or constants.2-210
DOUBLE LOGICAL ANDANDL/ @ANDL610Takes the logical AND of corresponding bits in double words of word data and/or constants.2-210
LOGICAL ORORW/ @ORW035Takes the logical OR of corresponding bits in single words of word data and/or constants.2-212
DOUBLE LOGICAL ORORWL/ @ORWL611Takes the logical OR of corresponding bits in double words of word data and/or constants.2-212
EXCLUSIVE ORXORW/ @XORW036Takes the logical exclusive OR of corresponding bits in single words of word data and/or constants.2-214
DOUBLE EXCLU-SIVE ORXORL/ @XORL612Takes the logical exclusive OR of corresponding bits in double words of word data and/or constants.2-214
COMPLEMENTCOM/ @COM029Turns OFF all ON bits and turns ON all OFF bits in Wd.2-216
DOUBLE COMPLEMENTCOML/ @COML614Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1.2-216
Special Math InstructionsARITHMETIC PRO-CCESSAPR/ @APR069Calculates the sine, cosine, or a linear extrapolation of the source data.2-218
BIT COUNTERBCNT/ @BCNT067Counts the total number of ON bits in the specified word(s).2-227
Instruion TypeInstructionMnemonicFUN No.FunctionPage
Floating-point Math Instru-tionsFLOATING TO 16-BITFIX/ @FIX450Converts a 32-bit floating-point value to 16-bit signed binary data and places the result in the specified result word.2-233
FLOATING TO 32-BITFIXL/ @FIXL451Converts a 32-bit floating-point value to 32-bit signed binary data and places the result in the specified result words.2-233
16-BIT TO FLOATINGFLT/ @FLT452Converts a 16-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.2-235
32-BIT TO FLOATINGFLTL/ @FLTL453Converts a 32-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.2-235
FLOATINGPOINT ADD+F/ @+F454Adds two 32-bit floating-point numbers and places the result in the specified result words.2-237
FLOATINGPOINT SUBTRACT-F/ @-F455Subtracts one 32-bit floating-point number from another and places the result in the specified result words.2-237
FLOATING- POINT MULTIPLY*F/ @*F456Multiplies two 32-bit floating-point numbers and places the result in the speci-fied result words.2-237
FLOATING- POINT DIVIDE/F @/F457Divides one 32-bit floating-point number by another and places the result in the specified result words.2-237
FLOATING SYMBOL COMPARISON=F329Compares 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.2-241
<>F3302-241
<F3312-241
<=F3322-241
>F3332-241
>=F3342-241
FLOATING- POINT TO ASCIIFSTR/ @FSTR448Converts 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.2-244
ASCII TO FLOATING-POINTFVAL/ @FVAL449Converts 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.2-249
Table Data Processing InstructionsSWAP BYTESSWAP/ @SWAP637Switches the leftmost and rightmost bytes in all of the words in the range.2-253
FRAME CHECKSUMFCS/ @FCS180Calculates the ASCII FCS value for the specified range.2-255
Data Control InstructionsPID CONTROL WITH AUTOTUN-INGPIDAT191Executes PID control according to the specified parameters. The PID constants can be auto-tuned with PIDAT(191).2-257
TIME-PROPOR-TIONAL OUTPUTTPO685Inputs 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.2-269
SCALINGSCL/ @SCL194Converts unsigned binary data into unsigned BCD data according to the speci-fied linear function.2-276
SCALING 2SCL2/ @SCL2486Converts signed binary data into signed BCD data according to the specified linear function. An offset can be input in defining the linear function.2-280
SCALING 3SCL3/ @SCL3487Converts signed BCD data into signed binary data according to the specified linear function. An offset can be input in defining the linear function.2-284
AVERAGEAVG195Calculates the average value of an input word for the specified number of cycles.2-287
Subroutine InstructionsSUBROUTINE CALLSBS/ @SBS091Calls the subroutine with the specified subroutine number and executes that program.2-290
SUBROUTINE ENTRYSBN092Indicates the beginning of the subroutine program with the specified subroutine number.2-295
SUBROUTINE RETURNIRET093Indicates the end of a subroutine program.2-295
Interrupt Control InstructionsSET INTERRUPT MASKMSKS/ @MSKS690Sets up interrupt processing for I/O interrupts or scheduled interrupts.2-300
CLEAR INTERRUPTCLI/ @CLI691Clears or retains recorded interrupt inputs for I/O interrupts or sets the time to the first scheduled interrupt for scheduled interrupts.2-303
DISABLE INTERRUPTSDI/ @DI693Disables execution of all interrupt tasks except the power OFF interrupt.2-306
ENABLE INTERRUPTSEI694Enables execution of all interrupt tasks that were disabled with DI(693).2-307
High-speed Counter and Pulse Output InstructionsMODE CONTROLINI/ @INI880INI(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 output.2-308
HIGH-SPEED COUNTER PV READPRV/ @PRV881PRV(881) is used to read the present value (PV) of a highspeed counter, pulse output, or interrupt input (counter mode).2-311
COMPARISON TABLE LOADCTBL/ @CTBL882CTBL(882) is used to perform target value or range comparisons for the present value (PV) of a high-speed counter.2-315
SPEED OUTPUTSPED/ @SPED885SPED(885) is used to specify the frequency and perform pulse output without acceleration or deceleration.2-319
SET PULSESPULS/ @PULS886PULS(886) is used to set the number of pulses for pulse output.2-323
PULSE OUTPUTPLS2/ @PLS2887PLS2(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.2-325
ACCELERATION CONTROLACC/ @ACC888ACC(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.2-331
ORIGIN SEARCHORG/ @ORG889ORG(889) is used to perform origin searches and returns.2-336
PULSE WITH VARIABLE DUTY FACTORPWM/ @PWM891PWM(891) is used to output pulses with a variable duty factor.2-339
Step InstructionsSTEP STARTSNXT009SNXT(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.2-342
STEP DEFINESTEP008STEP(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).2-342
Basic I/O Unit InstructionsI/O REFRESHIORF/ @IORF097Refreshes the specified I/O words.2-352
7-SEGMENT DECODERSDEC/ @SDEC078Converts the hexadecimal contents of the designated digit(s) into 8-bit, 7-segment display code and places it into the upper or lower 8-bits of the specified destination words.2-354
DIGITAL SWITCH INPUTDSW210Reads the value set on an external digital switch (or thumbwheel switch) connected to an Input Unit or Output Unit and stores the 4-digit or 8-digit BCD data in the specified words.2-357
MATRIX INPUTMTR213Inputs 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.2-361
7-SEGMENT PLAY OUTPUT7SEG214Converts the source data (either 4-digit or 8-digit BCD) to 7-segment display data, and outputs that data to the specified output word.2-365
Serial Communications InstructionsTRANSMITTXD/ @TXD236Outputs 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).2-369
RECEIVERXD/ @RXD235Reads 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).2-374
Clock InstructionsCALENDAR ADDCADD/ @CADD730Adds time to the calendar data in the specified words.2-380
CALENDAR SUBTRACTCSUB/ @CSUB731Subtracts time from the calendar data in the specified words.2-380
CLOCK ADJUSTMENTDATE/ @DATE735Changes the internal clock setting to the setting in the specified source words.2-385
Failure Diagnosis InstructionsFAILURE ALARMFAL/ @FAL006Generates or clears user-defined non-fatal errors.2-387
SEVERE FAILURE ALARMFALS007Generates user-defined fatal errors.2-393
Instruetion TypeInstructionMnemonicFUN No.FunctionPage
Other InstructionsSET CARRYSTC/ @STC040Sets the Carry Flag (CY).2-398
CLEAR CARRYCLC/ @CLC041Turns OFF the Carry Flag (CY).2-398
EXTEND MAXIMUM CYCLE TIMEWDT/ @WDT094Extends the maximum cycle time, but only for the cycle in which this instruction is executed.2-399

2

Instructions

This section describes the functions, operands and sample programs of the instructions that are supported by a CP1E CPU Unit.

Notation and Layout of Instruction Descriptions 2-2

Sequence Input Instructions 2-5

Sequence Output Instructions 2-18

Sequence Control Instructions 2-35

Timer and Counter Instructions 2-60

Comparison Instructions 2-88

Data Movement Instructions 2-108

Data Shift Instructions 2-127

Increment/Decrement Instructions 2-147

Symbol Math Instructions 2-158

Conversion Instructions 2-185

Logic Instructions 2-210

Special Math Instructions 2-218

Floating-point Math Instructions 2-229

Table Data Processing Instructions 2-253

Data Control Instructions 2-257

Subroutines Instructions 2-290

Interrupt Control Instructions 2-298

High-speed Counter/Pulse Output Instructions 2-308

Step Instructions 2-341

Basic I/O Unit Instructions 2-352

Serial Communication Instructions 2-369

Clock Instructions 2-380

Failure Diagnosis Instructions 2-387

Other Instructions 2-398

Notation and Layout of Instruction Descriptions

Instructions are described in groups by function. Refer to Appendix A List of Instructions by Function Code for a list of instructions by mnemonic that lists the page number in this section for each instruction.

The description of each instruction is organized as described in the following table.

ItemContents
InstructionIndicates the name of the instruction. Example: MOVE BIT
MnemonicIndicates the mnemonic. Example: MOVB(082)
VariationsDifferentiation @ Instruction that differentiates when the execution condition turns ON. % Instruction that differentiates when the execution condition turns OFF. Immediate refreshing ! Refreshes data in the I/O area specified by the operands or the Special I/O Unit words when the instruction is executed. JMP N Repeatedly as long execution condition
Function codeIndicates the function code.
FunctionThe basic purpose of the instruction is described after the section heading.
SymbolThe ladder symbol used to represent the instruction on the CX-Programmer is shown, as in the exam- ple for the MOVE BIT instruction given below. The name of each operand is also provided with the lad- der symbol. MOVBA S C D S: Source word or data C: Control word D: Destination word
Applicable Program AreasThe program areas in which the instruction can be used are specified. “OK” indicates the areas in which the instruction can be used.
AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK
OperandsIndicates a description of the operand, the data type, and the size. Where necessary, the meaning of words and bits used in specific operands, such as control words, is given. C 15 8 7 0 m n Source bit: 00 to 0F (0 to 15 decimal) Destination bit: 00 to 0F (0 to 15 decimal)
Operand SpecificationsThe memory areas addresses that can be used each operand are listed in a table like the following one. The letters used in the column headings on the above are the same as those used in the ladder symbol. “---” is used to indicate when an area cannot be specific for an operand.
AreaWord addressesIndirect DM addressesCon- stantCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------
C
D---
ItemContents
FlagsThe flags table indicates the status of the condition flags immediately after execution of the instruction. Any flags that are not listed are not affected by the instruction. “OFF” indicates that a flag is turned OFF immediately after execution of the instruction regardless of the results of executing the instruction.
NameLabelOperation
Error FlagEROFF
Equal Flag=ON if the data being transferred (D) is 0. OFF in all other cases.
Negative FlagNON if the leftmost bit of the data being transferred (D) is 1. OFF in all other cases.
FunctionIndicates the function of the instruction.
HintIndicates a supplemental explanation of other than the main function.
PrecautionsIndicates important points when using an instruction.
Sample programAn example of using the instruction with specific operands is provided to further explain the function of the instruction.

Constants

Constants input for operands are given as listed below.

Operand Descriptions and Operand Specifications

  • Operands Specifying Bit Strings (Normally Input as Hexadecimal): Only the hexadecimal form is given for operands specifying bit strings, e.g., only “#0000 to #FFFF” is specified as the S operand for the MOV(021) instruction. On the CX-Programmer, however, bit strings can be input in decimal form by using the & prefix.
  • Operands Specifying Numeric Values (Normally Input as Decimal, Including Jump Numbers): Both the decimal and hexadecimal forms are given for operands specifying numeric values, e.g., "#0000 to #FFFF" and "&0 to &65535" are given for the N operand for the XFER(070) instruction.
  • Operands Indicating Control Numbers (Except for Jump Numbers): The decimal form is given for control numbers, e.g., "0 to 1023" is given for the N operand for the SBS(091) instruction.

Examples

In the examples, constants are given using the CX-Programmer notation, e.g., operands specifying numeric values are given in decimal for with an & prefix, as shown in the following example.

XFER
&10
D100
D200

The input methods for constants for the Programming Devices are given in the following table.

OperandCX-Programmer
Operands specifying bit strings (normally input as hexadecimal)Input as decimal with an & prefix or input as hexadecimal with an # prefix. (See note.)
Operands specifying numeric values (normally input as decimal)
Operands specifying control numbers (except for jump numbers)Input as decimal with an # prefix. (See note.)

Note When operands are input on the CX-Programmer, the input ranges will be displayed along with the appropriate prefixes.

Condition Flags

With the CX-Programmer, the condition flags are registered in advance as global symbols with “P_” in front of the symbol name.

FlagCX-Programmer label
Error FlagP_ER
Access Error FlagP_AER
Carry FlagP_CY
Greater Than FlagP_GT
Equals FlagP_EQ
Less Than FlagP_LT
Negative FlagP_N
Overflow FlagP_OF
Underflow FlagP_UF
Greater Than or Equals FlagP_GE
Not Equal FlagP_NE
Less Than or Equals FlagP_LE
Always ON FlagP_On
Always OFF FlagP_Off

Symbol Instructions

Some of the C/CV-series PLC instructions have been changed to different instructions with the same functionality for the CP1E-series PLCs.

Instruction groupC/CV SeriesCP1E Series
ComparisonEQUAND=
Data MovementMOVQMOV
Increment/DecrementINC++B
INCL++BL
INCB++
INBL++L
DEC--B
DECL--BL
DECB--
DCBL--L
Symbol MathADB+C
ADBL+CL
ADD+BC
ADDL+BCL
SBB-C
SBBL-CL
SUB-BC
SUBL-BCL
MBS*
MBSL*L
MUL*B
MULL*BL
DBS/
DBSL/L
DIV/B
DIVL/BL
Interrupt ControlINTMSKS / CLIDI / EI

Sequence Input Instructions

Differentiated and Immediate Refreshing Instructions

  • The LOAD, AND, and OR instructions have differentiated and immediate refreshing variations in addition to their ordinary forms, and there are also two combinations available.
  • The LOAD NOT, AND NOT, OR NOT, OUT, and OUT NOT instructions have immediate refreshing variations in addition to their ordinary forms.
  • The I/O timing for data handled by instructions differs for ordinary and differentiated instructions, immediate refreshing instructions, and immediate refreshing differentiated instructions.
  • Ordinary and differentiated instructions are executed using data input by previous I/O refresh processing, and the results are output with the next I/O processing. Here "I/O refreshing" means the data exchanged between the CPU's internal memory and the I/O Unit.
  • In addition to the above I/O refreshing, an immediate refresh instruction exchanges data with the I/O Unit for those words that are accessed by the instruction. An immediate refresh instruction refreshes eight bits simultaneously (leftmost or rightmost eight bits) in addition to the specified bit. Immediate refresh instructions (i.e., instructions with!) cannot be used for I/O on CP Expansion Units or CP Expansion I/O Units. Use IORF(097) for I/O on CP Expansion Units or CP Expansion I/O Units.
Instruction variationMnemonicFunctionI/O refresh
OrdinaryLD, AND, OR, LD NOT, AND NOT, OR NOTThe ON/OFF status of the specified bit is taken by the CPU with cyclic refreshing, and it is reflected in the next instruction execution.Cyclic refreshing
OUT, OUT NOTAfter the instruction is executed, the ON/OFF status of the specified bit is out-put with the next cyclic refreshing.
Differentiated up@LD, @AND, @ORThe instruction is executed once when the specified bit turns from OFF to ON and the ON state is held for one cycle.
Differentiated down%LD, %AND, %ORThe instruction is executed once when the specified bit turns from ON to OFF and the ON state is held for one cycle.
Immediate refresh!LD, !AND, !OR, !LD NOT, !AND NOT, !OR NOTThe input data for the specified bit is taken by the CPU and the instruction is executed.Before instruction execu-tion
!OUT, !OUT NOTAfter the instruction is executed, the data for the specified bit is output.After instruction execution
Differentiated up / immediate refresh!@LD, !@AND, !@ORThe input data for the specified bit is refreshed by the CPU, and the instruc-tion is executed once when the bit turns from OFF to ON and the ON state is held for one cycle.Before instruction execu-tion
Differentiated down / immediate refresh!%LD, !%AND, !%ORThe input data for the specified bit is refreshed by the CPU, and the instruc-tion is executed once when the bit turns from ON to OFF and the ON state is held for one cycle.

Operation Timing for I/O Instructions

The following chart shows the differences in the timing of instruction operations for a program configured from LD and OUT.

OMRON CP1E - Operation Timing for I/O Instructions - 1

LD/LD NOT

InstructionMnemonicVariationsFunction codeFunction
LOADLD@LD, %LD, !LD, !@LD, !%LD---Indicates a logical start and creates an ON/OFF execution condition based on the ON/OFF status of the specified operand bit.
LOAD NOTLD NOT@LD NOT, %LD NOT, ! LD NOT, !@LD 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.
SymbolLDLD NOT
Bus barStarting point of blockBus barStarting point of block

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
------BOOL---

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
LDOKOKOKOKOKOK------------OKOKOK
LD NOT---

Flags

There are no flags affected by this instruction.

Function

LD

LD is used for the first normally open bit from the bus bar or for the first normally open bit of a logic block. If there is no immediate refreshing specification, the specified bit in I/O memory is read. If there is an immediate refreshing specification, the status of the CPU Unit's built-in input terminal is read and used.

- LD NOT

LD NOT is used for the first normally closed bit from the bus bar, or for the first normally closed bit of a logic block. If there is no immediate refreshing specification, the specified bit in I/O memory is read and reversed. If there is an immediate refreshing specification, the status of the CPU Unit's built-in input terminal is read, reversed, and used.

Hint

  • LD/LD NOT is used in the following circumstances as an instruction for indicating a logical start.

  • When directly connecting to the bus bar.

  • When logic blocks are connected by AND LD or OR LD, i.e., at the beginning of a logic block. The AND LOAD and OR LOAD instructions are used to connect in series or in parallel logic blocks beginning with LD or LD NOT.

  • At least one LOAD or LOAD NOT instruction is required for the execution condition when output-related instructions cannot be connected directly to the bus bar. If there is no LOAD or LOAD NOT instruction, a programming error will occur with the program check by the Peripheral Device.

  • When logic blocks are connected by AND LOAD or OR LOAD instructions, the total number of AND LOAD/OR LOAD instructions must match the total number of LOAD/LOAD NOT instructions minus 1. If they do not match, a programming error will occur. For details, refer to AND LOAD: AND LD and OR LOAD: OR LD.

Precautions

  • Differentiate up (@) or differentiate down (%) can be specified for LD. If differentiate up (@) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from OFF to ON. If differentiate down (%) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from ON to OFF.
  • Immediate refreshing (!) can be specified for LD/LD NOT. An immediate refresh instruction updates the status of the built-in input bit just before the instruction is executed from the CPU Unit.
  • For LD, it is possible to combine immediate refreshing and up or down differentiation (@ or!%). If either of these is specified, the input is refreshed from the Basic Input Unit just before the instruction is executed and the execution condition is turned ON for one cycle only after the status goes from OFF to ON, or from ON to OFF.

Sample program

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

AND/AND NOT

InstructionMnemonicVariationsFunction codeFunction
ANDAND@AND, %AND, !AND, !@AND, !%AND---Takes a logical AND of the status of the specified operand bit and the current execution condition.
AND NOTAND NOT@AND NOT, %AND NOT, !AND NOT, !@AND NOT, !%AND NOT---Reverses the status of the specified operand bit and takes a logical AND with the current execution condition.
SymbolANDAND NOT
—|——|—

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
------BOOL---

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
ANDOKOKOKOKOKOK------------OKOK---
AND NOT

Flags

There are no flags affected by this instruction.

Function

AND

AND is used for a normally open bit connected in series. AND cannot be directly connected to the bus bar, and cannot be used at the beginning of a logic block. If there is no immediate refreshing specification, the specified bit in I/O memory is read. If there is an immediate refreshing specification, the status of the CPU Unit's built-in input terminal is read.

AND NOT

AND NOT is used for a normally closed bit connected in series. AND NOT cannot be directly connected to the bus bar, and cannot be used at the beginning of a logic block. If there is no immediate refreshing specification, the specified bit in I/O memory is read. If there is an immediate refreshing specification, the status the CPU Unit's built-in input terminals is read.

Precautions

  • Differentiate up (@) or differentiate down (%) can be specified for AND. If differentiate up (@) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from OFF to ON. If differentiate down (%) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from ON to OFF.
  • Immediate refreshing (!) can be specified for AND/AND NOT. An immediate refresh instruction updates the status of the built-in input bit just before the instruction is executed from the CPU Unit.
  • For AND, it is possible to combine immediate refreshing and up or down differentiation (@ or!%). If either of these is specified, the input is refreshed from the Basic Input Unit just before the instruction is executed and the execution condition is turned ON for one cycle only after the status goes from OFF to ON, or from ON to OFF.

Sample program

OMRON CP1E - Sample program - 1

InstructionOperand
LD0.00
AND0.01
LD0.02
AND0.03
LD0.04
AND NOT0.05
OR LD--
AND LD--
OUT100.00

OR/OR NOT

InstructionMnemonicVariationsFunction codeFunction
OROR@OR, %OR, !OR, !@OR, !%OR---Takes a logical OR of the ON/OFF status of the specified operand bit and the current execution condition.
OR NOTOR NOT@OR NOT, %OR NOT, !OR NOT, !@OR NOT, !%OR NOT---Reverses the status of the specified bit and takes a logical OR with the current execution condition.
SymbolOROR NOT
Bus barBus bar

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
------BOOL---

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
OROKOKOKOKOKOK------------OKOK---
OR NOT

Flags

There are no flags affected by this instruction.

Function

OR

OR is used for a normally open bit connected in parallel. A normally open bit is configured to form a logical OR with a logic block beginning with a LOAD or LOAD NOT instruction (connected to the bus bar or at the beginning of the logic block). If there is no immediate refreshing specification, the specified bit in I/O memory is read. If there is an immediate refreshing specification, the status of the CPU Unit's built-in input terminal is read.

OR NOT

OR NOT is used for a normally closed bit connected in parallel. A normally closed bit is configured to form a logical OR with a logic block beginning with a LOAD or LOAD NOT instruction (connected to the bus bar or at the beginning of the logic block). If there is no immediate refreshing specification, the specified bit in I/O memory is read. If there is an immediate refreshing specification, the status of the CPU Unit's built-in input terminal is read.

Precautions

  • Differentiate up (@) or differentiate down (\%) can be specified for OR. If differentiate up (@) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from OFF to ON. If differentiate down (\%) is specified, the execution condition is turned ON for one cycle only after the status of the operand bit goes from ON to OFF.
  • Immediate refreshing (!) can be specified for OR/OR NOT. An immediate refresh instruction updates the status of the built-in input bit just before the instruction is executed from the CPU Unit.
  • For OR, it is possible to combine immediate refreshing and up or down differentiation (@ or!%). If either of these is specified, the input is refreshed from the Basic Input Unit just before the instruction is executed and the execution condition is turned ON for one cycle only after the status of the oper-and bit goes from OFF to ON, or from ON to OFF.

Sample program

OMRON CP1E - Sample program - 1

InstructionOperand
LD0.00
AND0.01
AND0.02
OR0.03
AND0.04
LD0.05
AND0.06
OR NOT0.07
AND LD--
OUT100.00

AND LD/OR LD

InstructionMnemonicVariationsFunction codeFunction
AND LOADAND LD------Takes a logical AND between logic blocks.
OR LOADOR LD------Takes a logical OR between logic blocks.
SymbolAND LDOR LD
Logic blockLogic blockLogic blockLogic block

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Flags

There are no flags affected by this instruction.

Function

AND LD

AND LD connects in series the logic block just before this instruction with another logic block.

The logic block consists of all the instructions from a LOAD or LOAD NOT instruction until just before the next LOAD or LOAD NOT instruction on the same rungs.

OMRON CP1E - AND LD - 1

OR LD

OR LD connects in parallel the logic block just before this instruction with another logic block.

The logic block consists of all the instructions from a LOAD or LOAD NOT instruction until just before the next LOAD or LOAD NOT instruction on the same rungs.

OMRON CP1E - OR LD - 1

Hint

AND LD

  • Three or more logic blocks can be connected in series using this instruction to first connect two of the logic blocks and then to connect the next and subsequent ones in order. It is also possible to continue placing this instruction after three or more logic blocks and connect them together in series.

OR LD

  • Three or more logic blocks can be connected in parallel using this instruction to first connect two of the logic blocks and then to connect the next and subsequent ones in order. It is also possible to continue placing this instruction after three or more logic blocks and connect them together in parallel.

Precautions

When a logic block is connected by AND LOAD or OR LOAD instructions, the total number of AND LOAD/OR LOAD instructions must match the total number of LOAD/LOAD NOT instructions minus 1. If they do not match, a programming error will occur.

AND LD

In the following diagram, the two logic blocks are indicated by dotted lines. Studying this example shows that an ON execution condition will be produced when either of the execution conditions in the left logic block is ON (i.e., when either CIO 0.00 or CIO 0.01 is ON) and either of the execution conditions in the right logic block is ON (i.e., when either CIO 0.02 is ON or CIO 0.03 is OFF).

OMRON CP1E - AND LD - 1

Coding

InstructionOperand
LD0.00
OR0.01
LD0.02
OR NOT0.03
AND LD---
OUT100.00

Second LD: Used for first bit of next block connected in series to previous block.

OR LD

The following diagram requires an OR LOAD instruction between the top logic block and the bottom logic block. An ON execution condition would be produced either when CIO 0.00 is ON and CIO 0.01 is OFF or when CIO 0.02 and CIO 0.03 are both ON. The operation of and mnemonic code for the OR LOAD instruction is exactly the same as those for a AND LOAD instruction except that the current execution condition is ORed with the last unused execution condition.

OMRON CP1E - OR LD - 1

Coding

InstructionOperand
LD0.00
AND NOT0.01
LD0.02
AND0.03
OR LD---
OUT100.01

Second LD: Used for first bit of next block connected in series to previous block.

Sample program

AND LD

OMRON CP1E - AND LD - 1

Coding Example (1)

InstructionOperand
LD0.00
OR NOT0.01
LD NOT0.02
OR0.03
AND LD---
LD0.04
OR0.05
AND LD---
..
..
OUT100.00

Coding Example (2)

InstructionOperand
LD0.00
OR NOT0.01
LD NOT0.02
OR0.03
LD0.04
OR0.05
..
..
AND LD---
AND LD---
..
..
OUT100.00
  • The AND LOAD instruction can be used repeatedly. In programming method (2) above, however, the number of AND LOAD instructions becomes one less than the number of LOAD and LOAD NOT instructions before that.
  • In method (2), make sure that the total number of LOAD and LOAD NOT instructions before AND LOAD is not more than eight.
  • To use nine or more, program using method (1).
  • If there are nine or more with method (2), then a program error will occur during the program check by the Peripheral Device.

OR LD

OMRON CP1E - OR LD - 1

Coding Example (1)

InstructionOperand
LD0.00
AND NOT0.01
LD NOT0.02
AND NOT0.03
OR LD---
LD0.04
AND0.05
OR LD---
..
..
OUT100.01

Coding Example (2)

InstructionOperand
LD0.00
AND NOT0.01
LD NOT0.02
AND NOT0.03
LD0.04
AND0.05
..
..
OR LD---
OR LD---
..
..
OUT100.01
  • The OR LOAD instruction can be used repeatedly. In programming method (2) above, however, the number of OR LOAD instructions becomes one less than the number of LOAD and LOAD NOT instructions before that.
  • In method (2), make sure that the total number of LOAD and LOAD NOT instructions before OR LOAD is not more than eight.
  • To use nine or more, program using method (1).
  • If there are nine or more with method (2), then a program error will occur during the program check by the Peripheral Device.

NOT

InstructionMnemonicVariationsFunction codeFunction
NOTNOT---520Reverses the execution condition.
SymbolNOT
—NOT(520) —

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Flags

There are no flags affected by NOT(520).

Function

NOT(520) is placed between an execution condition and another instruction to invert the execution condition.

Precautions

NOT(520) is an intermediate instruction, i.e., it cannot be used as a right-hand instruction. Be sure to program a right-hand instruction after NOT(520).

Sample program

OMRON CP1E - Sample program - 1

NOT(520) reverses the execution condition in the following example.

0.000.010.02100.00
1110
1100
1011
0110
1001
0101
0011
0001

UP/DOWN

InstructionMnemonicVariationsFunction codeFunction
CONDITION ONUP---521UP(521) turns ON the execution condition for the next instruction for one cycle when the execution condition it receives goes from OFF to ON.
CONDITION OFFDOWN---522DOWN(522) turns ON the execution condition for the next instruction for one cycle when the execu-tion condition it receives goes from ON to OFF.

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Flags

There are no flags affected by UP(521) and DOWN(522).

Function

UP

UP(521) is placed between an execution condition and another instruction to turn the execution condition into an up-differentiated condition. UP(521) causes the connecting instruction to be executed just once when the execution condition goes from OFF to ON.

DOWN

DOWN(522) is placed between an execution condition and another instruction to turn the execution condition into a down-differentiated condition. DOWN(522) causes the connecting instruction to be executed just once when the execution condition goes from ON to OFF.

Precautions

  • The operation of UP(521) and DOWN(522) depends on the execution condition for the instruction as well as the execution condition for the program section when it is programmed in an interlocked program section, a jumped program section, or a subroutine.
  • The operation of UP(521) and DOWN(522) will not be consistent if the same subroutine is executed more than once in the same cycle.
  • An subroutine will not be executed while the input condition for the subroutine is OFF. Caution is thus required when using UP(521) and DOWN(522) in a function block definition. For details, refer to information on SBS(091).

Sample program

UP

OMRON CP1E - UP - 1

When CIO 0.00 goes from OFF to ON, CIO 100.01 is turned ON for just one cycle.

OMRON CP1E - UP - 2

Sequence Output Instructions

OUT/OUT NOT

InstructionMnemonicVariationsFunction codeFunction
OUTPUTOUT!OUT---Outputs the result (execution condition) of the logical processing to the specified bit.
OUTPUT NOTOUT NOT!OUT NOT---Reverses the result (execution condition) of the logical processing, and outputs it to the specified bit.
SymbolOUTOUT NOT

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
------BOOL---

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
OUTOKOKOKOK------OK---------------OK
OUT NOT

Flags

There are no flags affected by this instruction.

Function

OUT

If there is no immediate refreshing specification, the status of the execution condition (power flow) is written to the specified bit in I/O memory. If there is an immediate refreshing specification, the status of the execution condition (power flow) is also written to the CPU Unit's built-in output terminal in addition to the output bit in I/O memory.

OUT NOT

If there is no immediate refreshing specification, the status of the execution condition (power flow) is reversed and written to a specified bit in I/O memory. If there is an immediate refreshing specification, the status of the execution condition (power flow) is reversed and also written to the CPU Unit's built-in output terminal in addition to the output bit in I/O memory.

Hint

  • Immediate refreshing (!) can be specified for OUT and OUT NOT. An immediate refresh instruction updates the status of the built-in output terminal just after the instruction is executed for the CPU Unit, at the same time as it writes the status of the execution condition (power flow) to the specified output bit in I/O memory.
  • Difference between SET/RSET and OUT For OUT, the operand bit is turned ON when the input condition turns ON and is turned OFF when the input condition turns OFF. For SET and RSET, the operand bit turns ON or OFF, respectively, when the input condition turns ON and the operand bit does not change when the input condition turns OFF.

Sample program

OMRON CP1E - Sample program - 1

InstructionOperand
LD0.00
OUT100.00
OUT NOT100.01

TR

InstructionMnemonicVariationsFunction codeFunction
TR BitsTR------TR bits are used to temporarily retain the ON/OFF status of execution conditions in a program when programming in mnemonic code.

Function

TR bits are used to temporarily retain the ON/OFF status of execution conditions in a program when programming in mnemonic code. They are not used when programming directly in ladder program form because the processing is automatically executed by the Peripheral Device. The following diagram shows a simple application using two TR bits.

OMRON CP1E - Function - 1

Coding

InstructionOperands
LD0.00
OUTTR0
AND0.01
OUTTR1
AND0.02
OUT100.00
LDTR1
AND0.03
OUT100.01
LDTR0
AND0.04
OUT100.02
LDTR0
AND NOT100.00
OUT100.03

Relay Address

Temporary RelayTR0 to TR15

Using TR0 to TR15

  • TR0 to TR15 are used only with LOAD and OUTPUT instructions.
  • There are no restrictions on the order in which the bit addresses are used.
  • Sometimes it is possible to simplify a program by rewriting it so that TR bits are not required. The following diagram shows one case in which a TR bit is unnecessary and one in which a TR bit is required.

In instruction block (1), the ON/OFF status at point A is the same as for output CIO 100.00, so AND 0.01 and OUT 100.01 can be coded without requiring a TR bit. In instruction block (2), the status of the branching point and that of output CIO 100.02 are not necessarily the same, so a TR bit must be used. In this case, the number of steps in the program could be reduced by using instruction block (1) in place of instruction block (2).

OMRON CP1E - Using TR0 to TR15 - 1

OMRON CP1E - Using TR0 to TR15 - 2

KEEP

InstructionMnemonicVariationsFunction codeFunction
KEEPKEEP!KEEP011Operates like a latching relay.
SymbolKEEP
S(SET)KEEP(011)R: Bit
R(RESET)R

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
RBitBOOL---

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
ROKOKOKOK------------------------OK

Flags

No flags are affected by KEEP(011).

Function

When S turns ON, the designated bit will go ON and stay ON until reset, regardless of whether S stays ON or goes OFF. When R turns ON, the designated bit will go OFF. The relationship between execution conditions and KEEP(011) bit status is shown below on the right.

OMRON CP1E - Function - 1

OMRON CP1E - Function - 2

Hint

  • KEEP(011) has an immediate refreshing variation (IKEEP(011)). When a CPU Unit built-in output bit has been specified for R in a !KEEP(011) instruction, any changes to R will be refreshed when !KEEP(011) is executed and reflected immediately in the output bit.
  • KEEP(011) operates like the self-maintaining bit, but a self-maintaining bit programmed with KEEP(011) requires one less instruction.

OMRON CP1E - Hint - 1

OMRON CP1E - Hint - 2

Self-maintaining bits programmed with KEEP(011) will maintain status even in an interlock program section, unlike the self-maintaining bit programmed without KEEP(011).

OMRON CP1E - Hint - 3
Output bit C will maintain its previous status in an interlock.

OMRON CP1E - Hint - 4
Output bit C will be turned OFF in an interlock.

  • KEEP(011) can be used to create flip-flops as shown below.

OMRON CP1E - Hint - 5

OMRON CP1E - Hint - 6

  • If a holding bit is used for R, the bit status will be retained even during a power interruption. KEEP(011) can thus be used to program bits that will maintain status after restarting the PLC following a power interruption. An example of this that can be used to produce a warning display following a system shutdown for an emergency situation is shown below.

OMRON CP1E - Hint - 7

  • The status of I/O Area bits can be retained in the event of a power interruption by turning ON the IOM Hold Bit and setting IOM Hold Bit Hold in the PLC Setup. In this case, I/O Area bits used in KEEP(011) will maintain status after restarting the PLC following a power interruption, just like holding bits. Be sure to restart the PLC after changing the PLC Setup; otherwise the new settings will not be used.

Precautions

  • If S and R are ON simultaneously, the reset input takes precedence.

OMRON CP1E - Precautions - 1

  • The set input (S) cannot be received while R is ON.

OMRON CP1E - Precautions - 2

  • Never use an input bit in a normally closed condition on the reset (R) for KEEP(011) when the input device uses an AC power supply. The delay in shutting down the PLC's DC power supply (relative to the AC power supply to the input device) can cause the operand bit of KEEP(011) to be reset. This situation is shown on the right.

OMRON CP1E - Precautions - 3

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 goes ON in the left example, CIO 100.00 is turned ON. CIO 100.00 remains ON until CIO 0.01 goes ON.

When CIO 0.02 goes ON and CIO 0.03 goes OFF in the left example, CIO 100.01 is turned ON. CIO 100.01 remains ON until CIO 0.04 or CIO 0.05 goes ON.

Coding

InstructionOperand
LD0.00
LD0.01
KEEP (011)100.00
LD0.02
AND NOT0.03
LD0.04
OR0.05
KEEP (011)100.01

Note KEEP(011) is input in different orders on in ladder and mnemonic form. In ladder form, input the set input, KEEP(011), and then the reset input. In mnemonic form, input the set input, the reset input, and then KEEP(011).

DIFU

InstructionMnemonicVariationsFunction codeFunction
DIFFERENTIATE UPDIFU!DIFU013DIFU(013) turns the designated bit ON for one cycle when the execution condition goes from OFF to ON (rising edge).
SymbolDIFU
— | — DIFU(013) — R: Bit

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
RBitBOOL---

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
ROKOKOKOK---------------------------

Flags

No flags are affected by DIFU(013).

Function

When the execution condition goes from OFF to ON, DIFU(013) turns R ON. When DIFU(013) is reached in the next cycle, R is turned OFF.

OMRON CP1E - Function - 1

Hint

  • UP(521) can be used to execute an instruction for just one cycle when the execution condition goes from OFF ON.
  • DIFU(013) has immediate refreshing variation (!DIFU(013)). When a CPU Unit built-in output bit has been specified for R in this instruction, any changes to R will be refreshed when the instruction is executed and reflected immediately in the output bit.

Precautions

  • The operation of DIFU(013) depends on the execution condition for the instruction itself as well as the execution condition for the program section when it is programmed in an interlocked program section, a jumped program section, or a subroutine.
  • An subroutine will not be executed while the input condition for the subroutine is OFF. Caution is thus required when using DIFU(013) in a function block definition. For details, refer to information on SBS(091).
  • The operation of DIFU(013) will not be consistent if the same subroutine is executed more than once in the same cycle.

Sample program

When CIO 0.00 goes from ON to OFF in the following example, CIO 100.00 is turned ON for one cycle.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

DIFD

InstructionMnemonicVariationsFunction codeFunction
DIFFERENTIATE DOWNDIFD!DIFD014DIFD(014) turns the designated bit ON for one cycle when the execution condition goes from ON to OFF (falling edge).
SymbolDIFD
— | — DIFD(014) — R: Bit

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
RBitBOOL---

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
BOKOKOKOK---------------------------

Flags

No flags are affected by DIFD(014).

Function

When the execution condition goes from ON to OFF, DIFD(014) turns R ON. When DIFD(014) is reached in the next cycle, R is turned OFF.

OMRON CP1E - Function - 1
Execution condition
Status of R

Hint

  • DOWN(522) can be used to execute an instruction for just one cycle when the execution condition goes from ON OFF.
  • The operation of DIFD(014) depends on the execution condition for the instruction itself as well as the execution condition for the program section when it is programmed in an interlocked program section, a jumped program section, or a subroutine.
  • DIFD(014) has immediate refreshing variation (IDIFD(014)). When a CPU Unit built-in output bit has been specified for R in this instruction, any changes to R will be refreshed when the instruction is executed and reflected immediately in the output bit.

Precautions

  • The operation of DIFD(014) will not be consistent if the same function block instance is executed more than once in the same cycle.
  • An subroutine will not be executed while the input condition for the subroutine is OFF. Caution is thus required when using DIFD(014) in a function block definition. For details, refer to information on SBS(091).

Sample program

When CIO 0.00 goes from ON to OFF in the following example, CIO 100.00 is turned ON for one cycle.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

SET/RSET

InstructionMnemonicVariationsFunction codeFunction
SETSET@SET, %SET, !SET, !@SET, !%SET---SET turns the operand bit ON when the execution condition is ON. After this, the specified contact will remain ON regardless of ON/OFF of the input condition.
RESETRSET@RSET, %RSET, !RSET, !@RSET, !%RSET---RSET turns the operand bit OFF when the execution condition is ON. After this, the specified contact will remain OFF regardless of ON/OFF of the input condition.
SymbolSETRSET
SET RR: BitSET RR: Bit

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
RBitBOOL---

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
ROKOKOKOK---------------------------

Flags

No flags are affected by SET and RSET.

Function

- SET

SET turns the operand bit ON when the execution condition is ON, and does not affect the status of the operand bit when the execution condition is OFF. Use RSET to turn OFF a bit that has been turned ON with SET.

Execution condition of SET

Status of R

OMRON CP1E - - SET - 1

- RSET

RSET turns the operand bit OFF when the execution condition is ON, and does not affect the status of the operand bit when the execution condition is OFF. Use SET to turn ON a bit that has been turned OFF with RSET.

Execution condition of RSET

Status of R

OMRON CP1E - - RSET - 1

Hint

  • Differences between OUT/OUT NOT and SET/RSET

The operation of SET differs from that of OUT because the OUT instruction turns the operand bit OFF when its execution condition is OFF. Likewise, RSET differs from OUT NOT because OUT NOT turns the operand bit ON when its execution condition is OFF. For OUT, the operand bit is turned ON when the input condition turns ON and is turned OFF when the input condition turns OFF. For SET and RSET, the operand bit turns ON or OFF, respectively, when the input condition turns ON and the operand bit does not change when the input condition turns OFF.

OMRON CP1E - Hint - 1

  • The set and reset inputs for a KEEP(011) instruction must be programmed with the instruction, but the SET and RSET instructions can be programmed completely independently. Furthermore, the same bit may be used as the operand in any number of SET or RSET instructions.
  • SET and RSET have immediate refreshing variations (!SET and !RSET). When a CPU Unit built-in output bit has been specified for R in one of these instructions, any changes to R will be refreshed when the instruction is executed and reflected immediately in the output bit.

If external output is specified for R by !SET (or !RSET), R will be OUT-refreshed as soon as it turns ON (or OFF) (when the instruction is executed). R, which turned ON (or OFF), will remain ON (or OFF) as normal until a RSET instruction (or SET instruction) is executed.

Precautions

  • SET and RSET cannot be used to set and reset timers and counters. When SET or RSET is programmed between IL(002) and ILC(003) or JMP(004) and JME(005), the status of the specified bit will not be changed if the program section is interlocked or jumped.

SETA/RSTA

InstructionMnemonicVariationsFunction codeFunction
MULTIPLE BIT SETSETA@SETA530SETA(530) turns ON the specified number of consecutive bits.
MULTIPLE BIT RESETRSTA@RSTA531RSTA(531) turns OFF the specified number of consecutive bits.
SymbolSETARSTA
SETA(530)RSTA(531)
DD: Beginning wordDD: Beginning word
N1N1: Beginning bitN1N1: Beginning bit
N2N2: Number of bitsN2N2: Number of bits

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
DBeginning WordUINTVariable
N1Beginning BitUINT1
N2Number of BitsUINT1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
DOKOKOKOKOKOKOKOKOK------------
N1,N2OK

Flags

OperandDescriptionData type
Error FlagP_ERON if N1 is not within the specified range of 0000 to 000F (&0 to &15).OFF in all other cases.

Function

- SETA

SETA(530) turns ON N2 bits, beginning from bit N1 of D, and continuing to the left (more-significant bits). All other bits are left unchanged. (No changes will be made if N2 is set to 0.)

Bits turned ON by SETA(530) can be turned OFF by any other instructions, not just RSTA(531).

OMRON CP1E - - SETA - 1

RSTA

RSTA(531) turns OFF N2 bits, beginning from bit N1 of D, and continuing to the left (more-significant bits). All other bits are left unchanged. (No changes will be made if N2 is set to 0.)

Bits turned OFF by RSTA(531) can be turned ON by any other instructions, not just SETA(530).

OMRON CP1E - RSTA - 1

Hint

- SETA

  • SETA(530) can be used to turn ON bits in data areas that are normally accessed by words only, such as the DM areas.

RSTA

  • RSTA(531) can be used to turn OFF bits in data areas that are normally accessed by words only, such as the DM areas.

Sample program

- SETA

When CIO 0.00 is turned ON in the following example, the 20 bits (0014 hexadecimal) beginning with bit 5 of CIO 100 are turned ON.

OMRON CP1E - - SETA - 1

OMRON CP1E - - SETA - 2

RSTA

When CIO 0.00 is turned ON in the following example, the 20 bits (0014 hexadecimal) beginning with bit 3 of CIO 100 are turned OFF.

OMRON CP1E - RSTA - 1

OMRON CP1E - RSTA - 2

SETB/RSTB

InstructionMnemonicVariationsFunction codeFunction
SINGLE BIT SETSETB@SETB, !SETB, !@SETB532SETB(532) turns ON the specified bit.
SINGLE BIT RESETRSTB@RSTB, !RSTB, !@RSTB533RSTB(533) turns OFF the specified bit.
SymbolSETBRSTB
SETB(532)D ND: Word addressN: Bit numberSETB(533)D ND: Word addressN: Bit number

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
DWord addressUINT1
NBit numberUINT1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
DOKOKOKOKOKOKOKOKOK------------
NOK

Flags

OperandDescriptionData type
Error FlagP_ERON if N is not within the specified range of 0000 to 000F (&0 to &15).OFF in all other cases.

Function

- SETB

SETB(532) turns ON bit N of word D when the execution condition is ON. The status of the bit is not affected when the execution condition is OFF.

OMRON CP1E - - SETB - 1

RSTB

RSTB(533) turns OFF bit N of word D when the execution condition is ON. The status of the bit is not affected when the execution condition is OFF. (Use SETB(532) to turn ON the bit.)

OMRON CP1E - RSTB - 1

Hint

  • Differences between SET/RSET and SETB(532)/RSTB(533)

The instructions operate in the same way when the specified bit is in the CIO, W, H, or A Area.

The SETB(532) and RSTB(533) instructions can control bits in the DM Areas, unlike SET and RSET.

  • The set and reset inputs for a KEEP(011) instruction must be programmed with the instruction, but the SETB(532) and RSTB(533) instructions can be programmed completely independently. Furthermore, the same bit may be used as the operand in any number of SETB(532) and RSTB(533) instructions.

Precautions

  • Bits turned ON by SETB(532) can be turned OFF by any other instruction, not just RSTB(533).
  • Bits turned OFF by RSTB(533) can be turned ON by any other instruction, not just SETB(532).
  • SETB(532) and RSTB(533) cannot set/reset timers and counters.
  • When SETB(532) or RSTB(533) is programmed between IL(002) and ILC(003) or JMP(004) and JME(005), the status of the specified bit will not be changed if the program section is interlocked or jumped, i.e., when the interlock condition or jump condition is OFF.
  • SETB(532) and RSTB(533) have immediate refreshing variations (!SETB(532) and !RSTB(533)). When a CPU Unit built-in output bit has been specified in one of these instructions, any changes to the specified bit will be refreshed when the instruction is executed and reflected immediately in the output bit.
  • When a CPU Unit built-in output is specified for bit address N of word D by !SETB (or !RSTB instruction), bit address N of word D which turned ON (or OFF) will be OUT-refreshed at that point (when the instruction is executed). Bit address N of word D which was turned ON (or OFF) remains ON (or OFF) as normal until an RSTB instruction (or SETB instruction) is executed.

Sample program

OMRON CP1E - Sample program - 1

Bit 02 of D0 is turned ON when CIO 0.00 is ON.

Bit 02 of D0 is turned OFF when CIO 0.01 is ON.

Sequence Control Instructions

Overview of Interlock Instructions

- Interlock Instructions

The following instruction combinations can be used to interlock outputs in a program section.

  • INTERLOCK and INTERLOCK CLEAR (IL(002) and IL(003))
  • MULTI-INTERLOCK DIFFERENTIATION HOLD and MULTI-INTERLOCK CLEAR (MILH(517) and MILC(519))*

Note MILH(517) holds the status of the Differentiation Flag, so differentiated instructions that were interlocked are executed after the interlock is cleared.
- MULTI-INTERLOCK DIFFERENTIATION RELEASE and MULTI-INTERLOCK CLEAR (MILR(518) and MILC(519))*

Note MILR(518) does not hold the status of the Differentiation Flag, so differentiated instructions that were interlocked are not executed after the interlock is cleared.

- Differences between Interlocks and Multiple Interlocks

Regular interlocks (IL(002) and IL(003)) cannot be nested, but multiple interlocks (MILH(517), MILR(518), and MILC(519)) can be nested. Ladder programming can be simplified by nesting multiple interlocks, as shown in the following diagram.

OMRON CP1E - - Differences between Interlocks and Multiple Interlocks - 1
Interlocks with MILH and MILC

OMRON CP1E - - Differences between Interlocks and Multiple Interlocks - 2
Interlocks with IL and ILC

- Differences between MILH(517) and MILR(518)

Differentiated instructions (DIFU, DIFD, or instructions with a @ or % prefix) operate differently in interlocks created with MILH(517) and MILR(518).

The operation of differentiated instructions in an interlock created with MILH(517) is identical to the operation in an interlock created with IL(002).

For details, refer to MULTI-INTERLOCK DIFFERENTIATION HOLD, MULTI-INTERLOCK DIFFERENTIATION RELEASE, and MULTI-INTERLOCK CLEAR: MILH(517), MILR(518), and MILC(519).

Precautions

Do not combine interlocks created with different interlock instructions (IL-ILC, MILH-MILC, and MILR-MILC). The interlocks may not operate properly if different interlock methods are used together. For details on combining instructions, refer to MULTI-INTERLOCK DIFFERENTIATION HOLD, MULTI-INTERLOCK DIFFERENTIATION RELEASE, and MULTI-INTERLOCK CLEAR: MILH(517), MILR(518), and MILC(519).

For example, an MILH(517) instruction cannot be inserted between IL(002) and IL(003).

OMRON CP1E - Precautions - 1

Note The different interlocks (IL-ILC, MILH-MILC, and MILR-MILC) can be used together as long as the interlocked program sections do not overlap.

For example, all three interlock methods can be used without overlapping, as shown in the following diagram.

OMRON CP1E - Precautions - 2

- Differences between Interlocks and Jumps

The following table shows the differences between interlocks (created with IL(002)/ILC(003), MILH(517)/MILC(519), or MILR(518)/MILC(519)) and jumps created with JMP(004)/JME(005).

ItemTreatment in IL(002)/ILC(003), MILH(517)/MILC (519), or MILR(518)/MILC (519)Treatment in JMP(004)/JME(005)
Instruction executionExcept OUT, OUT NOT, and timer instructions, all instructions are not executed.No instructions are executed.
Output status in instructionsExcept for outputs in OUT, OUT NOT, and timer instructions, all outputs retain their previous status.All outputs retain their previous status.
Bits in OUT, OUT NOTOFFAll outputs retain their previous status.
Status of timer instructions (except (TTIM(087), TTIMX(555), MTIM(543), and MTIMX(554))ResetOperating timers (TIM, TIMX(550), TIMH(015), TIMHX(551), TMHH(540), TMHHX(552) only) continue timing because the PVs are updated even when the timer instruction is not being executed.

END

InstructionMnemonicVariationsFunction codeFunction
ENDEND---001Indicates the end of a program.
SymbolEND
END(001)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedNot allowedOK

Flags

There are no flags affected by this instruction.

Function

END(001) completes the execution of a program for that cycle. No instructions written after END(001) will be executed.

Precautions

  • Always place END(001) at the end of each program. A programming error will occur if there is not an END(001) instruction in the program.

NOP

InstructionMnemonicVariationsFunction codeFunction
NO OPERATIONNOP---000This instruction has no function.
SymbolNOP
(There is no ladder symbol associated with NOP(000).)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Flags

No flags are affected by NOP(000).

Function

  • No processing is performed for NOP(000), but this instruction can be used to set aside lines in the program where instructions will be inserted later.
  • NOP(000) can only be used with mnemonic displays, not with ladder programs.

Hint

  • When the instructions are inserted later, there will be no change in program addresses.

IL/ILC

InstructionMnemonicVariationsFunction codeFunction
INTERLOCKIL---002Interlocks all outputs between IL(002) and ILC(003) when the execution condition for IL(002) is OFF.
INTERLOCK CLEARILC---003Indicates the end of the interlock range.
SymbolILILC
—| IL(002) —|—| ILC(003) —|

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedOKOK

Flags

There are no flags affected by this instruction.

Function

When the execution condition for IL(002) is OFF, the outputs for all instructions between IL(002) and ILC(003) are interlocked. When the execution condition for IL(002) is ON, the instructions between IL(002) and ILC(003) are executed normally.

The following table shows the treatment of various outputs in an interlocked section between IL(002) and ILC(003).

InstructionTreatment
Bits specified in OUT, OUT NOTOFF
TIM, TIMX(550), TIMH(015), TIMHX(551), TMHH(540), TMHHX(552), TIML(542), and TIMXL(553)Completion FlagOFF (reset)
PVTime set value (reset)
Bits/words specified in all other instructions (See note.)Retain previous status.

Note Bits and words in all other instructions including TTIM(087), TTIMX(555), SET, RSET, CNT, CNTX(546), CNTR(012), CNTRX(548), SFT, and KEEP(011) retain their previous status.

OMRON CP1E - Function - 1

Hint

  • If there are bits which you want to remain ON in an interlocked program section, set these bits to ON with SET just before IL(002).
  • It is often more efficient to switch a program section with IL(002) and ILC(003). When several processes are controlled with the same execution condition, it takes fewer program steps to put these processes between IL(002) and ILC(003).

OMRON CP1E - Hint - 1

Precautions

  • The cycle time is not shortened when a section of the program is interlocked because the interlocked instructions are executed internally.
  • In general, IL(002) and ILC(003) are used in pairs, although it is possible to use more than one IL(002) with a single ILC(003) as shown in the following diagram. If IL(002) and ILC(003) are not paired, an error message will appear when the program check is performed but the program will be executed properly.

OMRON CP1E - Precautions - 1

Execution conditionProgram section
abAB
OFFONInterlockedInterlocked
OFFOFFInterlockedInterlocked
ONOFFNot interlockedInterlocked
ONONNot interlockedNot interlocked
  • IL(002) and ILC(003) cannot be nested, as in the following diagram. (Use MILH(517)/MILR(518) and MILC(519) when it is necessary to nest interlocks.)

OMRON CP1E - Precautions - 2

Operation of Differentiated Instructions

If there is a differentiated instruction (DIFU, DIFD, or instruction prefixed by @ or %) between IL(002) and ILC(003) instructions, that instruction will be executed when the interlock is cleared if the differentiation condition of the instruction is satisfied by means of a change in the input condition between starting and clearing of the interlock.

Example:

When a DIFFERENTIATE UP (DIFU(013)) instruction is used and the input condition is OFF when the interlock starts and ON when the interlock is cleared, the DIFFERENTIATE UP (DIFU(013)) instruction will be executed when the interlock is cleared.

OMRON CP1E - Example: - 1

Reference:

An IL(002) instruction operates in the same way as an MILH(517) instruction in relation to differentiated instruction operation.

Timing Chart

OMRON CP1E - Reference: - 1

Sample program

When CIO 0.00 is OFF in the right example, all outputs between IL(002) and ILC(003) are interlocked. When CIO 0.00 is ON in the right example, the instructions between IL(002) and ILC(003) are executed normally.

OMRON CP1E - Sample program - 1

MILH/MILR/MILC

InstructionMnemonicVariationsFunction codeFunction
MULTI-INTERLOCK DIFFER-ENTIATION HOLDMILH---517Interlocks all outputs between MILH(517) and MILC(519) when the execution condition for MILH(517) is OFF.
MULTI-INTERLOCK DIFFER-ENTIATION RELEASEMILR---518Interlocks all outputs between MILR(518) and MILC(519) when the execution condition for MILR(518) is OFF.
MULTI-INTERLOCK CLEARMILC---519Indicates the end of a multi-interlock range by means of an MILH or MILR instruction with the same interlock number.
SymbolMILHMILRMILC
MILH(517)MILR(518)
NNN
DDN: Interlock Number
N: Interlock NumberN: Interlock Number
D: Interlock Status BitD: Interlock Status Bit

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedOKOK

Operands

OperandDescriptionData typeSize
NInterlock number--1
DInterlock status bitBOOL--

N: Interlock Number

The interlock number must be between 0 and 15. Match the interlock number of the MILH(517) (or MILR(518)) instruction with the same number in the corresponding MILC(519) instruction.

The interlock numbers can be used in any order.

D: Interlock Status Bit

  • ON when the program section is not interlocked.
  • OFF when the program section is interlocked.

When the interlock is engaged, the Interlock Status Bit can be force-set to release the interlock. Conversely, when the interlock is not engaged, the Interlock Status Bit can be force-reset to engage the interlock.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------
DOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_EROFF

Function

When the execution condition for MILH(517) (or MILR(518)) with interlock number N is OFF, the outputs for all instructions between that MILH(517)/MILR(518) instruction and the next MILC(519) with interlock number N are interlocked.

When the execution condition for MILH(517) (or MILR(518)) with interlock number N is ON, the instructions between that MILH(517)/MILR(518) instruction and the next MILC(519) with interlock number N are executed normally.

- Interlock Status

The following table shows the treatment of various outputs in an interlocked section between MILH(517)/MILR(518) instruction and the next MILC(519).

InstructionTreatment
Bits specified in OUT, OUT NOTOFF
TIM, TIMX(550), TIMH(015),TIMHX(551), TMHH(540),TMHHX(552), TIML(542), andTIMXL(553)Completion FlagOFF (reset)
PVTime set value (reset)
Bits/words specified in all other instructions (See note.)Retain previous status.

Note Bits and words in all other instructions including TTIM(087), TTIMX(555), SET, RSET, CNT, CNTX(546), CNTR(012), CNTRX(548), SFT, and KEEP(011) retain their previous status.

The MILH(517)/MILR(518) instruction turns OFF the Interlock Status Bit (operand D) when the interlock is in engaged and turns ON the bit when the interlock is not engaged. Consequently, the Interlock Status Bit can be monitored to check whether or not the interlock for a given interlock number is engaged.

OMRON CP1E - - Interlock Status - 1

- Nesting

Interlocks are nested when an interlocked program section (MILH(517)/MILR(518) and MILC(519) combination) is placed within another interlocked program section (MILH(517)/MILR(518) and MILC(519) combination). Interlocks can be nested up to 16 levels.

Nesting can be used for the following kinds of applications.

Example 1

Interlocking the entire program with one condition and interlocking a part of the program with another condition (1 nesting level)

OMRON CP1E - Example 1 - 1

  • A1 and A2 are interlocked when the Emergency Stop Button is ON.
  • A2 is interlocked when Conveyor RUN is OFF.

OMRON CP1E - Example 1 - 2

Example 2

Interlocking the entire program with one condition and interlocking two overlapping parts of the program with other conditions (2 nesting levels)

OMRON CP1E - Example 2 - 1

  • A1, A2, and A3 are interlocked when the Emergency Stop Button is ON.
  • A2 and A3 are interlocked when Conveyor RUN is OFF.
  • A3 is interlocked when Arm RUN is OFF.

OMRON CP1E - Example 2 - 2

- Differences between MILH(517) and MILR(518)

Differentiated instructions (DIFU, DIFD, or instructions with a @ or % prefix) operate differently in interlocks created with MILH(517) and MILR(518).

When a program section is interlocked with MILR(518), a differentiated instruction will not be executed when the interlock is cleared even if the differentiation condition was activated during the interlock (comparing the status of the execution condition when the interlock started to its status when the interlock was cleared).

When a program section is interlocked with MILH(517), a differentiated instruction will be executed when the interlock is cleared if the differentiation condition was activated during the interlock (comparing the status of the execution condition when the interlock started to its status when the interlock was cleared).

InstructionOperation of Differentiated Instructions
MILH(517) MULTI-INTERLOCK DIFFER-ENTIATION HOLDA differentiated instruction (DIFU, DIFD, or instruction with a @ or % prefix) will be executed after the interlock is cleared if the differentiation condition of the instruction was established while the instruction was interlocked. (The status of the execution condition when the interlock started is compared to its status when the interlock was cleared.)
MILR(518) MULTI-INTERLOCK DIFFER-ENTIATION RELEASEA differentiated instruction (DIFU, DIFD, or instruction with a @ or % prefix) will not be executed after the interlock is cleared even if the differentiation condition of the instruction was established while the instruction was interlocked.

- Operation of Differentiated Instructions in an MILH(517) Interlock

If there is a differentiated instruction (DIFU, DIFD, or instruction with a @ or % prefix) between MILH(517) and the corresponding MILC(519), that instruction will be executed after the interlock is cleared if the differentiation condition of the instruction was established.

In the same way, a differentiated instruction will be executed if its execution condition is established at the same time that the interlock is started or cleared.

Many other conditions in the program may cause the differentiation condition to be reset even if it was established during the interlock. In this case, the differentiation instruction will not be executed when the interlock is cleared.

Example

When a DIFFERENTIATE UP (DIFU(013)) instruction is being used and the input condition is OFF when the interlock starts and ON when the interlock is cleared, DIFU(013) will be executed when the interlock is cleared. (Differentiated instructions operate the same in the MILH(517) interlock as they would in an IL(002) interlock.)

OMRON CP1E - Example - 1

OMRON CP1E - Example - 2
Timing chart

- Operation of Differentiated Instructions in an MILR(518) Interlock

If there is a differentiated instruction (DIFU, DIFD, or instruction with a @ or % prefix) between MILR(518) and the corresponding MILC(519), that instruction will not be executed after the interlock is cleared even if the differentiation condition of the instruction was established.

In the same way, a differentiated instruction will not be executed if its execution condition is established at the same time that the interlock is started or cleared.

Example

When a DIFFERENTIATE UP (DIFU(013)) instruction is being used and the input condition is OFF when the interlock starts and ON when the interlock is cleared, DIFU(013) will not be executed when the interlock is cleared.

Timing chart
OMRON CP1E - Example - 1
1. When CIO 0.00 is OFF (interlock starts), the DIFU's CIO 0.01 input condition is OFF.
2. The DIFU's CIO 0.01 input condition goes from OFF to ON while CIO 0.00 is OFF (DIFU interlocked),
3. When CIO 0.00 goes from OFF to ON (interlock cleared), DIFU is not executed even though CIO 0.01 is still ON.

OMRON CP1E - Example - 2

OMRON CP1E - Example - 3

- Controlling Interlock Status from a Programming Device

An interlock can be engaged or released manually by force-resetting or force-setting the Interlock Status Bit (specified with operand D of MILH(517) and MILR(518)) from a Programming Device. The forced status of the Interlock Status Bit has priority and overrides the interlock status calculated by program execution.

OMRON CP1E - - Controlling Interlock Status from a Programming Device - 1
Force-set: Releases the interlock.

OMRON CP1E - - Controlling Interlock Status from a Programming Device - 2
Force-reset: Engages the interlock.

Hint

  • The cycle time is not shortened when a section of the program is interlocked by MILH(517) or MILR(518) because the interlocked instructions are executed internally.
  • When nesting interlocks, assign interlock numbers so that the nested program section does not exceed the outer program section.

OMRON CP1E - Hint - 1
The nested program section must not go beyond the outer program section.

  • Other instructions can be input between the MILC(519) instructions, as shown in the following diagram.

OMRON CP1E - Hint - 2

  • If there is an ILC(003) instruction between an MILH(517) and MILC(519) pair, the program section between MILH(517) and ILC(003) will be interlocked.

OMRON CP1E - Hint - 3

  • If there is an ILC(003) instruction between an MILR(518) and MILC(519) pair, the ILC(003) instruction will be ignored and the full program section between MILR(518) and MILC(519) will be interlocked.
  • If there is another MILH(517) or MILR(518) instruction with the same interlock number between an MILH(517) and MILC(519) pair and the first MILH(517) instruction's interlock is engaged, the second MILH(517)/MILR(518) will not operate.
  • If there is another MILH(517) or MILR(518) instruction with the same interlock number between an MILH(517) and MILC(519) pair and the first MILH(517) instruction's interlock is not engaged, the second MILH(517)/MILR(518) will operate normally.

OMRON CP1E - Hint - 4

Note The MILR(518) interlocks operate in the same way if there is another MILH(517) or MILR(518) instruction with the same interlock number between an MILR(518) and MILC(519) pair.

  • If there is an MILC(519) instruction with a different interlock number between an MILH(517)/MILR(518) and MILC(519) pair, that MILC(519) instruction will be ignored.
  • If there is an MILH(517) instruction between an IL(002) and ILC(003) pair and the IL(002) interlock is engaged, the MILH(517) instruction has no effect. In this case, the program section between IL(002) and ILC(003) will be interlocked. If the IL(002) interlock is not engaged and the MILH(517) instruction's execution condition (b in this case) is OFF, the program section between MILH(517) and ILC(003) will be interlocked.
  • If there is an MILC(519) instruction between an IL(002) and ILC(003) pair, that MILC(519) instruction will be ignored and the entire program section between IL(002) and ILC(003) will be interlocked.

OMRON CP1E - Hint - 5

OMRON CP1E - Hint - 6

  • Program operation can be switched more efficiently by using interlocks with MILH(517) or MILR(518). Instead of switching processing with compound conditions, insert an MILH(517) or MILR(518) instruction before each process and an MILC(519) instruction after each process.

OMRON CP1E - Hint - 7

  • Unlike the IL(002) interlocks, MILH(517) and MILR(518) interlocks can be nested, so the operation of similar programs will be different if MILH(517) or MILR(518) is used instead of ILC(002).
  • Program with MILH(517)/MILC(519) Interlocks

OMRON CP1E - Hint - 8

Execution conditionProgram section
abA1A2A3
OFFONInterlockedInterlockedNot interlocked
OFF
ONOFFNot interlockedInterlockedNot interlocked
ONONNot interlockedNot interlockedNot interlocked
  • Program with IL(002)/ILC(003) Interlocks

OMRON CP1E - Hint - 9

Execution conditionProgram section
abA1A2A3
OFFONInterlockedInterlockedNot interlocked (Not controlled by the IL(002)/ILC(003) interlock.)
OFF
ONOFFNot interlockedInterlocked
ONONNot interlockedNot interlocked
  • If there are bits which you want to remain ON in a program section interlocked by MILH(517) or MILR(518), set these bits to ON with SET just before the MILH(517) or MILR(518) instruction.

Sample program

When W0.00 and W0.01 are both ON, the instructions between MILH(517) with interlock number 0 and MILC(519) with interlock number 0 are executed normally.

When W0.00 is OFF, the instructions between MILH(517) with interlock number 0 and MILC(519) with interlock number 0 are interlocked.

When W0.00 is ON and W0.01 are OFF, the instructions between MILH(517) with interlock number 1 and MILC(519) with interlock number 1 are interlocked. The other instructions are executed normally.

OMRON CP1E - Sample program - 1

JMP/CJP/JME

InstructionMnemonicVariationsFunction codeFunction
JUMPJMP---004When 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.
CONDITIONAL JUMPCJP---510When 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.
JUMP ENDJME---005Indicates the end position of a jump by JMP or CJP instruction.
SymbolJMPJME
JMP(004)NN:Jump numberJME(005)NN: Jump number
CJP
CJP(510)NN: Jump number

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedOKOK

Operands

OperandDescriptionData typeSize
NJump numberUINT1

N: Jump Number

The jump number must be 0000 to 007F (&0 to &127 decimal).

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
JMP/CJPNOKOKOKOKOKOKOKOKOKOK---------
JMEN---------------------------

Flags

JMP/CJP

NameLabelOperation
Error FlagP_ERON if N is not within the specified range of 0000 to 007F.ON if there is a JMP(004) in the program without a JME(005) with the same jump number.OFF in all other cases.

JME

There are no flags affected by this instruction.

Function

JMP

When the execution condition for JMP(004) is ON, no jump is made and the program is executed consecutively as written.

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. The instructions between JMP(004) and JME(005) are not executed, so the status of outputs between JMP(004) and JME(005) is maintained. In block programs, the instructions between JMP(004) and JME(005) are skipped regardless of the status of the execution condition.

OMRON CP1E - JMP - 1

CJP

When the execution condition for CJP(510) is OFF, no jump is made and the program is executed consecutively as written.

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.

OMRON CP1E - CJP - 1

Hint

  • Because all of instructions between JMP(004)/CJP(510) and JME(005) are skipped when the execution condition for JMP(004) is OFF, the cycle time is reduced by the total execution time of the skipped instructions. In contrast, processing time equivalent to NOP(000) processing is required for instructions between JMP0(515) and JME0(516), so the cycle time is not reduced as much with those jump instructions.
  • The following table compares the various jump instructions.
ItemJMP(004)JME(005)CJP(510)JME(005)
Execution condition for jumpOFFON
Number allowed128
Instruction processing when jumpedNot executed.
Instruction execution time when jumpedNone
Status of outputs (bits and words) when jumpedBits and words maintain their previous status.
Status of operating timers when jumpedOperating timers continue timing.
Processing in block programsAlways jump.Jump when ON.

Precautions

  • All of the outputs (bits and words) in jumped instructions retain their previous status. Operating timers (TIM, TIMX(550), TIMH(015), TIMHX(551), TMHH(540) and TMHHX(552)) continue timing because the PVs are updated even when the timer instruction is not being executed.

  • When there are two or more JME(005) instructions with the same jump number, only the instruction with the lower address will be valid. The JME(005) with the higher program address will be ignored.

  • CJP(510) jumps to the first JME(005) when the execution condition is ON and JMP(004) jumps to the first JME(005) when the execution condition is OFF.
  • When JME(005) precedes JMP(004)/CJP(510) in the program, the instructions between JME(005) and JMP(004)/CJP(510) will be executed repeatedly as long as the execution condition for JMP(004)/CJP(510) is OFF. A Cycle Time Too Long error will occur if the execution condition is not turned ON or END(001) is not executed within the maximum cycle time.
  • The operation of DIFU(013), DIFD(014), and differentiated instructions is not dependent solely on the status of the execution condition when they are programmed between JMP(004)/CJP(510) and JME(005). When DIFU(013), DIFD(014), or a differentiated instruction is executed in an jumped section immediately after the execution condition for the JMP(004)/CJP(510) has gone ON, the execution condition for the DIFU(013), DIFD(014), or differentiated instruction will be compared to the execution condition that existed before the jump became effective (i.e., before the execution condition for JMP(004) went OFF).

OMRON CP1E - Precautions - 1
Program section A is executed repeatedly as long as execution condition a is OFF.

Sample program

When CIO 0.00 is OFF in the right example, the instructions between JMP(004) and JME(005) are not executed and the outputs maintain their previous status.

When CIO 0.00 is ON in the right example, the instructions between JMP(004) and JME(005) are executed normally.

OMRON CP1E - Sample program - 1

FOR/NEXT

InstructionMnemonicVariationsFunction codeFunction
---FOR---512The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.
NEXT---513
SymbolFORNEXT
FOR(512)NN: Number of loops—NEXT(513)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
Usage---OKOK

Operands

OperandDescriptionData typeSize
NNumber of loopsUINT1

N: Number of loops

The number of loops must be 0000 to FFFF (0 to 65,535 decimal).

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
NOKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
Error FlagP_ERON if more than 15 loops are nested. OFF in all other cases.
Equals FlagP_EQOFF
Negative FlagP_NOFF

Function

The instructions between FOR(512) and NEXT(513) are executed N times and then program execution continues with the instruction after NEXT(513). The BREAK(514) instruction can be used to cancel the loop.

If N is set to 0, the instructions between FOR(512) and NEXT(513) are processed as NOP(000) instructions.

Loops can be used to process tables of data with a minimum amount of programming.

OMRON CP1E - Function - 1

Hint

There are two ways to repeat a program section until a given execution condition is input.

FOR-NEXT Loop with BREAK
Start a FOR-NEXT loop with a maximum of N repetitions. Program BREAK(514) within the loop with the desired execution condition. The loop will end before N repetitions if the execution condition is input.
JME(005)-JMP(004) Loop

Program a loop with JME(005) before JMP(004). The instructions between JME(005) and JMP(004) will be executed repeatedly as long as the execution condition for JMP(004) is OFF. (A Cycle Time Too Long error will occur if the execution condition is not turned ON or END(001) is not executed within the maximum cycle time.)

Precautions

  • Program FOR(512) and NEXT(513) in the same task. Execution will not be repeated if these instructions are not in the same task.
  • If a loop repeats in one cycle and a differentiated instruction is used in the FOR-NEXT loop, that instruction will be executed only once. It is not executed the number of loops.

UP(521),DOWN(522)
- DIFU(013),DIFD(014)
- Differentiated up instruction(Differentiation variation:@)
Differentiated down instruction(Differentiation variation:%)

FOR-NEXT loops can be nested up to 15 levels.

OMRON CP1E - Precautions - 1

In the example above, program sections A, B, and C are executed as follows:

  • Use BREAK(514) to escape from a FOR-NEXT loop. Several BREAK(514) instructions (the number of levels nested) are required to escape from nested loops.
  • The remaining instructions in the loop after BREAK(514) are processed as NOP(000) instructions.

OMRON CP1E - Precautions - 2

  • A jump instruction such as JMP(004) may be executed within a FOR-NEXT loop, but do not jump beyond the FOR-NEXT loop.
  • The following instructions cannot be used within FOR-NEXT loops:

  • STEP DEFINE and STEP START: STEP(008)/SNXT(009)

Sample program

OMRON CP1E - Sample program - 1

In the left example, the looped program section transfers the content of D100 to the address indicated in D200 and then increments the content of D200 by 1.

OMRON CP1E - Sample program - 2

BREAK

InstructionMnemonicVariationsFunction codeFunction
BREAK LOOPBREAK---514Programmed 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.
SymbolBREAK
—| BREAK(514) —|

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
Usage---OKOK

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQOFF
Negative FlagP_NOFF

Function

Program BREAK(514) between FOR(512) and NEXT(513) to cancel the FOR-NEXT loop when BREAK(514) is executed. When BREAK(514) is executed, the rest of the instructions up to NEXT(513) are processed as NOP(000).

OMRON CP1E - Function - 1

Precautions

  • A BREAK(514) instruction cancels only one loop, so several BREAK(514) instructions (the number of levels nested) are required to escape from nested loops.
    BREAK(514) can be used only in a FOR-NEXT loop.

Timer and Counter Instructions

Refresh Methods for Timer/Counter PV

- Overview

There are two PV refresh methods for instructions related to timer/counters, "BCD" and "BINARY".

MethodDescriptionSetting rangeSet value
BCDSets the timer set value in BCD.0~9.999#0000~9999
BinarySets the timer set value in BINARY.0~65.535&0~65535 or #0000~FFFF

The PLC Setup for all of the timer/counter-related instructions. The refresh method is valid also when setting an SV indirectly (i.e., using the contents of memory word). (That is, the contents of the addressed word is taken as either BCD or binary data according to the refresh method that is set.)

- Applicable Instructions

ClassificationInstructionMnemonic
BCDBinary
Timer/counter instructionsHUNDRED-MS TIMERTIMTIMX(550)
TEN-MS TIMERTIMH(015)TIMHX(551)
ONE-MS TIMERTMHH(540)TMHHX(552)
ACCUMULATIVE TIMERTTIM(087)TTIMX(555)
LONG TIMERTIML(542)TIMLX(553)
COUNTERCNTCNTX(546)
REVERSIBLE COUNTERCNTR(012)CNTRX(548)
RESET TIMER/COUNTERCNR(545)CNRX(547)

- Setting method for PV refresh

BCD and binary PV refreshing can both be used in the same project. The setting of the PV refresh method in the PLC Setup will be ignored.

Basic Timer Specifications

ItemTIM/TIMX(550)TIMH(015)/TIMHX(551)TMHH(540)/TMHHX(552)TTIM(087)/TTIMX(555)TIML(542)/TIMLX(553)
Timing methodDecrementingDecrementingDecrementingIncrementingDecrementing
Timing units100 ms10 ms1 ms100 ms100 ms
Maximum SVTIM: 999.9 sTIMX: 6,553.5 sTIMH: 99.99 sTIMHX: 655.35 sTMHH: 9.999 sTMHHX: 65.535 sTTIM: 999.9 sTTIMX: 6,553.5 sTIML:115 daysTIMLX: 49,710 days
Outputs/instruction11111
Timer numbersUsedUsedUsedUsedNot used
Completion Flag refreshingWhen the instruction is executedWhen the instruction is executedWhen the instruction is executedWhen the instruction is executedWhen the instruction is executed
Timer PV refreshing(See note)When the instruction is executedWhen the instruction is executedWhen the instruction is executedWhen the instruction is executedWhen the instruction is executed
Value afterresetCompletion FlagsOFFOFFOFFOFFOFF
PVsSVSVSV0SV
  • Operating Mode
ItemTIM/TIMX(550)TIMH(015)/TIMHX(551)TMHH(540)/TMHHX(552)TTIM(087)/TTIMX(555)TIML(542)/TIMLX(553)
Operating mode changePV = 0Completion Flag = OFF---
Power interrupt/resetPV = 0Completion Flag = OFF---
Execution of CNR(545)/CNRX(547)Binary: PV = FFFF, Completion Flag = OFFBCD: PV = FFFF or 9999, Completion Flag = OFFNot applicable
Operation in jumped program section (JMP(004)-JME(005))Operating timers continue timing.Timer status is maintained.
Operation in interlocked program section (IL(002)-ILC(003))PV = SVCompletion Flag = OFFTimer status main-tained.PV = SVCompletion Flag = OFF
Forced setCompletion FlagON---
PVsSet to 0.---
Forced resetCompletion FlagsOFF---
PVsReset to SV.Set to 0.---

- Example Timer and Counter Applications

Example 1: Long-term Timers

The following program examples show three ways to create long-term timers with standard TIM and CNT instructions.

1) Two TIM Instructions

In this example, two TIM instructions are combined to make a 30-minute timer.

OMRON CP1E - 1) Two TIM Instructions - 1

InstructionOperands
LD0.00
TM1
#9000
LDT0001
TM2
#9000
LDT000
OUT100.00

2) TIM and CNT Instructions

In this example, a TIM instruction and a CNT instruction are combined to make a 500-second timer. TIM 0001 generates a pulse every 5 s and CNT 0002 counts these pulses. The set value for this combination is the timer interval × counter SV. In this case, the timer SV would be 5s× 100 = 500s . With this combination, the long-term timer's PV is actually the PV of a counter, which is maintained through power interruptions.

OMRON CP1E - 2) TIM and CNT Instructions - 1

InstructionOperands
LD100.00
LD0.01
CNT2
#0100
LD0.00
AND NOT100.00
AND NOTC0002
TIM1
#0050
LDT0001
OUT100.00
LDC0002
OUT100.01

3) Clock Pulse and CNT Instruction

In this example, a CNT instruction counts the pulses from the 1-s clock pulse to make a 700-second timer.

If the First Cycle Flag (A200.11) is ORed with the counter's reset input (CIO 0.01), the counter's PV will be reset to the SV (0700) when program execution begins rather than resuming the count from the previous PV.

OMRON CP1E - 3) Clock Pulse and CNT Instruction - 1

InstructionOperands
LD0.00
AND1s
LD NOT0.01
CNT1
#0700
C0001
100.02

Example 2: Two-stage Counter

When an SV higher than 9999 is required, two counters can be combined as shown in the following example. In this case, two CNT instructions are combined to make a BCD counter with an SV of 20,000.

OMRON CP1E - Example 2: Two-stage Counter - 1

InstructionOperands
LD0.00
AND0.01
LD NOT0.02
ORC0001
ORC0002
CNT1
#0100
LDC0001
LD NOT0.02
CNT2
#0200
LDC0002
OUT100.03

Example 3: ON/OFF Delay

In this example two TIM timers are combined with KEEP(011) to make an ON delay and an OFF delay. CIO 5.00 will be turned ON 5.0 seconds after CIO 0.00 goes ON and it will be turned OFF 3.0 seconds after CIO 0.00 goes OFF.

OMRON CP1E - Example 3: ON/OFF Delay - 1

InstructionOperands
LD0.00
TIM1
#0050
LD5.00
LD NOT0.00
TIM2
#0030
LDT0001
LDT0002
KEEP(011)100.05

OMRON CP1E - Example 3: ON/OFF Delay - 2

Example 4: One-shot Bit

A TIM timer can be combined with OUT or OUT NOT to control how long a particular bit is ON or OFF. In this example, CIO 2.04 will be ON for 1.5 seconds (the SV of T0001) after CIO 0.00 goes ON.

OMRON CP1E - Example 4: One-shot Bit - 1

InstructionOperands
LD0.00
LD10.00
AND NOT100.00
OR LD--
OUT10.00
LD10.00
TIM1
#0015
LDT0001
OUT100.00
LD10.00
AND NOT100.00
OUT100.04

OMRON CP1E - Example 4: One-shot Bit - 2

Example 5: Flicker Bit 1) Two TIM Instructions

Two TIM timers can be combined to make a bit turn ON and OFF at regular intervals while the execution condition is ON. In this example, CIO 2.05 will be OFF for 1.0 second and then ON for 1.5 seconds as long as CIO 0.00 is ON.

OMRON CP1E - Example 5: Flicker Bit 1) Two TIM Instructions - 1

InstructionOperands
LD0.00
AND LDT0002
TIM1
#0010
LD2.05
TIM2
#0015
LDT0001
OUT100.05

2) Clock Pulse

The desired execution condition can be combined with a clock pulse to mimic the clock pulse (0.1 s, 0.2 s, or 1.0 s).

OMRON CP1E - 2) Clock Pulse - 1

InstructionOperands
LD0.00
AND1s
OUT100.06
  • The internal clock pulse (0.1 s, 0.2 s, 1 s) can be used to easily program a flicker circuit.

- Timer reset method

There are two methods for resetting a timer instruction.

1. Turn OFF the execution condition for the timer instruction.

The timer will be reset when its execution condition turns OFF.

The timer will start timing again when its execution condition turns ON.

With this method, a timer cannot be reset and then restarted within the same cycle.

OMRON CP1E - Turn OFF the execution condition for the timer instruction. - 1

OMRON CP1E - Turn OFF the execution condition for the timer instruction. - 2

2. Use the RESET TIMER/COUNTER instruction.

The specified instruction will be reset when the RESET TIMER/COUNTER instruction (CNR/CNRX) is executed.

TIM/TIMX

InstructionMnemonicVariationsFunction codeFunction
HUNDRED-MS TIMERTIM/TIMX---550TIM or TIMX(550) operates a decrementing timer with units of 0.1-s.
SymbolTIMTIMX
BCDTIMBinaryTIMX(550)
NN:Timer numberN:Timer number
SS:Set valueS:Set value

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
TIMTIMX
NTimer NumberTIMERTIMER1
SSet ValueWORDUINT1

N: Timer Number

The timer number must be between 0000 and 0255 (decimal).

S: Set Value (100-ms Units)

TIM (BCD): #0000 to #9999.

TIMX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex).

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N------------OK------------------------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

  • When the timer input is OFF, the timer specified by N is reset, i.e., the timer's PV is reset to the SV and its Completion Flag is turned OFF.
  • When the timer input goes from OFF to ON, TIM/TIMX(550) starts decrementing the PV. The PV will continue timing down as long as the timer input remains ON and the timer's Completion Flag will be turned ON when the PV reaches 0.
  • The status of the timer's PV and Completion Flag will be maintained after the timer times out. To restart the timer, the timer input must be turned OFF and then ON again or the timer's PV must be changed to a non-zero value (by MOV(021), for example).
  • The setting range for the set value (SV) is 0 to 999.9 s for TIM and 0 to 6,553.5 s for TIMX(550).
  • The timer accuracy is -0.01 to 0 s.

OMRON CP1E - Function - 1

The following timing chart shows the behavior of the timer's PV and Completion Flag when the timer input is turned OFF before the timer times out.

OMRON CP1E - Function - 2

Hint

  • A TIM/TIMX(550) instruction's PV and Completion Flag can be refreshed in the following ways depending on the timer number that is used.
Refresh timingDescription
Execution of TIM/TIMX(550)·The PV is updated every time that TIM/TIMX(550) is executed. ·The Completion Flag is turned ON if the PV is 0. The Completion Flag is turned OFF if the PV is not 0.
  • Timers are reset (PV = SV, Completion Flag OFF) by power interruptions unless the IOM Hold Bit (A500.12) is ON and the bit is protected in the PLC Setup. It is also possible use a clock pulse bit and a counter instruction to program a timer that will retain its PV in the event of a power interruption, as shown in the following diagram.
  • When the timer set value is #0000, timeup occurs when the instruction is executed.

OMRON CP1E - Hint - 1

Precautions

  • Timer numbers are shared with other timer instructions. If two timers share the same timer number, but are not used simultaneously, a duplication error will be generated when the program is checked, but the timers will operate normally. Timers which share the same timer number will not operate properly if they are used simultaneously.
  • Timers will not operate properly when the CPU Unit cycle time exceeds 4s. Use timer instructions when the cycle time is no longer than 4s.
  • Timers will be reset or paused in the following cases. (When a timer is reset, its PV is reset to the SV and its Completion Flag is turned OFF.)
ConditionPVCompletion Flag
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*10OFF
Power off and reset0OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions*2BCD: 9999 Binary: FFFFOFF
Operation in interlocked program section (IL(002)–ILC(003))Reset to SV.OFF
Operation in jumped program section (JMP(004)–JME(005))Retains previous status.Retains previous status.

1 If the IOM Hold Bit (A500.12) has been turned ON, the status of timer Completion Flags and PVs will be maintained when the operating mode is changed.
2 The PV will be set to the SV when TIM/TIMX(550) is executed.

  • When TIM/TIMX(550) is in a program section between IL(002) and ILC(003) and the program section is interlocked, the PV will be reset to the SV and the Completion Flag will be turned OFF.
  • When an operating TIM/TIMX(550) timer is in a jumped program section (JMP(004), CJP(510), JME(005)), the timer's PV will not be refreshed.
  • When a TIM/TIMX(550) timer is forced set, its Completion Flag will be turned ON and its PV will be set to 0000. When a TIM/TIMX(550) timer is forced reset, its Completion Flag will be turned OFF and its PV will be reset to the SV.
  • The timer's Completion Flag is refreshed only when TIM/TIMX(550) is executed, so a delay of up to one cycle may be required for the Completion Flag to be turned ON after the timer times out.
  • If online editing is used to overwrite a timer instruction, always reset the Completion Flag. The timer will not operate properly unless the Completion Flag is reset.

Sample program

When timer input CIO 0.00 goes from OFF to ON in the following example, the timer PV will begin counting down from the SV. Timer Completion Flag T0000 will be turned ON when the PV reaches 0.

When CIO 0.00 goes OFF, the timer PV will be reset to the SV and the Completion Flag will be turned OFF.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

TIMH/TIMHX

InstructionMnemonicVariationsFunction codeFunction
TEN-MS TIMERTIMH---015TIMH(015)/TIMHX(551) operates a decrementing timer with units of 10-ms.
TIMHX---551
SymbolTIMHTIMHX
BCDTIMH(015)BinaryTIMHX(551)
NNN: Timer number
SSS: Set value

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
TIMHTIMHX
NTimer NumberTIMERTIMER1
SSet ValueWORDUINT1

N: Timer Number

The timer number must be between 0000 and 0255 (decimal).

S: Set Value

TIMH (BCD): #0000 to #9999

TIMHX (Binary): &0 to &65535 (decimal) or #0000 to FFFF (hex)

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N------------OK------------------------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

  • When the timer input is OFF, the timer specified by N is reset, i.e., the timer's PV is reset to the SV and its Completion Flag is turned OFF.
  • When the timer input goes from OFF to ON, TIMH(015)/TIMHX(551) starts decrementing the PV. The PV will continue timing down as long as the timer input remains ON and the timer's Completion Flag will be turned ON when the PV reaches 0000.
  • The status of the timer's PV and Completion Flag will be maintained after the timer times out. To restart the timer, the timer input must be turned OFF and then ON again or the timer's PV must be changed to a non-zero value (by MOV(021), for example).
  • The setting range for the set value (SV) is 0 to 99.99 s for TIMH(015) and 0 to 655.35 s for TIMHX(551).
  • The timer accuracy is 0 to 0.01 s.

Timer input

Timer PV

Completion Flag

OMRON CP1E - Function - 1

The following timing chart shows the behavior of the timer's PV and Completion Flag when the timer input is turned OFF before the timer times out.

Timer input

Timer PV

OMRON CP1E - Function - 2

Completion

Flag

ON

OFF

Hint

A TIMH(015)/TIMHX(551) instruction's PV and Completion Flag can be refreshed in the following ways depending on the timer number that is used.

Refresh timingDescription
Execution of TIMH(015)/TIMHX(551)·The PV is updated every time that TIMH(015)/TIMHX(551) is executed. ·The Completion Flag is turned ON if the PV is 0. The Completion Flag is turned OFF if the PV is not 0.

Precautions

  • Timer numbers are shared with other timer instructions. If two timers share the same timer number, but are not used simultaneously, a duplication error will be generated when the program is checked, but the timers will operate normally. Timers which share the same timer number will not operate properly if they are used simultaneously.
  • Timers will not operate properly when the CPU Unit cycle time exceeds 4s. Use timer instructions when the cycle time is no longer than 4s.
  • Timers will be reset or paused in the following cases. (When a timer is reset, its PV is reset to the SV and its Completion Flag is turned OFF.)
ConditionPVCompletion Flag
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*10OFF
Power off and reset0OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions*2BCD: 9999 Binary: FFFFOFF
Operation in interlocked program section (IL(002)-ILC(003))Reset to SV.OFF
Operation in jumped program section (JMP(004)-JME(005))Retains previous status.Retains previous status.

1 If the IOM Hold Bit (A500.12) has been turned ON, the status of timer Completion Flags and PVs will be maintained when the operating mode is changed.
2 The PV will be set to the SV when TIMH(015)/TIMHX(551) is executed.

  • When an operating TIMH(015)/TIMHX(551) timer is in a jumped program section (JMP(004), CJP(510), JME(005)), the timer's PV will not be refreshed in the above case.
  • When TIMH(015)/TIMHX(551) is in a program section between IL(002) and ILC(003) and the program section is interlocked, the PV will be reset to the SV and the Completion Flag will be turned OFF.
  • When a TIMH(015)/TIMHX(551) timer is forced set, its Completion Flag will be turned ON and its PV will be set to 0000. When a TIMH(015)/TIMHX(551) timer is forced reset, its Completion Flag will be turned OFF and its PV will be reset to the SV.
  • The timer's Completion Flag is refreshed only when TIMH(015)/TIMHX(551) is executed, so a delay of up to one cycle may be required for the Completion Flag to be turned ON after the timer times out.
  • If online editing is used to overwrite a timer instruction, always reset the Completion Flag. The timer will not operate properly unless the Completion Flag is reset.

Sample program

When timer input CIO 0.00 goes from OFF to ON in the following example, the timer PV will begin counting down from the SV (#0064 = 100 = 1.00 s). The Timer Completion Flag, T0000, will be turned ON when the PV reaches 0.

When CIO 0.00 goes OFF, the timer PV will be reset to the SV and the Completion Flag will be turned OFF.

OMRON CP1E - Sample program - 1
Timer input 0.00
Timer PV T0000 100 (1.00 s)
Timer Completion Flag T0000

OMRON CP1E - Sample program - 2

TMHH/TMHHX

InstructionMnemonicVariationsFunction codeFunction
ONE-MS TIMERTMHH---540TMHH(540)/TMHHX(552) operates a decrement-ing timer with units of 1-ms.
TMHHX---552
SymbolTMHHTMHHX
BCDTMHH(540)BinaryTMHHX(552)
NN: Timer numberN: Timer number
SS: Set valueS: Set value

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
TMHHTMHHX
NTimer NumberTIMERTIMER1
SSet ValueWORDUINT1

N: Timer Number

The timer must be between 0000 and 0015 decimal.

S: Set Value

TMHH (BCD): #0000 to #9999

TMHHX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex)

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N------------OK------------------------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

  • When the timer input is OFF, the timer specified by N is reset, i.e., the timer's PV is reset to the SV and its Completion Flag is turned OFF.
  • When the timer input goes from OFF to ON, TMHH(540)/TMHHX(552) starts decrementing the PV. The PV will continue timing down as long as the timer input remains ON and the timer's Completion Flag will be turned ON when the PV reaches 0000.
  • The status of the timer's PV and Completion Flag will be maintained after the timer times out. To restart the timer, the timer input must be turned OFF and then ON again or the timer's PV must be changed to a non-zero value (by MOV(021), for example).

  • The setting range for the set value (SV) is 0 to 9.999 s for TMHH(540) and 0 to 65.535 for TMHHX(552).

  • The timer accuracy is -0.01 to 0 s.

Hint

The timer PV and timeup used in TMHH/TMHHX instructions are refreshed at the timing below.

Refresh timingDescription
When each instruction is executed·The PV is updated every time that each instruction is executed. ·The timeup flag is ON when the PV is 0 and OFF otherwise.

Precautions

  • Timer numbers are shared with other timer instructions. If two timers share the same timer number, but are not used simultaneously, a duplication error will be generated when the program is checked, but the timers will operate normally. Timers which share the same timer number will not operate properly if they are used simultaneously.
  • The Completion Flag is updated only when TMHH(540)/TMHHX(552) is executed. The Completion Flag can thus be delayed by up to one cycle time from the actual set value.
  • The present value of a timer will not be refreshed even if the task is on standby.
  • Timers will be reset or paused in the following cases. (When a timer is reset, its PV is reset to the SV and its Completion Flag is turned OFF.)
ConditionPVCompletion Flag
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*10OFF
Power supply interrupted and reset0OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions*2BCD: 9999 Binary: FFFFOFF
Operation in interlocked program section (IL(002)-ILC(003))Reset to SV.OFF
Operation in jumped program section (JMP(004)-JME(005))Retains previous status.Retains previous status.

1 If the IOM Hold Bit (A500.12) has been turned ON, the status of timer Completion Flags and PVs will be maintained when the operating mode is changed.
2 The PV will be set to the SV when TMHH(540)/TMHHX(552) is executed.

  • The present value of all operating timers will not be refreshed even if the timer is in a program section that is jumped using JMP(004), CJP(510), JME(005).
  • When TMHH(540)/TMHHX(552) is in a program section between IL(002) and ILC(003) and the program section is interlocked, the PV will be reset to the SV and the Completion Flag will be turned OFF.
  • When a TMHH(540)/TMHHX(552) timer is forced set, its Completion Flag will be turned ON and its PV will be set to 0. When a TMHH(540)/TMHHX(552) timer is forced reset, its Completion Flag will be turned OFF and its PV will be reset to the SV.
  • If online editing is used to overwrite a timer instruction, always reset the Completion Flag. The timer will not operate properly unless the Completion Flag is reset.

TTIM/TTIMX

InstructionMnemonicVariationsFunction codeFunction
ACCUMULATIVE TIMERTTIM---087TTIM(087)/TTIMX(555) operates an incrementing timer with units of 0.1-s.
TTIMX---555
SymbolTTIMTTIMX
BCDTimer inputTTIM(087)BinaryTimer inputTTIMX(555)
NN: Timer numberReset inputN: Timer number
Reset inputSS: Set valueSS: Set value

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
TTIMTTIMX
NTimer NumberTIMERTIMER1
SSet ValueWORDUINT1

N: Timer Number

The timer number must be between 0000 to 0255 (decimal).

S: Set Value

TTIM (BCD): #0000 to #9999

TTIMX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex)

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N------------OK------------------------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

  • When the timer input is ON, TTIM(087)/TTIMX(555) increments the PV. When the timer input goes OFF, the timer will stop incrementing the PV, but the PV will retain its value. The PV will resume timing when the timer input goes ON again. The timer's Completion Flag will be turned ON when the PV reaches the SV.
  • The status of the timer's PV and Completion Flag will be maintained after the timer times out. There are three ways to restart the timer: the timer's PV can be changed to a non-zero value (by MOV(021), for example), the reset input can be turned ON, or CNR(545)/CNRX(547) can be executed.
  • The setting range for the set value (SV) is 0 to 999.9 s for TTIM(087) and 0 to 6,553.5 s for TTIMX(555).
  • The timer accuracy is 0 to 0.01 s.

Timer input

Timer PV

Completion

Flag

Reset input

OMRON CP1E - Function - 1

Hint

  • Typical timers such as TIM/TIMX(550) are decrementing counters and the PV shows the time remaining until the timer times out. The PV of TTIM(087)/TTIMX(555) shows how much time has elapsed, so the PV can be used unchanged in many calculations and display outputs.

Precautions

  • Timer numbers are shared with other timer instructions. If two timers share the same timer number, but are not used simultaneously, a duplication error will be generated when the program is checked, but the timers will operate normally. Timers which share the same timer number will not operate properly if they are used simultaneously.
  • Timers will be reset or paused in the following cases. (When a TTIM(087)/TTIMX(555) timer is reset, its PV is reset to 0 and its Completion Flag is turned OFF.)
ConditionPVCompletion Flag
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*10OFF
Power supply interrupted and reset0OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions*2BCD: 9999 Binary: FFFFOFF
Operation in interlocked program section (IL(002)-ILC(003))Retains previous status.Retains previous status.
Operation in jumped program section (JMP(004)-JME(005))Retains previous status.Retains previous status.

1 If the IOM Hold Bit (A500.12) has been turned ON, the status of timer Completion Flags and PVs will be maintained when the operating mode is changed.
2 The PV will be set to the SV when TTIM(087)/TTIMX(555) is executed.
- When TTIM(087)/TTIMX(555) is in a program section between IL(002) and ILC(003) and the program section is interlocked, the PV will retain its previous value (it will not be reset). Be sure to take this fact into account when TTIM(087)/TTIMX(555) is programmed between IL(002) and ILC(003).
- When an operating TTIM(087)/TTIMX(555) timer is in a program section between JMP(004) and JME(005) and the program section is jumped, the PV will retain its previous value. Be sure to take this fact into account when TTIM(087)/TTIMX(555) is programmed between JMP(004) and JME(005).

  • When a TTIM(087)/TTIMX(555) timer is forced set, its Completion Flag will be turned ON and its PV will be reset to 0. When a TTIM(087)/TTIMX(555) timer is forced reset, its Completion Flag will be turned OFF and its PV will be reset to 0. The forced set and forced reset operations take priority over the status of the timer and reset inputs.
  • The timer's PV is refreshed only when TTIM(087)/TTIMX(555) is executed, so the timer will not operate properly when the cycle time exceeds 100 ms because the timer increments in 100-ms units.
  • The timer's Completion Flag is refreshed only when TTIM(087)/TTIMX(555) is executed, so a delay of up to one cycle may be required for the Completion Flag to be turned ON after the timer times out.

Sample program

When timer input CIO 0.00 is ON in the following example, the timer PV will begin counting up from 0. Timer Completion Flag T0001 will be turned ON when the PV reaches the SV.

If the reset input is turned ON, the timer PV will be reset to 0 and the Completion Flag (T0001) will be turned OFF. (Usually the reset input is turned ON to reset the timer and then the timer input is turned ON to start timing.)

If the timer input is turned OFF before the SV is reached, the timer will stop timing but the PV will be maintained. The timer will resume from its previous PV when the timer input is turned ON again.

OMRON CP1E - Sample program - 1

TIML/TIMLX

InstructionMnemonicVariationsFunction codeFunction
LONG TIMERTIML---542TIML(542)/TIMLX(553) operates a decrementing timer with units of 0.1s.
TIMLX---553
SymbolTIMLTIMLX
BCDTIML(542)BinaryTIMLX(553)
D1D1D1: Completion Flag
D2D2D2: PV word
SSS: SV word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
TIMLTIMLX
D1Completion FlagWORDUINT1
D2PV wordDWORDUDINT2
SSV wordDWORDUDINT2

D1: Completion Flag

OMRON CP1E - D1: Completion Flag - 1

The PV and SV can range from #0000000 to #99999999 for TIML(542) and &0000000 to &4294967294 (decimal) or #0000000 to #FFFFFF (hexadecimal) for TIMLX(553).

Note S, S+1, D2 and D2+1 must be in the same data area.

D2: PV Word

D2

D2+1

OMRON CP1E - D2: PV Word - 1

D2

OMRON CP1E - D2: PV Word - 2

D2+1 is the leftmost 4 digits,

D2 is the rightmost 4 digits

S:SV Word

S

S+1

OMRON CP1E - S:SV Word - 1

S

OMRON CP1E - S:SV Word - 2

S + 1 is the leftmost 4 digits,

S is the rightmost 4 digits

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
D1,D2OKOKOKOK------OKOKOK------------
SOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and D2 does not contain BCD data.ON if in BCD mode and S does not contain BCD data.OFF in all other cases.

Function

  • When the timer input is OFF, the timer is reset, i.e., the timer's PV is reset to the SV and its Completion Flag is turned OFF.

  • When the timer input goes from OFF to ON, TIML(542)/TIMLX(553) starts decrementing the PV in D2+1 and D2. The PV will continue timing down as long as the timer input remains ON and the timer's Completion Flag will be turned ON when the PV reaches 0.

  • The status of the timer's PV and Completion Flag will be maintained after the timer times out. To restart the timer, the timer input must be turned OFF and then ON again or the timer's PV must be changed to a non-zero value (by MOV(021), for example).

OMRON CP1E - Function - 1
Timer input
Timer PV
Completion Flag (Bit 00 of D1)

  • TIML(542)/TIMLX(553) can time up to 115 days for TIML(542) and 4,971 days for TIMLX(553).
  • The timer accuracy is 0 to 0.01 s.

Precautions

  • Unlike most timers, TIML(542)/TIMLX(553) does not use a timer number. (Timer area PV refreshing is not performed for TIML(542)/TIMLX(553).)
  • Since the Completion Flag for TIML(542)/TIMLX(553) is in a data area it can be forced set or forced reset like other bits, but the PV will not change.
  • The timer's PV is refreshed only when TIML(542)/TIMLX(553) is executed, so the timer will not operate properly when the cycle time exceeds 100 ms because the timer increments in 100-ms units.
  • The timer's Completion Flag is refreshed only when TIML(542)/TIMLX(553) is executed, so a delay of up to one cycle may be required for the Completion Flag to be turned ON after the timer times out.
  • When TIML(542)/TIMLX(553) is in a program section between IL(002) and ILC(003) and the program section is interlocked, the PV will be reset to the SV and the Completion Flag will be turned OFF.
  • When an operating TIML(542)/TIMLX(553) timer is in a program section between JMP(004) and JME(005) and the program section is jumped, the PV will retain its previous value. Be sure to take this fact into account when TIML(542)/TIMLX(553) is programmed between JMP(004) and JME(005).
  • Be sure that the words specified for the Completion Flag and PV (D1, D2, and D2+1) are not used in other instructions. If these words are affected by other instructions, the timer might not time out properly.

Sample program

When timer input CIO 0.00 is ON in the following example, the timer PV (in D201 and D200) will be set to the SV (in D101 and D100) and the PV will begin counting down. The timer Completion Flag (CIO 200.00) will be turned ON when the PV reaches 0.

When CIO 0.00 goes OFF, the timer PV will be reset to the SV and the Completion Flag will be turned OFF.

OMRON CP1E - Sample program - 1

CNT/CNTX

InstructionMnemonicVariationsFunction codeFunction
COUNTERCNT/CNTX---546CNT/CNTX(546) operates a decrementing counter.
SymbolCNTCNTX
BCD Count inputBinary Count input
Reset inputCNTN: Counter number S: Set valueReset inputCNTX(546)N: Counter number S: Set value
NN
SS

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CNTCNTX
NCounter NumberCOUNTERCOUNTER1
SSet ValueWORDUINT1

N: Counter Number

The counter number must be between 0000 and 0255 (decimal).

S: Set Value

CNT (BCD): #0000 to #9999

CNTX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex)

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------OK---------------------
SOKOKOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

  • The counter PV is decremented by 1 every time that the count input goes from OFF to ON. The Completion Flag is turned ON when the PV reaches 0.
  • Once the Completion Flag is turned ON, reset the counter by turning the reset input ON or by using the CNR(545)/CNRX(547) instruction. Otherwise, the counter cannot be restarted.
  • The counter is reset and the count input is ignored when the reset input is ON. (When a counter is reset, its PV is reset to the SV and the Completion Flag is turned OFF.)
  • The setting range 0 to 9,999 for CNT and 0 to 65,535 for CNTX(546).

OMRON CP1E - Function - 1

Hint

  • Counter PVs are retained even through a power interruption. If you want to restart counting from the SV instead of resuming the count from the retained PV, add the First Cycle Flag (A200.11) as a reset input to the counter.

OMRON CP1E - Hint - 1

Note 1 In case CP1E CPU Unit is backed up in the capacitor and power remained OFF for a period in excess of the following, the Counters PVs and Countup Flags are unfixed.

E-type CPU Unit

9 hours (60^) , 50 hours (25^)

N/NA-type CPU Unit

7 hours (60^) 40 hours (25^)

2 By setting "Zero Clear Holding Memory" for the PLC Setup, the Counters PVs and Countup Flags will be cleared each time power turns ON. In this case, the DM area (D) and Holding Area (H) will be cleared at the same time.
3 N/NA-type CP1E CPU Unit (CP1E-N/NA□□D□-□) can be equipped with a battery. With the battery installed, the Counters PVs and Countup Flags can be retained during power OFF.

Precautions

  • Counter numbers are shared by the CNT, CNTX(546), CNTR(012) and CNTRX(548) instructions. If two counters share the same counter number but are not used simultaneously, a duplication error will be generated when the program is checked but the counters will operate normally. Counters which share the same counter number will not operate properly if they are used simultaneously.
  • A counter's PV is refreshed when the count input goes from OFF to ON and the Completion Flag is refreshed each time that CNT/CNTX(546) is executed. The Completion Flag is turned ON if the PV is 0 and it is turned OFF if the PV is not 0.

  • When a CNT/CNTX(546) counter is forced set, its Completion Flag will be turned ON and its PV will be reset to 0000. When a CNT/CNTX(546) counter is forced reset, its Completion Flag will be turned OFF and its PV will be set to the SV.

  • Be sure to reset the counter by turning the reset input from OFF ON OFF before beginning counting with the count input, as shown in the following diagram. The count input will not be received if the reset input is ON.

OMRON CP1E - Precautions - 1

  • The reset input will take precedence and the counter will be reset if the reset input and count input are both ON at the same time. (The PV will be reset to the SV and the Completion Flag will be turned OFF.)

OMRON CP1E - Precautions - 2

  • If online editing is used to add a counter, the counter must be reset before it will work properly. If the counter is not reset, the previous value will be used as the counter's present value (PV), and the counter may not operate properly after it is written.

CNTR/CNTRX

InstructionMnemonicVariationsFunction codeFunction
REVERSIBLE COUNTERCNTR---012---
CNTRX---548
SymbolCNTRCNTRX
BCDIncrement inputCNTR(012)BinaryIncrement inputCNTRX(548)
Decrement inputNN: Counter numberDecrement inputNN: Counter number
Reset inputSS: Set valueReset inputSS: Set value

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CNTRCNTRX
NCounter NumberCOUNTERCOUNTER1
SSet ValueWORDUINT1

N: Counter Number

The counter number must be between 0000 and 0255(decimal).

S: Set Value

CNTR (BCD):#0000 to #9999

CNTRX (Binary): &0 to &65535 (decimal) or #0000 to FFFF (hex)

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------OK---------------------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if in BCD mode and S does not contain BCD dataOFF in all other cases.

Function

The counter PV is incremented by 1 every time that the increment input goes from OFF to ON and it is decremented by 1 every time that the decrement input goes from OFF to ON. The PV can fluctuate between 0 and the SV.

When incrementing, the Completion Flag will be turned ON when the PV is incremented from the SV back to 0 and it will be turned OFF again when the PV is incremented from 0 to 1.

When decrementing, the Completion Flag will be turned ON when the PV is decremented from 0 up to the SV and it will be turned OFF again when the PV is decremented from the SV to SV-1.

OMRON CP1E - Function - 1

OMRON CP1E - Function - 2

Precautions

  • Counter numbers are shared by the CNT, CNTX(546), CNTR(012) and CNTRX(548) instructions. If two counters share the same counter number but are not used simultaneously, a duplication error will be generated when the program is checked but the counters will operate normally. Counters which share the same counter number will not operate properly if they are used simultaneously.
  • The PV will not be changed if the increment and decrement inputs both go from OFF to ON at the same time. When the reset input is ON, the PV will be reset to 0 and both count inputs will be ignored.
  • The Completion Flag will be ON only when the PV has been incremented from the SV to 0 or decremented from 0 to the SV; it will be OFF in all other cases.
  • When inputting the CNTR(012)/CNTRX(548) instruction with mnemonics, first enter the increment input (II), then the decrement input (DI), the reset input (R), and finally the CNTR(012)/CNTRX(548) instruction. When entering with the ladder diagrams, first input the increment input (II), then the CNTR(012)/CNTRX(548) instruction, the decrement input (DI), and finally the reset input (R).

Sample program

The counter PV is reset to 0 by turning the reset input (CIO 0.02) ON and OFF. The PV is incremented by 1 each time that the increment input (CIO 0.00) goes from OFF to ON. When the PV is incremented from the SV (3), it is automatically reset to 0 and the Completion Flag is turned ON.

Likewise, the PV is decremented by 1 each time that the decrement input (CIO 0.01) goes from OFF to ON. When the PV is decremented from 0, it is automatically set to the SV (3) and the Completion Flag is turned ON.

OMRON CP1E - Sample program - 1
or

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

The add and subtract count inputs increase/decrease the count once when the signal rises (OFF to ON). When both inputs turn ON at the same time, neither increases/decreases the count. When the reset input turns ON, the PV changes to 0 and count input is not accepted.

In the following example, the SV for CNTR(012) 0007 is determined by the content of CIO 0001. When the content of CIO 0001 is controlled by an external switch, the set value can be changed manually from the switch.

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

InstructionOperands
LD0.00
LD0.01
LD0.02
CNTR (012)0006
#5000
LD200.07
OUT0.03
LD0.04
LD0.05
LD0007
CNTR (012)1
LD NOTC0007
OUT200.08

CNR/CNRX

InstructionMnemonicVariationsFunction codeFunction
RESET TIMER/COUNTERCNR@CNR545Resetsthe timers or counters within the specified range of timer or counter numbers.
CNRX@CNRX547
SymbolCNRCNRX
BCDCNR(545)BinaryCNRX(547)
N1N1: First number in rangeN1: First number in range
N2N2: Last number in rangeN2: Last number in range

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CNTCNTX
N1First number in rangeTIMER/COUNTER*1Variable
N2Last number in rangeTIMER/COUNTER*1Variable

N1: First Number in Range

N1 must be a timer number between T000 and T255 or a counter number between C000 and C255.

N2: Last Number in Range

N2 must be a timer number between T000 and T255 or a counter number between C000 and C255.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N1,N2------------OKOK---------------------

Flags

NameLabelOperation
Error FlagP_ERON if N1 and N2 are not in the same data areaOFF in all other cases.

Function

CNR(545)/CNRX(547) resets the Completion Flags of all timers or counters from N1 to N2. At the same time, the PVs will all be set to the maximum value (9999 for BCD and FFFF for binary). (The PV will be set to the SV the next time that the timer or counter instruction is executed.)

Precautions

  • The timer/counter that is reset is as follows.
Instructions resetOperation of CNR(545)
BCDTIM:HUNDRED-MS TIMERThe PV is set to its maximum value (9,999 BCD) and the Completion Flag is turned OFF.
TIMH(015):TEN-MS TIMER
TMHH(540):ONE-MS TIMER
TTIM(087):ACCUMULATIVE TIMER
CNT:COUNTER
CNTR(012):REVERSIBLE COUNTER
Instructions resetOperation of CNRX(547)
BinaryTIMX(550):HUNDRED-MS TIMERThe PV is set to its maximum value (FFFF hex) and the Completion Flag is turned OFF.
TIMHX(551):TEN-MS TIMER
TMHHX(552):ONE-MS TIMER
TTIMX(555):ACCUMULATIVE TIMER
CNTX(546):COUNTER
CNTRX(548):REVERSIBLE COUNTER
  • The CNR(545)/CNRX(547) instructions do not reset TIML(542) and TIMLX(553), because these timers do not use timer numbers.
  • The CNR(545)/CNRX(547) instructions do not reset the timer/counter instructions themselves, they reset the PVs and Completion Flags allocated to those instructions. In most cases, the effect of CNR(545)/CNRX(547) is different from directly resetting the instructions. For example, when a TIM/TIMX(550) instruction is reset directly its PV is set to the SV, but when that timer is reset by CNR(545)/CNRX(547) its PV is set to the maximum value (9999 for BCD and FFFF for binary).
  • When N1 and N2 are specified with N1>N2, only the Completion Flag for the timer/counter number will be reset.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, the Completion Flags for timers T0002 to T0005 are turned OFF and the timers' PVs are set to the maximum value (9999 for BCD).

When CIO 0.01 is ON, the Completion Flags for counters C0003 to C0007 are turned OFF and the counters' PVs are set to the maximum value (9999 for BCD).

When CIO 0.00 is ON in the following example, the Completion Flags for timers T0002 to T0005 are turned OFF and the timers' PVs are set to the maximum value (FFFF for binary).

When CIO 0.01 is ON, the Completion Flags for counters C0003 to C0007 are turned OFF and the counters' PVs are set to the maximum value (FFFF for binary).

Comparison Instructions

$$ =, < >, < , < = , >, > = $$

InstructionMnemonicVariationsFunction codeFunction
Input Comparison Instructions=, <>, <, <=, >, >=---300 to 328Input comparison instructions compare two values (constants and/or the contents of specified words) and create an ON execution condition when the comparison condition is true.Input comparison instructions are available to compare signed or unsigned data of one-word or double length data.
Symbol=, <>, <, <=, >, >=
LD connection Mnemonic S1 S2S1: Comparison data 1 S2: Comparison data 2AND connection Mnemonic S1 S2OR connection Mnemonic S1 S2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
UnsignedUnsigned double lengthSignedSigned double lengthOne-wordDouble length
S1Comparison data 1UINTUDINTINTDINT12
S2Comparison data 2UINTUDINTINTDINT12

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTRbits
CIOWRHRARTCDM@DM*DM
S1,S2OKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
Data length: one-wordData length: double length
Error FlagP_EROFF or unchangedOFF or unchanged
Greater Than FlagP_GTON if S1 > S2 with one-word data. OFF in all other cases.ON if S1+1, S1 > S2+1, S2 with double-length data. OFF in all other cases.
Greater Than or Equal FlagP_GEON if S1 ≥ S2 with one-word data. OFF in all other cases.ON if S1+1, S1 ≥ S2+1, S2 with double-length data. OFF in all other cases.
Equal FlagP_EQON if S1 = S2 with one-word data. OFF in all other cases.ON if S1+1, S1 = S2+1, S2 with double-length data. OFF in all other cases.
Not Equal FlagP_NEON if S1 ≠ S2 with one-word data. OFF in all other cases.ON if S1+1, S1 ≠ S2+1, S2 with double-length data. OFF in all other cases.
Less Than FlagP_LTON if S1 < S2 with one-word dataOFF in all other cases.ON if S1+1, S1 < S2+1, S2 with double-length dataOFF in all other cases.
Less Than or Equal FlagP_LEON if S1 ≤ S2 with one-word dataOFF in all other cases.ON if S1+1, S1 ≤ S2+1, S2 with double-length dataOFF in all other cases.
Negative FlagP_NOFF or unchangedOFF or unchanged

Function

The input comparison instruction compares S1 and S2 as signed or unsigned values and creates an ON execution condition when the comparison condition is true.

The input comparison instructions are treated just like the LD, AND, and OR instructions to control the execution of subsequent instructions.

Input typeOperation
LDThe instruction can be connected directly to the left bus bar.
ANDThe instruction cannot be connected directly to the left bus bar.
ORThe instruction can be connected directly to the left bus bar.

OMRON CP1E - Function - 1

OMRON CP1E - Function - 2

- Options

The input comparison instructions can compare signed or unsigned data and they can compare one-word or double values. If no options are specified, the comparison will be for one-word unsigned data. With the three input types and two options, there are 72 different input comparison instructions.

SymbolOption (data format)Option (data length)
= (Equal)None: Unsigned dataNone: One-word data
< > (Not equal)S: Signed dataL: Double-length data
< (Less than)
<= (Less than or equal)
> (Greater than)
>= (Greater than or equal)
FunctionMnemonicNameCode
True if C1 = C2LD/AND/OR =EQUAL300
LD/AND/OR =LDOUBLE EQUAL301
LD/AND/OR =SSIGNED EQUAL302
LD/AND/OR =SLDOUBLE SIGNED EQUAL303
True if C1 ≠ C2LD/AND/OR <>NOT EQUAL305
LD/AND/OR <>LDOUBLE NOT EQUAL306
LD/AND/OR <>SSIGNED NOT EQUAL307
LD/AND/OR <>SLDOUBLE SIGNED NOT EQUAL308
True if C1 < C2LD/AND/OR <LESS THAN310
LD/AND/OR <LDOUBLE LESS THAN311
LD/AND/OR <SSIGNED LESS THAN312
LD/AND/OR <SLDOUBLE SIGNED LESS THAN313
True if C1 ≤ C2LD/AND/OR <=LESS THAN OR EQUAL315
LD/AND/OR<=LDOUBLE LESS THAN OR EQUAL316
LD/AND/OR <=SSIGNED LESS THAN OR EQUAL317
LD/AND/OR <=SLDOUBLE SIGNED LESS THAN OR EQUAL318
True if C1 > C2LD/AND/OR >GREATER THAN320
LD/AND/OR >LDOUBLE GREATER THAN321
LD/AND/OR >SSIGNED GREATER THAN322
LD/AND/OR >SLDOUBLE SIGNED GREATER THAN323
True if C1 ≥ C2LD/AND/OR >=GREATER THAN OR EQUAL325
LD/AND/OR >=LDOUBLE GREATER THAN OR EQUAL326
LD/AND/OR >=SSIGNED GREATER THAN OR EQUAL327
LD/AND/OR >=SLDBL SIGNED GREATER THAN OR EQUAL328

Unsigned input comparison instructions (i.e., instructions without the S option) can handle unsigned binary or BCD data. Signed input comparison instructions (i.e., instructions with the S option) handle signed binary data.

Hint

  • Unlike instructions such as CMP(020) and CMPL(060), the result of an input comparison instruction is reflected directly as an execution condition, so it is not necessary to access the result of the comparison through an Arithmetic Flag and the program is simpler and faster.

Precautions

  • Input comparison instructions cannot be used as right-hand instructions, i.e., another instruction must be used between them and the right bus bar.

Sample program

AND LESS THAN: AND<(310)

When CIO 0.00 is ON in the following example, the contents of D100 and D200 are compared in as unsigned binary data. If the content of D100 is less than that of D200, CIO 100.00 is turned ON and execution proceeds to the next line. If the content of D100 is not less than that of D200, the remainder of the instruction line is skipped and execution moves to the next instruction line.

OMRON CP1E - AND LESS THAN: AND&lt;(310) - 1

AND SIGNED LESS THAN: AND<312>

When CIO 0.01 is ON in the following example, the contents of D110 and D210 are compared as signed binary data. If the content of D110 is less than that of D210, CIO 100.01 is turned ON and execution proceeds to the next line. If the content of D110 is not less than that of D210, the remainder of the instruction line is skipped and execution moves to the next instruction line.

OMRON CP1E - AND SIGNED LESS THAN: AND&lt;312&gt; - 1

$$ = D T, < > D T, < D T, < = D T, > D T, > = D T $$

InstructionMnemonicVariationsFunction codeFunction
Time Comparison Instructions=DT---341Time comparison instructions compare two BCD time values and create an ON execution condition when the comparison condition is true.
<>DT342
<DT343
<=DT344
>DT345
>=DT346
Symbol=DT, <>DT, <DT, <=DT, >DT, >=DT
LDANDOR
SymbolSymbolSymbolC: Control word S1: First word of present time S2: First word of comparison time
CCCC: Control word S1: First word of present time S2: First word of comparison time
S1S1S1S1
S2S2S2S2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CControl wordWORD1
S1First word of present timeWORD3
S2First word of comparison timeWORD3

C: Control Word

Bits 00 to 05 of C specify whether or not the time data will be masked for the comparison. Bits 00 to 05 mask the seconds, minutes, hours, day, month, and year, respectively. If all 6 values are masked, the instruction will not be executed, the execution condition will be OFF, and the Error Flag will be turned ON.

OMRON CP1E - C: Control Word - 1

S_1 through S_1 + 2 : Present Time Data

S_1 through S_1 + 2 contain the present time data. S_1 through S_1 + 2 must be in the same data area.

OMRON CP1E - S_1 through S_1 + 2 : Present Time Data - 1

OMRON CP1E - S_1 through S_1 + 2 : Present Time Data - 2

OMRON CP1E - S_1 through S_1 + 2 : Present Time Data - 3
Note When using the CPU Unit's internal clock data for the comparison, set S1 to A351 to specify the CPU Unit's internal clock data (A351 to A353).

S_2 through S_2 + 2 : Comparison Time Data

S_2 through S_2 + 2 contain the comparison time data. S_2 through S_2 + 2 must be in the same data area.

OMRON CP1E - S_2 through S_2 + 2 : Comparison Time Data - 1

OMRON CP1E - S_2 through S_2 + 2 : Comparison Time Data - 2

OMRON CP1E - S_2 through S_2 + 2 : Comparison Time Data - 3
Note The year value indicates the last two digits of the year. Values 00 to 97 are interpreted as 2000 to 2097. Values 98 and 99 are interpreted as 1998 and 1999.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
COKOKOKOKOKOKOK------OK---------
S1, S2OKOK---

Flags

NameLabelOperation
Error FlagP_ERON if all 6 of the mask bits (C bits 00 to 05) are ON.OFF in all other cases.
Greater Than FlagP_GTON if S1 > S2OFF in all other cases.
Greater Than or Equal FlagP_GEON if S1 ≥ S2OFF in all other cases.
Equal FlagP_EQON if S1 = S2OFF in all other cases.
Not Equal FlagP_NEON if S1 ≠ S2OFF in all other cases.
Less Than FlagP_LTON if S1 < S2OFF in all other cases.
Less Than or Equal FlagP_LEON if S1 ≤ S2OFF in all other cases.

Function

The time comparison instruction compares the unmasked values (corresponding bit of C set to 0) of the present time data in S_1 to S_1 + 2 with the comparison time data in S_2 to S_2 + 2 and creates an ON execution condition when the comparison condition is true. At the same time, the result of a time comparison instruction is reflected in the arithmetic flags (=, <>, <, <=, >, >=) .

The time comparison instructions are treated just like the LD, AND, and OR instructions to control the execution of subsequent instructions.

There are 18 possible combinations of time comparison instructions.

Any time values that are masked in the control word (C) are not included in the comparison.

The following table shows the ON/OFF status of each flag for each comparison result.

ResultFlag status
=<><<=>>=
S1 = S2ONOFFOFFONOFFON
S1 > S2OFFONOFFOFFONON
S1 < S2OFFONONONOFFOFF

OMRON CP1E - Function - 1

- Masking Time Values

Time values can be masked individually and excluded from the comparison operation. To mask a time value, set the corresponding bit in the control word (C) to 1. Bits 00 to 05 of C mask the seconds, minutes, hours, day, month, and year, respectively.

Example:

When C = 39 hex, the rightmost 6 bits are 111001 (year=1, month=1, day=1, hours=0, minutes=0, and seconds=1) so only the hours and minutes are compared. This mask setting can be used to perform a particular operation at a given time (hour and minute) each day.

OMRON CP1E - Example: - 1

Hint

  • Previous data comparison instructions compared data in 16-bit units. The time comparison instructions are limited to comparing 8-bit time values.

The following table shows the structure of the CPU Unit's internal Calendar/Clock Area.

AddressesContents
A351.00 to A351.07Second (00 to 59, BCD)
A351.08 to A351.15Minute (00 to 59, BCD)
A352.00 to A352.07Hour (00 to 23, BCD)
A352.08 to A352.15Day of month (01 to 31, BCD)
A353.00 to A353.07Month (01 to 12, BCD)
A353.08 to A353.15Year (00 to 99, BCD)
  • The Calendar/Clock Area can be set with a Programming Device (including a Programming Console), DATE(735) instruction, or "CLOCK WRITE" FINS command (0702 hex).

Precautions

  • Time comparison instructions cannot be used as right-hand instructions, i.e., another instruction must be used between them and the right bus bar.
  • E-type CP1E CPU Unit (CP1E-E□□□□-□) does not have the clock function. The clock data inside the CPU Unit is always 01-01-01 01:01:01.

Sample program

When CIO 0.00 is ON and the time is 13:00:00, CIO 100.00 is turned ON. The contents of A351 to A353 (the CPU Unit's internal calendar/clock data) are used as the present time data and the contents of D100 to D102 are used as the comparison time data. The year, month, and day values are masked, so only the hour, minute, and second data are compared.

OMRON CP1E - Sample program - 1

CMP/CMPL

InstructionMnemonicVariationsFunction codeFunction
COMPARECMP!CMP020Compares two unsigned binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
DOUBLE COMPARECMPL---060Compares 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.
SymbolCMPCMPL
CMP(020)CMPL(060)
S1S1: Comparison data 1S1S1: Comparison data 1
S2S2: Comparison data 2S2S2: Comparison data 2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CMPCMPLCMPCMPL
S1CMP: Comparison data 1 CMPL: Comparison data 1, rightmost word addressUINTUDINT12
S2CMP: Comparison data 2 CMPL: Comparison data 2, rightmost word addressUINTUDINT12
  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S1, S2OKOKOKOKOKOKOKOKOKOK---------

Flags

NameCX-Programmer labelOperation
CMPCMPL
Error FlagP_ERUnchangedUnchanged
Greater Than FlagP_GTON if S1 > S2.OFF in all other cases.ON if S1 +1, S1 > S2+1, S2OFF in all other cases.
Greater Than or Equal FlagP_GEON if S1 ≥ S2.OFF in all other cases.ON if S1 +1, S1 ≥ S2+1, S2OFF in all other cases.
Equal FlagP_EQON if S1 = S2.OFF in all other cases.ON if S1 +1, S1 = S2+1, S2OFF in all other cases.
Not Equal FlagP_NEON if S1 ≠ S2.OFF in all other cases.ON if S1 +1, S1 ≠ S2+1, S2OFF in all other cases.
Less Than FlagP_LTON if S1 < S2.OFF in all other cases.ON if S1 +1, S1 < S2+1, S2OFF in all other cases.
Less Than or Equal FlagP_LEON if S1 ≤ S2.OFF in all other cases.ON if S1 +1, S1 ≤ S2+1, S2OFF in all other cases.
Negative FlagP_NUnchangedUnchanged
  • The following table shows the status of the Arithmetic Flags after execution of CMP(020).
CMP(020) ResultFlag status
>>==<=<<>
S1 > S2ONONOFFOFFOFFON
S1 = S2OFFONONONOFFOFF
S1 < S2OFFOFFOFFONONON
  • A status of “---” indicates that the Flag may be ON or OFF.

OMRON CP1E - Sample program - 2

  • The following table shows the status of the Arithmetic Flags after execution of CMPL(060).
CMPL(060) ResultFlag status
>>==<=<<>
S1+1, S1>S2+1, S2ONONOFFOFFOFFON
S1+1, S1=S2+1, S2OFFONONONOFFOFF
S1+1, S1<S2+1, S2OFFOFFOFFONONON
  • A status of “---” indicates that the Flag may be ON or OFF.

OMRON CP1E - Sample program - 3

Function

- CMP

CMP(020) compares the unsigned binary data in S_1 and S_2 and outputs the result to Arithmetic Flags (the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and Not Equal Flags) in the Auxiliary Area.

- CMPL

CMPL(060) compares the unsigned binary data in S_1 + 1 , S_1 and S_2 + 1 , S_2 and outputs the result to Arithmetic Flags (the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and Not Equal Flags) in the Auxiliary Area.

Precautions

  • Using CMP(020)Results in the Program

When CMP(020)/CMPL(060) is executed, the result is reflected in the Arithmetic Flags. Control the desired output or right-hand instruction with a branch from the same input condition that controls CMP(020)/CMPL(060), as shown in the following diagram. In this case, the Equals Flag and output A will be turned ON when S_1 = S_2 or S_1 + 1 , S_1 = S_2 + 1 , S_2 .

OMRON CP1E - Precautions - 1

Using CMP(020) Results in the Program

Do not program another instruction between CMP(020)/CMPL(060) and the instruction controlled by the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.

OMRON CP1E - Precautions - 2
Arithmetic Flag
(Example: Equal Flag)
In this case, the results of instruction B might
change the results of CMP(020).

  • The immediate-refreshing variation (!CMP(020)) can be used with words allocated to CPU Unit built-in inputs specified in S_1 and/or S_2 . When !CMP(020) is executed, input refreshing will be performed for the external input word specified in S_1 and/or S_2 and that refreshed value will be compared.

Sample program

  • When CIO 0.00 is ON in the following example, the eight-digit unsigned binary data in CIO 0011 and CIO 0010 is compared to the eight-digit unsigned binary data in CIO 0009 and CIO 0008 and the result is output to the Arithmetic Flags. The results recorded in the Greater Than, Equals, and Less Than Flags are immediately saved to CIO 20.00 (Greater Than), CIO 20.01 (Equals), and CIO 20.02 (Less Than).

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

CPS/CPSL

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY COMPRECPS!CPS114Compares two signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
DOUBLE SIGNED BINARY COMPRECPSL---115Compares 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.
SymbolCPSCPSL
CPS(114)S1: Comparison data 1CPSL(115)
S1S1S1: Comparison data 1
S2S2S2: Comparison data 2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CPSCPSLCPSCPSL
S1CMP: Comparison data 1 CMPL: Comparison data 1, rightmost word addressINTDINT12
S2CMP: Comparison data 2 CMPL: Comparison data 2, rightmost word addressINTDINT12
  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S1, S2OKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
CPSCPSL
Error FlagP_ERUnchangedOFF or unchanged
Greater Than FlagP_GTON if S1 > S2. OFF in all other cases.ON if S1 +1, S1 > S2+1, S2. OFF in all other cases.
Greater Than or Equal FlagP_GEON if S1 ≥ S2. OFF in all other cases.ON if S1 +1, S1 ≥ S2+1, S2. OFF in all other cases.
Equal FlagP_EQON if S1 = S2. OFF in all other cases.ON if S1 +1, S1 = S2+1, S2. OFF in all other cases.
Not Equal FlagP_NEON if S1 ≠ S2. OFF in all other cases.ON if S1 +1, S1 ≠ S2+1, S2. OFF in all other cases.
Less Than FlagP_LTON if S1 < S2. OFF in all other cases.ON if S1 +1, S1 < S2+1, S2. OFF in all other cases.
Less Than or Equal FlagP_LEON if S1 ≤ S2. OFF in all other cases.ON if S1 +1, S1 ≤ S2+1, S2. OFF in all other cases.
Negative FlagP_NUnchangedOFF or unchanged
  • The following table shows the status of the Arithmetic Flags after execution of CPS(114).
ResultFlag status
>>==<=<<>
S1 > S2ONONOFFOFFOFFON
S1 = S2OFFONONONOFFOFF
S1 < S2OFFOFFOFFONONON
  • A status of “---” indicates that the Flag may be ON or OFF.

OMRON CP1E - Sample program - 3

  • The following table shows the status of the Arithmetic Flags after execution of CPSL(115).
ResultFlag status
>>==<=<<>
S1+1, S1>S2+1, S2ONONOFFOFFOFFON
S1+1, S1=S2+1, S2OFFONONONOFFOFF
S1+1, S1<S2+1, S2OFFOFFOFFONONON
  • A status of “---” indicates that the Flag may be ON or OFF.

OMRON CP1E - Sample program - 4

Function

- CPS

CPS(114) compares the signed binary data in S_1 and S_2 and outputs the result to Arithmetic Flags (the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and Not Equal Flags) in the Auxiliary Area.

- CPSL

CPSL(115) compares the double signed binary data in S_1 + 1 , S_1 and S_2 + 1 , S_2 and outputs the result to Arithmetic Flags (the Greater Than, Greater Than or Equal, Equal, Less Than or Equal, Less Than, and Not Equal Flags) in the Auxiliary Area.

Precautions

  • When CPS(114)/CPSL(115) is executed, the result is reflected in the Arithmetic Flags. Control the desired output or right-hand instruction with a branch from the same input condition that controls CPS(114)/CPSL(115), as shown in the following diagram.

OMRON CP1E - Precautions - 1

  • Do not program another instruction between CPS(114)/CPSL(115) and the instruction controlled by the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.

OMRON CP1E - Precautions - 2
Arithmetic Flag
(Example: Equal Flag)
In this case, the results of instruction B might
change the results of CPS(114)/CPSL(115).

  • The immediate-refreshing variation (!CPS(114)/!CPSL(115)) can be used with words allocated to CPU Unit built-in inputs specified in S_1 and/or S_2 . When !CPS(114)/!CPSL(115) is executed, input refreshing will be performed for the external input word specified in S_1 and/or S_2 and that refreshed value will be compared.

Sample program

When CIO 0.00 is ON in the following example, the eight-digit signed binary data in D2 and D1 is compared to the eight-digit signed binary data in D6 and D5 and the result is output to the Arithmetic Flags.

  • If the content of D2 and D1 is greater than that of D6 and D5, the Greater Than Flag will be turned ON, causing CIO 20.00 to be turned ON.
  • If the content of D2 and D1 is equal to that of D6 and D5, the Equals Flag will be turned ON, causing CIO 20.01 to be turned ON.
  • If the content of D2 and D1 is less than that of D6 and D5, the Less Than Flag will be turned ON, causing CIO 20.02 to be turned ON.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

TCMP

InstructionMnemonicVariationsFunction codeFunction
TABLE COMPARETCMP@TCMP085Compares the source data to the contents of 16 consecutive words and turns ON the corresponding bit in the result word when the contents of the words are equal.
SymbolTCMP
TCMP(085)S: Source data T: First word of table R: Result word
S
T
R

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource dataWORD1
TFirst word of tableWORD16
RResult wordUINT1

T: First word of table

OMRON CP1E - T: First word of table - 1

R: Result word

OMRON CP1E - R: Result word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
T, R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the result word is 0000. (The two 16-word sets contain the same data.) OFF in all other cases.

Function

TCMP(085) compares the source data (S) to each of the 16 words T through T + 15 and turns ON the corresponding bit in word R when the data are equal. Bit n of R is turned ON if the content of T + n is equal to S and it is turned OFF if they are not equal.

S is compared to the content of T and bit 00 of R is turned ON if they are equal or OFF if they are not equal, S is compared to the content of T + 1 and bit 01 of R is turned ON if they are equal or OFF if they are not equal, ..., and S is compared to the content of

OMRON CP1E - Function - 1

T + 15 and bit 15 of R is turned ON if they are equal or OFF if they are not equal.

Sample program

When CIO 0.00 is ON in the following example, TCMP(085) compares the content of D100 with the contents of words D200 through D215 and turns ON the corresponding bits in D300 when the contents are equal or OFF when the contents are not equal.

OMRON CP1E - Sample program - 1

BCMP

InstructionMnemonicVariationsFunction codeFunction
BLOCK COMPAREBCMP@BCMP068Compares 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 a range.
SymbolBCMP
BCMP(068)
S
B
R
S: Source data B: First word of block R: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource dataWORD1
BFirst word of blockWORD32
RResult wordUINT1

B: First word of block

BLower limit value 0
B+1Upper limit value 0
B+2Lower limit value 1
B+3Upper limit value 1
B+30Lower limit value 15
B+31Upper limit value 15

R: Result word

OMRON CP1E - R: Result word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
B---
D

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the result word is 0000. (S is not within any of the 16 ranges.) OFF in all other cases.

Function

BCMP(068) compares the source data (S) to the 16 ranges defined by pairs of lower and upper limit values in B through B+31. The first word in each pair (B + 2n) provides the lower limit and the second word (B + 2n + 1) provides the upper limit of range n (n = 0 to 15). If S is within any of these ranges (inclusive of the upper and lower limits), the corresponding bit in R is turned ON. If S is out of any these ranges, the corresponding bit in R is turned OFF.

OMRON CP1E - Function - 1

For example, bit 00 of R is turned ON if S is within the first range (B≤ S≤ B + 1) ,bit 01 of R is turned ON if S is within the second range (B + 2 ≤ S≤ B + 3) ,..., and bit 15 of R is turned ON if S is within the fifteenth range (B + 30≤ S≤ B + 31) All other bits in R are turned OFF.

Note An error will not occur if the lower limit is greater than the upper limit, but 0 (not within the range) will be output to the corresponding bit of R.

Sample program

When CIO 0.00 is ON in the following example, BCMP(068) compares the content of D100 with the 16 ranges defined in D200 through D231 and turns ON the corresponding bits in D300 when S is within the range or OFF when S is not within the range.

OMRON CP1E - Sample program - 1

ZCP/ZCPL

InstructionMnemonicVariationsFunction codeFunction
AREA RANGE COMPREZCP---088Compares a 16-bit unsigned binary value (CD) with the range defined by lower limit LL and upper limit UL. The results are output to the Arithmetic Flags.
DOUBLE AREA RANGE COMPREZCPL---116Compares a 32-bit unsigned binary value (CD+1, CD) with the range defined by lower limit (LL+1, LL) and upper limit (UL+1, UL). The results are output to the Arithmetic Flags.
SymbolZCPZCPL
—|—|—|ZCP(088)—|—|—|CD|CD: Comparison DataLL: Lower limit of rangeUL: Upper limit of range—|—|—|ZCP(116)—|—|—|CD|CD: First word of Comparison DataLL: First word of Lower LimitUL: First word of Upper Limit
CDCD: Comparison Data
LLLL
ULUL

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CMPCMPLCMPCMPL
CDZCP: Comparison data (one word of data)UINTUDINT12
ZCPL: Comparison data (two words of data)
LLZCP: Low limitUINTUDINT12
ZCPL: Low limit leftmost word number
ULZCP: High limitUINTUDINT12
ZCPL: High limit rightmost word number

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
CD, LL, ULOKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
ZCPZCPL
Error FlagP_ERON if LL > UL.ON if LL+1, LL > UL+1, UL.
Greater Than FlagP_GT• ON if CD > UL. • OFF in all other cases.• ON if CD > UL+1, UL. • OFF in all other cases.
Greater Than or Equal FlagP_GELeft unchanged.Left unchanged.
Equal FlagP_EQ• ON if LL ≤ CD ≤ UL. • OFF in all other cases.• ON if LL+1, LL ≤ CD+1, CD ≤ UL+1, UL. • OFF in all other cases.
Not Equal FlagP_NELeft unchanged.Left unchanged.
Less Than FlagP_LT• ON if CD < LL. • OFF in all other cases.• ON if CD+1, CD < LL+1, LL. • OFF in all other cases.
Less Than or Equal FlagP_LELeft unchanged.Left unchanged.
Negative FlagP_NLeft unchanged.Left unchanged.

Function

ZCP

ZCP(088) compares the 16-bit signed binary data in CD with the range defined by LL and UL and outputs the result to the Greater Than, Equals, and Less Than Flags in the Auxiliary Area. (The Less Than or Equal, Greater Than or Equal, and Not Equal Flags are left unchanged.)

When CD > UL as shown below, the > flag turns ON.

When LL ≤ CD ≤ UL , the = flag turns ON. When CD < LL , the < flag turns ON.

ZCP(088)ResultFlag status
>=<
CD > ULONOFFOFF
CD = ULOFFON
LL < CD < UL
CD = LL
CD < LLOFFON

ZCPL

ZCPL(116) compares the 32-bit signed binary data in CD + 1 , CD with the range defined by LL + 1 , LL and UL+1, UL and outputs the result to the Greater Than, Equals, and Less Than Flags in the Auxiliary Area. (The Less Than or Equal, Greater Than or Equal, and Not Equal Flags are left unchanged.)

When CD + 1, CD > UL + 1, UL as shown below, the > flag turns ON.

When LL + 1, LL ≤ CD + 1, CD ≤ UL + 1, UL, the = flag turns ON.

When CD + 1 , CD < LL + 1 , LL , the < flag turns ON.

ZCPL(116)ResultFlag status
>=<
CD+1, CD > UL+1, ULONOFFOFF
CD+1, CD = UL+1, ULOFFON
LL+1, LL < CD+1, CD < UL+1, UL
CD+1, CD = LL+1, LL
CD+1, CD < LL+1, LLOFFON

Precautions

  • When ZCP(088)/ZCPL(116) is executed, the result is reflected in the Arithmetic Flags. Control the desired output or right-hand instruction with a branch from the same input condition that controls ZCP(088)/ZCPL(116), as shown in the following diagram.

OMRON CP1E - Precautions - 1
Arithmetic Flag
(Example: Equal Flag)
In this case, the Equals Flag and output A will be
turned ON when LL ≤ CD ≤ UL .

  • Do not program another instruction between ZCP(088)/ZCPL(116) and the instruction controlled by the Arithmetic Flag because the other instruction might change the status of the Arithmetic Flag.

OMRON CP1E - Precautions - 2
Arithmetic Flag
(Example: Equal Flag)
In this case, the results of instruction B
might change the results of ZCP(088)/ZCPL(116).

Sample program

  • When CIO 0.00 is ON in the following example, the 16-bit unsigned binary data in D0 is compared to the range 0005 to 001F hex (5 to 31 decimal) and the result is output to the Arithmetic Flags.

CIO 20.00 is turned ON if 0005 hex ≤ content of D0≤ 001F hex.

CIO 20.01 is turned ON if the content of D0 > 001F hex.

CIO 20.02 is turned ON if the content of D0 < 0005 hex.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

Data Movement Instructions

MOV/MOVL/MVN

InstructionMnemonicVariationsFunction codeFunction
MOVEMOV@MOV, !MOV, !@MOV021Transfers a word of data to the specified word.
DOUBLE MOVEMOVL@MOVL498Transfers two words of data to the specified words.
MOVE NOTMVN@MVN022Transfers the complement of a word of data to the specified word.
SymbolMOVMOVL
MOV(021)S DS: SourceD: DestinationMOVL(498)S DS: First source wordD: First destination word
MVN
MVN(022)S DS: SourceD: Destination

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
MOV / MVNMOVLMOV / MVNMOVL
SMOV / MVN: Source MOVL: First source wordWORDDWORD12
DMOV / MVN: Destination MOVL: First destination wordWORDDWORD12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
D---

Flags

NameLabelOperation
Error FlagP_EROFF
Equal FlagP_EQON if the data being transferred (D) is 0. OFF in all other cases.
Negative FlagP_NON if the leftmost bit of the data being transferred (D) is 1. OFF in all other cases.

Function

MOV

Transfers S to D. If S is a constant, the value can be used for a data setting.

- MOVL

MOVL(498) transfers S + 1 and S to D + 1 and D . If S + 1 and S are constants, the value can be used for a data setting.

MVN

MVN(022) inverts the bits in S and transfers the result to D. The content of S is left unchanged.

OMRON CP1E - MVN - 1

Precautions

MOV(021) has an immediate refreshing variation (!MOV(021)). A CPU Unit Built-in input bits can be specified for S and external output bits can be specified for D. Input bits used for S will refreshed just before, and output bits used for D will be refreshed just after execution.

When CPU Unit Built-in input is specified for S, the value of S will be in-refreshed when the instruction is executed and transferred to D. When external output is specified for D, the value of S will be transferred to D and immediately out-refreshed when the instruction is executed. It is also possible to refresh S and out-refresh D at the same time.

Sample program

When CIO 0.00 is ON in the following example, the content of CIO 100 is copied to D100.

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, the content of D101 and D100 are copied to D201 and D200.

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

When CIO 0.00 is ON in the following example, the status of the bits in CIO 100 is inverted and the result is copied to D100.

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

MOVB

InstructionMnemonicVariationsFunction codeFunction
MOVE BITMOVB@MOVB082Transfers the specified bit.
SymbolMOVB
MOVB(082)
S
C
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource word or dataWORD1
CControl wordUINT1
DDestination wordWORD1

C: Control Word

OMRON CP1E - C: Control Word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, COKOKOKOKOKOKOKOKOKOK---------
D---

Flags

NameLabelOperation
Error FlagP_ERON if the rightmost and leftmost two digits of C are not within the specified range of 00 to 0FOFF in all other cases.

Function

MOVB(082) copies the specified bit (n) from S to the specified bit (m) in D.

OMRON CP1E - Function - 1

Hint

The same word can be specified for both S and D to copy a bit within a word.

Precautions

The other bits in the destination word are left unchanged.

Sample program

When CIO 0.00 is ON in the following example, the 5^th bit of the source word (W0) is copied to the 12^th bit of the destination word (W100) in accordance with the control word's value of 0C05.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

MOVD

InstructionMnemonicVariationsFunction codeFunction
MOVE DIGITMOVD@MOVD083Transfers the specified digit or digits. (Each digit is made up of 4 bits.)
SymbolMOVB
MOVD(083)
S
C
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource word or dataWORD1
CControl wordUINT1
DDestination wordUINT1

S: Source Word

S15121187430
Digit 3Digit 2Digit 1Digit 0

The source digits are read from right to left, wrapping back to the rightmost digit (digit 0) if necessary.

D: Destination Word

15121187430
Digit 3Digit 2Digit 1Digit 0

The destination digits are written from right to left, wrapping back to the rightmost digit (digit 0) if necessary.

C: Control Word

OMRON CP1E - C: Control Word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, COKOKOKOKOKOKOKOKOKOK---------
D---

Flags

NameLabelOperation
Error FlagP_ERON if one of the first three digits of C is not within the specified range of 0 to 3. OFF in all other cases.

Function

MOVB(082) copies the specified bit (n) from S to the specified bit (m) in D. The other bits in the destination word are left unchanged.

OMRON CP1E - Function - 1

Precautions

If the number of digits being read or written exceeds the leftmost digit of S or D, MOVD(083) will wrap to the rightmost digit of the same word.

Sample program

When CIO 0.00 is ON in the following example, four digits of data are copied from W0 to W100. The transfer begins with the digit 1 of W0 and digit 0 of W100, in accordance with the control word's value of 31.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

Note After reading the leftmost digit of S (digit 3), MOVD(083) wraps to the rightmost digit (digit 0).

- Example of transferring multiple digits

The following diagram shows examples of data transfers for various values of C.

OMRON CP1E - - Example of transferring multiple digits - 1

XFRB

InstructionMnemonicVariationsFunction codeFunction
MULTIPLE BIT TRANSFERXFRB@XFRB062Transfers the specified number of consecutive bits.
SymbolXFRB
XFRB(062)
C
S
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CControl wordUINT1
SFirst source wordWORDVariable
DFirst destination wordWORDVariable

C: Control Word

OMRON CP1E - C: Control Word - 1

D: First destination Word

OMRON CP1E - D: First destination Word - 1

Note The source words and the destination words must be in the same data area respectively.

S: First Source Word

OMRON CP1E - S: First Source Word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
COKOKOKOKOKOKOKOKOKOK---------
S, D---

Flags

NameLabelOperation
Error FlagP_EROFF

Function

XFRB(062) transfers up to 255 consecutive bits from the source words (beginning with bit I of S) to the destination words (beginning with bit m of D).

The beginning bits and number of bits are specified in C, as shown in the following diagram.

OMRON CP1E - Function - 1

Hint

  • Up to 255 bits of data can be transferred per execution of XFRB(062).
  • It is possible for the source words and destination words to overlap. By transferring data overlapping several words, the data can be packed more efficiently in the data area. (This is particularly useful when handling position data for position control.)
  • Since the source words and destination words can overlap, XFRB(062) can be combined with ANDW(034) to shift m bits by n spaces.

Precautions

  • Be sure that the source words and destination words do not exceed the end of the data area.
  • When the number of transfer bits (n of C) is 0, transfer does not take place.
  • Bits in the destination words that are not overwritten by the source bits are left unchanged.

Sample program

When CIO 0.00 is ON in the following example, the 20 bits beginning with W0.06 are copied to the 20 bits beginning with W100.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

XFER

InstructionMnemonicVariationsFunction codeFunction
BLOCK TRANSFERXFER@XFER070Transfers the specified number of consecutive words.
SymbolXFER
— | —XFER(070) —
NN: Number of words
SS: First source word
DD: First destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NNumber of wordsUINT1
SFirst source wordWORDVariable
DFirst destination wordWORDVariable

N: Number of Words

Specifies the number of words to be transferred. The possible range for N is 0000 to FFFF (0 to 65,535 decimal).

OMRON CP1E - N: Number of Words - 1

OMRON CP1E - N: Number of Words - 2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
NOKOKOKOKOKOKOKOKOKOK---------
S, D---

Flags

NameLabelOperation
Error FlagP_EROFF

Function

XFER(070) copies N words beginning with S (S to S + (N - 1) ) to the N words beginning with D (D to D + (N - 1) ).

OMRON CP1E - Function - 1

Hint

  • It is possible for the source words and destination words to overlap, so XFER(070) can perform word-shift operations.
  • The specified source and destination data areas can overlap (word shift).

OMRON CP1E - Hint - 1

Precautions

  • Be sure that the source words (S to S+N-1) and destination words (D to D+N-1) do not exceed the end of the data area.
  • Some time will be required to complete XFER(070) when a large number of words is being transferred. Even if an interrupt occurs, execution of this instruction will not be interrupted and execution of the interrupt task will be started after execution of XFER(070) has been completed. If power is interrupted during execution of XFER(070), execution may not be completed, i.e., all of the specified data may not be transferred.

OMRON CP1E - Precautions - 1

Sample Program

When CIO 0.00 is ON in the following example, the 10 words D100 through D109 are copied to D200 through D209.

OMRON CP1E - Sample Program - 1

OMRON CP1E - Sample Program - 2

BSET

InstructionMnemonicVariationsFunction codeFunction
BLOCK SETBSET@BSET071Copies the same word to a range of consecutive words.
SymbolBSET
— | — BSET(071) — S: Source wordSt: Starting wordE: End word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordWORD1
StStarting wordWORDVariable
EEnd wordWORDVariable

St: Starting Word

Specifies the first word in the destination range.

E: End Word

Specifies the last word in the destination range.

OMRON CP1E - E: End Word - 1

Note St and E must be in the same data area.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
St, E---

Flags

NameLabelOperation
Error FlagP_ERON if St is greater than EOFF in all other cases.

Function

BSET(071) copies the same source word (S) to all of the destination words in the range St to E.

OMRON CP1E - Function - 1

Precautions

  • Some time will be required to complete BSET(071) when a large number of words is being set. Even if an interrupt occurs, execution of this instruction will not be interrupted and execution of the interrupt task will be started after execution of BSET(071) has been completed. If power is interrupted during execution of BSET(071), execution may not be completed, i.e., all of the specified words may not be set. One BSET(071) instruction can be replaced with two BSET(071) instructions to help avoid this problem.

OMRON CP1E - Precautions - 1

Sample program

When CIO 0.00 is ON in the following example, the source data in D100 is copied to D200 through D209.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

XCHG

InstructionMnemonicVariationsFunction codeFunction
DATA EXCHANGEXCHG@XCHG073Exchanges the contents of the two specified words.
SymbolXCHG
XCHG(073)
E1
E2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
E1First exchange wordWORD1
E2Second exchange wordWORD1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
E1,E2OKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERUnchanged
Equals FlagP_EQUnchanged
Negative FlagP_NUnchanged

Function

XCHG(073) exchanges the contents of E1 and E2.

OMRON CP1E - Function - 1

Hint

To exchange 3 or more words, use XFER(070) to transfer the words to a third set of words (a buffer) as shown in this diagram.

OMRON CP1E - Hint - 1

Sample program

When CIO 0.00 is ON in this example, the content of D100 is exchanged with the content of D200.

OMRON CP1E - Sample program - 1

DIST

InstructionMnemonicVariationsFunction codeFunction
SINGLE WORD DISTRIBUTEDIST@DIST080Transfers the source word to a destination word calculated by adding an offset value to the base address.
SymbolDIST
—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—S: Source word Bs: Destination base address Of: Offset

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordWORD1
BsDestination base addressWORD1
OfOffsetUINT1

Bs: Destination Base Address

OMRON CP1E - Bs: Destination Base Address - 1

Of: Offset

The offset can be any value from 0000 to FFFF (0 to 65,535 decimal).

Note Bs and Bs+Of must be in the same data area.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
Bs---
OfOK

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the source data is 0000. OFF in all other cases.
Negative FlagP_NON if the leftmost bit of the source data is 1. OFF in all other cases

Function

DIST(080) copies S to the destination word calculated by adding Of to Bs.

OMRON CP1E - Function - 1

Hint

The same DIST(080) instruction can be used to distribute the source word to various words in the data area by changing the value of Of.

Precautions

Be sure that the offset does not exceed the end of the data area, i.e., Bs and Bs+Of are in the same data area.

Sample program

When CIO 0.00 is ON in this example, the contents of D100 will be copied to D210 (D200 + 10) if the contents of D300 is 10 (0A hexadecimal). The contents of D100 can be copied to other words by changing the offset in D300.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

COLL

InstructionMnemonicVariationsFunction codeFunction
DATA COLLECTCOLL@COLL081Transfers the source word (calculated by adding an offset value to the base address) to the desti-nation word.
SymbolCOLL
COLL(081)
BsBs: Source base address
OfOf: Offset
DD: Destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
BsSource base addressWORD1
OfOffsetWORD1
DDestination wordWORD1

Bs: Source Base Address

OMRON CP1E - Bs: Source Base Address - 1

Of: Offset

The offset can be any value from 0000 to FFFF (0 to 65,535 decimal).

Note Bs and Bs+Of must be in the same data area.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
BsOKOKOKOKOKOKOKOKOK------------
OfOK
D---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the source data is 0000. OFF in all other cases.
Negative FlagP_NON if the leftmost bit of the source data is 1. OFF in all other cases

Function

COLL(081) copies the source word (calculated by adding Of to Bs) to the destination word.

OMRON CP1E - Function - 1

Hint

The same COLL(081) instruction can be used to collect data from various source words in the data area by changing the value of Of.

Precautions

Be sure that the offset does not exceed the end of the data area, i.e., Bs and Bs+Of are in the same data area.

Sample program

When CIO 0.00 is ON in the following example, the contents of D110 (D100 + 10) will be copied to D300 if the content of D200 is 10 (0A hexadecimal). The contents of other words can be copied to D300 by changing the offset in D200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

Data Shift Instructions

SFT

InstructionMnemonicVariationsFunction codeFunction
SHIFT REGISTERSFT---010Operates a shift register.
SymbolSFT
—| Data input Shift input Reset input |SFT(010) St E—| St: Starting word E: End word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
StStarting wordUINTVariable
EEnd wordUINTVariable

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
St,EOKOKOK------------------------------

Flags

NameLabelOperation
Error FlagP_EROFF

Function

  • When the execution condition on the shift input changes from OFF to ON, all the data from St to E is shifted to the left by one bit (from the rightmost bit to the leftmost bit), and the ON/OFF status of the data input is placed in the rightmost bit.

OMRON CP1E - Function - 1

Precautions

  • Do not use more than one SFT(010) instructions with overlapping shift words. The results will not be dependable.
  • St and E must be in the same data area.
  • The bit data shifted out of the shift register is discarded.
  • When the reset input turns ON, all bits in the shift register from the rightmost designated word (St) to the leftmost designated word (E) will be reset (i.e., set to 0). The reset input takes priority over other inputs.
  • St must be less than or equal to E, but even when St is set to greater than E an error will not occur and one word of data in St will be shifted.

Sample program

- Shift Register Exceeding 16 Bits

The following example shows a 48-bit shift register using words CIO 128 to CIO 130. A 1-s clock pulse is used so that the execution condition produced by CIO 0.05 is shifted into a 3-word register between CIO 128.00 and CIO 130.15 every second.

OMRON CP1E - - Shift Register Exceeding 16 Bits - 1

OMRON CP1E - - Shift Register Exceeding 16 Bits - 2

SFTR

InstructionMnemonicVariationsFunction codeFunction
REVERSIBLE SHIFT REGIS-TERSFTR@SFTR084Creates a shift register that shifts data to either the right or the left.
SymbolSFTR
SFTR(084)
CC: Control word
StSt: Starting word
EE: End word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CControl wordUINT1
StStarting wordUINTVariable
EEnd wordUINTVariable

C: Control Word

OMRON CP1E - C: Control Word - 1
Note St and E must be in the same data area.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
C,St,EOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON when St is greater than EOFF in all other cases.
Carry FlagP_CYON when 1 is shifted into it.OFF when 0 is shifted into it.OFF when reset is set to 1.

Function

When the execution condition of the shift input bit (bit 14 of C) changes to ON, all the data from St to E is moved in the designated shift direction (designated by bit 12 of C) by 1 bit, and the ON/OFF status of the data input is placed in the rightmost or leftmost bit. The bit data shifted out of the shift register is placed in the Carry Flag (CY)

OMRON CP1E - Function - 1

Note - The above shift operations are applicable when the reset bit (bit 15 of C) is set to OFF.
- When reset (bit 15 of C) turns ON all bits in the shift register, from St to E will be reset (i.e., set to 0).

Sample program

- Shifting Data

If shift input W0.14 goes ON when CIO 0.00 is ON, and the reset bit W0.15 is OFF, words CIO 100 through CIO 102 will shift one bit in the direction designated by W0.12 (e.g., 1: Right) and the contents of input bit W0.13 will be shifted into the rightmost bit, CIO 100.00. The contents of CIO 102.15 will be shifted to the Carry Flag (CY).

OMRON CP1E - - Shifting Data - 1

OMRON CP1E - - Shifting Data - 2

  • Resetting Data

If W0.14 is ON when CIO 0.00 is ON, and the reset bit, W0.15, is ON, words CIO 100 through CIO 102 and the Carry Flag will be reset to OFF.

- Controlling Data

Resetting Data

OMRON CP1E - Resetting Data - 1

Shifting Data Left (from Rightmost to Leftmost Bit)

OMRON CP1E - Shifting Data Left (from Rightmost to Leftmost Bit) - 1

Shifting Data Right (from Leftmost to Rightmost Bit)

OMRON CP1E - Shifting Data Right (from Leftmost to Rightmost Bit) - 1

All bits from St to E and the Carry Flag are set to 0 and no other data can be received when the reset input bit (bit 15 of C) is ON.

When the shift input bit (bit 14 of C) is ON, the contents of the input bit (bit 13 of C) is shifted to bit 00 of the starting word, and each bit thereafter is shifted one bit to the left. The status of bit 15 of the end word is shifted to the Carry Flag.

When the shift input bit (bit 14 of C) is ON, the contents of the input bit (bit 13 of C) (I/O) is shifted to bit 15 on the end word, and each bit thereafter is shifted one bit to the right. The status of bit 00 of the starting word is shifted to the Carry Flag.

WSFT

InstructionMnemonicVariationsFunction codeFunction
WORD SHIFTWSFT@WSFT016Shifts data between St and E in word units.
SymbolWSFT
—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—WSFT(016)
SS: Source word
StSt: Starting word
EE: End word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SControl wordWORD1
StStarting wordUINTVariable
EEnd wordUINTVariable

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
St,E---

Flags

NameLabelOperation
Error FlagP_ERON when St is greater than EOFF in all other cases.

Function

WSFT(016) shifts data from St to E in word units and the data from the source word S is places into St. The contents of E is lost.

OMRON CP1E - Function - 1

Precautions

  • St and E must be in the same data area.
  • When large amounts of data are shifted, the instruction execution time is quite long. Be sure that the power is not cut while WSFT(016) is being executed, causing the shift operation to stop halfway through.

Sample program

When CIO 0.00 is ON, data from CIO 100 through CIO 102 will be shifted one word toward E. The contents of W0 will be stored in CIO 100 and the contents of CIO 102 will be lost.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

ASL

InstructionMnemonicVariationsFunction codeFunction
ARITHMETIC SHIFT LEFTASL@ASL025Shifts the contents of Wd one bit to the left.
SymbolASL
— ASL(025) — Wd Wd: Word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
WdWordUINT1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the shift result is 0. OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY). OFF in all other cases.
Negative FlagP_NON when the leftmost bit is 1 as a result of the shift. OFF in all other cases.

Function

ASL(025) shifts the contents of Wd one bit to the left (from rightmost bit to leftmost bit). "0" is placed in the rightmost bit and the data from the leftmost bit is shifted into the Carry Flag (CY).

Sample program

When CIO 0.00 is ON, CIO 100 will be shifted one bit to the left. "0" will be placed in CIO 100.00 and the contents of CIO 100.15 will be shifted to the Carry Flag (CY).

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

ASR

InstructionMnemonicVariationsFunction codeFunction
ARITHMETIC SHIFT RIGHTASR@ASL026Shifts the contents of Wd one bit to the right.
SymbolASR
ASR(026) —
Wd Wd: Word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
WdWordUINT1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the shift result is 0. OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY). OFF in all other cases.
Negative FlagP_NOFF

Function

ASR(026) shifts the contents of Wd one bit to the right (from leftmost bit to rightmost bit). "0" will be placed in the leftmost bit and the contents of the rightmost bit will be shifted into the Carry Flag (CY).

Sample program

When CIO 0.00 is ON, word CIO 100 will shift one bit to the right. "0" will be placed in CIO 100.15 and the contents of CIO 100.00 will be shifted to the Carry Flag (CY).

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

ROL

InstructionMnemonicVariationsFunction codeFunction
ROTATE LEFTROL@ROL027Shifts all Wd bits one bit to the left including the Carry Flag (CY).
SymbolROL
—| ——ROL(027) ——
Wd Wd: Word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
WdWordUINT1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the shift result is 0. OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY). OFF in all other cases.
Negative FlagP_NON when the leftmost bit is 1 as a result of the shift. OFF in all other cases.

Function

ROL(027) shifts all bits of Wd including the Carry Flag (CY) to the left (from rightmost bit to leftmost bit).

OMRON CP1E - Function - 1

Hint

It is possible to set the Carry Flag contents to 1 or 0 immediately before executing this instruction, by using the Set Carry (STC(040)) or Clear Carry (CLC(041)) instructions.

Sample program

When CIO 0.00 is ON, word CIO 100 and the Carry Flag (CY) will shift one bit to the left. The contents of CIO 100.15 will be shifted to the Carry Flag (CY) and the Carry Flag contents will be shifted to CIO 100.00.

OMRON CP1E - Sample program - 1

ROR

InstructionMnemonicVariationsFunction codeFunction
ROTATE RIGHTROR@ROR028Shifts all Wd bits one bit to the right including the Carry Flag (CY).
SymbolROR
—|—ROR(028) —|—
Wd Wd: Word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
WdWordUINT1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the shift result is 0. OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY). OFF in all other cases.
Negative FlagP_NON when the leftmost bit is 1 as a result of the shift. OFF in all other cases.

Function

ROR(028) shifts all bits of Wd including the Carry Flag (CY) to the right (from leftmost bit to rightmost bit).

OMRON CP1E - Function - 1

Hint

It is possible to set the Carry Flag contents to 1 or 0 immediately before executing this instruction, by using the Set Carry (STC(040)) or Clear Carry (CLC(041)) instructions.

Sample program

When CIO 0.00 is ON, word CIO 100 and the Carry Flag (CY) will shift one bit to the right. The contents of CIO 100.00 will be shifted to the Carry Flag (CY) and the Carry Flag contents will be shifted to CIO 100.15.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

SLD/SRD

InstructionMnemonicVariationsFunction codeFunction
ONE DIGIT SHIFT LEFTSLD@SLD074Shifts data by one digit (4 bits) to the left.
ONE DIGIT SHIFT RIGHTSRD@SRD075Shifts data by one digit (4 bits) to the right.
SymbolSLDSRD
SLD(074)St: Starting WordE: End wordSRD(075)St: Starting WordE: End word
StSt
EE

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
StStarting WordUINTVariable
EEnd WordUINTVariable

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
St,EOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON when St is greater than EOFF in all other cases.

Function

SLD

SLD(074) shifts data between St and E by one digit (4 bits) to the left. "0" is placed in the rightmost digit (bits 3 to 0 of St), and the content of the leftmost digit (bits 15 to 12 of E) is lost.

SRD

SRD(075) shifts data between St and E by one digit (4 bits) to the right. "0" is placed in the leftmost digit (bits 15 to 12 of E), and the content of the rightmost digit (bits 3 to 0 of St) is lost.

Precautions

  • St and E must be in the same data area.
  • When large amounts of data are shifted, the instruction execution time is quite long. Be sure that the power is not cut while SLD(074) and SRD(075) is being executed, causing the shift operation to stop halfway through.

OMRON CP1E - Precautions - 1
■SLD
■SRD

OMRON CP1E - Precautions - 2

Sample program

SLD

When CIO 0.00 is ON, words CIO 100 through CIO 102 will shift by one digit (4 bits) to the left. A zero will be placed in bits 0 to 3 of word CIO 100 and the contents of bits 12 to 15 of CIO 102 will be lost.

OMRON CP1E - SLD - 1

OMRON CP1E - SLD - 2

SRD

When CIO 0.00 is ON, words CIO 100 through CIO 102 will shift by one digit (4 bits) to the right. A zero will be placed in bits 12 to 15 of CIO 102 and the contents of bits 0 to 3 of word CIO 100 will be lost.

OMRON CP1E - SRD - 1

OMRON CP1E - SRD - 2

NASL/NSLL

InstructionMnemonicVariationsFunction codeFunction
SHIFT N-BITS LEFTNASL@NASL580Shifts the specified 16 bits of word data to the left by the specified number of bits.
DOUBLE SHIFT N-BITS LEFTNSLL@NSLL582Shifts the specified 32 bits of word data to the left by the specified number of bits.
SymbolNASLNSLL
—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|——|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|−—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|0—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|3

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NASLNSLLNASLNSLL
DShift WordUINTUDINT12
CControl wordUINTUDINT11

C: Control word

OMRON CP1E - C: Control word - 1
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

OMRON CP1E - C: Control word - 2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
DOKOKOKOKOKOKOKOKOK------------
COKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
Error FlagP_ERON when the control word C (the number of bits to shift) is not within range.OFF in all other cases.
Equals FlagP_EQON when the shift result is 0.OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY).OFF in all other cases.
Negative FlagP_NON when the leftmost bit is 1 as a result of the shift.OFF in all other cases.

Function

- NASL

NASL(580) shifts D (the shift word) by the specified number of binary bits (specified in C) to the left (from the rightmost bit to the leftmost bit). Either zeros or the value of the rightmost bit will be placed into the specified number of bits of the shift word starting from the rightmost bit.

OMRON CP1E - - NASL - 1

OMRON CP1E - - NASL - 2

NSLL

NSLL(582) shifts D and D + 1 (the shift words) by the specified number of binary bits (specified in C) to the left (from the rightmost bit to the leftmost bit). Either zeros or the value of the rightmost bit will be placed into the specified number of bits of the shift word starting from the rightmost bit.

OMRON CP1E - NSLL - 1

Precautions

  • For any bits which are shifted outside the specified word, the contents of the last bit is shifted to the Carry Flag (CY), and all other data is lost.
  • When the number of bits to shift (specified in C) is "0," the data will not be shifted. The appropriate flags will turn ON and OFF, however, according to data in the specified word.

Sample program

When CIO 0.00 is ON, The contents of CIO 100 is shifted 10 bits to the left (from the rightmost bit to the leftmost bit). The number of bits to shift is specified in bits 0 to 7 of word W0 (control data). The contents of bit 0 of CIO 100 is copied into bits from which data was shifted and the contents of the rightmost bit which was shifted out of range is shifted into the Carry Flag (CY). All other data is lost.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

When CIO 0.00 is ON, CIO 100 and CIO 101 will be shifted to the left (from the rightmost bit to the left-most bit) by 10 bits. The number of bits to shift is specified in bits 0 to 7 of W0 (control data). The contents of bit 0 of CIO 100 is copied into bits from which data was shifted and the contents of the rightmost bit which was shifted out of range is shifted into the Carry Flag (CY). All other data is lost.

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

OMRON CP1E - Sample program - 6

NASR/NSRL

InstructionMnemonicVariationsFunction codeFunction
SHIFT N-BITS RIGHTNASR@NASR581Shifts the specified 16 bits of word data to the right by the specified number of bits.
DOUBLE SHIFT N-BITS RIGHTNSRL@NSRL583Shifts the specified 32 bits of word data to the right by the specified number of bits.
SymbolNASRNSRL
NASR(581)
DD: Shift wordDD: Shift word
CC: Control wordCC: Control word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NASRNSRLNASRNSRL
DShift WordUINTUDINT12
CControl wordUINTUDINT11

C: Control word

NASR
OMRON CP1E - C: Control word - 1
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

NSRL
OMRON CP1E - C: Control word - 2
0 Hex: 0 shifted in
8 Hex: Contents of rightmost bit shifted in

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
DOKOKOKOKOKOKOKOKOK------------
COK

Flags

NameLabelOperation
Error FlagP_ERON when the control word C (the number of bits to shift) is not within range.OFF in all other cases.
Equals FlagP_EQON when the shift result is 0OFF in all other cases.
Carry FlagP_CYON when 1 is shifted into the Carry Flag (CY).OFF in all other cases.
Negative FlagP_NON when the leftmost bit is 1 as a result of the shiftOFF in all other cases.

Function

- NASR

NASR(581) shifts D (the shift word) by the specified number of binary bits (specified in C) to the right (from the rightmost bit to the leftmost bit). Either zeros or the value of the rightmost bit will be placed into the specified number of bits of the shift word starting from the rightmost bit.

OMRON CP1E - - NASR - 1

NSRL

NSRL(583) shifts D and D+1 (the shift words) by the specified number of binary bits (specified in C) to the right (from the leftmost bit to the rightmost bit). Either zeros or the value of the rightmost bit will be placed into the specified number of bits of the shift word starting from the rightmost bit.

OMRON CP1E - NSRL - 1

Precautions

  • For any bits which are shifted outside the specified word, the contents of the last bit is shifted to the Carry Flag (CY), and all other data is discarded.
  • When the number of bits to shift (specified in C) is "0," the data will not be shifted. The appropriate flags will turn ON and OFF, however, according to data in the specified word.

Sample program

  • When CIO 0.00 is ON, CIO 100 will be shifted 10 bits to the right (from the leftmost bit to the rightmost bit). The number of bits to shift is specified in bits 0 to 7 of W0. The contents of bit 15 of CIO 100 is copied into the bits from which data was shifted and the contents of the leftmost bit of data which was shifted out of range, is shifted into the Carry Flag (CY). All other data is lost.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

When CIO 0.00 is ON, CIO 100 and CIO 101 will be shifted 10 bits to the right (from the leftmost bit to the rightmost bit). The number of bits to shift is specified in bits 0 to 7 of W0 (control data). The contents of bit 15 of CIO will be copied into the bits from which data was shifted and the contents of the leftmost bit of data which was shifted out of range will be shifted into the Carry Flag (CY). All other data is lost.

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

OMRON CP1E - Sample program - 6

Increment/Decrement Instructions

$$ + + / + + L $$

InstructionMnemonicVariationsFunction codeFunction
INCREMENT BINARY++@++590Increments the 4-digit hexadecimal content of the specified word by 1.
DOUBLE INIncrement BINARY++L@++L591Increments the 8-digit hexadecimal content of the specified words by 1.
Symbol++++L
—| |—++(590) Wd: Word—| |—++L(591) Wd: First word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
++++L++++L
Wd+: Word +: L: First wordUINTUDINT12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the result is 0000/0000 0000 after execution. OFF in all other cases.
Carry FlagP_CYON if a digit in Wd/Wd+1 or Wd went from F to 0 during execution. OFF in all other cases.
Negative FlagP_NON if bit 15 of Wd/Wd+1 is ON after execution. OFF in all other cases.

Function

+ +

The ++(590) instruction adds 1 to the binary content of Wd. The specified word will be incremented by 1 every cycle as long as the execution condition of ++(590) is ON. When the up-differentiated variation of this instruction (@++(590)) is used, the specified word is incremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - Function - 1

+ + L

The ++L(591) instruction adds 1 to the 8-digit hexadecimal content of Wd+1 and Wd. The content of the specified words will be incremented by 1 every cycle as long as the execution condition of ++L(591) is ON. When the up-differentiated variation of this instruction (@++L(591)) is used, the content of the specified words is incremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - Function - 2

Sample program

Operation of + + (590) / + + L(591)

In the following example, the content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of + + (590) / + + L(591) - 1

Incremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of + + (590) / + + L(591) - 2

In the following example, the content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of + + (590) / + + L(591) - 3

Incremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of + + (590) / + + L(591) - 4

OMRON CP1E - Operation of + + (590) / + + L(591) - 5

Operation of @++(590)/@++L(591)

The up-differentiated variation is used in the following example, so the content of D100 will be incremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - Operation of @++(590)/@++L(591) - 1

Incremented every cycle

while CIO 0.00 is ON.

OMRON CP1E - Operation of @++(590)/@++L(591) - 2

The up-differentiated variation is used in the following example, so the content of D101 and D100 will be incremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - Operation of @++(590)/@++L(591) - 3

Incremented only for

up-differentiation.

OMRON CP1E - Operation of @++(590)/@++L(591) - 4

: Execution of @++(590) or @++L(591)

OMRON CP1E - Operation of @++(590)/@++L(591) - 5

OMRON CP1E - Operation of @++(590)/@++L(591) - 6

InstructionMnemonicVariationsFunction codeFunction
DECREMENT BINARY--@@592Decrement the 4-digit hexadecimal content of the specified word by 1.
DOUBLE DECREMENT BINARY--L@@L593Decrement the 8-digit hexadecimal content of the specified words by 1.
Symbol----L
--(592) Wd--(592) Wd: Word--(593) Wd--L(593) Wd: First word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
----L----L
Wd--- Word --L: First wordUINTUDINT12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the result is 0000/0000 0000 after execution. OFF in all other cases.
Carry FlagP_CYON if a digit in Wd/Wd+1 or Wd went from 0 to F during execution. OFF in all other cases.
Negative FlagP_NON if bit 15 of Wd/Wd+1 is ON after execution. OFF in all other cases.

Function

The --(592) instruction subtracts 1 from the binary content of Wd. The specified word will be decremented by 1 every cycle as long as the execution condition of --(592) is ON. When the up-differentiated variation of this instruction (@ --(592)) is used, the specified word is decremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - Function - 1

The --L(593) instruction subtracts 1 from the 8-digit hexadecimal content of Wd+1 and Wd. The content of the specified words will be decremented by 1 every cycle as long as the execution condition of -- L(593) is ON. When the up-differentiated variation of this instruction (@--L(593)) is used, the content of the specified words is decremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - Function - 1

Sample program

Operation of --(592)/--L(593)

The up-differentiated variation is used in the following example, so the content of D100 will be decremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - Operation of --(592)/--L(593) - 1

Decremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of --(592)/--L(593) - 2

In the following example, the 8-digit hexadecimal content of D101 and D100 will be decremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of --(592)/--L(593) - 3

Decremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of --(592)/--L(593) - 4

OMRON CP1E - Operation of --(592)/--L(593) - 5

Operation of @--(592)/@@L(593)

In the following example, the content of D100 will be decremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of @--(592)/@@L(593) - 1

Decremented every cycle

while CIO 0.00 is ON.

OMRON CP1E - Operation of @--(592)/@@L(593) - 2

The up-differentiated variation is used in the following example, so the content of D101 and D100 will be decremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - Operation of @--(592)/@@L(593) - 3

Decremented only for

up-differentiation.

OMRON CP1E - Operation of @--(592)/@@L(593) - 4

:Execution of @ - L(593)

OMRON CP1E - Operation of @--(592)/@@L(593) - 5

$$ + + \mathrm {B} / + + \mathrm {B L} $$

InstructionMnemonicVariationsFunction codeFunction
INCREMENT BCD++B@ ++B594Increments the 4-digit BCD content of the speci-fied word by 1.
DOUBLE INIncrement BCD++BL@ ++BL595Increments the 8-digit BCD content of the speci-fied words by 1.
Symbol++B++BL
+ B(594) Wd+ B(594) Wd: Word+ B(595) Wd+ B(595) Wd: First word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
++++L++++L
Wd++B: WordWORDDWORD12
++BL: First word

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the content of Wd/Wd+1 and Wd is not BCD. OFF in all other cases.
Equals FlagP_EQON if the result is 0000/0000 0000 after execution. OFF in all other cases.
Carry FlagP_CYON if a digit in Wd/Wd+1 or Wd went from 9 to 0 during execution. OFF in all other cases.

Function

+ + B

The ++B(594) instruction adds 1 to the BCD content of Wd. The specified word will be incremented by 1 every cycle as long as the execution condition of ++B(594) is ON. When the up-differentiated variation of this instruction (@++B(594)) is used, the specified word is incremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - + + B - 1

+ + BL

The ++BL(595) instruction adds 1 to the 8-digit BCD content of Wd+1 and Wd. The content of the specified words will be incremented by 1 every cycle as long as the execution condition of ++BL(595) is ON. When the up-differentiated variation of this instruction (@++BL(595)) is used, the content of the specified words is incremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - + + BL - 1

Sample program

Operation of ++B(594)/++BL(595)

In the following example, the BCD content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of ++B(594)/++BL(595) - 1

Incremented every cycle

while CIO 0.00 is ON.

OMRON CP1E - Operation of ++B(594)/++BL(595) - 2

In the following example, the 8-digit BCD content of D101 and D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of ++B(594)/++BL(595) - 3

Incremented every cycle

while CIO 0.00 is ON.

OMRON CP1E - Operation of ++B(594)/++BL(595) - 4

OMRON CP1E - Operation of ++B(594)/++BL(595) - 5

OMRON CP1E - Operation of ++B(594)/++BL(595) - 6

OMRON CP1E - Operation of ++B(594)/++BL(595) - 7

OMRON CP1E - Operation of ++B(594)/++BL(595) - 8

- Operation of @ ++B(594)/@ ++BL(595)

The up-differentiated variation is used in the following example, so the content of D100 will be incremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - - Operation of @ ++B(594)/@ ++BL(595) - 1

Incremented only for up-differentiation.

OMRON CP1E - - Operation of @ ++B(594)/@ ++BL(595) - 2

The up-differentiated variation is used in the following example, so the BCD content of D101 and D100 will be incremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - - Operation of @ ++B(594)/@ ++BL(595) - 3

Incremented only for up-differentiation.

OMRON CP1E - - Operation of @ ++B(594)/@ ++BL(595) - 4

: Execution of @++B(594) or @++BL(595)

OMRON CP1E - - Operation of @ ++B(594)/@ ++BL(595) - 5

--B/--BL

InstructionMnemonicVariationsFunction codeFunction
DECREMENT BCD--B@@-B596Decrements the 4-digit BCD content of the speci-fied word by 1.
DOUBLE DECREMENT BCD--BL@@-BL597Decrements the 8-digit BCD content of the speci-fied words by 1.
Symbol--B--BL
—|——B(596) Wd: Word—|——BL(597) Wd: First word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
----L----L
Wd--B: WordWORDDWORD12
--BL: First word

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the content of Wd/Wd+1 and Wd is not BCD. OFF in all other cases.
Equals FlagP_EQON if the result is 0000/0000 0000 after execution. OFF in all other cases.
Carry FlagP_CYON if a digit in Wd/Wd+1 or Wd went from 0 to 9 during execution. OFF in all other cases.

Function

B

The --B(596) instruction subtracts 1 from the BCD content of Wd. The specified word will be decremented by 1 every cycle as long as the execution condition of --B(596) is ON. When the up-differentiated variation of this instruction (@--B(596)) is used, the specified word is decremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - B - 1

- --BL

The --BL(597) instruction subtracts 1 from the 8-digit BCD content of Wd+1 and Wd. The content of the specified words will be decremented by 1 every cycle as long as the execution condition of --BL(597) is ON. When the up-differentiated variation of this instruction (@--BL(597)) is used, the content of the specified words is decremented only when the execution condition has gone from OFF to ON.

OMRON CP1E - - --BL - 1

Sample program

Operation of --B(596)/--BL(597)

In the following example, the BCD content of D100 will be decremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of --B(596)/--BL(597) - 1

Decremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of --B(596)/--BL(597) - 2

In the following example, the 8-digit BCD content of D101 and D100 will be decremented by 1 every cycle as long as CIO 0.00 is ON.

OMRON CP1E - Operation of --B(596)/--BL(597) - 3

Decremented every cycle while CIO 0.00 is ON.

OMRON CP1E - Operation of --B(596)/--BL(597) - 4

OMRON CP1E - Operation of --B(596)/--BL(597) - 5

OMRON CP1E - Operation of --B(596)/--BL(597) - 6

OMRON CP1E - Operation of --B(596)/--BL(597) - 7

OMRON CP1E - Operation of --B(596)/--BL(597) - 8

- Operation of @--B(596)/@@BL(597)

The up-differentiated variation is used in the following example, so the BCD content of D100 will be decremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 1

Decremented only for up-differentiation.

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 2

The up-differentiated variation is used in the following example, so the BCD content of D101 and D100 will be decremented by 1 only when CIO 0.00 has gone from OFF to ON.

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 3

Decremented only for up-differentiation.

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 4

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 5

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 6

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 7

OMRON CP1E - - Operation of @--B(596)/@@BL(597) - 8

Symbol Math Instructions

+ / + L

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY ADD WITHOUT CARRY+@+400Adds 4-digit (single-word) hexadecimal data and/or constants.
DOUBLE SIGNED BINARY ADD WITHOUT CARRY+L@+L401Adds 8-digit (double-word) hexadecimal data and/or constants.
Symbol++L
+(400)AuAu: Augend wordAd: Addend wordR: Result word+(401)AuAu: 1st augend wordAd: 1st addend wordR: 1st result word
AdR

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
++L++L
Au+: Augend wordINTDINT12
+L: First augend word
Ad+: Addend wordINTDINT12
+L: First addend word
R+: Result wordINTDINT12
+L: First result word

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Au, AdOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
++L
Error FlagP_EROFFOFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.ON when the result is 0. OFF in all other cases.
Carry FlagP_CYON when the addition results in a carry. OFF in all other cases.ON when the addition results in a carry. OFF in all other cases.
Overflow FlagP_OFON when the result of adding two positive num- bers is in the range 8000 to FFFF hex. OFF in all other cases.ON when the result of adding two positive num- bers is in the range 80000000 to FFFFFFFF hex. OFF in all other cases.
Underflow FlagP_UFON when the result of adding two negative num- bers is in the range 0000 to 7FFF hex. OFF in all other cases.ON when the result of adding two negative num- bers is in the range 00000000 to 7FFFFFFF hex. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.ON when the leftmost bit of the result is 1. OFF in all other cases.

Function

• +

(+400) adds the binary values in Au and Ad and outputs the result to R.

OMRON CP1E - Function - 1

+L

+L(401) adds the binary values in Au and Au + 1 and Ad and Ad + 1 and outputs the result to R.

OMRON CP1E - Function - 2

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in this example, D100 and D110 will be added as 4-digit signed binary values and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON, D101 and D100 and D111 and D110 will be added as 8-digit signed binary values and the result will be output to D121 and D120.

+C/+CL

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY ADD WITH CARRY+C@+C402Adds 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
DOUBLE SIGNED BINARY ADD WITH CARRY+CL@+CL403Adds 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
Symbol+C+CL
+C(402)AuAu: Augend wordAd: Addend wordR: Result word+CL(403)AuAu: 1st augend wordAd: 1st addend wordR: 1st result word
AdAd
RR

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
+C+CL+C+CL
Au+C: Augend wordINTDINT12
+CL: First augend word
Ad+C: Addend wordINTDINT12
+CL: First addend word
R+C: Result wordINTDINT12
+CL: First result word

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Au, AdOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
+C+CL
Error FlagP_EROFFOFF
Equals FlagP_EQON when the addition result is 0. OFF in all other cases.ON when the result is 0. OFF in all other cases.
Carry FlagP_CYON when the addition results in a carry. OFF in all other cases.ON when the results in a carry. OFF in all other cases.
Overflow FlagP_OFON when the addition result of adding two positive numbers and CY is in the range 8000 to FFFF hex. OFF in all other cases.ON when the result of adding two positive numbers and CY is in the range 80000000 to FFFFFFFF hex. OFF in all other cases.
Underflow FlagP_UFON when the addition result of adding two negative numbers and CY is in the range 0000 to 7FFF hex. OFF in all other cases.ON when the result of adding two negative numbers and CY is in the range 00000000 to 7FFFFFFF hex. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.ON when the leftmost bit of the result is 1. OFF in all other cases.

Function

+C

+C(402) adds the binary values in Au, Ad, and CY and outputs the result to R.

OMRON CP1E - Function - 1

+CL

+CL(403) adds the binary values in Au and Au + 1 , Ad and Ad + 1 , and CY and outputs the result to R.

OMRON CP1E - Function - 2

Hint

  • To clear the Carry Flag (CY), execute the Clear Carry (CLC(041)) instruction.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON, D200, D210, and CY will be added as 4-digit signed binary values and the result will be output to D220.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON, D201, D200, D211, D210, and CY will be added as 8-digit signed binary values, and the result will be output to D221 and D220.

+B/+BL

InstructionMnemonicVariationsFunction codeFunction
BCD ADD WITHOUT CARRY+B@+B404Adds 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD ADD WITHOUT CARRY+BL@+BL405Adds 8-digit (double-word) BCD data and/or constants.
Symbol+B+BL
+B(404)+B(405)
AuAu: Augend wordAuAu: 1st augend word
AdAd: Addend wordAdAd: 1st addend word
RR: Result wordRR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
+B+BL+B+BL
Au+B: Augend wordWORDDWORD12
+BL: First augend word
Ad+B: Addend wordWORDDWORD12
+BL: First addend word
R+B: Result wordWORDDWORD12
+BL: First result word
  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Au, AdOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
+B+BL
Error FlagP_ER• ON when Au is not BCD. • ON when Ad is not BCD. • OFF in all other cases.• ON when Au, Au +1 is not BCD. • ON when Ad, Ad +1 is not BCD. • OFF in all other cases.
Equals FlagP_EQ• ON when the result is 0. • OFF in all other cases.• ON when the result is 0. • OFF in all other cases.
Carry FlagP_CY• ON when the addition results in a carry. • OFF in all other cases.• ON when the addition results in a carry. • OFF in all other cases.

Function

+B

+B(404) adds the BCD values in Au and Ad and outputs the result to R.

OMRON CP1E - Function - 1

+BL

+BL(405) adds the BCD values in Au and Au + 1 and Ad and Ad + 1 and outputs the result to R, R + 1

OMRON CP1E - Function - 2

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100 and D110 will be added as 4-digit BCD values, and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101 and D100 and D111 and D110 will be added as 8-digit BCD values, and the result will be output to D121 and D120.

+BC/+BCL

InstructionMnemonicVariationsFunction codeFunction
BCD ADD WITH CARRY+BC@ +BC406Adds 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).
DOUBLE BCD ADD WITH CARRY+BCL@ +BCL407Adds 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).
Symbol+BC+BCL
+BC(406)+BCL(407)
AuAu: Augend wordAuAu: 1st augend word
AdAd: Addend wordAdAd: 1st addend word
RR: Result wordRR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
+BC+BCL+BC+BCL
Au+BC: Augend wordWORDDWORD12
+BCL: First augend word
Ad+BC: Addend wordWORDDWORD12
+BCL: First addend word
R+BC: Result wordWORDDWORD12
+BCL: First result word

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Au, AdOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
+BC+BCL
Error FlagP_ER• ON when Au is not BCD. • ON when Ad is not BCD. • OFF in all other cases.• ON when Au, Au +1 is not BCD. • ON when Ad, Ad +1 is not BCD. • OFF in all other cases.
Equals FlagP_EQ• ON when the result is 0. • OFF in all other cases.• ON when the result is 0. • OFF in all other cases.
Carry FlagP_CY• ON when the addition results in a carry. • OFF in all other cases.• ON when the addition results in a carry. • OFF in all other cases.

Function

+BC

+BC(406) adds BCD values in Au, Ad, and CY and outputs the result to R.

OMRON CP1E - Function - 1

+BCL

+BCL(407) adds the BCD values in Au and Au + 1 , Ad and Ad + 1 , and CY and outputs the result to R, R+1.

OMRON CP1E - Function - 2

Hint

  • To clear the Carry Flay (CY), execute the Clear Carry (CLC(041)) instruction.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100, D110, and CY will be added as 4-digit BCD values, and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101, D100, D111, D110, and CY will be added as 8-digit BCD values, and the result will be output to D121 and D120.

OMRON CP1E - Sample program - 3

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY SUBTRACT WITHOUT CARRY-@-410Subtracts 4-digit (single-word) hexadecimal data and/or constants.
DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY-L@-L411Subtracts 8-digit (double-word) hexadecimal data and/or constants.
Symbol--L
-(-410)-(-410)
MiMi: Minuend wordMiMi: Minuend word
SuSu: Subtrahend wordSuSu: Subtrahend word
RR: Result wordRR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
--L--L
Mi:- Minuend wordINTDINT12
-L: First minuend word
Su:- Subtrahend wordINTDINT12
-L: First subtrahend word
R:- Result wordINTDINT12
-L: First result word

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Mi, SuOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
--L
Error FlagP_EROFFOFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.ON when the result is 0. OFF in all other cases.
Carry FlagP_CYON when the subtraction results in a borrow. OFF in all other cases.ON when the subtraction results in a borrow. OFF in all other cases.
Overflow FlagP_OFON when the result of subtracting a negative num- ber from a positive number is in the range 8000 to FFFF hex. OFF in all other cases.ON when the result of subtracting a negative num- ber from a positive number is in the range 8000000 toFFFFFFF hex. OFF in all other cases.
Underflow FlagP_UFON when the result of subtracting a negative num- ber from a positive number is in the range 0000 to 7FFF hex. OFF in all other cases.ON when the result of subtracting a positive num- ber from a negative number is in the range 0000000 to 7FFFFFFF hex. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.ON when the leftmost bit of the result is 1. OFF in all other cases.

Function

OMRON CP1E - Function - 1

-(400) subtracts the binary values in Su from Mi and outputs the result to R. When the result is negative, it is output to R as a 2's complement.

OMRON CP1E - Function - 2

OMRON CP1E - Function - 3

-L(411) subtracts the binary values in Su and Su + 1 from Mi and Mi + 1 and outputs the result to R, R + 1 . When the result is negative, it is output to R and R + 1 as a 2's complement.

OMRON CP1E - Function - 4

Hint

2's Complement

A 2's complement is the value obtained by subtracting each binary digit from 1 and adding one to the result. For example, the 2's complement for 1101 is calculated as follows: 1111 (F hexadecimal) - 1101 (D hexadecimal) + 1 (1 hexadecimal) = 0011 (3 hexadecimal). The 2's complement for 3039 (hexadecimal) is calculated as follows: FFFF (hexadecimal) - 3039 (hexadecimal) + 0001 (hexadecimal) - CFC7 (hexadecimal). Therefore, in case of 4-digit hexadecimal value, the 2's complement can be calculated as follows: FFFF (hexadecimal) - a (hexadecimal) + 0001 (hexadecimal) = b (hexadecimal). To obtain the true number from the 2's complement b (hexadecimal): a (hexadecimal) = 10000 (hexadecimal) - b (hexadecimal). For example, to obtain the true number from the 2's complement CFC7 (hexadecimal): 10000 (hexadecimal) - CFC7 = 3039.

OMRON CP1E - 2's Complement - 1

OMRON CP1E - 2's Complement - 2
Note 1. Since the Negative Flag is ON, the result (FFFE hex) is a negative value (2's complement) and is thus -2.
2. Since the Carry Flag is OFF, the result (FFFE hex) is an unsigned positive value of 65534.

  1. Since the Negative Flag is ON, the result (FFFE hex) is a negative value (2's complement) and is thus -2.

  2. Since the Carry Flag is ON, the result (FFFE hex) is a negative value (2's complement) and becomes -2 when converted to a true value.

20F55A10 - B8A360E3 = -97AE06D3. (Hexadecimal)

OMRON CP1E - 2's Complement - 3

In this example, the eight-digit binary value in CIO 121 and CIO 120 is subtracted from the value in CIO 201 and CIO 200, and the result is output in eight-digit binary to D101 and D100. If the result is negative, the instruction at (2) will be executed, and the actual result will then be output to D101 and D100.

Subtraction at (1)

OMRON CP1E - Subtraction at (1) - 1

The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000 to obtain the actual number.

Subtraction at (2)

OMRON CP1E - Subtraction at (2) - 1

Final Subtraction Result

OMRON CP1E - Final Subtraction Result - 1

The Carry Flag (CY) is turned ON, so the actual number is -97AE06D3. Because the content of D101 and D100 is negative, CY is used to turn ON CIO 21.00 to indicate this.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D110 will be subtracted from D100 as 4-digit signed binary values and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D111 and D110 will be subtracted from D101 and D100 as 8-digit signed binary values and the result will be output to D121 and D120.

If the result of the subtraction is a negative number (Mi < Su or Mi+1, Mi < Su+1, Su), the result is output as the 2's complement and the Carry Flag (CY) will turn ON to indicate that the result of the subtraction is negative. To convert the 2's complement to the true number, an instruction which subtracts the result from 0 is necessary using the Carry Flag (CY) as an execution condition.

-C/-CL

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY SUBTRACT WITH CARRY-C@-C412Subtracts 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
DOUBLE SIGNED BINARY SUBTRACT WITH CARRY-CL@-CL413Subtracts 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
Symbol-C-CL
—| —| —C(412) —| —| —Mi: Minuend word Su: Subtrahend word R: Result word—| —| —Mi: Minuend word Su: Subtrahend word R: Result word—| —| —CL(413) —| —| —Mi: Minuend word Su: Subtrahend word R: Result word—| —| —Mi: Minuend word Su: Subtrahend word R: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
-C-CL-C-CL
Mi-C: Minuend word -CL: First minuend wordINTDINT12
Su-C: Subtrahend word -CL: First subtrahend wordINTDINT12
R-C: Result word -CL: First result wordINTDINT12

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Mi, SuOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
-C-CL
Error FlagP_EROFFOFF
Equals FlagP_EQON when the subtraction result is 0. OFF in all other cases.ON when the result is 0. OFF in all other cases.
Carry FlagP_CYON when the subtraction results in a borrow. OFF in all other cases.ON when the results in a borrow. OFF in all other cases.
Overflow FlagP_OFON when the result of subtracting a negative num- ber and CY from a positive number is in the range 8000 to FFFF hex. OFF in all other cases.ON when the result of subtracting a negative num- ber and CY from a positive number is in the range 80000000 to FFFFFFFF hex. OFF in all other cases.
Underflow FlagP_UFON when the result of subtracting a positive num- ber and CY from a negative number is in the range 0000 to 7FFF hex. OFF in all other cases.ON when the result of subtracting a positive num- ber and CY from a negative number is in the range 00000000 to 7FFFFFFF hex. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.ON when the leftmost bit of the result is 1. OFF in all other cases.

Function

  • C

-C(412) subtracts the binary values in Su and CY from Mi, and outputs the result to R. When the result is negative, it is output to R as a 2's complement.

OMRON CP1E - Function - 1

-CL

-CL(413) subtracts the binary values in Su and Su+1 and CY from Mi and Mi+1, and outputs the result to R, R+1. When the result is negative, it is output to R, R+1 as a 2's complement.

OMRON CP1E - Function - 2

Hint

  • To clear the Carry Flag (CY), execute the Clear Carry (CLC(041)) instruction.
    2's Complement

A 2's complement is the value obtained by subtracting each binary digit from 1 and adding one to the result.

Example: The 2's complement for the binary number 1101 is as follows: 1111 (F hex) - 1101 (D hex) + 1 (1 hex) = 0011 (3 hex).

Example: The 2's complement for the 4-digit hexadecimal number 3039 is as follows: FFFF hex - 3039 hex + 0001 hex = CFC7 hex.

Accordingly, the 2's complement for the 4-digit hexadecimal value "a" is as follows: FFFF hex - a hex + 0001 hex = b hex.

And to obtain the true number “a” hex from the 2’s complement “b” hex: a hex + 10000 hex - b hex.

Example: To obtain the true number from the 2's complement CFC& hex: 10000 hex - CFC7 hex = 3039 hex.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D110 and CY will be subtracted from D100 as 4-digit signed binary values and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D111, D110 and CY will be subtracted from D101 and D100 as 8-digit signed binary values, and the result will be output to D121 and D120.

If the result of the subtraction is a negative number (Mi < Su or Mi+1, Mi < Su+1, Su), the result is output as a 2's complement. The Carry Flag (CY) will turn ON. To convert the 2's complement to the true number, a program which subtracts the result from 0 is necessary, as an input condition of the Carry Flag (CY). The Carry Flag turning ON thus indicates that the result of the subtraction is negative.

-B/-BL

InstructionMnemonicVariationsFunction codeFunction
BCD SUBTRACT WITHOUT CARRY-B@–B414Subtracts 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD SUBTRACT WITHOUT CARRY-BL@–BL415Subtracts 8-digit (double-word) BCD data and/or constants.
Symbol-B-BL
—| —| —B(414) —| —| —Mi: Minuend word Su: Subtrahend word R: Result word—| —| —BL(415) —| —| —Mi: 1st minuend word Su: 1st subtrahend word R: 1st result word—| —| —Mi: 1st minuend word Su: 1st subtrahend word R: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
-B-BL-B-BL
Mi-B: Minuend word -BL: First minuend wordWORDDWORD12
Su-B: Subtrahend word -BL: First subtrahend wordWORDDWORD12
R-B: Result word -BL: First result wordWORDDWORD12
  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Mi, SuOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
-B-BL
Error FlagP_ER·ON when Mi is not BCD. ·ON when Su is not BCD. ·OFF in all other cases.·ON when Mi and/or Mi +1 are not BCD. ·ON when Su and/or Su +1 are not BCD. ·OFF in all other cases.
Equals FlagP_EQ·ON when the result is 0. ·OFF in all other cases.·ON when the result is 0. ·OFF in all other cases.
Carry FlagP_CY·ON when the subtraction results in a borrow. ·OFF in all other cases.·ON when the subtraction results in a borrow. ·OFF in all other cases.

Function

  • B

-B(414) subtracts the BCD values in Su from Mi and outputs the result to R. If the result of the subtraction is negative, the result is output as a 10's complement.

OMRON CP1E - Function - 1

  • BL

  • BL(415) subtracts the BCD values in Su and Su+1 from Mi and Mi+1 and outputs the result to R, R+1. If the result is negative, it is output to R, R+1 as a 10's complement.

OMRON CP1E - Function - 2

Hint

10's Complement

A 10's complement is the value obtained by subtracting each digit from 9 and adding one to the result. For example, the 10's complement for 7556 is calculated as follows: 9999 - 7556 + 1 = 2444 . For a four digit number, the 10's complement of A is 9999 - A + 1 = B . To obtain the true number from the 10's complement B: A = 10000 - B . For example, to obtain the true number from the 10's complement 2444: 10000 - 2444 = 7556 .

Example: 9,583,960 - 17,072,641 = -7,488,681. (BCD)

OMRON CP1E - 10's Complement - 1

In this example, the eight-digit BCD content of CIO 121 and CIO 120 is subtracted from the content of CIO 201 and CIO 200, and the result is output in eight-digit BCD to D101 and D100. The result is negative, so the instruction at (2) will be executed, and the true value will then be output to D101 and D100.

Subtraction at (1)

OMRON CP1E - Subtraction at (1) - 1

The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000.

The Carry Flag (CY) will be turned ON, so the actual number is -7,488,681. Because the content of D101 and D100 is negative, CY is used to turn ON CIO 21.00 to indicate this.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D110 is subtracted from D100 as 4-digit BCD values, and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D111 and D110 will be subtracted from D101 and D100 as 8-digit BCD values, and the result will be output to D121 and D120.

If the result of the subtraction is a negative number (Mi < Su or Mi +1 , Mi < Su +1 , Su), the result is output as a 10's complement. The Carry Flag (CY) will turn ON. To convert the 10's complement to the true number, a program which subtracts the result from 0 is necessary, as an input condition of the Carry Flag (CY). The Carry Flag turning ON thus indicates that the result of the subtraction is negative.

-BC/-BCL

InstructionMnemonicVariationsFunction codeFunction
BCD SUBTRACT WITH CARRY-BC@-BC416Subtracts 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).
DOUBLE BCD SUBTRACT WITH CARRY-BCL@-BCL417Subtracts 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).
Symbol-BC-BCL
-BC(416)Mi: Minuend word Su: Subtrahend word R: Result word-BC(417)Mi: 1st minuend word Su: 1st subtrahend word R: 1st result word
MiMi
SuSu
RR

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
-BC-BCL-BC-BCL
Mi-BC: Minuend word -BCL: First minuend wordWORDDWORD12
Su-BC: Subtrahend word -BCL: First subtrahend wordWORDDWORD12
R-BC: Result word -BCL: First result wordWORDDWORD12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Mi, SuOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
-BC-BCL
Error FlagP_ER• ON when Mi is not BCD. • ON when Su is not BCD. • OFF in all other cases.• ON when Mi and/or Mi +1 are not BCD. • ON when Su and/or Su +1 are not BCD. • OFF in all other cases.
Equals FlagP_EQ• ON when the result is 0. • OFF in all other cases.• ON when the result is 0. • OFF in all other cases.
Carry FlagP_CY• ON when the subtraction results in a borrow. • OFF in all other cases.• ON when the subtraction results in a borrow. • OFF in all other cases.

Function

-BC

-BC(416) subtracts BCD values in Su and CY from Mi and outputs the result to R. If the result is negative, it is output to R as a 10's complement.

OMRON CP1E - -BC - 1

- BCL

-BCL(417)subtracts the BCD values in Su, Su + 1 , and CY from Mi and Mi + 1 and outputs the result to R, R + 1 . If the result is negative, it is output to R, R + 1 as a 10's complement.

OMRON CP1E - - BCL - 1

Hint

  • To clear the Carry Flay (CY), execute the Clear Carry (CLC(041)) instruction.
    10's Complement

A 10's complement is the value obtained by subtracting each digit from 9 and adding one to the result. For example, the 10's complement for 7556 is calculated as follows: 9999 - 7556 + 1 = 2444 . For a four digit number, the 10's complement of A is 9999 - A + 1 = B . To obtain the true number from the 10's complement B: A = 10000 - B . For example, to obtain the true number from the 10's complement 2444: 10000 - 2444 = 7556 .

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D110 and CY will be subtracted from D100 as 4-digit BCD values, and the result will be output to D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D111, D110, and CY will be subtracted from D101 and D100 as 8-digit BCD values, and the result will be output to D121 and D120.

If the result of the subtraction is a negative number (Mi < Su or Mi +1 , Mi < Su +1 , Su), the result is output as a 10's complement. The Carry Flag (CY) will turn ON. To convert the 10's complement to the true number, a program which subtracts the result from 0 is necessary, as an input condition of the Carry Flag (CY). The Carry Flag turning ON thus indicates that the result of the subtraction is negative.

OMRON CP1E - Sample program - 3

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY MULTIPLY*@*420Multiplies 4-digit signed hexadecimal data and/or constants.
DOUBLE SIGNED BINARY MULTIPLY*L@@L421Multiplies 8-digit signed hexadecimal data and/or constants.
Symbol**L
*(420)Md: Multipicand word*(421)Md: 1st multiplicand word
MdMdMr: 1st multiplier word
MrMr: Multiplier wordMr
RR: Result wordRR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
**L**L
Md*: Multipicand word *L: First multiplicand wordINTDINT12
Mr*: Multiplier word *L: First multiplier wordINTDINT12
RFirst result wordDINTLINT24

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Md, MrOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
**L
Error FlagP_EROFFOFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.ON when the result is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.ON when the leftmost bit of the result is 1. OFF in all other cases.

Function

OMRON CP1E - Function - 1

^*(420) multiplies the signed binary values in Md and Mr and outputs the result to R, R + 1

OMRON CP1E - Function - 2

^*L

^*L(421) multiplies the signed binary values in Md and Md + 1 and Mr and Mr + 1 and outputs the result to R, R + 1 , R + 2 , and R + 3 .

OMRON CP1E - ^*L - 1

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100 and D110 will be multiplied as 4-digit signed hexadecimal values and the result will be output to D120 and D121.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101, D100, D111, and D110 will be multiplied as 8-digit signed hexadecimal values and the result will be output to D123, D122, D121 and D120.

*B/*BL

InstructionMnemonicVariationsFunction codeFunction
BCD MULTIPLY*B@*B424Multiplies 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD MULTIPLY*BL@*BL425Multiplies 8-digit (double-word) BCD data and/or constants.
Symbol*B*BL
-B(424)-Md: Multipicand word-Md: 1st multiplicand wordMd: 1st multiplicand word
Md
MrMr: Multiplier wordMr: 1st multiplier wordMr: 1st multiplier word
RR: Result wordR: 1st result wordR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
*B*BL*B*BL
Md*B: Multipicand word *BL: First multiplicand wordWORDDWORD12
Mr*B: Multiplier word *BL: First multiplier wordWORDDWORD12
RFirst result wordDWORDLWORD24

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Md, MrOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
*B*BL
Error FlagP_ER• ON when Md is not BCD. • ON when Mr is not BCD. • OFF in all other cases.• ON when Md and/or Md+1 are not BCD. • ON when Mr and/or Mr +1 are not BCD. • OFF in all other cases.
Equals FlagP_EQ• ON when the result is 0. • OFF in all other cases.• ON when the result is 0. • OFF in all other cases.

Function

^*B

*B(424) multiplies the BCD content of Md and Mr and outputs the result to R, R+1.

OMRON CP1E - Function - 1

*BL

*BL(425) multiplies BCD values in Md and Md+1 and Mr and Mr+1 and outputs the result to R, R+1, R+2, and R+3.

OMRON CP1E - Function - 2

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100 and D110 will be multiplied as 4-digit BCD values and the result will be output to D121 and D120.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101, D100, D111, and D110 will be multiplied as 8-digit unsigned BCD values and the result will be output to D123, D122, D121 and D120.

1, /L

InstructionMnemonicVariationsFunction codeFunction
SIGNED BINARY DIVIDE/@/430Divides 4-digit (single-word) signed hexadecimal data and/or constants.
DOUBLE SIGNED BINARY DIVIDE/L%@/L431Divides 8-digit (double-word) signed hexadecimal data and/or constants.
Symbol//L
/(430)Dd: Dividend word/(431)Dd: 1st dividend word
DdDdDr: 1st divisor word
DrDr: Divisor wordDr
RR: Result wordRR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
//L//L
Dd: Dividend word /L: First dividend wordINTDINT12
Dr: Divisor word /L: First divisor wordINTDINT12
RFirst result wordDWORDLWORD24

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Dd, DrOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_ERON when the divisor is 0. OFF in all other cases.
Equals FlagP_EQON when as a result of the division, R/R+1, R is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the R/R+1, R is 1. OFF in all other cases.

Function

/(430) divides the signed binary (16 bit) values in Dd by those in Dr and outputs the result to R, R+1. The quotient is placed in R and the remainder in R+1.

OMRON CP1E - Function - 1

Note Division of hexadecimal #8000 by #FFFF is undefined.

/L(431) divides the signed binary values in Dd and Dd + 1 by those in Dr and Dr + 1 and outputs the result to R, R + 1 , R + 2 , and R + 3 . The quotient is output to R and R + 1 and the remainder is output to R + 2 and R + 3 .

OMRON CP1E - Function - 1

Note Division of hexadecimal #80000000 by FFFFFFFF is undefined.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100 will be divided by D110 as 4-digit signed binary values and the quotient will be output to D120 and the remainder to D121.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101 and D100 are divided by D111 and D110 as 8-digit signed hexadecimal values and the quotient will be output to D121 and D120 and the remainder to D123 and D122.

/B, /BL

InstructionMnemonicVariationsFunction codeFunction
BCD DIVIDE/B@/B434Divides 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD DIVIDE/BL@/BL435Divides 8-digit (double-word) BCD data and/or constants.
Symbol/B/BL
—| |—/B(434)—| |—/Dd: Dividend word—| |—/Dd: Dd: 1st dividend word—| |—/Dr: 1st divisor word
Dr: Divisor word
R: Result wordRR: 1st result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
/B/BL/B/BL
Dd/B: Dividend word /BL: First dividend wordWORDDWORD12
Dr/B: Divisor word /BL: First divisor wordWORDDWORD12
RFirst result wordDWORDLWORD24

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Dd, DrOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
/B/BL
Error FlagP_ER• ON when Dd is not BCD. • ON when Dr is not BCD. • ON when the divisor is 0. • OFF in all other cases.• ON when Dd, Dd+1 is not BCD. • ON when Dr, Dr +1 is not BCD. • ON when the divisor is 0. • OFF in all other cases.
Equals FlagP_EQ• ON when as a result of the division R is 0. • OFF in all other cases.• ON when as a result of the division R+1, R is 0. • OFF in all other cases.

Function

/B

/B(434) divides the BCD content of Dd by those of Dr and outputs the quotient to R and the remainder to R+1.

OMRON CP1E - /B - 1

/BL

/BL(435) divides BCD values in Dd and Dd+1 by those in Dr and Dr+1 and outputs the quotient to R, R+1 and the remainder to R+2, R+3.

OMRON CP1E - /BL - 1

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, D100 will be divided by D110 as 4-digit BCD values and the quotient will be output to D120 and the remainder to D121.

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, D101 and D100 will be divided by D111 and D110 as 8-digit BCD values and the quotient will be output to D121 and D120 and the remainder to D123 and D122.

Conversion Instructions

BIN/BINL

InstructionMnemonicVariationsFunction codeFunction
BCD TO BINARYBIN@BIN023Converts BCD data to binary data.
DOUBLE BCD TO DOUBLE BINARYBINL@BINL058Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary) data.
SymbolBINBINL
BIN(023)SS: Source wordR: Result wordBINL(058)SS: First source wordR: First result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
BINBINLBINBINL
SBIN: Source word
BINL: First source wordWORDDWORD12
RBIN: Results word
BINL: First result wordUINTUDINT12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S,ROKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
BINBINL
Error FlagP_ERON if the content of S is not BCDOFF in all other cases.ON if the contents of S+1, S are not BCDOFF in all other cases.
Equals FlagP_EQON if the result is 0000OFF in all other cases.ON if the result is 0OFF in all other cases.
Negative FlagP_NOFFOFF

Function

BIN

BIN(023) converts the BCD data in S to binary data and writes the result to R.

OMRON CP1E - BIN - 1

The following diagram shows an example BCD-to-binary conversion.

OMRON CP1E - BIN - 2

BINL

BINL(058) converts the 8-digit BCD data in S and S+1 to 8-digit hexadecimal (32-bit binary) data and writes the result to R and R+1.

OMRON CP1E - BINL - 1

The following diagram shows an example of 8-digit BCD-to-binary conversion.

OMRON CP1E - BINL - 2

OMRON CP1E - BINL - 3

Sample program

When CIO 0.00 is ON in the following example, the 8-digit BCD value in CIO 0010 and CIO 0011 is converted to hexadecimal and stored in D200 and D201.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

BCD/BCDL

InstructionMnemonicVariationsFunction codeFunction
BINARY TO BCDBCD@BCD024Converts a word of binary data to a word of BCD data.
DOUBLE BINARY TO DOUBLE BCDBCDL@BCDL059Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD data.
SymbolBCDBCDL
BCD(024)S RS: Source word D: Result wordBCDL(059)S RS: First source word D: First result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
BCDBCDLBCDBCDL
SBCD: Source wordBCDL: First source wordUINTUDINT12
RBCD: Result wordBCDL: First result wordWORDDWORD12

S: Source Word (BCD)/First Source Word (BCDL)

BCD

S must be between 0000 and 270F hexadecimal (0000 and 9999 decimal).

  • BCDL

The content of S+1 and S must be between 0000 0000 and 05F5 E0FF hexadecimal (0000 0000 and 9999 9999 decimal).

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S,ROKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
BCDBCDL
Error FlagP_ERON if the content of S exceeds 270F (9999 decimal).OFF in all other cases.ON if the contents of S and S+1 exceed 05F5E0FF (9999 9999 decimal).OFF in all other cases.
Equals FlagP_EQON if the result is 0000OFF in all other cases.ON if the result is 0OFF in all other cases.

Function

BCD

BCD(024) converts the binary data in S to BCD data and writes the result to R.

OMRON CP1E - BCD - 1

The following diagram shows an example BCD-to-binary conversion.

OMRON CP1E - BCD - 2

BCDL

BCDL(059) converts the 8-digit hexadecimal (32-bit binary) data in S and S+1 to 8-digit BCD data and writes the result to R and R+1.

OMRON CP1E - BCDL - 1

The following diagram shows an example of 8-digit BCD-to-binary conversion.

OMRON CP1E - BCDL - 2

OMRON CP1E - BCDL - 3

Sample program

When CIO 0.00 is ON in the following example, the hexadecimal value in CIO 11 and CIO 10 is converted to a BCD value and stored in D100 and D101.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3
2 × 16^5 + 13 × 16^4 + 3 × 16^3 + 2 × 16^2 + 10 = 2961930

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

NEG

InstructionMnemonicVariationsFunction codeFunction
2'S COMPLEMENTNEG@NEG160Calculates the 2's complement of a word of hexadecimal data.
SymbolNEG
NEG(160)S: Source word
SR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordWORD1
RResult wordUINT1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if the result is 0000/0000 0000. OFF in all other cases.
Negative FlagP_NON if bit 15 of the result is ON. OFF in all other cases.

Function

- NEG

NEG(160) calculates the 2's complement of S and writes the result to R. The 2's complement calculation basically reverses the status of the bits in S and adds 1.

2's complement (Complement + 1)
(S) →(R)

Note The result for 8000 hex will be 8000 hex.

Hint

  • This operation (reversing the status of the bits and adding 1) is equivalent to subtracting the content of S/S+1 and S from 0000/0000 0000.

Sample program

When CIO 0.00 is ON in the following example, NEG(160) calculates the 2's complement of the content of D100 and writes the result to D200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

MLPX

InstructionMnemonicVariationsFunction codeFunction
DATA DECODERMLPX@MLPX076Reads the numerical value in the specified digit (or byte) in the source word with 4-to 16 conversion (or 8-to-256 conversion), turns ON the corresponding bit in the result word, and turns OFF all other bits in the result word.
SymbolMLPX
MLPX(076)
S
C
R
S: Source word
C: Control word
R: First result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordUINT1
CControl wordUINT1
RFirst result wordUINTVariable

- 4-to-16 bit decoder

S: Source Word

15 12 11 8 7 4 3 0 S Digit 3 Digit 2 Digit 1 Digit 0

Digits from the starting digit going left are decoded

(Returns to digit 3 after digit 0)

R: First Result Word

D: Decoding result of 1st digit of decoded digits
D+1: Decoding result of 2nd digit of decoded digits
D+2: Decoding result of 3rd digit of decoded digits
D+3: Decoding result of 4th digit of decoded digits

Note The result words must be in the same data area.

C: Control Word

OMRON CP1E - C: Control Word - 1

8-to-256 bit conversion

S: Source Word

15870
Digit 1Digit 0
Digits from the starting digit going left are decoded (Returns to digit 0 after digit 1)

R: First Result Word

D+15 to D: Decoding result of 1st digit of decoded digits

D+31 to D+16:

Decoding result of 2nd digit of decoded digits

Note The result words must be in the same data area.

C: Control Word

OMRON CP1E - C: Control Word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------
COK
R---

Flags

NameLabelOperation
Error FlagP_ERON if C is not within the specified rangesOFF in all other cases.

Function

MLPX(076) can perform 4-to-16 bit or 8-to-256 bit conversions. Set the leftmost digit of C to 0 to specify 4-to-16 bit conversion and set it to 1 to specify 8-to-256 bit conversion.

- 4-to-16 bit Conversion

When the leftmost digit of C is 0, MLPX(076) takes the value of the specified digit in S (0 to F) and turns ON the corresponding bit in the result word. All other bits in the result word will be turned OFF. Up to four digits can be converted.

OMRON CP1E - - 4-to-16 bit Conversion - 1

- 8-to-256 bit Conversion

When the leftmost digit of C is 1, MLPX(076) takes the value of the specified byte in S (00 to FF) and turns ON the corresponding bit in the range of 16 result words. All other bits in the result words will be turned OFF. Up to two bytes can be converted.

OMRON CP1E - - 8-to-256 bit Conversion - 1

Hint

As shown at right, 4 to 16 decoding consists of taking the 4-bit binary value as the bit number and setting 1 in that bit number and 0 in the other bit numbers of the 16 bits.

As shown at right, 8 to 256 decoding consists of taking the 8-bit binary value as the bit number and setting 1 in that bit number and 0 in the other bit numbers of the 256 bits.

OMRON CP1E - Hint - 1

Precaution

- 4-to-16 bit conversion

When two or more digits are being converted, MLPX(076) will read the digits in S from right to left and will wrap around to the rightmost digit after the leftmost digit, if necessary.

- 8-to-256 bit conversion

When two bytes are being converted, MLPX(076) will read the bytes in S from right to left and will wrap around to the rightmost byte if the leftmost byte (byte 1) has been specified as the starting byte.

Sample program

- 4-to-16 bit Conversion

When CIO 0.00 is ON in the following example, MLPX(076) will convert 3 digits in S beginning with digit 1 (the second digit), as indicated by C (#0021). The corresponding bits in D100, D101, and D102 will be turned ON.

OMRON CP1E - - 4-to-16 bit Conversion - 1

OMRON CP1E - - 4-to-16 bit Conversion - 2

Bits 0 to 3: Starting digit (Digit 1)
Bits 4 to 7: Number of digits (3 digits)

Digit 1 contains 6, so bit 6 is turned ON.
Digit 2 contains A, so bit 10 is turned ON.
Digit 3 contains F, so bit 15 is turned ON.

8-to-256 bit Conversion

When CIO 0.00 is ON in the following example, MLPX(076) will convert the 2 bytes in S beginning with byte 1 (the leftmost byte), as indicated by C (#1011). The corresponding bits in D100 to D115 and D116 to D131 will be turned ON.

OMRON CP1E - 8-to-256 bit Conversion - 1

OMRON CP1E - 8-to-256 bit Conversion - 2

- Example of multi-digit decoding

Example of 4-to-16 bit decoding

OMRON CP1E - - Example of multi-digit decoding - 1
C: #0010

OMRON CP1E - - Example of multi-digit decoding - 2
C: #0030

OMRON CP1E - - Example of multi-digit decoding - 3
C: #0031

Example of 8-to-256 bit decoding

OMRON CP1E - - Example of multi-digit decoding - 4
C: #1010

OMRON CP1E - - Example of multi-digit decoding - 5
C: #1011

DMPX

InstructionMnemonicVariationsFunction codeFunction
DATA ENCODERDMPX@DMPX077Find the location of the first or last ON bit within the source word with 16-to-4 conversion (or 256-to-8 conversion), and writes that value to the spec-ified digit (or byte) in the result word.
SymbolDMPX
— | —DMPX(077) —
S
R
C
C: Control word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordUINTVariable
RResult wordUINT1
CControl wordUINT1

16-to-4 bit conversion

S: First Source Word

S: 1st digit of digits to be encoded

S+1: 2nd digit of digits to be encoded
S+2: 3rd digit of digits to be encoded
S+3: 4th digit of digits to be encoded

R: Result Word

OMRON CP1E - R: Result Word - 1

The results of encoding of S to S + 3 are stored from the starting digit going left (returns to digit 0 after digit 3).

Note The source words must be in the same data area.

C: Control Word

OMRON CP1E - C: Control Word - 1

256-to-8 bit conversion

S: First Source Word

S+15 to S: 1st digit of digits to be encoded
S+31 to S+16: 2nd digit of digits to be encoded

R: Result Word

Note The source words must be in the same data area.

C: Control word

OMRON CP1E - C: Control word - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S,ROKOKOKOKOKOKOKOKOK------------
COK

Flags

NameLabelOperation
Error FlagP_ERON if any of the source words contains 0000 hex (i.e., no bit to encode).ON if C is not within the specified ranges.OFF in all other cases.

Function

DMPX(077) can perform 16-to-4 bit or 256-to-8 bit conversions. Set the leftmost digit of C to 0 to specify 16-to-4 bit conversion and set it to 1 to specify 256-to-8 bit conversion.

16-to-4 bit Conversion

When the fourth (leftmost) digit of C is 0, DMPX(077) finds the locations of the leftmost or rightmost ON bits in up to 4 source words and writes these locations to R beginning with the specified digit.

OMRON CP1E - 16-to-4 bit Conversion - 1

- 256-to-8 bit Conversion

When the fourth (leftmost) digit of C is 1, DMPX(077) finds the locations of the leftmost (highest bit address) or rightmost (lowest bit address) ON bits in one or two 16-word ranges of source words. The locations of these bits are written to R beginning with the specified byte.

OMRON CP1E - - 256-to-8 bit Conversion - 1

Hint

As shown at right, 16 to 4 encoding consists of converting the bit number (m) of the leftmost or rightmost bit that has 1 set among the 16 bits to a 4-bit binary value.

OMRON CP1E - Hint - 1

As shown at right, 256 to 8 encoding consists of converting the bit number (m) of the leftmost or rightmost bit that has 1 set among the 256 bits to an 8-bit binary value.

OMRON CP1E - Hint - 2

Precaution

16-to-4 bit conversion

When two or more digits are being converted, DMPX(077) will write the values to the digits in R from right to left and will wrap around to the rightmost digit after the leftmost digit, if necessary.

256-to-8 bit conversion

When two bytes are being converted, DMPX(077) will write the values to the bytes in R from right to left and will wrap around to the rightmost byte if the leftmost byte (byte 1) has been specified as the starting byte.

Sample program

16-to-4 bit Conversion

When CIO 0.00 is ON in the following example, DMPX(077) will find the leftmost ON bits in CIO 100, CIO 101, and CIO 102 and write those locations to 3 digits in R beginning with digit 1 (the second digit), as indicated by C (#0021).

OMRON CP1E - 16-to-4 bit Conversion - 1

OMRON CP1E - 16-to-4 bit Conversion - 2

- Example of multi-digit decoding

Example of 16-to-4 bit decoding

OMRON CP1E - - Example of multi-digit decoding - 1

OMRON CP1E - - Example of multi-digit decoding - 2

OMRON CP1E - - Example of multi-digit decoding - 3

OMRON CP1E - - Example of multi-digit decoding - 4

OMRON CP1E - - Example of multi-digit decoding - 5
- 256-to-8 bit Conversion

OMRON CP1E - - Example of multi-digit decoding - 6

If the conversion data contains 0000 hex, but other data is to be encoded, separate the conversion by using more than one DMPX(077) instructions.

InstructionMnemonicVariationsFunction codeFunction
ASCII CONVERTASC@ASC086Converts 4-bit hexadecimal digits in the source word into their 8-bit ASCII equivalents.
SymbolASC
—|—|—ASC(086)
S
DI
D
D: Source word
DI: Digit designator
D: First destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordUINT1
DIDigit designatorUINT1
DFirst destination wordUINTVariable

S: Source Word

15121187430
Digit 3Digit 2Digit 1Digit 0

Digits from the starting digit of conversion going left are treated as HEX data and converted to ASCII code (returns to digit 0 after digit 3)

D: First Destination Word

15870
D+1Leftmost byteRightmost byte
Leftmost byteRightmost byte
D+2Leftmost byteRightmost byte

ASCII code is stored in the left word side. The code is stored from the output starting byte of D in the order rightmost byte, leftmost byte.
Note The destination words must be in the same data area.

DI: Digit Designator

The digit designator specifies various parameters for the conversion, as shown in the following diagram.

OMRON CP1E - DI: Digit Designator - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------
DIOK
D---

Flags

NameLabelOperation
Error FlagP_ERON if the content of Di is not within the specified ranges. OFF in all other cases.

Function

ASC(086) treats the contents of S as 4 hexadecimal digits, converts the designated digit(s) of S into their 8-bit ASCII equivalents, and writes this data into the destination word(s) beginning with the specified byte in D.

A parity specification (bits 12 to 15 of K) is possible in the leftmost bit of the ASCII code data, and this can be converted to an odd or even parity bit (the number of bits that are 1 of the eight bits is adjusted to odd or even).

OMRON CP1E - Function - 1

Hint

  • The parity bit is appended to the data to enable detection of errors when the data is transmitted. By adding this bit, the number of bits that are 1 in the data can be indicated as odd or even, and if the number of 1s in the received data is not similarly odd or even, it is assumed that an error has occurred.

Precaution

  • When multiple digits are specified in the number of digits to be converted (K), the digits are converted in order from the starting conversion digit going left (returns to digit 0 after digit 3), and the conversion results are stored in order from the output position of D going to the left word side (in units of 8 bits).
  • Among the data in the conversion result output word, data in positions that are not to be output are held.
  • When converting multiple digits, take care that D+1 and D+2CH do not exceed the area.

Sample program

When CIO 0.00 is ON in the following example, ASC(086) converts three hexadecimal digits in D100 (beginning with digit 1) into their ASCII equivalents and writes this data to D200 and D201 beginning with the leftmost byte in D200. In this case, a digit designator of #0121 specifies no parity, the starting byte (when writing) = leftmost byte, the number of digits to read = 3, and the starting digit (when reading) = digit 1.

OMRON CP1E - Sample program - 1

  • Example of ASCII code conversion
Content of conversion data digitsConversion output data
ValueBit contentCode(MSB) bit content (LSB)
00000#30*0110000
10001#31*0110001
20010#32*0110010
30011#33*0110011
40100#34*0110100
50101#35*0110101
60110#36*0110110
70111#37*0110111
81000#38*0111000
91001#39*0111001
A1010#41*1000001
B1011#42*1000010
C1100#43*1000011
D1101#44*1000100
E1110#45*1000101
F1111#46*1000110
  • Parity bit - changes according to the parity specification.

- Parity

It is possible to specify the parity of the ASCII data for use in error control during data transmissions. The leftmost bit of each ASCII character will be automatically adjusted for even, odd, or no parity.

  • When no parity (0) is designated, the leftmost bit will always be zero. When even parity (1) is designated, the leftmost bit will be adjusted so that the total number of ON bits is even. When odd parity (2) is designated, the leftmost bit of each ASCII character will be adjusted so that there is an odd number of ON bits. The status of the parity bit does not affect the meaning of the ASCII code.
    Examples of even parity:

When adjusted for even parity, ASCII "31" (00110001) will be "B1" (10110001: parity bit turned ON to create an even number of ON bits); ASCII "36" (00110110) will be "36" (00110110: parity bit remains OFF because the number of ON bits is already even).

Examples of odd parity:

When adjusted for odd parity, ASCII "36" (00110110) will be "B6" (10110110: parity bit turned ON to create an odd number of ON bits); ASCII "46" (01000110) will be "46" (01000110: parity bit remains OFF because the number of ON bits is already odd).

Examples of Di

OMRON CP1E - Examples of Di - 1

OMRON CP1E - Examples of Di - 2

OMRON CP1E - Examples of Di - 3

OMRON CP1E - Examples of Di - 4

HEX

InstructionMnemonicVariationsFunction codeFunction
ASCII TO HEXHEX@HEX162Converts up to 4 bytes of ASCII data in the source word to their hexadecimal equivalents and writes these digits in the specified destination word.
SymbolHEX
HEX(162)
S
DI
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordUINTVariable
DIDigit designatorUINT1
DDestination wordUINT1

S: First Source Word

OMRON CP1E - S: First Source Word - 1

The conversion start byte and bytes to the left are treated as ASCII code and converted to hex (returns to the rightmost byte after the leftmost byte.

D: Destination Word

OMRON CP1E - D: Destination Word - 1

The results of conversion to hex are stored from the starting digit going left (returns to digit 0 after digit 3)

DI: Digit Designator

The digit designator specifies various parameters for the conversion, as shown in the following diagram.

OMRON CP1E - DI: Digit Designator - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------
DIOK
D---

Flags

NameLabelOperation
Error FlagP_ERON if there is a parity error in the ASCII data.ON if the ASCII data in the source words is not equivalent to hexadecimal digitsON if the content of Di is not within the specified ranges.OFF in all other cases.

Function

HEX(162) treats the contents of the source word(s) as ASCII data representing hexadecimal digits (0 to 9 and A to F), converts the specified number of bytes to hexadecimal, and writes the hexadecimal data to the destination word beginning at the specified digit.

When converting data, the leftmost bit of the ASCII code data can be treated as an odd or even parity bit according to the parity specification.

OMRON CP1E - Function - 1

Hint

  • The parity bit is appended to the data to enable detection of errors when the data is transmitted. By adding this bit, the number of bits that are 1 in the data can be indicated as odd or even, and if the number of 1s in the received data is not similarly odd or even, it is assumed that an error has occurred.

Precaution

  • When multiple digits are specified in the number of digits to be converted (C), the digits are converted in order from the starting conversion position (C) of S going to the left word side, and the conversion results are stored in order from the output starting bit (C) of D going to the left (returns to digit 0 after digit 3).
  • Among the data in the conversion result output word, data of bits that are not to be output are held (kept the same as before).
  • The following table shows ASCII data which can be contained in the source word(s) (excluding parity bits) and corresponding hexadecimal digits.
ASCII data (2 hexadecimal digits)Hexadecimal digits
30 to 390 to 9
41 to 46A to F

Sample program

When CIO 0.00 is ON in the following example, HEX(162) converts the ASCII data in D100 and D101 according to the settings of the digit designator. (Di=#0121 specifies no parity, the starting byte (when reading) = leftmost byte, the number of bytes to read = 3, and the starting digit (when writing) = digit 1.) HEX(162) converts three bytes of ASCII data (3 characters) beginning with the leftmost byte of D100 into their hexadecimal equivalents and writes this data to D200 beginning with digit 1.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

- Parity

It is possible to specify the parity of the ASCII data for use in error control during data transmissions. The leftmost bit in each byte is the parity bit. With no parity the parity bit should always be zero, with even parity the status of the parity bit should result in an even number of ON bits, and with odd parity the status of the parity bit should result in an odd number of ON bits.

The following table shows the operation of HEX(162) for each parity setting.

Parity setting(leftmost digit of Di)Operation of HEX(162)
No parity (0)HEX(162) will be executed only when the parity bit in each byte is 0. An error will occur if a parity bit is non-zero.
Even parity (1)HEX(162) will be executed only when there is an even number of ON bits in each byte. An error will occur if a byte has an odd number of ON bits.
Odd parity (2)HEX(162) will be executed only when there is an odd number of ON bits in each byte. An error will occur if a byte has an even number of ON bits.

- Output example

Conversion dataOutput result (hex data)
ASCII code(MSB) bit content (LSB)ValueBit content
#30*011000000000
#31*011000110001
#32*011001020010
#33*011001130011
#34*011010040100
#35*011010150101
#36*011011060110
#37*011011170111
#38*011100081000
#39*011100191001
#41*1000001A1010
#42*1000010B1011
#43*1000011C1100
#44*1000100D1101
#45*1000101E1110
#46*1000110F1111
  • Parity bit - changes according to the parity specification.

When CIO 0.00 is ON in the following example, HEX(162) converts the ASCII data in D10 beginning with the rightmost byte and writes the hexadecimal equivalents in D300 beginning with digit 1.

The digit designator setting of #1011 specifies even parity, the starting byte (when reading) = rightmost byte, the number of bytes to read = 2, and the starting digit (when writing) = digit 1.)

OMRON CP1E - - Output example - 1

OMRON CP1E - - Output example - 2

OMRON CP1E - - Output example - 3

- Example of converting multiple bytes of ASCII code to hex

OMRON CP1E - - Example of converting multiple bytes of ASCII code to hex - 1

OMRON CP1E - - Example of converting multiple bytes of ASCII code to hex - 2

OMRON CP1E - - Example of converting multiple bytes of ASCII code to hex - 3

Logic Instructions

ANDW/ANDL

InstructionMnemonicVariationsFunction codeFunction
LOGICAL ANDANDW@ANDW034Takes the logical AND of corresponding bits in single words of word data and/or constants.
DOUBLE LOGICAL ANDANDL@ANDL610Takes the logical AND of corresponding bits in double words of word data and/or constants.
SymbolANDWANDL
ANDW(034)I1: Input 1ANDL(610)I1: Input 1
I1I2: Input 2I2I2: Input 2
RR: Result wordRR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
ANDWANDLANDWANDL
I1Input 1WORDDWORD12
I2Input 2WORDDWORD12
RResult wordWORDDWORD12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
I1, I2OKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of R is 1. OFF in all other cases.

Function

ANDW

ANDW(034) takes the logical AND of data specified in I_1 and I_2 and outputs the result to R .

$$ \mathbf {I} _ {1}, \mathbf {I} _ {2} \rightarrow \mathsf {R} $$

I1I2R
111
100
010
000

- ANDL

ANDL(610) takes the logical AND of data specified in I_1 , I_1 + 1 and I_2 , I_2 + 1 and outputs the result to R , R + 1 .

$$ \left(\mathrm {I} _ {1}, \mathrm {I} _ {1} + 1\right) \cdot \left(\mathrm {I} _ {2}, \mathrm {I} _ {2} + 1\right)\rightarrow (\mathrm {R}, \mathrm {R} + 1) $$

I1, I1+1I2, I2+1R, R+1
111
100
010
000

Sample program

When the execution condition CIO 0.00 is ON, the logical AND is taken of corresponding bits in CIO 11, CIO 10 and CIO 21, CIO 20 and the results will be output to corresponding bits in D201 and D200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3
A
C

OMRON CP1E - Sample program - 4
Note The vertical arrow indicates logical AND.

ORW/ORWL

InstructionMnemonicVariationsFunction codeFunction
LOGICAL ORORW@ORW035Takes the logical OR of corresponding bits in single words of word data and/or constants.
DOUBLE LOGICAL ORORWL@ORWL611Takes the logical OR of corresponding bits in double words of word data and/or constants.
SymbolORWORWL
ORW(035)I1: Input 1ORWL(611)I1: Input 1
I1I2: Input 2I1I2: Input 2
RR: Result wordRR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
ORWORWLORWORWL
I1Input 1WORDDWORD12
I2Input 2WORDDWORD12
RResult wordWORDDWORD12

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
I1, I2OKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of R is 1. OFF in all other cases.

Function

ORW

ORW(035) takes the logical OR of data specified in I_1 and I_2 and outputs the result to R.

$$ \mathbf {I} _ {1}, \mathbf {I} _ {2} \rightarrow \mathsf {R} $$

I1I2R
111
101
011
000

ORWL

ORWL(611) takes the logical OR of data specified in I_1 and I_2 as double-word data and outputs the result to R , R + 1 .

$$ (I _ {1}, I _ {1} + 1) + (I _ {2}, I _ {2} + 1) \rightarrow (R, R + 1) $$

\( I_1, I_1+1 \)\( I_2, I_2+1 \)R, R+1
111
101
011
000

Sample program

When the execution condition CIO 0.00 is ON, the logical OR is taken of corresponding bits in CIO 21, CIO 20 and CIO 31, CIO 30 and the results will be output to corresponding bits in D501 and D500.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2
Note The vertical arrow indicates logical OR.

XORW/XORL

InstructionMnemonicVariationsFunction codeFunction
EXCLUSIVE ORXORW@XORW036Takes the logical exclusive OR of corresponding bits in single words of word data and/or constants.
DOUBLE EXCLUSIVE ORXORL@XORL612Takes the logical exclusive OR of corresponding bits in double words of word data and/or constants.
SymbolXORWXORL
XORW(036)I1: Input 1XORL(612)I1: Input 1
I1I2: Input 2I1I2: Input 2
RR: Result wordRR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
XORWXORLXORWXORL
I1Input 1WORDDWORD12
I2Input 2WORDDWORD12
RResult wordWORDDWORD12

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
I1, I2OKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of R is 1. OFF in all other cases.

Function

XORW

XORW(036) takes the logical exclusive OR of data specified in I_1 and I_2 and outputs the result to R .

$$ \mathrm {I} _ {1} \bullet \overline {{\mathrm {I} _ {2}}} + \overline {{\mathrm {I} _ {1}}} \bullet \mathrm {I} _ {2} \rightarrow \mathrm {R} $$

I1I2R
110
101
011
000

XORL

XORL(612) takes the logical exclusive OR of data specified in I_1 and I_2 as double-word data and outputs the result to R , R + 1 .

$$ \left(\mathrm {I} _ {1}, \mathrm {I} _ {1} + 1\right) \bullet \overline {{\left(\mathrm {I} _ {2} , \mathrm {I} _ {2} + 1\right)}} + \overline {{\left(\mathrm {I} _ {1} , \mathrm {I} _ {1} + 1\right)}} \bullet \left(\mathrm {I} _ {2}, \mathrm {I} _ {2} + 1\right)\rightarrow (\mathrm {R}, \mathrm {R} + 1) $$

I1, I1+1I2, I2+1R, R+1
110
101
011
000

Sample program

When the execution condition CIO 0.00 is ON, the logical exclusive OR is taken of corresponding bits in CIO 151, CIO 150 and D1001, D1000 and the results will be output to corresponding bits in D1201 and D1200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2
Note The symbol indicates exclusive logical OR.

COM/COML

InstructionMnemonicVariationsFunction codeFunction
COMPLEMENTCOM@COM029Turns OFF all ON bits and turns ON all OFF bits in Wd.
DOUBLE COMPLEMENTCOML@COML614Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1.
SymbolCOMCOML
COM(029) WdWd: WordCOML(614) WdWd: Word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
COMCOMLCOMCOML
WdWordWORDDWORD12

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
WdOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON when the result is 0. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of R is 1. OFF in all other cases.

Function

COM

COM(029) reverses the status of every specified bit in Wd.

Wd .. 1 0 and 0 1

Note When using the COM instruction, be aware that the status of each bit will change each cycle in which the execution condition is ON.

COML

COML(614) reverses the status of every specified bit in Wd and Wd+1.

Note When using the COML instruction, be aware that the status of each bit will change each cycle in which the execution condition is ON.

Sample program

When CIO 0.00 is ON in the following example, the status of each bit D100 will be reversed.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

When CIO 0.00 is ON in the following example, the status of each bit in D100 and D101 will be reversed.

OMRON CP1E - Sample program - 3

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

Special Math Instructions

APR

InstructionMnemonicVariationsFunction codeFunction
ARITHMETIC PROCESSAPR@APR069Calculates the sine, cosine, or a linear extrapolation of the source data.
SymbolAPR
APR(069)C: Control word
CS: Source word
SR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CControl wordUINTVariable
SSource dataWORD1
RResult wordWORD1

Sine Function

OperandValueData range
C0000 hex---
S0000 to 0900 (BCD)0° to 90°
R0000 to 9999 (BCD) 9999 (BCD)0.0000 to 0.9999 1.0000

- Cosine Function

OperandValueData range
C0001 hex---
S0000 to 0900 (BCD)0° to 90°
R0000 to 9999 (BCD) 9999 (BCD)0.0000 to 0.9999 1.0000

Note The actual result for SIN(90^) and COS(0^) is 1, but 9999 (0.9999) will be output to R.

  • Sine Function (C=0000)

When C is 0000, APR(069) calculates the SIN(S) and writes the result to R. The range for S is 0000 to 0900 BCD (0.0° to 90.0°) and the range for R is 0000 to 9999 BCD (0.0000 to 0.9999). The remainder of the result beyond the fourth decimal place is eliminated.

  • Cosine Function (C=0001)

When C is 0001, APR(069) calculates the COS(S) and writes the result to R. The range for S is 0000 to 0900 BCD (0.0° to 90.0°) and the range for R is 0000 to 9999 BCD (0.0000 to 0.9999). The remainder of the result beyond the fourth decimal place is eliminated.

- Linear Extrapolation Function

OperandValueData range
CData area address---
S16-bit unsigned BCD data0000 to 9999
16-bit unsigned binary data0 to 65,535
16-bit signed binary data-32,768 to 32,767
32-bit signed binary data-2,147,483,648 to 2,147,483,647
Floating-point data-∞, -3.402823 × 1038 to -1.175494 × 10-38, 1.175494 × 10-38 to 3.402823 × 1038, +∞
R16-bit unsigned BCD data0000 to 9999
16-bit unsigned binary data0 to 65,535
16-bit signed binary data-32,768 to 32,767
32-bit signed binary data-2,147,483,648 to 2,147,4,83,647
Floating-point data-∞, -3.402823 × 1038 to -1.175494 × 10-38, 1.175494 × 10-38 to 3.402823 × 1038, +∞

The following 5 kinds of I/O data can be used:

  • 16-bit unsigned BCD data
    16-bit unsigned binary data
    16-bit signed binary data
  • 32-bit signed binary data
  • Single-precision floating-point data

  • Linear Extrapolation (C = Data area address)

APR(069) linear extrapolation is specified when C is a word address.

The content of word C specifies the number of coordinates in a data table starting at C + 2 , the form of the source data, and whether data is BCD or binary.

OMRON CP1E - - Linear Extrapolation Function - 1

OMRON CP1E - - Linear Extrapolation Function - 2
Signed Integer Data (Binary)

OMRON CP1E - - Linear Extrapolation Function - 3
- Single-precision Floating-point Data

16-bit BCD16-bit binary (signed or unsigned) or 16-bit BCD data

C+1X0 (*1)
C+2Y0
C+3X1
C+4Y1
C+5X2
C+6Y2
Xn
Yn
C+ (2m+1)Xm
C+ (2m+2)Ym

Note: Write Xm (max. X value in the table) in word C+1 when the I/O data in S and D contain unsigned data (bit 11 of C = 0).

32-bit signed binary data

C+1X0 (rightmost 16 bits)
C+2X0 (leftmost 16 bits)
C+3Y0 (rightmost 16 bits)
C+4Y0 (leftmost 16 bits)
C+5X1 (rightmost 16 bits)
C+6X1 (leftmost 16 bits)
C+7Y1 (rightmost 16 bits)
C+8Y1 (leftmost 16 bits)
toto
C+ (4n+1)Xn (rightmost 16 bits)
C+ (4n+2)Xn (leftmost 16 bits)
C+ (4n+3)Yn (rightmost 16 bits)
C+ (4n+4)Yn (leftmost 16 bits)
toto
C+ (4m+1)Xm (rightmost 16 bits)
C+ (4m+2)Xm (leftmost 16 bits)
C+ (4m+3)Ym (rightmost 16 bits)
C+ (4m+4)Ym (leftmost 16 bits)

Floating-point data

C+1X0 (rightmost 16 bits)
C+2X0 (leftmost 16 bits)
C+3Y0 (rightmost 16 bits)
C+4Y0 (leftmost 16 bits)
C+5X1 (rightmost 16 bits)
C+6X1 (leftmost 16 bits)
C+7Y1 (rightmost 16 bits)
C+8Y1 (leftmost 16 bits)
toto
C+ (4n+1)Xn (rightmost 16 bits)
C+ (4n+2)Xn (leftmost 16 bits)
C+ (4n+3)Yn (rightmost 16 bits)
C+ (4n+4)Yn (leftmost 16 bits)
toto
C+ (4m+1)Xm (rightmost 16 bits)
C+ (4m+2)Xm (leftmost 16 bits)
C+ (4m+3)Ym (rightmost 16 bits)
C+ (4m+4)Ym (leftmost 16 bits)

Note: The X coordinates must be in ascending order: X1 < X2 < < Xm . Input all values of (X_n, Y_n) as binary data, regardless of the data format specified in control word C.

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
C,SOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_ERON if C is a constant greater than 0001. ON if C is a word address but the X coordinates are not in ascending order (X1 ≤ X2 ≤ ... ≤ Xm). ON if C is a word address and bits 9, 11, and 15 of C indicate BCD input, but S is not BCD. ON if C is a word address and bit 9 of C indicates floating-point data, but S is a one-word constant. ON if C is 0000 or 0001 but S is not BCD between 0000 and 0900. OFF in all other cases.
Equals FlagP_EQON if the result is 0. OFF in all other cases.
Negative FlagP_NON if bit 15 of R is ON. OFF in all other cases.

Function

Operation of the Linear Extrapolation Function

APR(069) processes the input data specified in S with the following equation and the line-segment data (X_n,Y_n) specified in the table beginning at C + 1 . The result is output to the destination word(s) specified with D.

Up to 256 endpoints can be stored in the line-segment data table beginning at C+1.

OMRON CP1E - Operation of the Linear Extrapolation Function - 1

- 16-bit Unsigned BCD Data

The input data and/or the output data can be 16-bit unsigned BCD data. Also, the linear extrapolation function can be set to operate on the value specified in S directly or on X_m -S. (X_m is the maximum value of X in the line-segment data.)

- 16-bit Unsigned Binary Data

The input data and/or the output data can be 16-bit unsigned binary data. Also, the linear extrapolation function can be set to operate on the value specified in S directly or on X_m -S. ( X_m is the maximum value of X in the line-segment data.)

- 16-bit Signed Binary Data

- 32-bit Signed Binary Data

Setting nameBit in CSetting
Input data (S) format150: Binary 1: BCD
Output data (D) format140: Binary 1: BCD
Source data form130: Operate on S 1: Operate on Xm-S
Signed data specification for S and D110: Unsigned data
Data length specification for S and D10Invalid (fixed at 16 bits)
Floating-point specification090: Integer data
Setting nameBit in CSetting
Input data (S) format150: Binary 1: BCD
Output data (D) format140: Binary 1: BCD
Source data form130: Operate on S 1: Operate on Xm-S
Signed data specification for S and D110: Unsigned data
Data length specification for S and D10Invalid (fixed at 16 bits)
Floating-point specification090: Integer data
Setting nameBit in CSetting
Input data (S) format150: Binary
Output data (D) format140: Binary
Source data form130
Signed data specification for S and D111: Signed data
Data length specification for S and D100: 16-bit signed binary data
Floating-point specification090: Integer data
Setting nameBit in CSetting
Input data (S) format150: Binary
Output data (D) format140: Binary
Source data form130
Signed data specification for S and D111: Signed data
Data length specification for S and D101: 32-bit signed binary data
Floating-point specification090: Integer data

Note If the "Data length specification for S and D" in bit 10 of C is set to 1 and a 16-bit constant is input for S, the input data will be converted to 32-bit signed binary before the linear extrapolation calculation.

  • Floating-point Data
Setting nameBit in CSetting
Input data (S) format150
Output data (D) format140
Source data form130
Signed data specification for S and D110
Data length specification for S and D100
Floating-point specification091: Floating-point data

Note If the "Floating-point specification" in bit 09 of C is set to 1, a constant cannot be input for S.

Sample program

- Sine Function (C: #0000)

The following example shows APR(069) used to calculate the sine of 30^ .

$$ (S I N (3 0) = 0. 5 0 0 0) $$

OMRON CP1E - - Sine Function (C: #0000) - 1

Source data

S: D0
0×10^1×10^0×10^-1
0300

Set the source data in × 10^-1 degrees. (0000 to 0900, BCD)

Result

R: D100
×10-1×10-2×10-3×10-4
5000

Result data has four significant digits, fifth and higher digits are ignored. (0000 to 9999, BCD)

- Cosine Function (C: #0001)

The following example shows APR(069) used to calculate the cosine of 30^ .

$$ (\operatorname {C O S} (3 0) = 0. 8 6 6 0) $$

OMRON CP1E - - Cosine Function (C: #0001) - 1

Source data

S: D10
0×10^1×10^0×10^-1
0300

Set the source data in × 10^-1 degrees. (0000 to 0900, BCD)

Result

R: D100
×10-1×10-2×10-3×10-4
8660

Result data has four significant digits, fifth and higher digits are ignored. (0000 to 9999, BCD)

- Linear Extrapolation (C: Word Address)

  • Using 16-bit Unsigned BCD or Binary Data APR(069) processes the input data specified in S based on the control data in C and the line-segment data specified in the table beginning at C + 1 . The result is output to D.

OMRON CP1E - - Linear Extrapolation (C: Word Address) - 1

  • Y_n = f(X_n), Y_0 = f(X_0)
  • Be sure that X_n - 1 < X_n in all cases.
  • Input all values of (X_n, Y_n) as binary data.
WordCoordinate
C+1Xm (max. X value)
C+2Y0
C+3X1
C+4Y1
C+5X2
C+6Y2
C+(2m+1)Xm (max. X value)
C+(2m+2)Ym

This example shows how to construct a linear extrapolation with 12 coordinates. The block of data is continuous, as it must be, from D0 to D26 (C to C + (2 × 12 + 2) ). The input data is taken from CIO 10, and the result is output to CIO 11.

0.00
APR
D0
10
11

OMRON CP1E - - Linear Extrapolation (C: Word Address) - 2

In this case, the source word, CIO 0010, contains 0014, and f(0014) = 0726 is output to R, CIO 0011.

OMRON CP1E - - Linear Extrapolation (C: Word Address) - 3

The linear-extrapolation calculation is shown below.

= 0726 Values are all hexadecimal (Hex).

$$ \begin{array}{l} Y = 0 F 0 0 + \frac {0 4 0 2 - 0 F 0 0}{0 0 1 A - 0 0 0 5} \times (0 0 1 4 - 0 0 1 5) \ = 0 F 0 0 - (0 0 8 6 \times 0 0 0 F) \ \end{array} $$

  • Using 32-bit Signed Binary Data

In this example, APR(069) is used to convert the fluid height in a tank to fluid volume based on the shape of the holding tank.

OMRON CP1E - - Linear Extrapolation (C: Word Address) - 4

  • Using Floating-point Data In this example, APR(069) is used to convert the fluid height in a tank to fluid volume based on the shape of the holding tank.

OMRON CP1E - - Linear Extrapolation (C: Word Address) - 5

BCNT

InstructionMnemonicVariationsFunction codeFunction
BIT COUNTERBCNT@BCNT067Counts the total number of ON bits in the specified word(s).
SymbolBCNT
BCNT(067)
N
S
R
N: Number of words
S: First source word
R: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NNumber of wordsUINT1
SFirst source wordUINTVariable
RResult wordUINT1

N: Number of words

The number of words must be 0001 to FFFF (1 to 65,535 words).

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
NOKOKOKOKOKOKOKOKOKOK---------
S,R---

Flags

NameLabelOperation
Error FlagP_ERON if N is 0000. ON if result exceeds FFFF. OFF in all other cases.
Equals FlagP_EQON if the result is 0000. OFF in all other cases.

Function

BCNT(067) counts the total number of bits that are ON in all words between S and S + (N - 1) and places the result in R.

OMRON CP1E - Function - 1

Precautions

  • Some time will be required to complete BCNT(067) if a large number of words is specified. Even if an interrupt occurs, execution of this instruction will not be interrupted and execution of the interrupt task will be started after execution of BCNT(067) has been completed. One BCNT(067) instruction can be replaced with two BCNT(067) instructions to help avoid this problem.

OMRON CP1E - Precautions - 1

Sample Program

When CIO 0.00 is ON in the following example, BCNT(067) counts the total number of ON bits in the 10 words from CIO 100 through CIO 109 and writes the result to D100.

OMRON CP1E - Sample Program - 1

Floating-point Math Instructions

The Floating-point Math Instructions convert data and perform floating-point arithmetic operations.

Data Format

Floating-point data expresses real numbers using a sign, exponent, and mantissa. When data is expressed in floating-point format, the following formula applies.

Real number = (-1)^S2^e - 127 (1.f)

s: Sign

e: Exponent

f: Mantissa

The floating-point data format conforms to the IEEE754 standards. Data is expressed in 32 bits, as follows:

SignExponentMantissa
sef
313023220
DataNo. of bitsContents
s: sign10: positive; 1: negative
e: exponent8The exponent (e) value ranges from 0 to 255. The actual exponent is the value remaining after 127 is subtracted from e, resulting in a range of -127 to 128. “e=0” and “e=255” express special numbers.
f: mantissa23The mantissa portion of binary floating-point data fits the formal 2.0 > 1.f ≥1.0.

Number of Digits

The number of effective digits for floating-point data is seven digits for decimal.

- Floating-point Data

The following data can be expressed by floating-point data:

-oo
- -3.402823 × 10^38 ≤ value ≤ -1.175494 × 10^-38
0
1. 1.175494 × 10^-38 ≤ value ≤ 3.402823 × 10^38
+00
Not a number (NaN)

OMRON CP1E - - Floating-point Data - 1

- Special Numbers

The formats for NaN, ± , and 0 are as follows:

  • NaN^*:e = 255, f 0
    + : e = 255, f = 0, s = 0
  • - : e = 255, f = 0, s = 1
    0: e = 0 f = 0
  • NaN (not a number) is not a valid floating-point number. Executing floating-point calculation instructions will not result in NaN.

- Writing Floating-point Data

When floating-point is specified for the data format in the I/O memory edit display in the CX-Programmer, standard decimal numbers input in the display are automatically converted to the floating-point format shown above (IEEE754-format) and written to I/O Memory. Data written in the IEEE754-format is automatically converted to standard decimal format when monitored on the display.

OMRON CP1E - - Writing Floating-point Data - 1

It is not necessary for the user to be aware of the IEEE754 data format when reading and writing floating-point data. It is only necessary to remember that floating point values occupy two words each.

- Numbers Expressed as Floating-point Values

The following types of floating-point numbers can be used.

Mantissa (f)Exponent (e)
0Not 0 and not all 1'sAll 1's (255)
00Normalized numberInfinity
Not 0Non-normalized numberNaN

Note A non-normalized number is one whose absolute value is too small to be expressed as a normalized number. Non-normalized numbers have fewer significant digits. If the result of calculations is a non-normalized number (including intermediate results), the number of significant digits will be reduced.

(1) Normalized Numbers

Normalized numbers express real numbers. The sign bit will be 0 for a positive number and 1 for a negative number.

The exponent (e) will be expressed from 1 to 254, and the real exponent will be 127 less, i.e., -126 to 127.

The mantissa (f) will be expressed from 0 to 2^33 - 1 , and it is assumed that, in the real mantissa, bit 2^33 is 1 and the binary point follows immediately after it.

Normalized numbers are expressed as follows:

(-1)(sign s) × 2^(exponent e) - 127 × (1 + mantissa × 2^-23)

Example

OMRON CP1E - Example - 1

Sign:

Exponent: 128 - 127 = 1

Mantissa: 1 + (2^22 + 2^21) × 2^-23 = 1 + (2^-1 + 2^-2) = 1 + 0.75 = 1.75

Value: -1.75 × 2^1 = -3.5

(2) Non-normalized Numbers

Non-normalized numbers express real numbers with very small absolute values. The sign bit will be 0 for a positive number and 1 for a negative number.

The exponent (e) will be 0, and the real exponent will be -126.

The mantissa (f) will be expressed from 1 to 2^33 - 1 , and it is assume that, in the real mantissa, bit 2^33 is 0 and the binary point follows immediately after it.

Non-normalized numbers are expressed as follows:

$$ (- 1) ^ {(\text {s i g n} s)} \times 2 ^ {- 1 2 6} \times (\text {m a n t i s s a} \times 2 ^ {- 2 3}) $$

Example

31 3023 220
00 0 0 0 0 0 0 0 01 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Sign:

Exponent: -126

Mantissa: 0 + (2^22 + 2^21) × 2^-23 = 0 + (2^-1 + 2^-2) = 0 + 0.75 = 0.75

Value: -0.75 × 2^-126

(3) Zero

Values of +0.0 and -0.0 can be expressed by setting the sign to 0 for positive or 1 for negative. The exponent and mantissa will both be 0. Both +0.0 and -0.0 are equivalent to 0.0. Refer to Floating-point Arithmetic Results, below, for differences produced by the sign of 0.0.

(4) Infinity

Values of + and - can be expressed by setting the sign to 0 for positive or 1 for negative. The exponent will be 255 (28 - 1) and the mantissa will be 0.

(5) NaN

NaN (not a number) is produced when the result of calculations, such as 0.0 / 0.0 , / , or - , does not correspond to a number or infinity. The exponent will be 255 ( 2^8 - 1 ) and the mantissa will be not 0.

Note There are no specifications for the sign of NaN or the value of the mantissa field (other than to be not 0).

- Floating-point Arithmetic Results

(1) Rounding Results

The following methods will be used to round results when the number of digits in the accurate result of floating-point arithmetic exceeds the significant digits of internal processing expressions.

If the result is close to one of two internal floating-point expressions, the closer expression will be used.

If the result is midway between two internal floating-point expressions, the result will be rounded so that the last digit of the mantissa is 0.

(2) Overflows, Underflows, and Illegal Calculations

Overflows will be output as either positive or negative infinity, depending on the sign of the result. Underflows will be output as either positive or negative zero, depending on the sign of the result.

Illegal calculations will result in NaN. Illegal calculations include adding infinity to a number with the opposite sign, subtracting infinity from a number with the opposite sign, multiplying zero and infinity, dividing zero by zero, or dividing infinity by infinity.

The value of the result may not be correct if an overflow occurs when converting a floating-point number to an integer.

(3) Precautions in Handling Special Values

The following precautions apply to handling zero, infinity, and NaN.

  • The sum of positive zero and negative zero is positive zero.
  • The difference between zeros of the same sign is positive zero.
  • If any operand is a NaN, the Error Flag will be turned ON and the tests will not be executed.
  • Positive zero and negative zero are treated as equivalent in comparisons.
  • Comparison or equivalency tests on one or more NaN will not be executed and the Error Flag will be turned ON.

- Floating-point Calculation Results

When the absolute value of the result is greater than the maximum value that can be expressed for floating-point data, the Overflow Flag will turn ON and the result will be output as ± . If the result is positive, it will be output as + ; if negative, then - .

The Equals Flag will only turn ON when both the exponent (e) and the mantissa (f) are zero after a calculation. A calculation result will also be output as zero when the absolute value of the result is less than the minimum value that can be expressed for floating-point data. In that case the Underflow Flag will turn ON.

FIX/FIXL

InstructionMnemonicVariationsFunction codeFunction
FLOATING TO 16-BITFIX@FIX450Converts a 32-bit floating-point value to 16-bit signed binary data and places the result in the specified result word.
FLOATING TO 32-BITFIXL@FIXL451Converts a 32-bit floating-point value to 32-bit signed binary data and places the result in the specified result words.
SymbolFIXFIXL
FIX(450)S RS: First source wordR: Result wordFIXL(451)S RS: First source wordR: First result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
FIXFIXLFIXFIXL
SFirst source wordREALREAL22
RFirst result wordINTDINT12

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_ERFIX ON if the integer portion of S+1 and S is not within the range of -32,768 to 32,767. FIXL ON if the integer portion of S+1 and S is not within the range of -2,147,483,648 to 2,147,483,647. ON if the data in S+1 and S is not a number (NaN). OFF in all other cases.
Equals FlagP_EQON if the result is 0000. OFF in all other cases.
Negative FlagP_NON when the leftmost bit of the result is 1. OFF in all other cases.

Function

FIX

FIX(450) converts the integer portion of the 32-bit floating-point number in S+1 and S (IEEE754-format) to 16-bit signed binary data and places the result in R.

OMRON CP1E - FIX - 1

Only the integer portion of the floating-point data is converted, and the fraction portion is truncated.

Example conversions:

A floating-point value of 3.5 is converted to 3.

A floating-point value of -3.5 is converted to -3 .

- FIXL

FIXL(451) converts the integer portion of the 32-bit floating-point number in S+1 and S (IEEE754-format) to 32-bit signed binary data and places the result in R+1 and R.

OMRON CP1E - - FIXL - 1

Only the integer portion of the floating-point data is converted, and the fraction portion is truncated.

Example conversions:

A floating-point value of 2,147,483,640.5 is converted to 2,147,483,640. A floating-point value of -214,748,340.5 is converted to -214,748,340 .

FLT/FLTL

InstructionMnemonicVariationsFunction codeFunction
16-BIT TO FLOATINGFLT@FLT452Converts a 16-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
32-BIT TO FLOATINGFLTL@FLTL453Converts a 32-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
SymbolFLTFLTL
FLT(452)SS: Source wordR: First result wordFLTL(453)SS: First source wordR: First result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
FLTFLTLFLTFLTL
SFirst source wordINTDINT12
RFirst result wordREALREAL22

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_EROFF
Equals FlagP_EQON if both the exponent and mantissa of the result are 0. OFF in all other cases.
Negative FlagP_NON if the result is negative. OFF in all other cases.

Function

- FLT

FLT(452) converts the 16-bit signed binary value in S to 32-bit floating-point data (IEEE754-format) and places the result in R+1 and R. A single 0 is added after the decimal point in the floating-point result.

OMRON CP1E - - FLT - 1

Only values within the range of -32,768 to 32,767 can be specified for S. To convert signed binary data outside of that range, use FLTL(453).

Example conversions:

A signed binary value of 3 is converted to 3.0. A signed binary value of -3 is converted to -3.0.

- FLTL

FLTL(453) converts the 32-bit signed binary value in S + 1 and S to 32-bit floating-point data (IEEE754-format) and places the result in R + 1 and R . A single 0 is added after the decimal point in the floating-point result.

OMRON CP1E - - FLTL - 1

Signed binary data within the range of -2,147,483,648 to 2,147,483,647 can be specified for S+1 and S. The floating point value has 24 significant binary digits (bits). The result will not be exact if a number greater than 16,777,215 (the maximum value that can be expressed in 24-bits) is converted by FLTL(453).

Example Conversions:

A signed binary value of 16,777,215 is converted to 16,777,215.0. A signed binary value of -16,777,215 is converted to -16,777,215.0 .

$$ + F, - F, * F, / F $$

InstructionMnemonicVariationsFunction codeFunction
FLOATING-POINT ADD+F@+F454Adds two 32-bit floating-point numbers and places the result in the specified result words.
FLOATING-POINT SUBTRACT-F@-F455Subtracts one 32-bit floating-point number from another and places the result in the specified result words.
FLOATING-POINT MULTIPLY*F@*F456Multiplies two 32-bit floating-point numbers and places the result in the specified result words.
FLOATING-POINT DIVIDE/F@/F457Divides one 32-bit floating-point number by another and places the result in the specified result words.
Symbol+F-F
+F(454)AuAu: First augend wordAD: First addend wordR: First result word-F(455)MiMi: First Minuend wordSu: First Subtrahend wordR: First result word
SuSu: First Subtrahend wordR: First result word
+F/F
+F(456)MdMd: First Multipicand wordMr: First Multiplier wordR: First result word/F(457)DdDd: First Dividend wordDr: First Divisor wordR: First result word
Dd
Dr
R

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
+FAuFirst augend wordREAL2
ADFirst addend word
-FMiFirst Minuend wordREAL2
SuFirst Subrahend word
*FMdFirst Multipicand wordREAL2
MrFirst Multiplier word
/FDdFirst Dividend wordREAL2
DrFirst Divisor word
RFirst result wordREAL2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
Au, AD, Mi, Su, Md, Mr, Dd, DrOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_ER+FON if the augend or addend data is not a number (NaN).ON if +∞ and -∞ are added.-FON if the minuend or subtrahend is not a number (NaN).ON if +∞ is subtracted from +∞.ON if -∞ is subtracted from -∞.*FON if the multiplicand or multiplier is not a number (NaN).ON if +∞ and 0 are multiplied.ON if -∞ and 0 are multiplied./FON if the dividend or divisor is not a number (NaN).ON if the dividend and divisor are both 0.ON if the dividend and divisor are both +∞ or -∞.OFF in all other cases.
Equals FlagP_EQON if both the exponent and mantissa of the result are 0 OFF in all other cases.
Overflow FlagP_OFON if the absolute value of the result is too large to be expressed as a 32-bit floating-point value.OFF in all other cases.
Underflow FlagP_UFON if the absolute value of the result is too small to be expressed as a 32-bit floating-point value.OFF in all other cases.
Negative FlagP_NON if the result is negative.OFF in all other cases.

Function

The data specified in Au/Mi/Md/Dd and the data specified in AD/Su/Mr/Dr are added (+F), subtracted (-F), multiplied (*F), or divided (/F) as single-precision floating-point data (32 bits: IEEE754) and output to R+1, R.

+F

Au+1Au

Augend (floating-point data, 32 bits)

+Ad+1Ad

Addend (floating-point data, 32 bits)

R+1R

Result (floating-point data, 32 bits)

-F

Mi+1Mi

Minuend (floating-point data, 32 bits)

Su+1Su

Subrahend (floating-point data, 32 bits)

R+1R

Result (floating-point data, 32 bits)

*F

Md+1MdMultiplier (floating-point data, 32 bits)
× Mr+1Mr
R+1RResult (floating-point data, 32 bits)

/F

Dd+1DdDividend (floating-point data, 32 bits)
Dr+1DrDivisor (floating-point data, 32 bits)
R+1RResult (floating-point data, 32 bits)
  • If the absolute value of the result is greater than the maximum value that can be expressed as floating-point data, the Overflow Flag will turn ON and the result will be output as ± .
  • If the absolute value of the result is less than the minimum value that can be expressed as floating-point data, the Underflow Flag will turn ON and the result will be output as 0.

Operation rules

The result of an operation is output as shown below depending on the combination of floating-point data.

- FLOATING-POINT ADD (+F)

Augend
Addend0Numeral+∞-∞NaN
00Numeral+∞-∞
NumeralNumeralSee note 1.+∞-∞
+∞+∞+∞+∞ER
-∞-∞-∞ER-∞
NaNER

Note 1 The results could be zero (including underflows), a numeral, + , or - .
ER The Error Flag will be turned ON and the instruction will not be executed.

- FLOATING-POINT SUBTRACT (-F)

Minuend
Subtrahend0Numeral+∞-∞NaN
00Numeral+∞-∞
NumeralNumeralSee note 1.+∞-∞
+∞-∞-∞ER-∞
-∞+∞+∞+∞ER
NaNER

Note 1 The results could be zero (including underflows), a numeral, + , or - .
ER The Error Flag will be turned ON and the instruction will not be executed.

- FLOATING-POINT MULTIPLY (*F)

Multipicand
Multiplier0Numeral+∞-∞NaN
000ERER
Numeral0See note 1.+/-∞+/-∞
+∞ER+/-∞+∞-∞
-∞ER+/-∞-∞+∞
NaNER

Note 1 The results could be zero (including underflows), a numeral, + , or - .
ER The Error Flag will be turned ON and the instruction will not be executed.

- FLOATING-POINT DIVIDE (/F)

Dividend
Divisor0Numeral+∞-∞NaN
0ER+/-∞+∞-∞
Numeral0See note 2.+/-∞+/-∞
+∞00 (See note 1)ERER
-∞00 (See note 1)ERER
NaNER

Note 1 The results will be zero for underflows.
2 The results could be zero (including underflows), a numeral, + , or - .

ER The Error Flag will be turned ON and the instruction will not be executed.

$$ = F, < > F, < F, < = F, > F, > = F $$

InstructionMnemonicVariationsFunction codeFunction
Single-precision Floating-point Comparison=F---329These input comparison instructions compare two single-precision floating point values (32-bit IEEE754 constants and/or the contents of speci-fied words) and create an ON execution condition when the comparison condition is true.
<>F330
<F331
<=F332
>F333
>=F334
SymbolSingle-precision Floating-point Comparison
LD connectionAND connectionOR connection
MnemonicMnemonicS1: Comparison data 1S1: Comparison data 1S1: Comparison data 2S1: Comparison data 2
S1S2S2: Comparison data 2S2: Comparison data 2S2: Comparison data 2S2: Comparison data 2

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
S1Comparison data 1REAL2
S2Comparison data 2REAL2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S1, S2OKOKOKOKOKOKOKOKOKOK---------

Flags

NameLabelOperation
Error FlagP_ERON if S1+1, S1 or S2+1, S2 is not a number (NaN).ON if S1+1, S1 or S2+1, S2 is +∞.ON if S1+1, S1 or S2+1, S2 is -∞OFF in all other cases.
Greater Than FlagP_GTON if S1+1, S1 > S2+1, S2 OFF in all other cases.
Greater Than or Equal FlagP_GEON if S1+1, S1 ≥ S2+1, S2. OFF in all other cases.
Equal FlagP_EQON if S1+1, S1 = S2+1, S2. OFF in all other cases.
Not Equal FlagP_NEON if S1+1, S1 ≠ S2+1, S2. OFF in all other cases.
Less Than FlagP_LTON if S1+1, S1 < S2+1, S2. OFF in all other cases.
Less Than or Equal FlagP_LEON if S1+1, S1 ≤ S2+1, S2. OFF in all other cases.
Negative FlagP_NUnchanged

Function

The input comparison instruction compares the data specified in S1 and S2 as single-precision floating point values (32-bit IEEE754 data) and creates an ON execution condition when the comparison condition is true.

When the data is stored in words, S1 and S2 specify the first of two words containing the 32-bit data. It is also possible to input the floating-point data as an 8-digit hexadecimal constant.

The input comparison instructions are treated just like the LD, AND, and OR instructions to control the execution of subsequent instructions.

LD: The instruction can be connected directly to the left bus bar.

AND: The instruction cannot be connected directly to the left bus bar.

OR: The instruction can be connected directly to the left bus bar.

OMRON CP1E - Function - 1

- Options

With the three input types and six symbols, there are 18 different possible combinations.

Symbol (LD, AND, and OR cannot be used in a ladder program)Option (data format)
LD=, AND=, OR=, LD<>, AND<, OR<, LD<, AND<, OR<, LD>, AND>, OR>, AND>=, AND>=, OR>=F: Single-precision floating-point data
CodeMnemonicNameFunction
329LD=FLOAD FLOATING EQUALTrue if S1+1, S1 = S2+1, S2
AND=FAND FLOATING EQUAL
OR=FOR FLOATING EQUAL
330LD<>FLOAD FLOATING NOT EQUALTrue if S1+1, S1≠ S2+1, S2
AND<>FAND FLOATING NOT EQUAL
OR<>FOR FLOATING NOT EQUAL
331LD<FLOAD FLOATING LESS THANTrue if S1+1, S1 < S2+1, S2
AND<FAND FLOATING LESS THAN
OR<FOR FLOATING LESS THAN
332LD<=FLOAD FLOATING LESS THAN OR EQUALTrue if S1+1, S1 ≤ S2+1, S2
AND<=FAND FLOATING LESS THAN OR EQUAL
OR<=FOR FLOATING LESS THAN OR EQUAL
333LD>FLOAD FLOATING GREATER THANTrue if S1+1, S1 > S2+1, S2
AND>FAND FLOATING GREATER THAN
OR>FOR FLOATING GREATER THAN
334LD>=FLOAD FLOATING GREATER THAN OR EQUALTrue if S1+1, S1 ≥ S2+1, S2
AND>=FAND FLOATING GREATER THAN OR EQUAL
OR>=FOR FLOATING GREATER THAN OR EQUAL

Precautions

  • Input comparison instructions cannot be used as right-hand instructions, i.e., another instruction must be used between them and the right bus bar.

Sample program

When CIO 0.00 is ON in the following example, the floating point data in D101, D100 is compared to the floating point data in D201, D200. If the content of D101, D100 is less than that of D201, D200, execution proceeds to the next line and CIO 50.00 is turned ON. If the content of D101, D100 is not less than that of D201, D200, execution does not proceed to the next instruction line.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2
SINGLE FLOATING LESS THAN Comparison (<F)

OMRON CP1E - Sample program - 3

FSTR

InstructionMnemonicVariationsFunction codeFunction
FLOATING-POINT TO ASCIIFSTR@FSTR448Expresses a 32-bit floating-point value (IEEE754-format) in standard decimal notation or scientific notation and converts that value to ASCII text.
SymbolFSTR
FSTR(448)
S
C
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordREAL2
CFirst control wordUINT3
DFirst destination wordUINTVariable

C: First Control Word

OMRON CP1E - C: First Control Word - 1
Note There are limits on the total number of characters and the number of fractional digits.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
C, D---

Flags

NameLabelOperation
Error FlagP_ERON if the data in S+1 and S is not a valid floating-point number (NaN).ON if the data in S+1 and S is +o or -o.ON if the Data Format setting in C is not 0000 or 0001.ON if the Total Characters setting in C+1 is not within the allowed range. (See 1. Limits on the Total Number of ASCII Characters above for details.)ON if the Fractional Digits setting in C+2 is not within the allowed range. (See 3. Limits on the Number of Digits in the Fractional Part above for details.)
Equals FlagP_EQON if the conversion result is 0OFF in all other cases.

Function

FSTR(448) expresses the 32-bit floating-point number in S+1 and S (IEEE754-format) in decimal notation or scientific notation according to the control data in words C to C+2, converts the number to ASCII text, and outputs the result to the destination words starting at D.

  • The content of C (Data format) specifies whether to express the number in S + 1 , S in decimal notation or scientific notation.

  • Decimal notation

Expresses a real number as an integer and fractional part.

Example: 124.56

Scientific notation

Expresses a real number as an integer part, fractional part, and exponent part.

Example: 1.2456E-2 (1.2456×10-2)

  • The content of C + 1 (Total characters) specifies the number of ASCII characters after conversion including the sign symbol, numbers, decimal point and spaces.
  • The content of C + 2 (Fractional digits) specifies the number of digits (characters) below the decimal point.

The ASCII text is stored in D and subsequent words in the following order: leftmost byte of D, rightmost byte of D, leftmost byte of D+1, rightmost byte of D+1, etc.

OMRON CP1E - Function - 1

Storage of ASCII Text

After the floating-point number is converted to ASCII text, the ASCII characters are stored in the destination words beginning with D, as shown in the following diagrams. Different storage methods are used for decimal notation and scientific notation.

Decimal notation (C=0 hex)

OMRON CP1E - Decimal notation (C=0 hex) - 1
Total number of characters

Scientific notation (C=1 hex)

Total number of characters
OMRON CP1E - Scientific notation (C=1 hex) - 1
Note Either one or two bytes of zeroes are added to the end of ASCII text as an end code.

  • Total number of characters odd: 00 hex is stored after the ASCII text.
  • Total number of characters even: 0000 hex is stored after the ASCII text.

- Limits on the Number of ASCII Characters

There are limits on the number of ASCII characters in the converted number. The Error Flag will be turned ON if the number of characters exceeds the maximum allowed.

  • Limits on the Total Number of ASCII Characters

1) Decimal Notation (C = 0 hex)

  • When there is no fractional part (C + 2 = 0 hex): 2 ≤ Total Characters ≤ 24
  • When there is a fractional part (C + 2 = 1 to 7hex) : (Fractional digits +3 ) ≤ Total Characters ≤ 24

2) Scientific Notation (C = 1 hex)

  • When there is no fractional part (C + 2 = 0 hex): 6 ≤ Total Characters ≤ 24
  • When there is a fractional part (C + 2 = 1 to 7hex ): (Fractional digits +7 ) ≤ Total Characters ≤ 24

  • Limits on the Number of Digits in the Integer Part

1) Decimal Notation (C = 0 hex)

  • When there is no fractional part (C + 2 = 0 hex): 1 ≤ Number of Integer Digits ≤ 24 - 1
  • When there is a fractional part (C + 2 = 1 to 7 hex): 1 ≤ Number of Integer Digits ≤ (24 - Fractional digits - 2)

2) Scientific Notation (C = 1 hex) 1 digit (fixed)

  • Limits on the Number of Digits in the Fractional Part

1) Decimal Notation (C = 0 hex)

  • Fractional Digits ≤ 7
  • Also: Fractional Digits ≤ (Total Number of ASCII Characters - 3)

2) Scientific Notation (C =1 hex)

  • Fractional Digits ≤ 7
  • Also: Fractional Digits ≤ (Total Number of ASCII Characters - 7)

Sample program

- Converting to ASCII Text in Decimal Notation

When CIO 0.00 is ON in the following example, FSTR(448) converts the floating-point data in D1 and D0 to decimal-notation ASCII text and writes the ASCII text to the destination words beginning with D100. The contents of the control words (D10 to D12) specify the details on the data format (decimal notation, 7 characters total, 3 fractional digits).

OMRON CP1E - - Converting to ASCII Text in Decimal Notation - 1

- Converting to ASCII Text in Scientific Notation

When CIO 0.00 is ON in the following example, FSTR(448) converts the floating-point data in D1 and D0 to scientific-notation ASCII text and writes the ASCII text to the destination words beginning with D100. The contents of the control words (D10 to D12) specify the details on the data format (scientific notation, 11 characters total, 3 fractional digits).

OMRON CP1E - - Converting to ASCII Text in Scientific Notation - 1

FVAL

InstructionMnemonicVariationsFunction codeFunction
ASCII TO FLOATING-POINTFVAL@FVAL449Converts a number expressed in ASCII text (decimal or scientific notation) to a 32-bit floating-point value (IEEE754-format) and outputs the floating-point value to the specified words.
SymbolFVAL
FVAL(449)
S
D
S: First source word
D: First destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordUINTVariable
DFirst destination wordREAL2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, DOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the digits (integer and fractional parts) in the source data starting at S are not 30 to 39 hex (0 to 9).ON if the first two digits of the exponential part do not contain 45 and 2B hex (E+) or 45 and 2D hex (E-). in the source data starting at S are not 30 to 39 hex (0 to 9).ON if there are two or more exponential parts in the source data.ON if the data is +∞ or -∞ after conversion.ON if there are 0 characters in the text data.ON if a byte containing 00 hex is not found within the first 25 characters.OFF in all other cases.
Equals FlagP_EQON if the conversion result is 0.OFF in all other cases.

Function

FVAL(449) converts the specified ASCII text number (starting at word S) to a 32-bit floating-point number (IEEE754-format) and outputs the result to the destination words starting at D.

FVAL(449) can convert ASCII text in decimal or scientific notation if it meets the following conditions:

Up to 6 characters are valid, excluding the sign, decimal point, and exponent. Any characters beyond the 6th character will be ignored.

  • Decimal Notation

Real numbers expressed with an integer and fractional part.

Example: 124.56

Scientific Notation

Real numbers expressed as an integer part, fractional part, and exponent part.

Example: 1.2456 E - 2 ( 1.2456 × 10^-2 )

The data format (decimal or scientific notation) is detected automatically.

The ASCII text must be stored in S and subsequent words in the following order: leftmost byte of S, rightmost byte of S, leftmost byte of S+1, rightmost byte of S+1, etc.

OMRON CP1E - Function - 1
Decimat notation

OMRON CP1E - Function - 2
Scientific notation

- Storage of ASCII Text

The following diagrams show how the ASCII text number is converted to floating-point data. Different conversion methods are used for numbers stored with decimal notation and scientific notation.

ASCII Character Storage

OMRON CP1E - ASCII Character Storage - 1
S

FVAL(449) converts the ASCII characters starting with the leftmost byte of S and continuing until a byte containing 00 hex is reached. There must be a byte containing 00 hex within the first 25 bytes.

Up to 00 hex (25 characters max.)

Decimal notation

OMRON CP1E - Decimal notation - 1

OMRON CP1E - Decimal notation - 2

Scientific notation

OMRON CP1E - Scientific notation - 1

OMRON CP1E - Scientific notation - 2

Sample program

- Converting ASCII Text in Decimal Notation to Floating-point Data

When CIO 0.00 is ON in the following example, FVAL(449) converts the specified decimal-notation ASCII text number in the source words starting at D0 to floating-point data and writes the result to destination words D100 and D101.

OMRON CP1E - - Converting ASCII Text in Decimal Notation to Floating-point Data - 1

- Converting ASCII Text in Scientific Notation

When CIO 0.00 is ON in the following example, FVAL(449) converts the specified scientific-notation ASCII text number in the source words starting at D0 to floating-point data and writes the result to destination words D100 and D101.

OMRON CP1E - - Converting ASCII Text in Scientific Notation - 1

Table Data Processing Instructions

SWAP

InstructionMnemonicVariationsFunction codeFunction
SWAP BYTESSWAP@SWAP637Switches the leftmost and rightmost bytes in all of the words in the range.
SymbolSWAP
SWAP(637)
N
R1
N: Number of words
R1: First word in range

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NNumber of wordsUINT1
R1First word in rangeUINTVariable

N: Number of words

N specifies the number of words in the range and must be 0001 to FFFF hexadecimal (or &1 to &65,535).

R1: First word in range

OMRON CP1E - R1: First word in range - 1

Note R1 and R1 + (N - 1) must be in the same data area.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
NOKOKOKOKOKOKOKOKOKOK---------
R1---

Flags

NameLabelOperation
Error FlagP_ERON if the N is 0. OFF in all other cases.

Function

SWAP(637) switches the position of the two bytes in all of the words in the range of memory from R1 to R1+N-1.

OMRON CP1E - Function - 1

Hint

  • This instruction can be used to reverse the order of ASCII-code characters in each word.

Sample program

When CIO 0.00 is ON in the following example, SWAP(637) switches the data in the leftmost bytes with the data in the rightmost bytes in each word in the 10-word range from W0 to W9.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

OMRON CP1E - Sample program - 4

FCS

InstructionMnemonicVariationsFunction codeFunction
FRAME CHECKSUMFCS@FCS180Calculates the FCS value for the specified range and outputs the result in ASCII.
SymbolFCS
— | — FCS(180) —
CC: First control word
R1R1: First word in range
DD: First destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CFirst control wordUDINT2
R1First word in rangeUINTVariable
DFirst destination wordUINTVariable

OMRON CP1E - Operands - 1
C: First control word

OMRON CP1E - Operands - 2
R1: First word in range
D: First destination word

When bytes are specified as the operation units:

OMRON CP1E - Operands - 3

When words are specified as the operation units:

OMRON CP1E - Operands - 4

Note C and C + 1 , all of the words in the calculation range must be in the same data area.

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
COKOKOKOKOKOKOKOKOKOK---------
R1, D---

Flags

NameLabelOperation
Error FlagP_ERON if the content of C is not within the specified range of 0001 through FFFF.OFF in all other cases.

Function

FCS(180) calculates the FCS value for W units of data beginning with the data in R1, converts the value to ASCII code, and outputs the result to D (for bytes) or D+1 and D (for words). The settings in C+1 determine whether the units are words or bytes, whether the data is binary (signed or unsigned) or BCD, and whether to start with the right or left byte of R1 if bytes are being added.

When bit 13 of C + 1 has been set to 1, FCS(180) operates on bytes of data. In this case, bit 12 determines whether the calculation starts with the rightmost byte of R1 (bit 12 = 1 ) or the leftmost byte of R1 (bit 12 = 0 ).

OMRON CP1E - Function - 1

Sample program

When CIO 0.00 is ON in the following example, FCS(180) calculates the FCS value for the 10 bytes of data beginning with the rightmost byte of D100 and writes the result to D200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

Data Control Instructions

PIDAT

InstructionMnemonicVariationsFunction codeFunction
PID CONTROL WITH AUTOTUNINGPIDAT---191Executes PID control according to the specified parameters. The PID constants can be autotuned.
SymbolPID
PIDAT(191)
SS: Input word
CC: First parameter word
DD: Output word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
SInput wordUINT1
CFirst parameter wordWORD41
DOutput wordUINT1

C: First Parameter Word

OMRON CP1E - C: First Parameter Word - 1

OMRON CP1E - C: First Parameter Word - 2

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, C, DOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the C data is out of range.ON if the actual sampling period is more than twice the designated sampling period.ON if an error occurred during autotuning.OFF in all other cases.
Greater Than FlagP_GTON if the manipulated variable after the PID action exceeds the upper limit.OFF in all other cases.
Less Than FlagP_LTON if the manipulated variable after the PID action is below the lower limit.OFF in all other cases.
Carry FlagP_CYON while PID control is being executed.OFF in all other cases.

Function

When the execution condition is ON, PIDAT(191) carries out target value filtered PID control with two degrees of freedom according to the parameters designated by C (set value, PID constant, etc.). It takes the specified input range of binary data from the contents of input word S and carries out the PID action according to the parameters that are set. The result is then stored as the manipulated variable in output word D.

The parameter settings are read when the execution condition turns from OFF to ON, and the Error Flag will turn ON if the settings are outside of the permissible range.

If the settings are within the permissible range, PID processing will be executed using the initial values. Bumpless operation is not performed at this time. It will be used for manipulated variables in subsequent PID processing execution. (Bumpless operation is processing that gradually and continuously changes the manipulated variable in order to avoid the adverse effects of sudden changes.)

When the execution condition turns ON, the PV for the specified sampling period is entered and processing is performed.

OMRON CP1E - Function - 1

Autotuning

The status of the AT Command Bit (bit 15 of C + 9 ) is checked every cycle. If this control bit is turned ON in a given cycle, PIDAT(191) will begin autotuning the PID constants. (The changes in the SV will not be reflected while autotuning is being performed.)

The limit-cycle method is used for autotuning. PIDAT(191) forcibly changes the manipulated variable (max. manipulated variable min. manipulated variable) and monitors the characteristics of the controlled system. The PID constants are calculated based on the characteristics that were observed, and the new P, I, and D constants are stored automatically in C + 1 , C + 2 , and C + 3 . At this point, the AT Command Bit (bit 15 of C + 9 ) is turned OFF and PID control resumes with the new PID constants in C + 1 , C + 2 , and C + 3 .

  • If the AT Command Bit is ON when PIDAT(191) execution begins, autotuning will be performed first and then PID control will start with the calculated PID constants.
  • If the AT Command Bit is turned ON during PIDAT(191) execution, PIDAT(191) interrupts the PID control being performed with the user-set PID constants, performs autotuning, and then resumes PID control with the calculated PID constants.

The following flowchart shows the autotuning procedure:

OMRON CP1E - Autotuning - 1

Note 1 If autotuning is interrupted by turning OFF the AT Command Bit during autotuning, PID control will start with the PID constants that were being used before autotuning began.
2 Also, if an AT execution error occurs, PID control will start with the PID constants that were being used before autotuning began.

In both cases described in notes 1 and 2, the PID constants will be enabled if they were already calculated when autotuning was interrupted.

PID Control

  • The number of valid input data bits within the 16 bits of the PV input (S) is designated by the input range setting in C + 6 , bits 08 to 11. For example, if 12 bits (4 hex) is designated for the input range, the range from 0000 hex to 0FFF hex will be enabled as the PV. (Values greater than 0FFF hex will be regarded as 0FFF hex.)
  • The set value range also depends on the input range.
  • Measured values (PV) and set values (SV) are in binary without sign, from 0000 hex to the maximum value of the input range.
  • The number of valid output data bits within the 16 bits of the manipulated variable output is designated by the output range setting in C+6, bits 00 to 03. For example, if 12 bits (4 hex) is designated for the output range, the range from 0000 hex to 0FFF hex will be output as the manipulated variable.
  • For proportional operation only, the manipulated variable output when the PV equals the SV can be designated as follows:

0: Output 0%

1: Output 50%.

  • The direction of proportional operation can be designated as either forward or reverse.
  • The upper and lower limits of the manipulated variable output can be designated.
  • The sampling period can be designated in units of 10 ms (0.01 to 99.99 s), but the actual PID action is determined by a combination of the sampling period and the time of PIDAT(191) instruction execution (with each cycle).
  • The timing of enabling changes made to PID constants can be set to either 1) the beginning of PIDAT(191) instruction execution or 2) the beginning of PID instruction execution and each sampling period. Only the proportional band (P), integral constant (Tik), and derivative constant (Tdk) can be changed each sampling cycle (i.e., during PID instruction execution). The timing is set in bit 1 of C+5.

Hint

  • PIDAT(191) is executed as if the execution condition was a STOP-RUN signal. PID calculations are executed when the execution condition remains ON for the next cycle after C + 11 to C + 40 are initialized. Therefore, when using the Always ON Flag (ON) as an execution condition for PIDAT(191), provide a separate process where C + 11 to C + 40 are initialized when operation is started.

Precautions

  • A PID parameter storage word cannot be shared by multiple PIDAT instructions. Even when the same parameter is used in multiple PIDAT instructions, separate words must be specified.
  • When changing the PID constants manually, set the PID constant change enable setting (bit 1 of C + 5 ) to 1 so that the values in C + 1 , C + 2 , and C + 3 are refreshed each sampling period in the PID calculation. This setting also allows the PID constants to be adjusted manually after autotuning.
  • Of the PID parameters (C to C+40), only the following parameters can be changed when the execution condition is ON. When any other values have been changed, be sure to change the execution condition from OFF to ON to enable the new settings.

  • Set value (SV) in C

(Can be changed during PID control only. An SV change during autotuning will not be reflected.)

  • PID constant change enable setting (bit 1 of C+5)
  • P, I, and D constants in C+1, C+2, and C+3

(Changes to these constants will be reflected each sampling period only if the PID constant change enable setting (bit 1 of C+5) is set to 1.)

  • AT Command Bit (bit 15 of C+9)
  • AT Calculation Gain (bits 0 to 14 of C+9) and Limit-cycle Hysteresis (C+10) (These values are read when autotuning starts.)

Performance Specifications

ItemSpecifications
PID control method---Target value filter-type two-degrees-of-freedom PID method (forward/reverse)
Number of PID control loops---Unlimited (1 loop per instruction)
Sampling periodτ0.01 to 99.99 s
PID constantProportional bandP0.1 to 999.9%
Integral constantTik1 to 8191, 9999 (No integral action for sampling period multiple, 9999.)
Derivative constantTdk0 to 8191 (No derivative action for sampling period multiple, 0.)
Set valueSV0 to 65535 (Valid up to maximum value of input range.)
Measured valuePV0 to 65535 (Valid up to maximum value of input range.)
Manipulated variableMV0 to 65535 (Valid up to maximum value of output range.)

Calculation Method

Calculations in PID control are performed by the target value filtered control with two degrees of freedom.

Block Diagram for Target Value PID with Two Degrees of Freedom

When overshooting is prevented with simple PID control, stabilization of disturbances is slowed (1). If stabilization of disturbances is speeded up, on the other hand, overshooting occurs and response toward the target value is slowed (2).

When target-value PID control with two degrees of freedom is used, on the other hand, there is no overshooting, and response toward the target value and stabilization of disturbances can both be speeded up (3).

OMRON CP1E - Block Diagram for Target Value PID with Two Degrees of Freedom - 1

OMRON CP1E - Block Diagram for Target Value PID with Two Degrees of Freedom - 2

OMRON CP1E - Block Diagram for Target Value PID with Two Degrees of Freedom - 3

OMRON CP1E - Block Diagram for Target Value PID with Two Degrees of Freedom - 4

PID Parameter Settings

Control dataItemContentsSetting rangeChange with ON input condition
CSet value (SV)The target value of the process being controlled.Binary data (of the same number of bits as specified for the input range)Allowed
C+1Proportional bandThe parameter for P action expressing the proportional control range/total control range.0001 to 270F hex (1 to 9999); (0.1% to 999.9%, in units of 0.1%)Can be changed with input condi-tion ON if bit 1 of C+5 is 1.
C+2Tik Integral ConstantA constant expressing the strength of the integral action. As this value increases, the integral strength decreases.0001 to 1FFF hex (1 to 8191); (9999 = Integral operation not executed) (See note 1.)
C+3Tdk Derivative ConstantA constant expressing the strength of the deriva-tive action. As this value increases, the derivative strength decreases.0001 to 1FFF hex (1 to 8191); (0000 = Derivative operation not executed) (See note 1.)
C+4Sampling period (τ)Sets the period for executing the PID action.0001 to 270F hex (1 to 9999); (0.01 to 99.99 s, in units of 10 ms)Not allowed
Bits 04 to 15 of C+52-PID parameter (α)The input filter coefficient. Normally use 0.65 (i.e., a setting of 000). The filter efficiency decreases as the coefficient approaches 0.000 hex: α = 0.65 Setting from 100 to 163 hex means that the value of the rightmost two digits is set from α= 0.00 to α= 0.99. (See note 2.)
Bit 03 of C+5Manipulated variable output designationDesignates the manipulated variable output for when the PV equals the SV.0: Output 0%1: Output 50%
Bit 01 of C+5PID constant change enable settingThe timing of enabling changes made to the pro-porportional band (P), integral constant (Tik), and derivative constant (Tdk) for use in PID calcula-tions.0: At start of PID instruction execution1: At start of PID instruction execution and each sampling periodAllowed
Bit 00 of C+5PID forward/reverse designationDetermines the direction of the proportional action.0: Reverse action1: Forward actionNot allowed
Bit 12 of C+6Manipulated variable output limit controlDetermines whether or not limit control will apply to the manipulated variable output.0: Disabled (no limit control)1: Enabled (limit control)
Bits 08 to 11 of C+6Input rangeThe number of input data bits.0: 8 bits 5: 13 bits1: 9 bits 6: 14 bits2: 10 bits 7: 15 bits3: 11 bits 8: 16 bits4: 12 bits
Bits 04 to 07 of C+6Integral and deriva-tive unitDetermines the unit for expressing the integral and derivative constants.1: Sampling period multiple9: Time (unit: 100 ms)
Bits 00 to 03 of C+6Output rangeThe number of output data bits. (The number of output bits is automatically the same as the num-ber of input bits.)0: 8 bits 5: 13 bits1: 9 bits 6: 14 bits2: 10 bits 7: 15 bits3: 11 bits 8: 16 bits4: 12 bits
C+7Manipulated variable output lower limitThe lower limit for when the manipulated variable output limit is enabled.0000 to FFFF (binary)(See note 3.)
C+8Manipulated variable output upper limitThe upper limit for when the manipulated variable output limit is enabled.0000 to FFFF (binary)(See note 3.)
Bit 15 of C+9AT Command BitThis control bit starts autotuning.• Set the AT Command Bit to 1 to perform auto-tuning. (Autotuning can be started while PIDAT(191) is being executed.)• This bit is turned OFF automatically when auto-tuning is completed.Autotuning will be interrupted if the AT Command Bit is turned OFF manually. In this case, the PID constants will be enabled if they were already cal-culated when autotuning was interrupted.As a Control Bit:0→1:Executes autotuning.1→0:Interrupts autotuning.(PID(191) turns the bit OFF automatically when autotuning is completed.As a Flag:0: Autotuning is not being executed.1: Autotuning is being executed.Allowed
Bits 00 to 11 of C+9AT Calculation GainSet this parameter to adjust the contribution of the PID calculation results to the stored values.Normally, leave this parameter set to its default(0000).• Increase the value when emphasizing stability.Decrease the value when emphasizing respon-siveness.0000 hex: 1.00 (Default)0001 to 03E8 hex (1 to 1000); (0.01 to 10.00, in units of 0.01)Allowed(These parameters are read when autotuning starts.)
C+10Limit-cycle HysteresisSets the hysteresis when the limit cycle is gener-ated. The default setting for reverse operation turns ON the MV with a hysteresis of SV-20%.Increase this setting if a proper limit cycle cannot be generated because the PV is unstable. How-ever, the AT accuracy will decline if the Limit-cycle Hysteresis is higher than necessary.0000 hex: 0.20% (Default)0001 to 03E8 hex:0.01 to 10.00% in units of 0.01%FFFF hex: 0.00%Note The percentage is with respect to the input range.

Note 1 When the unit is designated as 1, the range is from 1 to 8,191 times the period. When the unit is designated as 9, the range is from 0.1 to 819.1 s. When 9 is designated, set the integral and derivative times to within a range of 1 to 8,191 times the sampling period.
2 Setting the 2-PID parameter () to 000 yields 0.65, the normal value.
3 When the manipulated variable output limit control is enabled (i.e., set to "1"), set the values as follows: 0000 ≤ MV output lower limit ≤ MV output upper limit ≤ Max. value of output range

Sampling Period and Cycle Time

The sampling period can be designated in units of 10 ms (0.01 to 99.99 s), but the actual PID action is determined by a combination of the sampling period and the time of PID instruction execution (with each cycle). The relationship between the sampling period and the cycle time is as follows:

  • If the sampling period is less than the cycle time, PID control is executed with each cycle and not with each sampling period.
  • If the sampling period is greater than or equal to the cycle time, PID control is not executed with each cycle, but PID(190) is executed when the cumulative value of the cycle time (the time between PID instructions) is greater than or equal to the sampling period. The surplus portion of the cumulative value (i.e., the cycle time's cumulative value minus the sampling period) is carried forward to the next cumulative value.

For example, suppose that the sampling period is 100 ms and that the cycle time is consistently 60 ms. For the first cycle after the initial execution, PID(190) will not be executed because 60 ms is less than 100 ms. For the second cycle, 60 ms + 60 ms is greater than 100 ms, so PID(190) will be executed. The surplus of 20 ms (i.e., 120 ms - 100 ms = 20 ms) will be carried forward.

For the third cycle, the surplus 20ms is added to 60~ms . Because the sum of 80~ms is less than 100 ms, PID(190) will not be executed. For the fourth cycle, the 80~ms is added to 60~ms . Because the sum of 140~ms is greater than 100~ms , PID(190) will be executed and the surplus of 40~ms (i.e., 120~ms - 100~ms = 20~ms ) will be carried forward. This procedure is repeated for subsequent cycles.

OMRON CP1E - Sampling Period and Cycle Time - 1
Reading of measurement time
Less than 100 ms, so PID is not executed.
Greater than 100 ms, so PID is executed and 20 ms is carried forward.
Less than 100 ms, so PID is not executed.
Greater than 100 ms, so PID is executed and 40 ms is carried forward.

PID control

Proportional Action (P)

Proportional action is an operation in which a proportional band is established with respect to the set value (SV), and within that band the manipulated variable (MV) is made proportional to the deviation. An example for reverse operation is shown in the following illustration.

If the proportional action is used and the present value (PV) becomes smaller than the proportional band, the manipulated variable (MV) is 100% (i.e., the maximum value). Within the proportional band, the MV is made proportional to the deviation (the difference between from SV and PV) and gradually decreased until the SV and PV match (i.e., until the deviation is 0), at which time the MV will be at the minimum value of 0% (or 50% , depending on the setting of the manipulated variable output designation parameter). The MV will also be 0% when the PV is larger than the SV.

The proportional band is expressed as a percentage of the total input range. The smaller the proportional band, the larger the proportional constant and the stronger the corrective action will be. With proportional action an offset (residual deviation) generally occurs, but the offset can be reduced by making the proportional band smaller. If it is made too small, however, hunting will occur.

OMRON CP1E - Proportional Action (P) - 1

- Integral Action (I)

Combining integral action with proportional action reduces the offset according to the time that has passed, so that the PV will match the SV. The strength of the integral action is indicated by the integral time, which is the time required for the manipulated variable of the integral action to reach the same level as the manipulated variable of the proportional action with respect to the step deviation, as shown in the following illustration. The shorter the integral time, the stronger the correction by the integral action will be. If the integral time is too short, the correction will be too strong and will cause hunting to occur.

OMRON CP1E - - Integral Action (I) - 1

- Derivative Action (D)

Proportional action and integral action both make corrections with respect to the control results, so there is inevitably a response delay. Derivative action compensates for that drawback. In response to a sudden disturbance it delivers a large manipulated variable and rapidly restores the original status. A correction is executed with the manipulated variable made proportional to the incline (derivative coefficient) caused by the deviation.

The strength of the derivative action is indicated by the derivative time, which is the time required for the manipulated variable of the derivative action to reach the same level as the manipulated variable of the proportional action with respect to the step deviation, as shown in the following illustration. The longer the derivative time, the stronger the correction by the derivative action will be.

OMRON CP1E - - Derivative Action (D) - 1

PID Action

PID action combines proportional action (P), integral action (I), and derivative action (D). It produces superior control results even for control objects with dead time. It employs proportional action to provide smooth control without hunting, integral action to automatically correct any offset, and derivative action to speed up the response to disturbances.

OMRON CP1E - PID Action - 1

Direction of Action

When using PID control, select either of the following two control directions. In either direction, the MV increases as the difference between the SV and the PV increases.

  • Forward action: MV is increased when the PV is larger than the SV.
  • Reverse action: MV is increased when the PV is smaller than the SV.

OMRON CP1E - Direction of Action - 1
(MV output designation: 50%

OMRON CP1E - Direction of Action - 2

Adjusting PID Parameters

The general relationship between PID parameters and control status is shown below.

  • When it is not a problem if a certain amount of time is required for stabilization (settlement time), but it is important not to cause overshooting, then enlarge the proportional band.

OMRON CP1E - Adjusting PID Parameters - 1

  • When there is broad hunting, or when operation is tied up by overshooting and undershooting, it is probably because integral action is too strong. The hunting will be reduced if the integral time is increased or the proportional band is enlarged.

OMRON CP1E - Adjusting PID Parameters - 2

  • When overshooting is not a problem but it is desirable to quickly stabilize control, then narrow the proportional band. If the proportional band is narrowed too much, however, then hunting may occur.

OMRON CP1E - Adjusting PID Parameters - 3

  • If the period is short and hunting occurs, it may be that the control system response is quick and the derivative action is too strong. In that case, set the derivative action lower.

OMRON CP1E - Adjusting PID Parameters - 4

Sample program

- Interrupting PID Control to Perform Autotuning

OMRON CP1E - - Interrupting PID Control to Perform Autotuning - 1

  • At the rising edge of CIO 0.00 (OFF to ON), the work area in D211 to D240 is initialized according to the parameters (shown below) set in D200 to D208. After the work area has been initialized, PID control is executed and the manipulated variable is output to CIO 20.
  • While CIO 0.00 is ON, PID control is executed at the sampling period intervals according to the parameters set in D200 to D210. The manipulated variable is output to CIO 20.
  • The PID constants used in PID calculations will not be changed even if the proportional band (P), integral constant (Tik), or derivative constant is changed after CIO 0.00 turns ON.
  • At the rising edge of W 0.0 (OFF to ON), SETB(532) turns ON bit 15 of D209 ( C + 9 ) and starts autotuning. When autotuning is completed, the calculated P , I , and D constants are written to C + 1 , C + 2 , and C + 3 . PID control is then restarted with the new PID constants.

OMRON CP1E - - Interrupting PID Control to Perform Autotuning - 2

OMRON CP1E - - Interrupting PID Control to Perform Autotuning - 3

- Starting PIDAT(191) with Autotuning

0.00
PIDAT
S10
CD200
D20

At the rising edge of CIO 0.00 (OFF to ON), autotuning will be performed first if bit 15 of D209 (C + 9) is ON. When autotuning is completed, the calculated P, I, and D constants are written to C + 1 , C + 2 , and C + 3 . PID control is then started with the calculated PID constants.

OMRON CP1E - - Starting PIDAT(191) with Autotuning - 1

- Interrupting Autotuning Before Completion

Autotuning can be interrupted by turning bit 15 of D209 (C+9) from ON to OFF. PID control will be restarted with the P, I, and D constants that were in effect before autotuning was started.

OMRON CP1E - - Interrupting Autotuning Before Completion - 1

TPO

InstructionMnemonicVariationsFunction codeFunction
TIME-PROPORTIONAL OUTPUTTPO---685Inputs 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 speci-fied output.
SymbolTPO
TPOS: Input word C: First parameter word R: Pulse output bit
S
C
R

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SInput wordUINT1
CFirst parameter wordWORD7
RPulse output bitBOOL---

S: Input Word

Specifies the input word containing the input duty ratio or manipulated variable.

  • Input duty ratio: 0000 to 2710 hex (0.00% to 100.00%)
  • Input manipulated variable (See note.): 0000 to FFFF hex (0 to 65,535 max.) (Bits 00 to 03 of C specify the manipulated variable range, i.e., the number of valid bits in the manipulated variable. Specify the same number of bits as specified for the output range setting in PIDAT(191).)

Note If S is a manipulated variable, specify the word containing the manipulated variable output from a PIDAT(191) instruction.

C: First Parameter Word

Bits 04 to 07 of C specify the input type, i.e., whether the input word contains an input duty ratio or manipulated variable. (Set these bits to 0 hex to specify a input duty ratio or to 1 hex to specify a manipulated variable.)

The following diagram shows the locations of the parameter data.

OMRON CP1E - C: First Parameter Word - 1

OMRON CP1E - C: First Parameter Word - 2

Note For details, see the description of each parameter.

R: Pulse Output Bit

Specifies the destination output bit for the pulse output.

Normally, specify an output bit allocated to a Transistor Output Unit and connect a solid state relay to the Transistor Output Unit.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOKOK---------
C---
R---------------

Flags

NameLabelOperation
Error FlagERON if the input data in S is out of range. (The input data setting range depends on the input type setting.)ON if the C data is out of range. (The manipulated variable range will cause an error only when the input type is set to manipulated variable.)ON if the control period in C+1 is out of range.ON if the output limit function is enabled but the output lower limit (C+2) or output upper limit (C+3) is out of range.ON if the output limit function is enabled but the output lower limit (C+2) is less than or equal to the output upper limit (C+3).OFF in all other cases.

Function

Receives a duty ratio or manipulated variable input from the word address specified by S, converts the duty ratio to a time-proportional output (see note) based on the parameters specified in words C to C+3, and outputs a pulse output to the bit specified by R.

Note A time-proportional output is changed proportionally based on the ON/OFF ratio in input word S. The period in which the ON and OFF status changes is known as the control period and is set in parameter word C+1. Example: When the control period is 1 s and the input value is 50% , the bit is ON for 0.5 s and OFF for 0.5 s. When the control period is 1 s and the input value is 80% , the bit is ON for 0.8 s and OFF for 0.2 s.

Generally, TPO(685) is used together with PIDAT(191) and the PID instruction's manipulated variable result word (D) is specified as the input word (S) for the TPO(685) instruction. Also, an output bit allocated to a Transistor Output Unit is generally specified as R and a solid state relay is connected to the Transistor Output Unit to perform time-proportional control of a heater (proportional control of the ON/OFF ratio).

- Combining TPO(685) with a PID Control Instruction

When combining TPO(685) with a PID control instruction, the manipulated variable input is divided by the manipulated variable range to calculate the duty ratio, that duty ratio is converted to a time-proportional output, and pulses are output.

OMRON CP1E - - Combining TPO(685) with a PID Control Instruction - 1

In this case, set the same value for the PID Control instruction's output range and the TPO(685) instruction's manipulated variable range. For example, when the PID Control instruction's output range and the TPO(685) instruction's manipulated variable range are both set to 12 bits (0000 to 0FFF hex), the duty ratio is calculated by dividing the manipulated variable from the PID Control instruction by 0FFF hex and TPO(685) converts that duty ratio to a time-proportional output.

- External Wiring Example

Connect the Transistor Output Unit to a solid state relay (SSR) as shown in the following diagram.

OMRON CP1E - - External Wiring Example - 1

Parameter Settings

Control dataItemContentsSetting rangeChange with ON input condition
WordBits
C00 to 03Manipulated variable rangeSpecifies the number of input data bits.0 hex: 8 bits 5 hex: 13 bits1 hex: 9 bits 6 hex: 14 bits2 hex: 10 bits 7 hex: 15 bits3 hex: 11 bits 8 hex: 16 bits4 hex: 12 bitsAllowed
04 to 07Input typeSpecifies whether S contains a duty ratio or manipulated variable.0 hex: Duty ratioSetting range for S: 0000 to 2710 hex (0.00 to 100.00%)1 hex: Manipulated variableSetting range for S: 0000 to FFFF hex (0 to 65,535)(The maximum setting depends on the MV range set with bits 00 to 03 of C.)Allowed
08 to 11Input read timingSpecifies the input read timing.0 hex: Use the beginning value of the control period1 hex: Use lower value2 hex: Use higher value3 hex: Continuous adjustmentAllowed
12 to 15Output limit controlSpecifies whether the output limit function is enabled or disabled.0 hex: Disabled1 hex: Enabled (See note.)Allowed
C+100 to 15Control periodControl period(Time period in which the ON/OFF changes are made.)0064 to 270F hex (1.00 to 99.99 s)Note For example, 1.00 s is set as 0064 hex, and not 0001 hex.Allowed
C +200 to 15Output lower limitSpecifies the lower limit when the output limit is enabled.0000 to 2710 hex (0 to 100.00%)Allowed
C +300 to 15Output upper limitSpecifies the upper limit when the output limit is enabled.0000 to 2710 hex (0 to 100.00%)Allowed
C+400 to 15Work areaThis work area is used by the system. It cannot be used by the user.Cannot be used.---
C+500 to 15
C+600 to 15

Note When the output limit control function is enabled, set the lower and upper limits as follows: 0000 hex ≤ lower limit ≤ upper limit ≤ 2710 hex.

Execution

  • The instruction is executed while the input condition is ON.
  • When instruction execution starts, the output bit (R) is turned ON/OFF according to the duty ratio.

  • The parameters (in C to C+3) are read in real time each time that the instruction is executed. When changing the parameters, change all of them at the same time so that different sets of parameters are not mixed.

  • The output (R) is turned ON/OFF when the instruction is executed and the accuracy of the output's ON/OFF timing is 10 ms max.
  • Execution of the instruction stops when the input condition goes OFF. At that time, the elapsed time value will be reset and the control period will be initialized.
  • The input type setting (bits 04 to 07 of C) determines whether the input word (S) contains a duty ratio or manipulated variable. When S contains the manipulated variable, the duty ratio is calculated by dividing the manipulated variable input by the manipulated variable range (bits 00 to 03 of C).
  • The input read timing setting (bits 08 to 11 of C) specifies when the input word (S) is read, as shown in the following table:
Input read timingDescription
0: Use the beginning value of the control periodThe duty ratio input is read at the beginning of the control period and the ratio cannot be changed during the control period.
1: Use lower valueIf the duty ratio input falls below the duty ratio at the beginning of the control period, the lower value will take precedence and the output ON time will be reduced accordingly.
2: Use higher valueIf the duty ratio input rises above the duty ratio at the beginning of the control period, the higher value will take precedence and the output ON time will be increased accordingly.
3: Continuous adjustmentThe duty ratio will be read in real time each time the instruction is executed and the ON/OFF operation will be repeated within the control period.

The following diagrams show the operation of each input read timing setting.

  • Input time setting = 0 (Use the beginning value of the control period.)

OMRON CP1E - Execution - 1

  • Input time setting = 1 (Use lower value.)

OMRON CP1E - Execution - 2

  • Input time setting = 2 (Use higher value.)

OMRON CP1E - Execution - 3

If the duty ratio rises above the initial value early enough, the duty ratio will be adjusted and the output will be turned ON sooner. (With this setting the output's ON/OFF order is reversed and the output goes from OFF to ON.)

Use this setting for applications such as avoiding undershooting when using time-proportional control to control cooling and using relatively long control period.

  • Input time setting = 3 (Continuous adjustment)

OMRON CP1E - Execution - 4

Changes in the duty ratio are monitored in real time. If the duty ratio falls below the initial value early enough, the duty ratio will be adjusted and the output will be turned OFF sooner. If the duty ratio rises again after that, the ratio will be adjusted again and the output will be turned ON. This process is repeated continuously. Use this setting to improve responsiveness when the control period is relatively long and the duty ratio changes quickly. This setting is also appropriate for lighting or power applications that require precise control.

  • The output limiter function (bits 12 to 15 of C) can be enabled to restrict (saturate) output when it is outside the range between the output limiter lower limit (C + 2) and output limiter upper limit (C + 3) .

Precautions

When using TPO(685) in combination with PIDAT(191) in a cyclic task and also using an interrupt task, temporarily disable interrupts by executing DI(693) (DISABLE INTERRUPTS) ahead PIDAT(191) and TPO(685). If interrupts are not disabled and an interrupt occurs between the PIDAT(191) and TPO(685), the control period may be shifted.

OMRON CP1E - Precautions - 1

Sample program

Combining TPO(685) with PIDAT(191)

When CIO 0.00 is ON, TPO(685) takes the manipulated variable output from PIDAT(191) (contained in D0), calculates the duty ratio from that manipulated variable value (Duty ratio = MV ÷ MV range), converts the duty ratio to a time-proportional output, and outputs the pulses to bit 01 of CIO 100.

In this case, CIO 100 is allocated to a Transistor Output Unit and bit CIO 100.01 is connected to a solid state relay for heater control.

OMRON CP1E - Combining TPO(685) with PIDAT(191) - 1

OMRON CP1E - Combining TPO(685) with PIDAT(191) - 2

Using TPO(685) Alone

When CIO 0.00 is ON, TPO(685) takes the duty ratio in D10, converts the duty ratio to a time-proportional output, and outputs the pulses to bit 00 of CIO 100.

In this case, the control period is 1 s and the output limit function is enabled with a lower limit 20.00% and an upper limit of 80.00% .

OMRON CP1E - Using TPO(685) Alone - 1

SCL

InstructionMnemonicVariationsFunction codeFunction
SCALINGSCL@SCL194Converts unsigned binary data into unsigned BCD data according to the specified linear function.
SymbolSCL
SCL(194)S: Source word
SP1: First parameter word
RR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordUINT1
P1First parameter wordLWORD4
RResult wordWORD1

P1: First Parameter Word

OMRON CP1E - P1: First Parameter Word - 1

Note P1 to P1 + 3 must be in the same area.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, P1, ROKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the contents of P1 (Ar) or P1+1 (Br) is not BCD. ON if the contents of P1+1 (As) and P1+3 (Bs) are equal. OFF in all other cases.
Equals FlagP_EQON if the result is 0. OFF in all other cases.

Function

SCL(194) is used to convert the unsigned binary data contained in the source word S into unsigned BCD data and place the result in the result word R according to the linear function defined by points (As, Ar) and (Bs, Br). The address of the first word containing the coordinates of points (As, Ar) and (Bs, Br) is specified for the first parameter word P1. These points define by 2 values (As and Bs) before scaling and 2 values (Ar and Br) after scaling.

The following equations are used for the conversion.

$$ R = B d - \frac {(B r - A r)}{B C D c o n v e r s i o n o f (B s - A s)} \times B C D c o n v e r s i o n o f (B s - S) $$

Points A and B can define a line with either a positive or negative slope. Using a negative slope enables reverse scaling.

  • The result will be rounded to the nearest integer. If the result is less than 0000, 0000 will be output as the result.
  • If the result is greater than 9999, 9999 will be output.

OMRON CP1E - Function - 1

Hint

  • SCL(194) can be used to scale the results of analog signal conversion values from Analog Input Units according to user-defined scale parameters. For example, if a 1 to 5-V input to an Analog Input Unit is input to memory as 0000 to 0FA0 hexadecimal, the value in memory can be scaled to 50 to 200^ using SCL(194).
  • SCL(194) converts unsigned binary to unsigned BCD. To convert a negative value, it will be necessary to first add the maximum negative value in the program before using SCL(194) (see example). SCL(194) cannot output a negative value to the result word, R. If the result is a negative value, 0000 will be output to R.

Sample program

In the following example, it is assumed that an analog signal from 1 to 5V is converted and input to D0 as 0000 to 0FA0 hexadecimal. SCL(194) is used to convert (scale) the value in CIO 200 to a value between 0 and 300 BCD.

When CIO 0.00 is ON, the contents of D0 is scaled using the linear function defined by point A (0000, 0000) and point B (0FA0, 0300). The coordinates of these points are contained in D100 to D103, and the result is output to D200.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

P1: D1000000Ar(BCD)
P1+1:D1010000As(BIN)
P1+2:D1020300Br(BCD)
P1+3:D1030FA0Bs(BIN)

Reference:

An Analog Input Unit actually inputs values from FF38 to 1068 hexadecimal for 0.8 to 5.2 V. SCL(194), however, can handle only unsigned binary values between 0000 and FFFF hexadecimal, making it impossible to use SCL(194) directly to handle signed binary values below 1 V (0000 hexadecimal), i.e., FF38 to FFFF hexadecimal. In an actual application, it is thus necessary to add 00C8 hexadecimal to all values so that FF38 hexadecimal is represented as 0000 hexadecimal before using SCL(194), as shown in the following example.

OMRON CP1E - Reference: - 1

OMRON CP1E - Reference: - 2

OMRON CP1E - Reference: - 3

Point A (00C8 Hex 0000 (BCD)) Point B (1068 Hex 0300 (BCD))

P1: D1000000
P1+1:D10100C8
P1+2:D1020300
P1+3:D1031068

In this example, values from 0000 to 00C8 hexadecimal will be converted to negative values. SCL(194), however, can output only unsigned BCD values from 0000 to 9999, so 0000 BCD will be output whenever the contents of D0.00 is between 0000 and 00C8 hexadecimal.

Reverse Scaling

Reverse scaling can also be used by setting As < Bs and Ar > Br . The following relationship will result.

OMRON CP1E - Reverse Scaling - 1

Reverse scaling can be used, for example, to convert (reverse scale) 1 to 5V (0000 to 0FA0 hexadecimal) to 0300 to 0000, respectively, as shown in the following diagram.

OMRON CP1E - Reverse Scaling - 2

SCL2

InstructionMnemonicVariationsFunction codeFunction
SCALING 2SCL2@SCL2486Converts signed binary data into signed BCD data according to the specified linear function. An offset can be input in defining the linear function.
SymbolSCL2
SCL2(486)S: Source word
SP1: First parameter word
RR: Result word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordINT1
P1First parameter wordWORD3
RResult wordWORD1

OMRON CP1E - Reverse Scaling - 3
P1: First Parameter Word

Note P1 to P1 + 2 must be in the same area.

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, P1, ROKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the contents of C+1 (ΔX) is 0000. ON if the contents of C+2 (ΔY) is not BCD. OFF in all other cases.
Equals FlagP_EQON if the result is 0. OFF in all other cases.
Carry FlagP_CYON if the result is negative. OFF if the result is zero or positive.

Function

SCL2(486) is used to convert the signed binary data contained in the source word S into signed BCD data (the BCD data contains the absolute value and the Carry Flag shows the sign) and place the result in the result word R according to the linear function defined by the slope ( X, Y) and an offset. The address of the first word containing X, Y, and the offset is specified for the first parameter word P1. The sign of the result is indicated by the status of the Carry Flag (ON: negative, OFF: positive).

The following equations are used for the conversion.

$$ R = \frac {\Delta Y}{\text {B C D c o n v e r s i o n} \Delta X} \times [ (\text {B C D c o n v e r s i o n} S) - (\text {B C D c o n v e r s i o n} \text {o f t e s t}) ] $$

Note The slope of the line is Y / X

The offset and slope can be a positive value, 0, or a negative value. Using a negative slope enables reverse scaling.

  • The result will be rounded to the nearest integer.
  • The result in R will be the absolute BCD conversion value and the sign will be indicated by the Carry Flag. The result can thus be between -9999 and 9999.
  • If the result is less than -9999 , -9999 will be output as the result. If the result is greater than 9999 , 9999 will be output.

OMRON CP1E - Function - 1
Positive Offset
R (signed BCD)

Negative Offset
R (signed BCD)
OMRON CP1E - Function - 2
P1
P1+1
P1+2

OMRON CP1E - Function - 3
(Signed binary)

OMRON CP1E - Function - 4
(Signed binary)
(Signed BCD)
Offset of 0000
R (signed BCD)

Hint

  • SCL2(486) can be used to scale the results of analog signal conversion values from Analog Input Units according to user-defined scale parameters. For example, if a 1 to 5-V input to an Analog Input Unit is input to memory as 0000 to 0FA0 hexadecimal, the value in memory can be scaled to -100 to 200^ using SCL2(486).
  • SCL2(486) converts signed binary to signed BCD. Negative values can thus be handled directly for S. The result of scaling in R and the Carry Flag can also be used to output negative values for the scaling result.

Sample program

- Scaling 1 to 5-V Analog Input to 0 to 300

In the following example, it is assumed that an analog signal from 1 to 5V is converted and input to CIO 3 as 0000 to 1770 hexadecimal. SCL2(486) is used to convert (scale) the value in CIO 3 to a value between 0000 and 0300 BCD.

When CIO 0.00 is ON, the contents of CIO 3 is scaled using the linear function defined by X (1770), Y (0300), and the offset (0). These values are contained in D100 to D102, and the result is output to D200.

OMRON CP1E - - Scaling 1 to 5-V Analog Input to 0 to 300 - 1

OMRON CP1E - - Scaling 1 to 5-V Analog Input to 0 to 300 - 2

P1: D1000000Offset
P1+1:D1011770ΔX
P1+2:D1020300ΔY

- Scaling 1 to 5-V Analog Input to -200 to 200

In the following example, it is assume that an analog signal from 1 to 5V is converted and input to CIO 3 as 0000 to 1770 hexadecimal. SCL2(486) is used to convert (scale) the value in CIO 3 to a value between -0200 and 0200 BCD.

When CIO 0.00 is ON, the contents of CIO 3 is scaled using the linear function defined by X (1770), Y (0400), and the offset (07D0). These values are contained in D100 to D102, and the result is output to D200.

OMRON CP1E - - Scaling 1 to 5-V Analog Input to -200 to 200 - 1

OMRON CP1E - - Scaling 1 to 5-V Analog Input to -200 to 200 - 2

P1: D10007D0Offset
P1+1:D1011770ΔX
P1+2:D1020400ΔY

SCL3

InstructionMnemonicVariationsFunction codeFunction
SCALING 3SCL3@SCL3487Converts signed BCD data into signed binary data according to the specified linear function. An offset can be input in defining the linear function.
SymbolSCL3
SCL3(487)
S
P1
R

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordWORD1
P1First parameter wordWORD5
RResult wordINT1

OMRON CP1E - - Scaling 1 to 5-V Analog Input to -200 to 200 - 3
P1: First Parameter Word

Note P1 to P1 + 4 must be in the same area.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S. P1,ROKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the contents of S is not BCD.ON if the contents of C+1 (ΔX) is not between 0001 and 9999 BCDOFF in all other cases.
Equals FlagP_EQON if the result is 0.OFF in all other cases.
Negative FlagP_NON when the MSB of the R (the result) is 1OFF in all other cases.

Function

SCL3(487) is used to convert the signed BCD data (the BCD data contains the absolute value and the Carry Flag shows the sign) contained in the source word S into signed binary data and place the result in the result word R according to the linear function defined by the slope ( X, Y) and an offset. The maximum and minimum conversion values are also specified. The address of the first word containing X, Y , the offset, the maximum conversion, and the minimum conversion is specified for the first parameter word P1.

The sign of the result is indicated by the status of the Carry Flag (ON: negative, OFF: positive). Use STC(040) and CLC(041) to turn the Carry Flag ON and OFF.

The following equations are used for the conversion.

$$ R = \frac {\Delta Y}{\text {B i n a r y c o n v e r s i o n o f} \Delta X} \times ((\text {B i n a r y c o n v e r s i o n o f S}) + (\text {O f f s e t})) $$

Note The slope of the line is Y / X

  • The offset and slope can be a positive value, 0, or a negative value. Using a negative slope enables reverse scaling.
  • The result will be rounded to the nearest integer.
  • The source value in S is treated as an absolute BCD value and the sign is indicated by the Carry Flag. The source value can thus be between -9999 and 9999.
  • If the result is less than the minimum conversion value, the minimum conversion value will be output as the result. If the result is greater than the maximum conversion value, the maximum conversion value will be output.

OMRON CP1E - Function - 1

Hint

SCL3(487) is used to convert data using a user-defined scale to signed binary for Analog Output Units. For example, SCL3(487) can convert 0 to 200^ to 0000 to 1770 (hex) and output an analog output signal 1 to 5V from the Analog Output Unit.

Sample program

When a value from 0 to 200 is scaled to an analog signal (1 to 5V , for example), a signed BCD value of 0000 to 0200 is converted (scaled) to signed binary value of 0000 to 1770 for an Analog Output Unit. When CIO 0.00 turns ON in the following example, the contents of D0 is scaled using the linear function defined by X (0200), Y (1770), and the offset (0). These values are contained in D100 to D102. The sign of the BCD value in D0 is indicated by the Carry Flag. The result is output to CIO 103.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

P1 :D1000000
P1+1:D1010200
P1+2:D1021770
P1+3:D103189C
P1+4:D104FED4

AVG

InstructionMnemonicVariationsFunction codeFunction
AVERAGEAVG---195Calculates the average value of an input word for the specified number of cycles.
SymbolAVG
AVG(195)S: Source word
SN: Number of cycles
RR: Result first word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordUINT1
NNumber of cyclesUINT1
RResult first wordUINTVariable

N: Number of Cycles

The number of cycles must be between 0001 and 0040 hexadecimal (0 to 64 cycles).

R: Result First Word and R+1: First Work Area Word

R: Average

R+1: Processing information

OMRON CP1E - R: Result First Word and R+1: First Work Area Word - 1

Note R to R + N + 1 must be in the same area.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, NOKOKOKOKOKOKOKOKOKOK---------
R---

Flags

NameLabelOperation
Error FlagP_ERON if the contents of N is 0. OFF in all other cases.

Function

For the first N-1 cycles when the execution condition is ON, AVG(195) writes the values of S in order to words starting with R+2. The Previous Value Pointer (bits 00 to 07 of R+1) is incremented each time a value is written. Until the Nth value is written, the contents of S will be output unchanged to R and the Average Value Flag (bit 15 of R+1) will remain OFF.

When the Nth value is written to R + N + 1 , the average of all the values that have been stored will be computed, the average will be output to R as an unsigned binary value, and the Average Value Flag (bit 15 of R + 1 ) will be turned ON. For all further cycles, the value in R will be updated for the most current N values of S .

The maximum value of N is 64. If a value greater than 64 is specified, operation will use a value of 64.

The Previous Value Pointer will be reset to 0 after N-1 values have been written.

The average value output to R will be rounded to the nearest integer.

OMRON CP1E - Function - 1

Precautions

The processing information (R + 1) is cleared to 0000 each time the execution condition changes from OFF to ON.

But the processing information (R + 1) will not be cleared to 0000 the first time the program is executed at the start of operation. If AVG(195) is to be executed in the first program scan, clear the First Work Area Word from the program.

Sample program

When CIO 0.00 is ON in the following example, the contents of D100 will be stored one time each scan for the number of scans specified in D200. The contents will be stored in order in the ten words from D302 to D311. The average of the contents of these ten words will be placed in D300 and then bit 15 of D301 will be turned ON.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

  • In the following example, the content of CIO 40 is set to #0000 and then incremented by 1 each cycle.
  • For the first two cycles, AVG(195) moves the content of CIO 40 to D1002 and D1003. The contents of D1001 will also change (which can be used to confirm that the results of AVG(195) has changed).
  • On the third and later cycles AVG(195) calculates the average value of the contents of D1002 to D1004 and writes that average value to D1000.

OMRON CP1E - Sample program - 3

OMRON CP1E - Sample program - 4

D10000112
D10011280008001
D10020003
D1003---111
D1004------22

Average

Pointer

3 previous values of IR 40

Subroutines Instructions

SBS

InstructionMnemonicVariationsFunction codeFunction
SUBROUTINE CALLSBS@SBS091Calls the subroutine with the specified subroutine number and executes that program.
SymbolSBS
SBS(091) N: Subroutine number

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NSubroutine number---1

N: Subroutine number

Specifies the subroutine number between 0 and 127 decimal.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------

Combined-use instructions

NameLabelOperation
Error FlagP_ERON if nesting exceeds 16 levels.ON if the specified subroutine number does not exist.ON if a subroutine calls itself.ON if a subroutine being executed is called.ON if the specified subroutine is not defined in the current task.OFF in all other cases.

Function

SBS(091) calls the subroutine with the specified subroutine number. The subroutine is the program section between SBN(092) and RET(093). When the subroutine is completed, program execution continues with the next instruction after SBS(091).

A subroutine can be called more than once in a program.

OMRON CP1E - Function - 1

Subroutines can be nested up to 16 levels. Nesting is when another subroutine is called from within a subroutine program, such as shown in the following example, which is nested to 3 levels.

OMRON CP1E - Function - 2

OMRON CP1E - Function - 3

Precautions

  • The subroutine number must be unique for each subroutine. You cannot use the same number for more than one subroutine.
    Each subroutine must have a unique subroutine number. Do not use the same subroutine number for more than one subroutine.
  • Observe the following precautions when using differentiated instructions (DIFU(013), DIFD(014), or up/down differentiated instructions) in subroutines.

  • The operation of differentiated instructions in a subroutine is unpredictable if a subroutine is executed more than once in the same cycle. In the following example, subroutine 1 is executed when CIO 0.00 is ON and CIO 1.00 is turned ON by DIFU(013) when CIO 0.01 has gone from OFF to ON. If CIO 0.01 is ON in the same cycle, subroutine 1 will be executed again but this time DIFU(013) will turn CIO 1.00 OFF without checking the status of CIO 0.01.

  • In contrast, a differentiated instruction (UP, DOWN, DIFU(013) or DIFD(014)) would maintain the ON status if the instruction was executed and the output was turned ON but the same subroutine was not called a second time.
  • In the following example, subroutine 1 is executed if CIO 0.00 is ON. Output CIO 1.00 is turned ON by DIFU(013) when CIO 0.01 has gone from OFF to ON. If CIO 0.00 is OFF in the following cycle, subroutine 1 will not be executed again and output CIO 1.00 will remain ON
  • SBS(091) will be treated as NOP(000) when it is within a program section interlocked by IL(002) and ILC(003).

OMRON CP1E - Precautions - 1

OMRON CP1E - Precautions - 2

Sample program

- Sequential (Non-nested) Subroutines

OMRON CP1E - - Sequential (Non-nested) Subroutines - 1

0.000.01Order of execution
ONONA→S1→B→S2→C
ONOFFA→S1→B→C
OFFONA→B→S2→C
OFFOFFA→B→C

When CIO 0.00 is ON in the following example, subroutine 1 is executed and program execution returns to the next instruction after SBS(091) 1. When CIO 0.01 is ON, subroutine 2 is executed and program execution returns to the next instruction after SBS(091) 2.

- Nested Subroutines

OMRON CP1E - - Nested Subroutines - 1

0.000.01Order of execution
ONONA→S1-1→S2→S1-2→B
ONOFFA→S1-1→S1-2→B
OFFONA→B
OFFOFFA→B

When CIO 0.00 is ON in the following example, subroutine 1 is executed. If CIO 0.01 is ON, subroutine 2 is executed from within subroutine 1 and program execution returns to the next instruction after SBS(091) 2 when subroutine 2 is completed. Execution of subroutine 1 continues and program execution returns to the next instruction after SBS(091) 1 when subroutine 1 is completed.

SBN/RET

InstructionMnemonicVariationsFunction codeFunction
SUBROUTINE ENTRYSBN---092Indicates the beginning of the subroutine program with the specified subroutine number.
SUBROUTINE RETURNRET---093Indicates the end of a subroutine program.
SymbolSBNRET
SBN(092)NN: Subroutine numberRET(093)

Applicable Program Areas

SBN

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedNot allowedOK

RET

AreaStep program areasSubroutinesInterrupt tasks
UsageNot allowedOKOK

Operands

OperandDescriptionData typeSize
SBN
NSubroutine number---1
  • SBN

N: Subroutine number

Specifies the subroutine number between 0 and 127 decimal.

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SBNN---------------------------OK---------

Combined-use instructions

There are no flags affected by this instruction.

Function

- SBN

SBN(092) indicates the beginning of the subroutine with the specified subroutine number. The end of the subroutine is indicated by RET(093).

The region of the program beginning at the first SBN(092) instruction is the subroutine region. A subroutine is executed only when it has been called by SBS(091).

OMRON CP1E - - SBN - 1

RET

When program execution reaches RET(093), it is automatically returned to the next instruction after the SBS(091) instruction that called the subroutine.

Precautions

  • Place the subroutine program area (SBN(092) to RET(093)) in the same task as the SBS(091) instruction of the same number. Subroutines in other tasks cannot be called.

OMRON CP1E - Precautions - 1

  • The step instructions, STEP(008) and SNXT(009) cannot be used in subroutines.

OMRON CP1E - Precautions - 2

  • Place the subroutines after the main program and just before the END(001) instruction in the program for each task. If part of the main program is placed after the subroutine region, that program section will be ignored.

OMRON CP1E - Precautions - 3

Note The input method for the subroutine number, N, is different for the CX-Programmer. Input #0 to #127 on the CX-Programmer.

Sample program

When CIO 0.00 is ON in the following example, subroutine 10 is executed and program execution returns to the next instruction after the SBS(091) or MCRO(099) instruction that called the subroutine.

OMRON CP1E - Sample program - 1

Interrupt Control Instructions

CP1E CPU Units support the following interrupts.

TypeExecution conditionSetting procedure
I/O InterruptsInterrupt input from the built-in Input on the CPU Rack turns ON/OFF.Use the MSKS instruction to assign inputs from Interrupt Input on the CPU Rack.
Scheduled InterruptsScheduled (fixed intervals)Use the MSKS instruction to set the interrupt interval.

Outline of Interrupt Control Instructions

- SET INTERRUPT MASK: MSKS(690)

Both I/O interrupt tasks and scheduled interrupt tasks are masked (disabled) when the PLC enters RUN mode. MSKS(690) can be used to unmask or mask I/O interrupts and set the time intervals for scheduled interrupts.

CLEAR INTERRUPT: CLI(691)

CLI(691) clears or retains recorded interrupt inputs for I/O interrupts or sets the time to the first scheduled interrupt for scheduled interrupts. It also clears or retains recorded high-speed counter interrupts.

- DISABLE INTERRUPTS: DI(693)

DI(693) disables execution of all interrupt tasks.

- ENABLE INTERRUPTS: EI(694)

EI(694) enables execution of all interrupt tasks.

Precautions in Using Interrupt Tasks

- Precautions for All Interrupts

  • When multiple interrupts occur at once, the order of execution of the interrupts is as follows: I/O interrupt > scheduled interrupt

Note "A > B" indicates that A is given priority over B. On the same interrupt level, lower numbered tasks are given priority over higher numbered tasks.

- Precautions for I/O Interrupts

  • Only built-in inputs from CP1E CPU Units are supported for interrupt tasks.
  • Use interrupt inputs on the CPU Rack from 0ch02 bit to 0ch07 bit. I/O interrupt tasks will not be executed if using any other input.
  • All interrupt inputs that have been detected will be cleared when the interrupt mask is cleared.
  • There is no limit on the number of I/O interrupt inputs that can be recorded, but only one interrupt is recorded for each I/O interrupt number. Furthermore, the recorded interrupt is not cleared until its interrupt task has been completed, so a new interrupt input will be ignored if it is received while its interrupt task is being executed.

- Precautions for Scheduled Interruptions

  • Be sure that the time interval is longer than the time required to execute the scheduled interrupt task.
  • To accurately control the time to the first interrupt and the interrupt interval, program CLI(691) to set the time to the first schedule interrupt just before programming MSKS(690). If MSKS(690) is used to restart a schedule interrupt, the time to the first scheduled interrupt will be accurate even if CLI(691) is not used.
  • The time unit for the scheduled interrupt is always 0.1ms.

Related Memory Area Words

NameAddressOperation
Maximum Interrupt Task Processing TimeA440The maximum processing time for an interrupt task is stored in binary data in 0.1-ms units and is cleared at the start of operation.
Interrupt Task with Maximum Processing TimeA441The interrupt task number with maximum processing time is stored in binary data. Here, 8000 to 800F Hex correspond to task numbers 00 to 0F 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 and will be cleared at the start of operation.

MSKS

InstructionMnemonicVariationsFunction codeFunction
SET INTERRUPT MASKMSKS@MSKS690Controls whether I/O interrupt tasks and sched-uled interrupt tasks are executed.
SymbolMSKS
MSKS(690)
N
C

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NInterrupt identifier---1
CControl dataUINT1

(1) I/O Interrupt Task

OperandContents
Disabling/Enabling Interrupt Input SettingSpecifying Up/Down Differentiation of an Interrupt Input
NI/O Interrupt No.I/O Interrupt No.
102: Interrupt input 2 (interrupt task 2)112: Interrupt input 2 (interrupt task 2)
103: Interrupt input 3 (interrupt task 3)113: Interrupt input 3 (interrupt task 3)
104: Interrupt input 4 (interrupt task 4)114: Interrupt input 4 (interrupt task 4)
105: Interrupt input 5 (interrupt task 5)115: Interrupt input 5 (interrupt task 5)
106: Interrupt input 6 (interrupt task 6)116: Interrupt input 6 (interrupt task 6)
(Cannot be used in CP1E-E10D□-□)(Cannot be used in CP1E-E10D□-□)
107: Interrupt input 7 (interrupt task 7)117: Interrupt input 7 (interrupt task 7)
(Cannot be used in CP1E-E10D□-□)(Cannot be used in CP1E-E10D□-□)
CInterrupt MaskInterrupt Mask
0000 hex: Enable (unmask) the interrupt (direct mode).0000 hex: Up-differentiation (Detect rising edge.)
0001 hex: Disable (mask) the interrupt (direct mode).0001 hex: Down-differentiation (Detect falling edge.)

Note When the up/down differentiation setting is changed, all detected interrupt inputs will be cleared.

(2) Resetting and Starting Scheduled Interrupts

OperandContents
NScheduled Interrupt No.
4 or 14: Scheduled interrupt 0 (interrupt task 1)
CScheduled interrupt time unitsScheduled interrupt set time
Any time unit setting0 decimal (0000 hex): Disable interrupt. (Stop internal timer.)
0.1 ms10 to 9,999 decimal (000A to 270F hex): Enable interrupt. (Reset internal timer value, and then start timer with interrupt interval between 1.0 and 999.9 ms.) Note Settings 0001 to 000A cannot be used. An error will occur if one of these settings is used.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------
COKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if N is not within the specified range. Errors when specifying I/O Interrupts: · The Error Flag will go ON if C is not within the specified range. Errors when specifying Scheduled Interrupts: · The Error Flag will go ON if C is not between 10 and 9,999 decimal (000A to 270F hex). OFF in all other cases.

Function

When the program execution starts, the interrupt inputs that generate I/O interrupt tasks are masked (disabled), and the internal timers creating the timer interrupts that generate scheduled interrupt tasks are stopped.

Use MSKS(690) to enable the I/O interrupts and timer interrupts, so that the corresponding interrupt tasks can be executed.

The value of N specifies the interrupt task and the kind of processing that will be performed.

(1) N = 102 to 107: Enabling/Disabling the Interrupt Inputs of I/O Interrupt Tasks

  • Enables or disables the interrupt inputs specified by N, based on the status of the bits in C. With this function, MSKS(690) can control whether or not each task is executed.
  • When an interrupt input is enabled, any interrupts detected up to that point will be cleared.

(2) N = 112 to 117: Specifying the Differentiation of Interrupt Inputs

  • Specifies whether the interrupt inputs specified by N are up-differentiated or down-differentiated, based on the status of the bits in C.
  • Use the differentiation specification together with the enabling/disabling function. If MSKS(690) is not executed to specify up or down differentiation, the interrupt inputs are up-differentiated (the default setting).
  • When MSKS(690) is executed to specify an interrupt input's up or down differentiation, any interrupts detected up to that point will be cleared.

(3) N = 4 or 14: Resetting and Restarting Scheduled Interrupt Tasks

  • Sets the time interval (specified by C) for the specified scheduled interrupt task (specified by N), resets the internal timer's PV, and starts the internal timer. Since the internal timer's PV is reset, this function maintains the proper interval from the execution of MSKS(690) until the start of the first interrupt.

Hint

The longest interrupt task processing time is stored in A440 (Maximum Interrupt Task Processing Time). At the same time, the task number of the interrupt task with the longest interrupt task processing time is stored in A441 (Interrupt Task with Maximum Processing Time).

Precaution

  • Be sure that the time interval is longer than the time required to execute the scheduled interrupt task.
  • To accurately control the time to the first interrupt and the interrupt interval, program CLI(691) to set the time to the first schedule interrupt just before programming MSKS(690). If MSKS(690) is used to restart a schedule interrupt, however, the time to the first scheduled interrupt will be accurate even if CLI(691) is not used.
  • During the execution of a scheduled interrupt, the scheduled interrupt set time cannot be changed. Please change the scheduled interrupt set time after disable interrupt (stop internal timer) is set with MSKS instruction.

Sample program

Examples for Input Interrupts

When W0.00 turns ON in the following example, the first MSKS(690) (1) specifies generating input interrupts for input interrupt 3 when the interrupt input turns ON and the second MSKS(690) (2) unmarks the interrupt.

OMRON CP1E - Examples for Input Interrupts - 1

- Example for Scheduled Interrupts

When W0.01 turns ON in the following example, MSKS(690) sets the schedule interrupt interval for schedule interrupt 0 to 10.5 ms (assuming the unit is set to 0.1 ms in the PLC Setup), resets the internal timer, and starts the internal timer.

OMRON CP1E - - Example for Scheduled Interrupts - 1

CLI

InstructionMnemonicVariationsFunction codeFunction
CLEAR INTERRUPTCLI@CLI691C clears/retains recorded interrupt inputs, sets the time to the first scheduled interrupt for scheduled interrupt tasks.
SymbolCLI
—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—N: Interrupt numberC: Control data
CLI(691)
N
C

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NInterrupt number---1
CControl dataUINT1

(1) Clearing/Retaining an I/O Interrupt Task's Recorded Interrupt Inputs

OperandContents
NInterrupt Input No.
102: Interrupt input 2 (interrupt task 2)
103: Interrupt input 3 (interrupt task 3)
104: Interrupt input 4 (interrupt task 4)
105: Interrupt input 5 (interrupt task 5)
106: Interrupt input 6 (interrupt task 6) (Cannot be used in CP1E-E10D□-□)
107: Interrupt input 7 (interrupt task 7) (Cannot be used in CP1E-E10D□-□)
CRecorded Interrupt
0000 hex: Retain the recorded interrupt.
0001 hex: Clear the recorded interrupt.

(2) Setting the Time to the First Scheduled Interrupts

OperandContents
NScheduled Interrupt No.
4: Interrupt task 0 (interrupt task 1)
CScheduled interrupt time units (Set in the PLC Setup.)Scheduled interrupt set time
0.1 ms10 to 9,999 decimal (000A to 270F hex): Sets time to first interrupt between 1.0 and 999.9 ms.

(3) Clearing/Retaining High-speed Counter Interrupts

OperandContents
NHigh-speed Counter Input
10: High-speed counter input 0
11: High-speed counter input 1
12: High-speed counter input 2
13: High-speed counter input 3
14: High-speed counter input 4
15: High-speed counter input 5 (Cannot be used in CP1E-E10D□-□)
CRecorded Interrupt
0000 hex: Retain the recorded interrupt.
0001 hex: Clear the recorded interrupt.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------
COKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if N is not within the specified range.ON if C is not 0000 or 0001 hex (for I/O interrupts or high-speed counter interrupts).ON if C is not within the specified range of 10 to 9,999 decimal (000A to 270F hex) for scheduled interrupts.OFF in all other cases.

Function

Depending on the value of N, CLI(691) clears the specified recorded I/O interrupts, sets the time before execution of the first scheduled interrupt, or clears the specified recorded high-speed counter interrupts.

(1) N = 102 to 107: Clearing Interrupt Inputs

CLI(691) clears a recorded interrupt input specified by N, when the corresponding bit of C is ON and retains the recorded interrupt input when the corresponding bit is OFF.

OMRON CP1E - N = 102 to 107: Clearing Interrupt Inputs - 1

If an I/O interrupt task is being executed and an interrupt input with a different interrupt number is received, that interrupt number is recorded internally. The recorded I/O interrupts are executed later in order of their priority (from the lowest number to the highest).

If you want to ignore interrupt inputs that are received while an interrupt task is being executed, use CLI(691) to clear the recorded interrupts before they are executed.

(2) N = 4 : Setting the Time to the First Scheduled Interrupt Task

When N is 4, the content of C specifies the time interval to the first scheduled interrupt task.

OMRON CP1E - N = 4 : Setting the Time to the First Scheduled Interrupt Task - 1

(3) N = 10 or 15: Clearing High-speed Counter Interrupts

When N is 10 or 15, CLI(691) clears or retains the recorded high-speed counter interrupt (target comparison) specified by N.

Sample program

- Example for Input Interrupts

When W0.00 turns ON in the following example, CLI(691) clears all interrupts stored for input interrupt 2.

OMRON CP1E - - Example for Input Interrupts - 1

- Example for First Scheduled Interrupts

When W0.01 turns ON in the following example, CLI(691) sets the time to the first schedule interrupt 10.5 ms (0069 hex = 105 decimal).

OMRON CP1E - - Example for First Scheduled Interrupts - 1

OMRON CP1E - - Example for First Scheduled Interrupts - 2

- Example for High-speed Counter Interrupts

When W0.02 turns ON in the following example, CLI(691) clears all interrupts stored for high-speed counter interrupt 0.

OMRON CP1E - - Example for High-speed Counter Interrupts - 1

DI

InstructionMnemonicVariationsFunction codeFunction
DISABLE INTERRUPTSDI@DI693Disables execution of all interrupt tasks except the power OFF interrupt.
SymbolDI
—|—|—DI(693)—|—

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Flags

NameLabelOperation
Error FlagP_ERON if DI(693) is executed from an interrupt task. OFF in all other cases.

Function

DI(693) is executed from the main program to temporarily disable all interrupt tasks (I/O interrupts, scheduled interrupts).

Precautions

All interrupt tasks will remain disabled until El(694) is executed.

DI(693) cannot be executed from an interrupt task.

Sample program

OMRON CP1E - Sample program - 1

When CIO 0.00 is ON in the following example, DI(693) disables all interrupt tasks.

E

InstructionMnemonicVariationsFunction codeFunction
ENABLE INTERRUPTSEI---694Enables execution of all interrupt tasks that were disabled with DI(693).
SymbolEI
| EI(694) |

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Flags

NameLabelOperation
Error FlagP_ERON if EI(694) is executed from an interrupt taskOFF in all other cases.

Function

  • El(694) is executed from the main program to temporarily enable all interrupt tasks that were disabled by DI(693). DI(693) disables all interrupts (I/O interrupts, scheduled interrupts).

Precautions

  • El(694) does not require an execution condition. It is always executed with an ON execution condition.
  • EI(694) enables the interrupt tasks that were disabled by DI(693). It cannot unmask I/O interrupts that have not been unmasked by MSKS(690) or set scheduled interrupts that have not been set by MSKS(690).
  • El(694) cannot be executed in an interrupt task.

Sample program

OMRON CP1E - Sample program - 1

High-speed Counter/Pulse Output Instructions

INI

InstructionMne-monicVari-ationsFunction codeFunction
MODE CONTROLINI@INI880INI(880) can be used to execute the following operations • To start comparison with the high-speed counter comparison table • To stop comparison with the high-speed counter comparison table • To change the PV of the high-speed counter. • To change the PV of interrupt inputs in counter mode. • To change the PV of the pulse output (origin fixed at 0). • To stop pulse output.
SymbolINI
INI(880)
PP: Port specifier
CC: Control data
NVNV: First word with new PV

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifierWORD1
CControl dataUINT1
NVFirst word with new PVDWORD2

P: Port Specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1
0010 hexHigh-speed counter 0
0011 hexHigh-speed counter 1
0012 hexHigh-speed counter 2
0013 hexHigh-speed counter 3
0014 hexHigh-speed counter 4
0015 hexHigh-speed counter 5 (Cannot be used in CP1E-E10D□-□)
1000 hexPWM(891) output 0

C: Control Data

CINI(880) function
0000 hexStarts comparison.
0001 hexStops comparison.
0002 hexChanges the PV.
0003 hexStops pulse output.

NV: First Word with New PV

If C is 0002 hex (i.e., when changing a PV), NV and NV + 1 contain the new PV. Any values in NV and NV + 1 are ignored when C is not 0002 hex.

OMRON CP1E - NV: First Word with New PV - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, C---------------------------OK---------
NVOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, C, or NV is exceeded.ON if the combination of P and C is not allowed.ON if a comparison table has not been registered but starting comparison is specified.ON if a new PV is specified for a port that is currently outputting pulses.ON if changing the PV of a high-speed counter is specified for a port that is not specified for a high-speed counter.ON if INI(880) is executed in an interrupt task for a high-speed counter and an interrupt occurs when CTBL(882) is executed.OFF in all other cases.

Function

INI(880) performs the operation specified in C for the port specified in P. The possible combinations of operations and ports are shown in the following table.

P: Port specifierC: Control data
0000 hex: Start comparison0001 hex: Stop comparison0002 hex: Change PV0003 hex: Stop pulse output
0000 or 0001 hex: Pulse outputNot allowed.Not allowed.OKOK
0010 to 0015 hex: High-speed counter inputOKOKOKNot allowed.
1000 hex: PWM (891) outputNot allowed.Not allowed.Not allowed.OK

- Starting Comparison (C = 0000 hex)

If C is 0000 hex, INI(880) starts comparison of a high-speed counter's PV to the comparison table registered with CTBL(882).

Note A target value comparison table must be registered in advance with CTBL(882). If INI(880) is executed without registering a table, the Error Flag will turn ON.

- Stopping Comparison (C = 0001 hex)

If C is 0001 hex, INI(880) stops comparison of a high-speed counter's PV to the comparison table registered with CTBL(882).

  • Changing a PV ( C = 0002 hex)
Port and modeOperationSetting range
Pulse output (P = 0000 or 0001 hex)The present value of the pulse output is changed. The new value is specified in NV and NV+1.Note This instruction can be executed only when pulse output is stopped. An error will occur if it is executed during pulse output.8000 0000 to 7FFF FFFF hex(-2,147,483,648 to 2,147,483,647)
High-speed counter input (P = 0010 to 0015 hex)Linear ModeDifferential inputs, increment/decrement pulses, or pulse + direction inputsThe present value of the high-speed counter is changed. The new value is specified in NV and NV+1.Note An error will occur for the instruction if the specified port is not set for a high-speed counter.8000 0000 to 7FFF FFFF hex(-2,147,483,648 to 2,147,483,647)
Increment pulse input0000 0000 to FFFF FFFF hex(0 to 4,294,967,295)
Ring Mode0000 0000 to FFFF FFFF hex(0 to 4,294,967,295)

- Stopping Pulse Output ( P = 0000 , 0001 or 1000 hex and C = 0003 hex)

If C is 0003 hex, INI(880) immediately stops pulse output for the specified port. If this instruction is executed when pulse output is already stopped, then the pulse amount setting will be cleared.

Sample program

When CIO 0.00 turns ON in the following example, SPED(885) starts outputting pulses from pulse output 0 in Continuous Mode at 500Hz . When CIO 0.01 turns ON, pulse output is stopped by INI(880).

OMRON CP1E - Sample program - 1

PRV

InstructionMnemonicVariationsFunction codeFunction
HIGH-SPEED COUNTER PV READPRV@PRV881PRV(881) reads the High-speed counter PV and pulse output PV and interrupt input PV in counter mode.
SymbolPRV
— | —PRV(881)
P
C
D
P: Port specifier
C: Control data
D: First destination word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
CControl data---1
DFirst destination wordWORDVariable

P: Port Specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1
0010 hexHigh-speed counter 0
0011 hexHigh-speed counter 1
0012 hexHigh-speed counter 2
0013 hexHigh-speed counter 3
0014 hexHigh-speed counter 4
0015 hexHigh-speed counter 5 (Cannot be used in CP1E-E10D□-□)
1000 hexPWM(891) output 0

C: Control Data

CPRV(881) function
0000 hexReads the PV.
0001 hexReads status.
0002 hexReads range comparison results.
00□3 hexP = 0000 or 0001: Reads the output frequency of pulse output 0 or pulse output 1. C = 0003 hex P = 0010: Reads the frequency of high-speed counter input 0. C = 0013 hex: 10-ms sampling method C = 0023 hex: 100-ms sampling method C = 0033 hex: 1-s sampling method

D: First Destination Word

OMRON CP1E - D: First Destination Word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, C---------------------------OK---------
DOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P or C is exceeded.ON if the combination of P and C is not allowed.ON if reading range comparison results is specified even though range comparison is not being executed.ON if reading the output frequency is specified for anything except for high-speed counter 0.ON if specified for a port not set for a high-speed counter.OFF in all other cases.

Function

PRV(881) reads the data specified in C for the port specified in P. The possible combinations of data and ports are shown in the following table.

P: Port specifierC: Control data
0000 hex: Read PV0001 hex: Read status0002 hex: Read range comparison results
0000 or 0001 hex: Pulse outputOKOKNot allowed.
0010 to 0015 hex: High-speed counter inputOKOKOK
1000 hex: PWM (891) outputNot allowed.OKNot allowed.
P: Port specifier00□3 hex: Read frequency
0003 hex: Pulse output read high-speed counter frequency0013 hex: 10-ms sampling method0023 hex: 100-ms sampling method0033 hex: 1-s sampling method
0000 or 0001 hex: Pulse outputOKNot allowed.Not allowed.Not allowed.
0010 or 0015 hex: High-speed counter inputNot allowed.OK (high-speed counter 0 only)OK (high-speed counter 0 only)OK (high-speed counter 0 only)
1000 hex: PWM (891) outputNot allowed.Not allowed.Not allowed.Not allowed.

- Reading a PV ( C = 0000 hex)

Port and modeOperationSetting range
Pulse output (P = 0000 or 0001 hex)The present value of the pulse output is stored in D and D+1.8000 0000 to 7FFF FFFF hex(-2,147,483,648 to 2,147,483,647)
High-speed counter input (P = 0010 to 0015 hex)Linear ModeThe present value of the high-speed counter is stored in D and D+1.8000 0000 to 7FFF FFFF hex(-2,147,483,648 to 2,147,483,647)
Ring Mode0000 0000 to FFFF FFFF hex(0 to 4,294,967,295)

- Reading Status (C = 0001 hex)

Port and modeOperationResults of reading
Pulse outputThe pulse output status is stored in D.0 D 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15
High-speed counter inputThe high-speed counter status is stored in D.0 D 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PWM(891) outputThe PWM(891) output is stored in D.0 D 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0

- Reading the Results of Range Comparison (C = 0002 hex)

If C is 0002 hex, PRV(881) reads the results of range comparison and stores it in D as shown in the following diagram.

OMRON CP1E - - Reading the Results of Range Comparison (C = 0002 hex) - 1

- Reading Pulse Output or High-speed Counter Frequency (C = 00□3 hex)

If C is 00□3 hex, PRV(881) reads the frequency being output from pulse output 0 or 1 or the frequency being input to high-speed counter 0 and stores it in D and D + 1 .

0000 or 0001 hex (Reading the frequency of pulse output 0 or 1)

0000 0000 to 0001 86A0 hex (0 to 100,000)

0010 hex (Reading the frequency of high-speed counter 0)

Counter input method: Any input method other than 4 × differential phase mode:

Result = 00000000 to 000186A0 hex (0 to 100,000)

Note If a frequency higher than 100kHz has been input, the output will remain at the maximum value of 000186A0 hex.

Counter input method: 4× differential phase mode:

Result = 00000000 to 00030D40 hex (0 to 200,000)

Note If a frequency higher than 200kHz has been input, the output will remain at the maximum value of 00030D40 hex.

- Pulse Frequency Calculation Methods

The function counts the number of pulses within a fixed interval (the sampling time) and calculates the frequency from that count. One of the following three sampling times can be selected by setting the rightmost two digits of C.

Sampling timeValue of CDescription
10 ms0013 hexCounts the number of pulses every 10 ms. The error is 10% max. at 1 kHz.
100 ms0023 hexCounts the number of pulses every 100 ms. The error is 1% max. at 1 kHz.
1 s0033 hexCounts the number of pulses every 1 s. The error is 0.1% max. at 1 kHz.

Precautions

If the counter is reset when P is 0010 hex (high-speed counter 0) and C is 0013, 0023, or 0033 hex (sampling method), the data read during the sampling time when the counter was reset will not be dependable.

Sample program

When CIO 0.00 turns ON in the following programming example, CTBL(882) registers a range comparison table for high-speed counter 0 and starts comparison. When CIO 0.01 turns ON, PRV(881) reads the range comparison results at that time and stores them in CIO 0100.

OMRON CP1E - Sample program - 1

When CIO 1.00 turns ON in the following programming example, PRV(881) reads the frequency of the pulse being input to high-speed counter 0 at that time and stores it as a hexadecimal value in D200 and D201.

OMRON CP1E - Sample program - 2

CTBL

InstructionMnemonicVariationsFunction codeFunction
REGISTER COMPARISON TABLECTBL@CTBL882CTBL(882) is used to register a comparison table and perform comparisons for a high-speed counter PV.
SymbolCTBL
—|—|—CTBL(882)—|—|—P: Port specifierC: Control dataTB: First comparison table word
P
C
TB

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
CControl data---1
TBFirst comparison table wordLWORDVariable

P: Port specifier

PPort
0000 hexHigh-speed counter 0
0001 hexHigh-speed counter 1
0002 hexHigh-speed counter 2
0003 hexHigh-speed counter 3
0004 hexHigh-speed counter 4
0005 hexHigh-speed counter 5 (Cannot be used in CP1E-E10D□-□)

C: Control data

CCTBL(882) function
0000 hexRegisters a target value comparison table and starts comparison.
0001 hexRegisters a range comparison table and performs one comparison.
0002 hexRegisters a target value comparison table. Comparison is started with INI(880).
0003 hexRegisters a range comparison table. Comparison is started with INI(880).

TB: First comparison table word

  • TB is the first word of the comparison table. The structure of the comparison table depends on the type of comparison being performed.

For target value comparison, the length of the comparison table is determined by the number of target values specified in TB. The table can be between 4 and 19 words long, as shown below.

OMRON CP1E - TB: First comparison table word - 1

  • For range comparison, the comparison table always contains six ranges. The table is 30 words long, as shown below. If it is not necessary to set six ranges, set the interrupt task number to FFFF hex for all unused ranges.

OMRON CP1E - TB: First comparison table word - 2

Note Always set the upper limit greater than or equal to the lower limit for any one range.

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, C---------------------------OK---------
TBOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P or C is exceeded.ON if the number of target values specified for target value comparison is set to 0.ON if the number of target values specified for target value comparison exceeds 6.ON if the upper value is less than the lower value for any range.ON if the set values for all ranges are disabled during a range comparison.ON if the high-speed counter is set for incremental pulse mode and decrementing is set in the table as the direction for comparison.ON if the same target value is specified more than once in the same comparison direction for target comparison when the high-speed counter is set to incremental pulse mode and linear mode.ON if an instruction is executed when the high-speed counter is set to Ring Mode and the specified value exceeds the maximum ring value.ON if specified for a port not set for a high-speed counter.ON if executed for a different comparison method while comparison is already in progress.OFF in all other cases.

Function

CTBL(882) registers a comparison table and starts comparison for the port specified in P and the method specified in C. Once a comparison table is registered, it is valid until a different table is registered or until the CPU Unit is switched to PROGRAM mode.

Each time CTBL(882) is executed, comparison is started under the specified conditions. When using CTBL(882) to start comparison, it is normally sufficient to use the differentiated version (@CTBL(882)) of the instruction or an execution condition that is turned ON only for one scan.

Note If an interrupt task that has not been registered is specified, a fatal program error will occur the first time an interrupt is generated.

- Registering a Comparison Table (C = 0002 or 0003 hex)

If C is set to 0002 or 0003 hex, a comparison table will be registered, but comparison will not be started. Comparison is started with INI(880).

- Registering a Comparison Table and Starting Comparison (C = 0000 or 0001 hex)

If C is set to 0000 or 0001 hex, a comparison table will be registered, and comparison will be started.

- Stopping Comparison

Comparison is stopped with INI(880). It makes no difference what instruction was used to start comparison.

- Target Value Comparison

The corresponding interrupt task is called and executed when the PV matches a target value.

  • The same interrupt task number can be specified for more than one target value.
  • The direction can be set to specify whether the target value is valid when the PV is being incremented or decremented. If bit 15 in the word used to specify the interrupt task number for the range is OFF, the PV will be compared to the target value only when the PV is being incremented, and if bit 00 is ON, only when the PV is being decremented.
  • The comparison table can contain up to 6 target values, and the number of target values is specified in TB (i.e., the length of the table depends on the number of target values that is specified).
  • Comparisons are performed for all target values registered in the table.

Note 1 An error will occur if the same target value with the same comparison direction is registered more than once in the same table.

2 If the high-speed counter is set for incremental pulse mode, an error will occur if decrementing is set in the table as the direction for comparison.
3 If the count direction changes while the PV equals a target value that was reached in the direction opposite to that set as the comparison direction, the comparison condition for that target value will not be met. Do not set target values at peak and bottom values of the count value.

- Range Comparison

The corresponding interrupt task is called and executed when the PV enters a set range.

  • The same interrupt task number can be specified for more than one target value.
  • The range comparison table contains 6 ranges, each of which is defined by a lower limit and an upper limit. If a range is not to be used, set the interrupt task number to FFFF hex to disable the range.
  • The interrupt task is executed only once when the PV enters the range. If the PV is within more than one range when the comparison is made, the interrupt task for the range closest to the beginning of the table will be given priority and other interrupt tasks will be executed in following cycles.
  • If there is no reason to execute an interrupt task, specify AAAA hex as the interrupt task number. The range comparison results can be read with PRV(881) or using the Range Comparison In-progress Flags.

Note An error will occur if the upper limit is less than the lower limit for any one range.

Sample program

When CIO 0.00 turns ON in the following programming example, CTBL(882) registers a target value comparison table and starts comparison for high-speed counter 0. The PV of the high-speed counter is counted incrementally and when it reaches 500, it equals target value 1 and interrupt task 1 is executed. When the PV is incremented to 1000, it equals target value 2 and interrupt task 2 is executed.

OMRON CP1E - Sample program - 1

SPED

InstructionMnemonicVariationsFunction codeFunction
SPEED OUTPUTSPED@SPED885SPED(885) is used to set the output pulse frequency for a specific port and start pulse output without acceleration or deceleration.
SymbolSPED
— | —SPED(855) —
PP: Port specifier
MM: Output mode
FF: First pulse frequency word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifierUINT1
MOutput modeWORD1
FFirst pulse frequency wordUDINT2

P: Port specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1

M: Output mode

OMRON CP1E - M: Output mode - 1

F: First pulse frequency word

OMRON CP1E - F: First pulse frequency word - 1
Specify the pulse frequency in Hz.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, M---------------------------OK---------
FOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, M, or F is exceeded.ON if PLS2(887) or ORG(889) is already being executed to control pulse output for the specified port.ON if SPED(885) or INI(880) is used to change the mode between continuous and independent output during pulse output.ON if SPED(885) is executed in an interrupt task when an instruction controlling pulse output is being executed in a cyclic task.ON if SPEC(885) is executed in independent mode with an absolute number of pulses and the origin has not been established.OFF in all other cases.

Function

SPED(885) starts pulse output on the port specified in P using the method specified in M at the frequency specified in F. Pulse output will be started each time SPED(885) is executed. It is thus normally sufficient to use the differentiated version (@SPED(885)) of the instruction or an execution condition that is turned ON only for one scan.

OMRON CP1E - Function - 1

In independent mode, pulse output will stop automatically when the number of pulses set with PULS(886) in advance have been output. In continuous mode, pulse output will continue until stopped from the program.

An error will occur if the mode is changed between independent and continuous mode while pulses are being output.

Note SPED instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit.

In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

Continuous Mode Speed Control

When continuous mode operation is started, pulse output will be continued until it is stopped from the program.

Note Pulse output will stop immediately if the CPU Unit is changed to PROGRAM mode.

OperationPurposeApplicationFrequency changesDescriptionProcedure/ instruction
Starting pulse outputTo output with speci-fied speedChanging the speed (fre-quence) in one stepPulse frequency Target frequency Time Execution of SPED(885)Outputs pulses at a specified frequency.SPED(885) (Continu-ous)
Changing settingsTo change speed in one stepChanging the speed during operationPulse frequency Target frequency Present frequency Execution of SPED(885)Changes the fre-quence (higher or lower) of the pulse out-put in one step.SPED(885) (Continu-ous) ↓ SPED(885) (Continu-ous)
Stopping pulse outputStop pulse outputImmediate stopPulse frequency Present frequency Time Execution of INI(880)Stops the pulse output immediately.SPED(885) (Continu- ous) ↓ INI(880)
Stop pulse outputImmediate stopPulse frequency Present frequency Time Execution of SPED(885)Stops the pulse output immediately.SPED(885) (Continu- ous) ↓ SPED(885) (Continu- ous, Target frequency of 0 Hz)

- Independent Mode Positioning

When independent mode operation is started, pulse output will be continued until the specified number of pulses has been output.

Note - Pulse output will stop immediately if the CPU Unit is changed to PROGRAM mode.

  • The number of output pulses must be set each time output is restarted.
  • The number of output pulses must be set in advance with PULS(881). Pulses will not be output for SPED(885) if PULS(881) is not executed first.
  • The direction set in the SPED(885) operand will be ignored if the number of pulses is set with PULS(881) as an absolute value.
OperationPurposeApplicationFrequency changesDescriptionProcedure/ instruction
Starting pulse outputTo output with specified speedPositioning without acceleration or decelerationPulse frequency Specified number of pulses (Specified with PULS(886).)Starts outputting pulses at the specified frequency and stops immediately when the specified number of pulses has been output.PULS(886) ↓
Target frequency Execution of SPED(885) Outputs the specified number of pulses and then stops.Note The target position (number of pulses) cannot be changed during positioning (pulse output).SPED(885) (Independent)
Changing settingsTo change speed in one stepChanging the speed in one step during operationPulse frequency Specified number of pulses (Specified with PULS(886).) Number of pulses specified with PULS(886) does not change. Execution of SPED(885) (independent mode) SPED(885) (independent mode) executed again to change the target frequency. (The target position is not changed.)SPED(885) can be executed during position- ing to change (raise or lower) the pulse output frequency in one step. The target position (specified number of pulses) is not changed.PULS(886) ↓
SPED(885) (Independent) ↓
SPED(885) (Independent)
Stopping pulse outputTo stop pulse output (Number of pulses setting is not preserved.)Immediate stopPulse frequency Present frequency Time Execution of SPED(885) Execution of INI(880)Stops the pulse output immediately and clears the number of output pulses setting.PULS(886) ↓ SPED(885) (Independent) ↓ INI(880)
Stop pulse output (Number of pulses setting is not preserved.)Immediate stopPulse frequency Present frequency Time Execution of SPED(885) Execution of SPED(885)Stops the pulse output immediately and clears the number of output pulses setting.PULS(886) ↓ SPED(885) (Independent) ↓ SPED(885), (Independent, Target frequency of 0 Hz)

Sample program

When CIO 0.00 turns ON in the following programming example, PULS(886) sets the number of output pulses for pulse output 0. An absolute value of 5,000 pulses is set. SPED(885) is executed next to start pulse output using the pulse + direction method in the clockwise direction in independent mode at a target frequency of 500Hz .

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

PULS

InstructionMnemonicVariationsFunction codeFunction
SET PULSESPULS@PULS886PULS(886) is used to set the pulse output amount (number of out-put pulses).
SymbolPULS
— | — PULS(886) —
PP: Port specifier
TT: Pulse type
NN: Number of pulses

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
TPulse type---1
NNumber of pulsesDINT2

P: Port specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1

T: Pulse type

TPulse type
0000 hexRelative
0001 hexAbsolute

N and N+1: Number of pulses

OMRON CP1E - N and N+1: Number of pulses - 1
Relative pulse output:
0 to 2,147,483,647 (0000 0000 to 7FFF FFFF hex)

Absolute pulse output:

-2,147,483,648 to 2,147,483,647 (80000000 to 7FFF FFFF hex)

  • The actual number of movement pulses that will be output are as follows:

For relative pulse output, the number of movement pulses = the set number of pulses.

For absolute pulse output, the number of movement pulses = the set number of pulses - the PV.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P,T---------------------------OK---------
NOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, T, or N is exceeded.ON if PULS(886) is executed for a port that is already outputting pulses.ON if PULS(886) is executed in an interrupt task when an instruction controlling pulse output is being executed in a cyclic task.OFF in all other cases.

Function

PULS(886) sets the pulse type and number of pulses specified in T and N for the port specified in P. Actual output of the pulses is started later in the program using SPED(885) or ACC(888) in independent mode.

Note

  • An error will occur if PULS(886) is executed when pulses are already being output. Use the differentiated version (@PULS(886)) of the instruction or an execution condition that is turned ON only for one scan to prevent this.
  • The calculated number of pulses output for PULS(886) will not change even if INI(880) is used to change the PV of the pulse output.
  • The direction set for SPED(885) or ACC(888) will be ignored if the number of pulses is set with PULS(881) as an absolute value.
  • It is possible to move outside of the range of the PV of the pulse output amount (-2,147,483,648 to 2,147,483,647).
  • PULS instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit. In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

Sample program

When CIO 0.00 turns ON in the following programming example, PULS(886) sets the number of output pulses for pulse output 0. An absolute value of 5,000 pulses is set. SPED(885) is executed next to start pulse output using the pulse + direction method in the clockwise direction in independent mode at a target frequency of 500Hz .

OMRON CP1E - Sample program - 1

PLS2

InstructionMnemonicVariationsFunction codeFunction
PULSE OUTPUTPLS2@PLS2887PLS2(887) outputs a specified number of pulses to the specified port. Pulse output starts at a spec-ified startup frequency, accelerates to the target frequency at a specified acceleration rate, decel-erates at the specified deceleration rate, and stops at approximately the same frequency as the start-up frequency.
SymbolPLS2
—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|——|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|—|−P: Port specifierM: Output modeS: First word of settings tableF: First word of starting frequency
PLS2(887)
P
M
S
F

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
MOutput mode---1
SFirst word of settings tableWORD6
FFirst word of starting frequencyUDINT2

P: Port Specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1

M: Output Mode

OMRON CP1E - M: Output Mode - 1

S: First Word of Settings Table

OMRON CP1E - S: First Word of Settings Table - 1

Specify the increase or decrease in the frequency per pulse control period (4 ms).

OMRON CP1E - S: First Word of Settings Table - 2

Specify the frequency after acceleration/deceleration in Hz.

OMRON CP1E - S: First Word of Settings Table - 3

Relative pulse output: 0 to 2.147,483,647

(0000 0000 to 7FFF FFFF hex)

Absolute pulse output: -2,147,483,648 to 2,147,483,647

(8000 0000 to 7FFF FFFF hex)

The actual number of movement pulses that will be output are as follows:

  • For relative pulse output, the number of movement pulses = the set number of pulses.
  • For absolute pulse output, the number of movement pulses = the set number of pulses – the PV.

F: First Word of Starting Frequency

The starting frequency is given in F and F + 1

OMRON CP1E - F: First Word of Starting Frequency - 1

Specify the starting frequency in Hz.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, M---------------------------OK---------
SOKOKOKOKOKOKOKOKOK---
FOK

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, M, S, or F is exceeded.ON if PLS2(887) is executed for a port that is already outputting pulses for SPED(885) or ORG(889).ON if PLS2(887) is executed in an interrupt task when an instruction controlling pulse output is being executed in acyclic task.ON if PLS2(887) is executed for an absolute pulse output but the origin has not been established.OFF in all other cases.

Function

PLS2(887) starts pulse output on the port specified in P using the mode specified in M at the start frequency specified in F (1 in diagram).

The frequency is increased every pulse control period (4 ms) at the acceleration rate specified in S until the target frequency specified in S is reached (2 in diagram).

When the target frequency has been reached, acceleration is stopped and pulse output continues at a constant speed (3 in diagram).

The deceleration point is calculated from the number of output pulses and deceleration rate set in S and when that point is reached, the frequency is decreased every pulse control period (4 ms) at the deceleration rate specified in S until the starting frequency specified in S is reached, at which point pulse output is stopped (4 in diagram).

Pulse output is started each time PLS2(887) is executed. It is thus normally sufficient to use the differentiated version (@PLS2(887)) of the instruction or an execution condition that is turned ON only for one scan.

OMRON CP1E - Function - 1

PLS2(887) can be used only for positioning.

With the CJ1M CPU Units, PLS2(887) can be executed during pulse output for ACC(888) in either independent or continuous mode, and during acceleration, constant speed, or deceleration. (See notes 1 and 2.) ACC(888) can also be executed during pulse output for PLS2(887) during acceleration, constant speed, or deceleration.

Note 1 Executing PLS2(887) during speed control with ACC(888) (continuous mode) with the same target frequency as ACC(888) can be used to achieve interrupt feeding of a fixed distance. Acceleration will not be performed by PLS2(887) for this application, but if the acceleration rate is set to 0, the Error Flag will turn ON and PLS2(887) will not be executed. Always set the acceleration rate to a value other than 0.

2 If PLS2 (887) is executed during the period from pulse output stop to one cycle after the stop (when pulse output in-progress flag is ON), pulse output will start again in the next cycle after stopping. However, if pulse output is stopped by INI (880), the pulse output instruction will become invalid within one cycle after the stop. Execute the instruction till the pulse output in-progress flag is OFF.
3 PLS2 instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit. In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

- Independent Mode Positioning

Note Pulse output will stop immediately if the CPU Unit is changed to PROGRAM mode.

OperationPurposeApplicationFrequency changesDescriptionProcedure/instruction
Starting pulse outputComplex trapezoidal controlPositioning with trapezoidal acceleration and deceleration (Separate rates used for acceleration and deceleration; starting speed) The number of pulses can be changed during positioning.Pulse frequency Specified number of pulses Target frequency Acceleration rate Deceleration rate Stop frequency Time Execution of PLS2(887) Target frequency Deceleration point reached.Accelerates and decelerates at a fixed rates. The pulse output is stopped when the specified number of pulses has been output. (See note.) Note The target position (specified number of pulses) can be changed during positioning.PLS2(887)
Changing settingsTo change speed smoothly (with unequal acceleration and deceleration rates)Changing the target speed (frequency) during positioning (different acceleration and deceleration rates)Pulse frequency Specified number of pulses (Specified with PULS(886).) Change target frequency Acceleration/ deceleration rate Time Execution of ACC(888) (independent mode) PLS2(887) executed to change the target frequency and acceleration/deceleration rates. (The original target position is specified again.)PLS2(887) can be executed during positioning to change the acceleration rate, deceleration rate, and target frequency. Note To prevent the target position from being changed intentionally, the original target position must be specified in absolute coordinates.PLS2(887) ↓ PLS2(887)
PULS(886) ↓ ACC(888) (Independent) ↓ PLS2(887)
To change target positionChanging the target position during positioning (multi-ple start function)Pulse frequency Specified number of pulses Target frequency Acceleration/ deceleration rate Time Execution of PLS2(887) PLS2(887) executed to change the target position. (The target frequency and acceleration/deceleration rates are not changed.)PLS2(887) can be executed during positioning to change the target position (number of pulses), acceleration rate, deceleration rate, and target frequency. Note If a constant speed cannot be maintained after changing the settings, an error will occur and the original operation will continue to the original target position.PLS2(887) ↓ PLS2(887)
PULS(886) ↓ ACC(888) (Independent) ↓ PLS2(887)
To change target position and speed smoothlyChanging the target position and target speed (frequency) during positioning (multi-ple start function)Pulse frequency Specified number of pulses (Specified with PLS2(887)). Change target frequency Acceleration/ deceleration rate Time Execution of PLS2(887) PLS2(887) executed to change the target frequency, acceleration rate and deceleration rate.PLS2(887) can be executed during positioning to change the target position (number of pulses), acceleration rate, deceleration rate, and target frequency. Note If a constant speed cannot be maintained after changing the settings, an error will occur and the original operation will continue to the original target position.PULS(886) ↓ ACC(888) (Independent) ↓ PLS2(887)
PLS2(887) ↓ PLS2(887)
Changing settings, continuedTo change target position and speed smoothly, continuedChanging the acceleration and deceleration rates during positioning (multiple start function)Pulse frequency New target frequency Original target frequency Execution of PLS2(887) #1 Execution of PLS2(887) #3 Execution of PLS2(887) #2PLS2(887) can be executed during positioning (acceleration or deceleration) to change the acceleration rate or deceleration rate.PULS(886) ↓ ACC(888) (Independent) ↓ PLS2(887)
To change directionChanging the direction during positioningPulse frequency Target frequency Execution of PLS2(887) #1 Execution of PLS2(887) #2PLS2(887) can be executed during positioning with absolute pulse specification to change to absolute pulses and reverse direction.PLS2(887) ↓ PLS2(887)
Stopping pulse outputStop pulse output (Number of pulses setting is not preserved.)Immediate stopPulse frequency Present frequency Execution of SPED(885)Stops the pulse output immediately and clears the number of output pulses.PLS2(887) ↓ INI(880)
Stop pulse output smoothly. (Number of pulses setting is not preserved.)Decelerate to a stopPulse frequency Present frequency Target frequency = 0 Execution of PLS2(887)Decelerates the pulse output to a stop.PLS2(887) ↓ ACC(888) (Independent, target frequency of 0 Hz)

Note Triangular Control
If the specified number of pulses is less than the number required to reach the target frequency and return to zero, the function will automatically reduce the acceleration/deceleration time and perform triangular control (acceleration and deceleration only.) An error will not occur.

OMRON CP1E - - Independent Mode Positioning - 1

  • Switching from Continuous Mode Speed Control to Independent Mode Positioning
Example applicationFrequency changesDescriptionProcedure/ instruction
Change from speed control to fixed distance positioning during operationPulse frequency Target frequency Execution of ACC(888) (continuous mode) Time Execution of PLS2(887)PLS2(887) can be executed during a speed control operation started with ACC(888) to change to positioning operation.ACC(888) (Continuous) ↓ PLS2(887)
Fixed distance feed interruptPulse frequency Present frequency Execution of ACC(888) (continuous mode) Time Execution of PLS2(887) with the following settings ·Number of pulses = number of pulses until stop ·Relative pulse specification ·Target frequency = present frequency ·Acceleration rate = 0001 to 07D0 hex ·Deceleration rate = target deceleration rate

Sample program

When CIO 0.00 turns ON in the following programming example, PLS2(887) starts pulse output from pulse output 0 with an absolute pulse specification of 100,000 pulses. Pulse output is accelerated at a rate of 500Hz every 4 ms starting at 200Hz until the target speed of 50kHz is reached. From the deceleration point, the pulse output is decelerated at a rate of 250Hz every 4 ms starting until the starting speed of at 200Hz is reached, at which point pulse output is stopped.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

ACC

InstructionMnemonicVariationsFunction codeFunction
ACCELERATION CONTROLACC@ACC888ACC(888) outputs pulses to the specified output port at the specified frequency using the specified acceleration and deceleration rate.
SymbolACC
—|—|—ACC(888)—|—
PP: Port specifier
MM: Output mode
SS: First word of settings table

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
MOutput mode---1
SFirst word of settings tableWORD3

P: Port Specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1

M: Output Mode

OMRON CP1E - M: Output Mode - 1
Note Use the same pulse output method when using both pulse outputs 0 and 1.

S: First Word of Settings Table

OMRON CP1E - S: First Word of Settings Table - 1
Specify the increase or decrease in the frequency per pulse control period (4 ms).

OMRON CP1E - S: First Word of Settings Table - 2
Specify the frequency after acceleration or deceleration in Hz.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P, M---------------------------OK---------
SOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, M, or S is exceeded.ON if pulses are being output using ORG(889) for the specified port.ON if ACC(888) is executed to switch between independent and continuous mode for a port that is outputting pulses for SPED(885), ACC(888), or PLS2(887).ON if ACC(888) is executed in an interrupt task when an instruction controlling pulse output is being executed in a cyclic task.ON if ACC(888) is executed for an absolute pulse output in independent mode but the origin has not been established.OFF in all other cases.

Function

ACC(888) starts pulse output on the port specified in P using the mode specified in M using the target frequency and acceleration/deceleration rate specified in S. The frequency is increased every pulse control period (4 ms) at the acceleration rate specified in S until the target frequency specified in S is reached.

Pulse output is started each time ACC(888) is executed. It is thus normally sufficient to use the differentiated version (@ACC(888)) of the instruction or an execution condition that is turned ON only for one scan.

OMRON CP1E - Function - 1

In independent mode, pulse output stops automatically when the specified number of pulses has been output. In continuous mode, pulse output continues until it is stopped from the program.

An error will occur if an attempt is made to switch between independent and continuous mode during pulse output.

PLS2(887) can be executed during pulse output for ACC(888) in either independent or continuous mode, and during acceleration, constant speed, or deceleration. (See note.) ACC(888) can also be executed during pulse output for PLS2(887) during acceleration, constant speed, or deceleration.

If ACC(888) is executed in independent or continuous mode with a target frequency of 0Hz and then ACC(888) or PLS2(887) is executed before pulse output stops, the target frequency will not change and pulse output will stop. Execute ACC(888) or PLS2(887) after pulse output stops.

Note 1 Executing PLS2(887) during speed control with ACC(888) (continuous mode) with the same target frequency as ACC(888) can be used to achieved interrupt feeding of a fixed distance. Acceleration will not be performed by PLS2(887) for this application, but if the acceleration rate is set to 0, the Error Flag will turn ON and PLS2(887) will not be executed. Always set the acceleration rate to a value other than 0.

2 If ACC (888) or PLS2 (887) is executed during the period from pulse output stop to one cycle after the stop (when pulse output in-progress flag is ON), pulse output will start again in the next cycle after stopping. However, if pulse output is stopped by INI (880), the pulse output instruction will become invalid within one cycle after the stop. Execute the instruction till the pulse output in-progress flag is OFF.
3 ACC instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit. In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

Continuous Mode Speed Control

Pulse output will continue until it is stopped from the program.

Note Pulse output will stop immediately if the CPU Unit is changed to PROGRAM mode.

OperationPurposeApplicationFrequency changesDescriptionProcedure/instruction
Starting pulse outputTo output with speci-fied acceleration and speedAccelerating the speed (frequency) at a fixed ratePulse frequency Target frequency Present frequency Acceleration/ deceleration rate Time Execution of ACC(888)Outputs pulses and changes the frequency at a fixed rate.ACC(888) (Continuous)
Changing settingsTo change speed smoothlyChanging the speed smoothly during operationPulse frequency Target frequency Present frequency Acceleration/ deceleration rate Time Execution of ACC(888)Changes the frequency from the present frequency at a fixed rate. The frequency can be accelerated or decelerated.ACC(888) or SPED(885) (Continuous) ↓ ACC(888) (Continuous)
Changing the speed in a polylne curve during operationPulse frequency Target frequency Acceleration rate 2 Acceleration rate 1 Execution of ACC(888) Execution of ACC(888) Execution of ACC(888)Changes the acceleration or deceleration rate during acceleration or deceleration.ACC(888) (Continuous) ↓ ACC(888) (Continuous)
Decelerating to a stopPulse frequency Present frequency Target frequency = 0 Execution of ACC(888) Execution of ACC(888) Execution of ACC(888) (target frequency = 0)The deceleration rate is changed while decelerating. Note If the target frequency is set to 0 Hz, the current deceleration rate will be used.ACC(888) (Continuous) ↓ ACC(888) (Continuous) ↓ ACC(888) (Continuous, target frequency of 0 Hz)
Stopping pulse outputTo stop pulse outputImmediate stopPulse frequency Present frequency Execution of ACC(888) Execution of INI(880)Immediately stops pulse output.ACC(888) (Continuous) ↓ INI(880) (Continuous)
To stop pulse output smoothlyDecelerating to a stopPulse frequency Present frequency Target frequency = 0 Execution of ACC(888) Execution of ACC(888)Decelerated pulse output to a stop. Note If the target frequency of the second ACC(888) instruction is 0 Hz, the deceleration rate from the first ACC(888) instruction will be used.ACC(888) (Continuous) ↓ ACC(888) (Continuous, target frequency of 0)

- Independent Mode Positioning

When independent mode operation is started, pulse output will be continued until the specified number of pulses has been output.

The deceleration point is calculated from the number of output pulses and deceleration rate set in S and when that point is reached, the frequency is decreased every pulse control period (4 ms) at the deceleration rate specified in S until the specified number of points has been output, at which point pulse output is stopped.

Note 1 Pulse output will stop immediately if the CPU Unit is changed to PROGRAM mode.

2 The number of output pulses must be set each time output is restarted.
3 The number of output pulses must be set in advance with PULS(881). Pulses will not be output for ACC(888) if PULS(881) is not executed first.
4 The direction set in the ACC(888) operand will be ignored if the number of pulses is set with PULS(881) as an absolute value.

OperationPurposeApplicationFrequency changesDescriptionProcedure/instruction
Starting pulse outputSimple trap-ezoidal controlPositioning with trapezoidal acceleration and deceleration (Same rate used for acceleration and deceleration; no starting speed) The number of pulses cannot be changed during positioning.Pulse frequency Specified number of pulses (Specified with PULS(886).) Target frequency Acceleration/ deceleration rate Time Execution of ACC(888) Outputs the specified number of pulses and then stops.Accelerates and decelerates at the same fixed rate and stops immediately when the specified number of pulses has been output. (See note.) Note The target position (specified number of pulses) cannot be changed during positioning.PULS(886) ↓ ACC(888) (Independent)
Changing settingsTo change speed smoothly (with the same acceleration and deceleration rates)Changing the target speed (frequency) during positioning (acceleration rate = deceleration rate)Pulse frequency Specified number of pulses (Specified with PULS(886).) Number of pulses specified with PULS(886) does not change. Target frequency Execution of ACC(888) (independent mode) ACC(888) (independent mode) executed again to change the target frequency. (The target position is not changed, but the acceleration/deceleration rate is changed.)ACC(888) can be executed during positioning to change the acceleration/deceleration rate and target frequency. The target position (specified number of pulses) is not changed.PULS(886) ↓ ACC(888) or SPED(885) (Independent) ↓ ACC(888) (Independent) PLS2(887) ↓ ACC(888) (Independent)
Stopping pulse outputTo stop pulse output. (Number of pulses setting is not preserved.)Immediate stopPulse frequency Present frequency Execution of ACC(888) Execution of INI(880)Pulse output is stopped immediately and the remaining number of outputs is cleared.PULS(886) ↓ ACC(888) (Independent) ↓ INI(880)
Stopping pulse output, continuedTo stop pulse output smoothly. (Number of pulses setting is not preserved.)Decelerating to a stopPulse frequency Present frequency Target frequency = 0 Execution of PLS2(887)Decelerates the pulse output to a stop. Note If ACC(888) started the operation, the original acceleration/deceleration rate will remain in effect. If SPED(885) started the operation, the acceleration / deceleration rate will be invalid and the pulse output will stop immediately.PULS(886)↓ACC(888) or SPED(885)(Independent)↓ACC(888)(Independent, independent, target frequency of 0)
PLS2(887)↓ACC(888)(Independent, target frequency of 0)

Note Triangular Control

If the specified number of pulses is less than the number required to reach the target frequency and return to zero, the function will automatically reduce the acceleration/deceleration time and perform triangular control (acceleration and deceleration only.) An error will not occur.

OMRON CP1E - Note Triangular Control - 1

Sample program

When CIO 0.00 turns ON in the following programming example, ACC(888) starts pulse output from pulse output 0 in continuous mode in the clockwise direction using the pulse + direction method. Pulse output is accelerated at a rate of 20Hz every 4 ms until the target frequency of 500Hz is reached. When CIO 0.01 turns ON, ACC(888) changes to an acceleration rate of 10Hz every 4 ms until the target frequency of 1,000Hz is reached.

OMRON CP1E - Sample program - 1

D1000014Acceleration/deceleration rate: 20 Hz
D10101F4Target frequency: 500 Hz
D1020000
D105000AAcceleration/deceleration rate: 10 Hz
D10603E8Target frequency: 1,000 Hz
D1070000

OMRON CP1E - Sample program - 2

ORG

InstructionMnemonicVariationsFunction codeFunction
ORIGIN SEARCHORG@ORG889ORG(889) performs an origin search or origin return operation.
SymbolORG
ORG(889)
P
C
P: Port specifier
C: Control data

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
CControl data---1

P: Port Specifier

PPort
0000 hexPulse output 0
0001 hexPulse output 1

C: Control Data

OMRON CP1E - C: Control Data - 1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P,C---------------------------OK---------

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P or C is exceeded.ON if ORG(889) is specified for a port during pulse output for SPED(885), ACC(888), or PLS2(887).ON if ORG(889) is executed in an interrupt task when an instruction controlling pulse output is being executed in a cyclic task.ON if the origin search or origin return parameters set in the PLC Setup are not within range.ON if the Origin Search High Speed is less than or equal to the Origin Search Proximity Speed or the Origin Search Proximity Speed is less than or equal to the Origin Search Initial Speed.ON if an origin return operation is attempted when the origin has not been established.OFF in all other cases.

Function

ORG(889) performs an origin search or origin return operation for the port specified in P using the method specified in C.

The following parameters must be set in the PLC Setup before ORG(889) can be executed.

Origin searchOrigin return
• Origin Search Function Enable/Disable • Origin Search Operating Mode • Origin Search Operation Setting • Origin Detection Method • Origin Search Direction Setting • Origin Search/Return Initial Speed • Origin Search High Speed • Origin Search Proximity Speed • Origin Compensation • Origin Search Acceleration Rate • Origin Search Deceleration Rate • Limit Input Signal Type • Origin Proximity Input Signal Type • Origin Input Signal Type • Positioning Monitor Time• Origin Search/Return Initial Speed • Origin Return Target Speed • Origin Return Acceleration Rate • Origin Return Deceleration Rate

An origin search or origin return is started each time ORG(889) is executed. It is thus normally sufficient to use the differentiated version (@ORG(889)) of the instruction or an execution condition that is turned ON only for one scan.

Note ORG instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit.

In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

- Origin Search (Bits 12 to 15 of C = 0 hex)

ORG(889) starts outputting pulses using the specified method at the Origin Search Initial Speed (1 in diagram).

Pulse output is accelerated to the Origin Search High Speed using the Origin Search Acceleration Rate (2 in diagram).

Pulse output is then continued at constant speed until the Origin Proximity Input Signal turns ON (3 in diagram), from which point pulse output is decelerated to the Origin Search Proximity Speed using the Origin Search Deceleration Rate (4 in diagram).

Pulses are then output at constant speed until the Origin Input Signal turns ON (5 in diagram).

Pulse output is stopped when the Origin Input Signal turns ON (6 in diagram).

OMRON CP1E - - Origin Search (Bits 12 to 15 of C = 0 hex) - 1

When the origin search operation has been completed, the Error Counter Reset Output will be turned ON.

The above operation, however, depends on the operating mode, origin detection method, and other parameters.

- Origin Return (Bits 12 to 15 of C = 1 hex)

ORG(889) starts outputting pulses using the specified method at the Origin Return Initial Speed (1 in diagram).

Pulse output is accelerated to the Origin Return Target Speed using the Origin Return Acceleration Rate (2 in diagram) and pulse output is continued at constant speed (3 in diagram).

The deceleration point is calculated from the number of pulses remaining to the origin and the deceleration rate and when that point is reached, the pulse output is decelerated (4 in diagram) at the Origin Return Deceleration Rate until the Origin Return Start Speed is reached, at which point pulse output is stopped at the origin (5 in diagram).

OMRON CP1E - - Origin Return (Bits 12 to 15 of C = 1 hex) - 1

Sample program

When CIO 0.00 turns ON in the following programming example, ORG(889) starts an origin return operation for pulse output 0 by outputting pulses using the pulse + direction method. According to the PLC Setup, the initial speed is 100 pps, the target speed is 200 pps, and the acceleration and deceleration rates are 50Hz / 4 ms.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

The PLC Setup parameters are as follows:

ParameterSetting
Pulse Output 0 Starting Speed for Origin Search and Origin Return0000 0064 hex: 100 pps
Pulse Output 0 Origin Return Target Speed0000 00C8 hex: 200 pps
Pulse Output 0 Origin Return Acceleration Rate0032 hex: 50 hex/4 ms
Pulse Output 0 Origin Return Deceleration Rate0032 hex: 50 hex/4 ms

PWM

InstructionMnemonicVariationsFunction codeFunction
PULSE WITH VARIABLE DUTY FACTORPWM@PWM891PWM(891) is used to output pulses with the speci-fied duty factor from the specified port.
SymbolPWM
—|—|—|PWM—|—|P: Port specifierF: FrequencyD: Duty factor
PP: Port specifier
F
DD: Duty factor

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
PPort specifier---1
FFrequency---1
DDuty factor---1

P: Port Specifier

PPort
1000 hexPWM output 0 (duty factor: in increments of 1%, frequency 0.1 Hz)
1100 hexPWM output 0 (duty factor: in increments of 1%, frequency 1 Hz)

F: Frequency

F specifies the frequency of the PWM output between 2.0 and 6,553.5 Hz (0.1 Hz units, 0014 to FFFF hex), or between 2 and 32,000 Hz (2 Hz units, 0002 to 7D00 hex).

D: Duty Factor

  • 0.0% to 100.0% (0.1% units, 0000 to 03E8 hex)

D specifies the duty factor of the PWM output, i.e., the percentage of time that the output is ON.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
P---------------------------OK---------
F, DOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if the specified range for P, F, or D is exceeded.ON if PWM are being output using ORG(889) for the specified port.ON if PWM(891) is executed in an interrupt task when an instruction controlling PWM output is being executed in a cyclic task.OFF in all other cases.

Function

PWM(891) outputs the frequency specified in F at the duty factor specified in D from the port specified in P. PWM(891) can be executed during duty-factor PWM output to change the duty factor without stopping PWM output. Any attempts to change the frequency will be ignored.

PWM output is started each time PWM(891) is executed. It is thus normally sufficient to use the differentiated version (@PWM(891)) of the instruction or an execution condition that is turned ON only for one scan.

The PWM output will continue either until INI(880) is executed to stop it (C = 0003 hex: stop PWM output) or until the CPU Unit is switched to PROGRAM mode.

Note PWM instruction can be used only with transistor output type of CP1E N/NA-type CPU Unit.

In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.

Sample program

When CIO 0.00 turns ON in the following programming example, PWM(891) starts PWM output from PWM output 0 at 200Hz with a duty factor of 50% . When CIO 0.01 turns ON, the duty factor is changed to 25% .

OMRON CP1E - Sample program - 1

Step Instructions

In CP1E series PLCs, STEP(008)/SNXT(009) can be used together to create step programs.

InstructionOperationDiagram
SNXT(009): STEP STARTControls progression to the next step of the program.Step Ladder section start instruction Equivalent to
STEP(008): STEP DEFINEIndicates the start of a step. Repeats the same step pro-gram until the conditions for progression to the next step are established.Step Ladder section start instruction Equivalent to Step

OMRON CP1E - Step Instructions - 1
Note Work bits are used as the control bits for A, B, C and D.

SNXT/STEP

InstructionMnemonicVariationsFunction codeFunction
STEP STARTSNXT---009SNXT(009) is used to control progression of step execution in the step program area.
STEP DEFINESTEP---008STEP(008) is used to define the beginning and the end of the step program area.
SymbolSNXTSTEP
SNXT(009)B: BitWhen defining the beginning of a step, a control bit is specified as follows:STEP(008)B: BitWhen defining the end of a step, a control bit is not specified as follows:STEP(008)When defining the beginning of a step, a control bit is specified as follows:STEP(008)B: BitWhen defining the end of a step, a control bit is not specified as follows:STEP(008)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKNot allowedNot allowed

Operands

OperandDescriptionData typeSize
BBit---1

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
B---OK---------------------------------

Flags

NameLabelOperation
SNXTSTEP
Error FlagP_ERON when the specified bit B is not in the WR area.ON when SNXT(009) is used in an interrupt pro-gram.OFF in all other cases.ON when the specified bit B is not in the WR area.ON when STEP(008) is used in an interrupt pro-gram.OFF in all other cases.

Function

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.

The step program area is from the first STEP(008) instruction (which always takes a control bit) to the last STEP(008) instruction (which never takes a control bit).

Starting Step Execution

SNXT(009) is placed at the beginning of the step program area to start step execution. It turns ON the control bit specified for B for the next STEP(008) and proceeds to step B (all instructions after STEP(008) B). A differentiated execution condition must be used for the SNXT(009) instruction that starts step programming area execution, or step execution will last for only one cycle.

Proceeding to the Next Step

When SNXT(009) occurs in the middle of the step program area, it is used to proceed to the next step. It turns OFF the previous control bit and turns ON the next control bit B, for the next step, thereby starting step B (all instructions after STEP(008) B).

Ending the Step Programming Area

When SNXT(009) is placed at the very end of the step program area, it ends step execution and turns OFF the previous control bit. The control bit specified for B is a dummy bit. This bit will however be turned ON, so be sure to select a bit that will not cause problems.

- 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 program area (i.e., step execution).

Starting a Step

STEP(008) is placed at the beginning of each step with an operand, B, that serves as the control bit for the step.

The control bit B will be turned ON by SNXT(009) and the instruction in the step will be executed from the one immediately following STEP(008). A200.12 (Step Flag) will also turn ON when execution of a step begins.

After the first cycle, step execution will continue until the conditions for changing the step are established, i.e., until the SNXT(009) instruction turns ON the control bit in the next STEP(008).

When SNXT (009) turns ON the control bit for a step, the control bit B of the current instruction will be reset (turned OFF) and the step controlled by bit B will become interlocked.

Handling of outputs and instructions in a step will change according to the ON/OFF status of the control bit B. (The status of the control bit is controlled by SNXT(009)). When control bit B is turned OFF, the instructions in the step are reset and are interlocked. Refer to the following tables.

Control bit statusHandling
ONInstructions in the step are executed normally.
ON→OFFBits and instructions in the step are interlocked as shown in the next table.
OFFAll instructions in the step are processed as NOPs.

Interlock Status (IL)

Instruction outputStatus
Bits specified for OUT, OUT NOTAll OFF
TIM, TIMX(551), TIMH(015), TIMHX(551), TMHH(540),TIMHHX(552), TIML(542), and TIMLX(553)PV0000 hex (reset)
Completion FlagOFF (reset)
Bits or words specified for other instructions (see note)Holds the previous status (but the instructions are not executed)

Note Indicates all other instructions, such as TTIM(087), TTIMX(555), SET, REST, CNT, CNTX(546), CNTR(012), CNTRX(548), SFT(010), and KEEP(011).

The STEP(008) instruction must be placed at the beginning of each step. STEP(008) is placed at the beginning of a step area to define the start of the step.

Ending the Step Program Area

STEP(008) is placed at the end of the step program area without an operand to define the end of step programming.

When the control bit preceding a SNXT(009) instruction is turned OFF, step execute is stopped by SNXT(009).

Hint

A200.12 (Step Flag) is turned ON for one cycle when STEP(008) is executed. This flag can be used to conduct initialization once the step execution has started.

OMRON CP1E - Hint - 1

NameAddressDetails
Step FlagA200.12ON for one cycle when a step program is started using STEP(008). Can be used to reset timers and perform other processing when starting a new step.

OMRON CP1E - Related Bits - 1

Precaution

  • The control bit, B, must be in the Work Area for STEP(008)/SNXT(009).
  • A control bit for STEP(008)/SNXT(009) cannot be use anywhere else in the ladder diagram. If the same bit is used twice, as duplication bit error will occur.
  • If SBS(091) is used to call a subroutine from within a step, the subroutine outputs and instructions will not be interlocked when the control bit turns OFF.
  • SNXT(009) will be executed only once, i.e., on the rising edge of the execution condition.
  • Input SNXT(009) at the end of the step program area and make sure that the control bit is a dummy bit in the Work Area. If a control bit for a step is used in the last SNXT(009) in the step program area, the corresponding step will be started when SNXT(009) is executed.

  • STEP(008) and SNXT(009) cannot be used inside of subroutines, interrupt programs, or block programs.

  • Be sure that two steps are not executed during the same cycle.
  • The instructions that cannot be used within step programs are listed in the following table.
FunctionMnemonicName
Sequence Control InstructionsEND(001)END
IL(002)INTERLOCK
ILC(003)INTERLOCK CLEAR
JMP(004)JUMP
JME(005)JUMP END
CJP(510)CONDITIONAL JUMP
Subroutine InstructionsSBN(092)SUBROUTINE ENTRY
RET(093)SUBROUTINE RETURN

Sample program

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2
(1) Sequential Control

OMRON CP1E - Sample program - 3

OMRON CP1E - Sample program - 4
(2) Branching Control

OMRON CP1E - Sample program - 5
0.02 0.01

Additional Information:

  • In the above example, where SNXT(009) is executed for W0.02, the branching moves onto the next steps even though the same control bit is used twice. This is not picked up as an error in the program check using the CX-Programmer. A duplicate bit error will only occur in a step ladder program only when a control bit in a step instructions is also used in the normal ladder diagram.
  • The above programming is used when steps A and B cannot be executed simultaneously. For simultaneous execution of A and B, delete the execution conditions illustrated below.

OMRON CP1E - Additional Information: - 1
(3) Parallel Control

OMRON CP1E - Additional Information: - 2

Application Examples

OMRON CP1E - Application Examples - 1
(1) Sequential Execution

OMRON CP1E - Application Examples - 2

Explanation of operation

(1) SW1 ON:

Solenoid 1 operates
Conveyor 1 operates

(2) SW2 ON stops the previous process

Robot hand operates Process B Conveyor 2 operates

(3) SW3 ON stops the previous process

Photo microsensor operates (for part inspection)
Conveyor 3 operates
Solenoid 2 operates (removal of defective items)

(4) SW4 ON stops the previous process

Additional Information

When another process is started from within a process (when an SNXT instruction turns ON), all outputs of the current process are turned OFF within that cycle.

OMRON CP1E - Additional Information - 1

OMRON CP1E - Additional Information - 2
(2) Branching Execution

OMRON CP1E - Additional Information - 3

Explanation of operation

Products are sorted by the guides by weight.

(1) SWA1 ON:
Conveyor (A) operates Machine (A) operates
(2) SWB1 ON:
Conveyor (B) operates Machine (B) operates Process B
(3) SWA2 ON stops process A
Printing machine operates (down) Process C UP by SWC2 ON
(4) SWB2 ON stops process B
Printing machine operates (down) Process C UP by SWC2 ON
(5) SWD ON stops the printing machine

OMRON CP1E - Explanation of operation - 1

OMRON CP1E - Explanation of operation - 2
(3) Parallel Execution

OMRON CP1E - Explanation of operation - 3

Explanation of operation

(1) SW1, SW2 ON:

Conveyor (A) operates Process A Work (A) operates

Conveyor (C) operates Process C Work (C) operates

(2) SW3 ON:

Process (A) stops Conveyor (B) operates Process B Work (B) operates

(3) SW4 ON:

Process (C) stops Conveyor (D) operates Process D Work (D) operates

(4) SW5, SW6 ON:

Process (B) stops Process (D) stops Conveyor (E) operates Work (E) operates

(5) SW7 ON:

Process (E) stops

Note When processes (B) and (D) are in operation and SW5 and SW6 turn ON, it is judged that processes (B) and (D) are finished. Execution of SNXT W0.04 turns OFF the outputs of process (B) and W0.03 turns OFF. STEP W0.03 judges ON to OFF and turns OFF the outputs of process (D).

Additional Information

The STEP instruction turns all outputs in its process OFF when ON changes to OFF.

OMRON CP1E - Additional Information - 1

Basic I/O Unit Instructions

IORF

InstructionMnemonicVariationsFunction codeFunction
I/O REFRESHIORF@IORF097Refreshes the specified I/O words.
SymbolIORF
IORF(097)St: Starting word
StE: End word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
StStarting word---Variable
EEnd word---Variable

St: Starting Word

CIO 001 to CIO 099, CIO 101 to CIO 199 (CP1W Expansion I/O Unit's I/O Area)

E: End Word

CIO 001 to CIO 099, CIO 101 to CIO 199 (CP1W Expansion I/O Unit's I/O Area)

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
St, EOK------------------------------------

Flags

NameLabelOperation
Error FlagP_ERON if St is greater than E.ON if St and E are in different memory areas.OFF in all other cases.

Units Refreshed by IORF(097)

Unit typeCHRefreshable by IORF(097)
CPU Unit with 30 or 40 I/O PointsCP1E CPU Unit built-in I/O: 0CH, 1CH, 100CH and 101CHNo
CP1W Expansion I/O Unit: 2CH to 99CH, 102CH to 199CHYes
CP1W Expansion Unit: 2CH to 99CH, 102CH to 199CHYes
CPU Unit with 60 I/O PointsCP1E CPU Unit built-in I/O: 0CH, 1CH, 2CH, 100CH, 101CH and 102CHNo
CP1W Expansion I/O Unit: 3CH to 99CH, 103CH to 199CHYes
CP1W Expansion Unit: 3CH to 99CH, 103CH to 199CHYes
NA-type CPU UnitCP1E CPU Unit built-in I/O: 0CH and 100CHNo
CP1E CPU Unit built-in analog: 90CH, 91CH and 190CHYes
CP1W Expansion I/O Unit: 1CH to 99CH, 101CH to 199CHYes
CP1W Expansion Unit: 1CH to 99CH, 101CH to 199CHYes

Note CP1E CPU Unit built-in I/O area cannot be refreshed with IORF(097).

CP1E CPU Unit built-in I/O area can be refreshed with immediate refreshing specifications (!).

Function

IORF(097) refreshes the I/O words between St and E, inclusively. IORF(097) is used to refresh words allocated to CP1W Expansion (I/O) Units. For 30 or 40 I/O Points, Expansion (I/O) Units are allocated words between CIO 002 and CIO 099, CIO102 and CIO199. For 60 I/O Points, Expansion (I/O) Units are allocated words between CIO 003 and CIO 099, CIO103 and CIO199. For NA20 I/O Points, Expansion (I/O) Units are allocated words between CIO 001 and CIO 099, CIO101 and CIO199.

OMRON CP1E - Function - 1

Precaution

  • IORF(097) can be used in an interrupt task, which allows high-speed processing of specific I/O data with an interrupt. If IORF(097) is used in an interrupt task, always disable cyclic refreshing of the specified Special I/O Unit by turning ON the corresponding Special I/O Unit Cyclic Refreshing Disable Bit in the PLC Setup.
  • If words for which there is no Unit mounted exist between St and E, nothing will be done for those words and only the words allocated to Units will be refreshed.
  • The I/O refreshing initiated by IORF(097) will be stopped midway if an I/O bus error occurs during I/O refreshing.

Sample program

Refreshing Words in the I/O Bit Area

When CIO 0.00 turns ON in the following example, CIO 2 to CIO 4 (36 inputs) are refreshed (1) and then after the required processing is performed (2), CIO 104 (8 outputs) is refreshed (3).

OMRON CP1E - Refreshing Words in the I/O Bit Area - 1

OMRON CP1E - Refreshing Words in the I/O Bit Area - 2

SDEC

InstructionMnemonicVariationsFunction codeFunction
7-SEGMENT DECODERSDEC@SDEC078Converts the hexadecimal contents of the designated digit(s) into 8-bit, 7-segment display code and places it into the upper or lower 8-bits of the specified destination words.
SymbolSDEC
SDEC(078)
S
Di
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SSource wordUINT1
DiDigit designatorUINT1
DFirst destination wordUINTVariable

Di: Digit designator

OMRON CP1E - Di: Digit designator - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------
DiOK
D---

Flags

NameLabelOperation
Error FlagP_ERON if settings in Di are not within the specified ranges. OFF in all other cases.

Function

SDEC(078) regards the data specified by S as 4-digit hexadecimal data, converts the digits specified in S by Di (first digit and number of digits) to 7-segment data and outputs the results to D in the bits specified in Di.

OMRON CP1E - Function - 1

Precaution

  • If more than one digit is specified for conversion in Di, digits are converted in order toward the most-significant digit. Digit 0 is the next digit after digit 3.
  • Results are stored in D in order from the specified portion toward higher-address words. If just one of the bytes in a destination word receives converted data, the other byte is left unchanged.

Sample program

When CIO 0.00 turns ON in the following example, the contents of the 3 digits beginning with digit 1 in D100 will be converted from hexadecimal data to 7-segment data, and the results will be output to the upper byte of D200 and both bytes of D201. The specifications of the bytes to be converted and the location of the output bytes are made in CIO 100.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

- 7-segment Data

The following table shows the data conversions from a hexadecimal digit (4 bits) to 7-segment code (8 bits).

Original dataConverted code (segments)Display Original data
DigitBits-gfedcbaHex
00000001111113F0
1000100000110061
20010010110115B2
30011010011114F3
4010001100110664
50101011011016D5
60110011111017D6
7011100100111277
81000011111117F8
91001011011116F9
A101001110111778
B1011011111007Cb
C11000011100139c
D1101010111105Ed
E11100111100179E
F11110111000171F

DSW

InstructionMnemonicVariationsFunction codeFunction
DIGITAL SWITCH INPUTDSW---210Reads the value set on a external digital switch (or thumbwheel switch) connected to an I/O Unit and stores the 4-digit or 8-digit value in the specified words.
SymbolDSW
— | —DSW(210) —
I | I: Input word
O | O: Output word
D | D: First result word
C1 | C1: Number of digits
C2 | C2: System word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
IInput wordUINT1
OOutput wordUINT1
DFirst result wordWORDVariable
C1Number of digitUINT1
C2System wordWORD1

I: Input Word (Data Line D0 to D3 Inputs)

Specify the input word allocated to the Input Unit and connect the digital switch's D0 to D3 data lines to the Input Unit as shown in the following diagram.

OMRON CP1E - I: Input Word (Data Line D0 to D3 Inputs) - 1

O: Output Word (CS/RD Control Signal Outputs)

Specify the output word allocated to the Output Unit and connect the digital switch's control signals (CS and RD signals) to the Output Unit as shown in the following diagram.

OMRON CP1E - O: Output Word (CS/RD Control Signal Outputs) - 1

D: First Result Word

Specifies the leading word address where the external digital switch's set values will be stored.

OMRON CP1E - D: First Result Word - 1
Note: Only when C1 = 0001 hex to read 8 digits.

C1: Number of Digits

  • Specifies the number of digits that will be read from the external digital switch. Set C1 to 0000 hex to read 4 digits or 0001 hex to read 8 digits.

C2: System Word

Specifies a work word used by the instruction. This word cannot be used in any other application.

OMRON CP1E - C2: System Word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
I, O, DOKOKOKOKOKOKOKOKOK------------
C1---------------------------OK
C2OKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_EROFF

Function

DSW(210) outputs control signals to bits 00 to 04 of O, reads the specified number of digits (either 4-digit or 8-digit, specified in C1) of digital switch data line data from I, and stores the result in D and D+1. (If 4 digits are read, the result is stored in D. If 8 digits are read, the result is stored in D and D+1.)

DSW(210) reads the 4-digit or 8-digit switch data once every 16 cycles, and then starts over and continues reading the data. The One Round Flag (bit 05 of O) is turned ON once every 16 CPU Unit cycles.

- External Connections

Connect the digital switch or thumbwheel switch to Input Unit contacts 0 to 7 and Output Unit contacts 0 to 4, as shown in the following diagram. The following example illustrates connections for an A7B Thumbwheel Switch.

OMRON CP1E - - External Connections - 1

- Timing Chart

OMRON CP1E - - Timing Chart - 1

Precaution

  • Do not read or write the system word (C2) from any other instruction. DSW(210) will not operate correctly if the system word is accessed by another instruction. The system word is not initialized by DSW(210) in the first cycle when program execution starts. If DSW(210) is being used from the first cycle, clear the system word from the program.
  • DSW(210) will not operate correctly if I/O refreshing is not performed with the Input Unit and Output Unit connected to the digital switch or thumbwheel switch after DSW(210) is executed. Consequently, set the input time constant for the Input Units used for the data line input word to a value that is shorter than the cycle time.
  • DSW(210) reads the 4-digit or 8-digit data once in 16 cycles, and then starts over and reads the data again in the next 16 cycles.
  • When executed, DSW(210) begins reading the switch data from the first of the sixteen cycles, regardless of the point at which the last instruction was stopped.

Sample program

In this example, DSW(210) is used to read an 8-digit number from a digital switch and outputs the resulting value constantly to D0 and D3. The digital switch is connected through CIO 3 and CIO 104.

D1000 is used as the system word.

OMRON CP1E - Sample program - 1

MTR

InstructionMnemonicVariationsFunction codeFunction
MATRIX INPUTMTR---213Inputs up to 64 signals from an 8 × 8 matrix con- nected to an Input Unit and an Output Unit (using 8 input points and 8 output points) and stores that 64-bit data in the 4 destination words.
SymbolMTR
MTR(213)
I
O
D
C

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
IInput wordUINT1
OOutput wordUINT1
DFirst destination wordULINT4
CSystem wordWORD1

I: Input Word

Specify the input word allocated to the Input Unit and connect the 8 input signal lines to the Input Unit as shown in the following diagram.

OMRON CP1E - I: Input Word - 1

O: Output Word (Selection Signal Outputs)

Specify the output word allocated to the Output Unit and connect the 8 selection signals to the Output Unit as shown in the following diagram.

OMRON CP1E - O: Output Word (Selection Signal Outputs) - 1

D: First Register Word

Specifies the leading word address of the 4 words that contain the data from the 8 × 8 matrix.

OMRON CP1E - D: First Register Word - 1

OMRON CP1E - D: First Register Word - 2

OMRON CP1E - D: First Register Word - 3

OMRON CP1E - D: First Register Word - 4

C: System Word

Specifies a work word used by the instruction. This word cannot be used in any other application.

OMRON CP1E - C: System Word - 1
(Cannot be accessed by the user.)

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
I, O, D, COKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_EROFF

Function

MTR(213) outputs the selection signals to bits 00 to 07 of O, reads the data in order from bits 00 to 07 of I, and stores the 64 bits of data in the 4 words D through D+3. MTR(213) reads the status of the 64-bit matrix every 24 CPU Unit cycles. The One Round Flag (bit 08 of O) is turned ON for one cycle in every 24 cycles after each of the selection signals has been turned ON.

- External Connections

Connect the hexadecimal keypad to Input Unit contacts 0 to 7 and Output Unit contacts 0 to 7, as shown in the following diagram.

OMRON CP1E - - External Connections - 1

- Timing Chart

OMRON CP1E - - Timing Chart - 1

Precaution

  • Do not read or write the system word (C) from any other instruction. MTR(213) will not operate correctly if the system word is accessed by another instruction. The system word is not initialized by MTR(213) in the first cycle when program execution starts. If MTR(213) is being used from the first cycle, clear the system word from the program.
  • MTR(213) will not operate correctly if I/O refreshing is not performed with the Input Unit and Output Unit connected to the external matrix after MTR(213) is executed. Consequently, set the input time constant for the Input Units used for the data line input word to a value that is shorter than the cycle time.
  • When executed, MTR(213) begins reading the matrix status from the beginning of the matrix, regardless of the point at which the last instruction was stopped.

Sample program

In this example, MTR(213) reads the 64 bits of data from the 8 × 8 matrix and stores the data in W0 to W3. The 8 × 8 matrix is connected through CIO 3 and CIO 104. D1000 is used as the system word.

P_On
Always ON FlagMTR(213)
3
104
W0
D1000

7SEG

InstructionMnemonicVariationsFunction codeFunction
7-SEGMENT DISPLAY OUTPUT7SEG---214Converts the source data (either 4-digit or 8-digit BCD) to 7-segment display data, and outputs that data to the specified output word.
Symbol7SEG
7SEG(214)
S
O
C
D

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKNot allowed

Operands

OperandDescriptionData typeSize
SSource wordWORDVariable
OOutput wordUINT1
CControl word#+10 decimal only1
DSystem wordWORD1

S: Source Word

Specify the first source word containing the data that will be converted to 7-segment display data.

OMRON CP1E - S: Source Word - 1

OMRON CP1E - S: Source Word - 2

O: Output Word (Data and Latch Outputs)

Specify the output word allocated to the Output Unit and connect the 7-segment display to the Output Unit as shown in the following diagram.

  • Converting 4 digits

OMRON CP1E - O: Output Word (Data and Latch Outputs) - 1

  • Converting 8 digits

OMRON CP1E - O: Output Word (Data and Latch Outputs) - 2

C: Control Data

The value of C indicates the number of digits of source data and the logic for the Input and Output Units, as shown in the following table. (The logic refers to the transistor output's NPN or PNP logic.)

Source dataDisplay's data input logicDisplay's latch input logicC
4 digits (S)Same as Output UnitSame as Output Unit0000
Different from Output Unit0001
Different from Output UnitSame as Output Unit0002
Different from Output Unit0003
8 digits (S, S+1)Same as Output UnitSame as Output Unit0004
Different from Output Unit0005
Different from Output UnitSame as Output Unit0006
Different from Output Unit0007

D: System Word

Specifies a work word used by the instruction. This word cannot be used in any other application.

OMRON CP1E - D: System Word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
S, OOKOKOKOKOKOKOKOKOK------------
C---------------------------OK
DOKOKOKOKOKOKOKOKOK---

Flags

NameLabelOperation
Error FlagP_EROFF

Function

7SEG(214) reads the source data, converts it to 7-segment display data, and outputs that data (as leftmost 4 digits D0 to D3, rightmost 4 digits D0 to D3, latch output signals LE0 to LE3) to the 7-segment display connected to the output indicated by O. The value of C indicates the number of digits of source data (either 4-digit or 8-digit) and the logic for the Input and Output Units.

7SEG(214) displays the 4-digit or 8-digit data in 12 cycles, and then starts over and continues displaying the data.

The One Round Flag (bit 08 of O when converting 4 digits, bit 12 of O when converting 8 digits) is turned ON for one cycle in every 12 cycles after 7SEG(214) has turned ON each of the latch output signals.

- External Connections

Connect the 7-segment display to the Output Unit as shown in the following diagram. This example shows an 8-digit display. With a 4-digit display, the data outputs (D0 to D3) would be connected to outputs 0 to 3 and the latch outputs (LE0 to LE3) would be connected to outputs 4 to 7. Output point 12 (for 8-digit display) or output point 8 (for 4-digit display) will be turned ON when one round of data has been output, but it is not necessary to connect them unless required by the application.

OMRON CP1E - - External Connections - 1

- Timing Chart

FunctionBit(s) in OOutput status (Data and latch logic depends on C)
(4 digits, 1 block)(4 digits, 2 blocks)
Data output00 to 0300 to 03
04 to 07100101102103
Latch output 00408
Latch output 10509
Latch output 20610
Latch output 30711
One Round Flag0812
12 cycles required to complete one round

Precaution

  • Do not read or write the system word (D) from any other instruction. 7SEG(214) will not operate correctly if the system word is accessed by another instruction. The system word is not initialized by 7SEG(214) in the first cycle when program execution starts. If 7SEG(214) is being used from the first cycle, clear the system word from the program.
  • After the 7-segment data is output in 12 cycles, 7SEG(214) starts over and converts the present contents of the source word(s) in the next 12 cycles.
  • When executed, 7SEG(214) begins on latch output 0 at the beginning of the round, regardless of the point at which the last instruction was stopped.
  • Even if the connected 7-segment display has fewer than 4 digits or 8 digits in its display, 7SEG(214) will still output 4 digits or 8 digits of data.

Sample program

In this example, 7SEG(214) converts the 8 digits of BCD data in D100 and D101 and outputs the data through CIO 100.

There are 8 digits of data being output and the 7-segment display's logic is the same as the Output Unit's logic, so the control data (C) is set to 4. D200 is used as the system word, D.

OMRON CP1E - Sample program - 1

Serial Communication Instructions

TXD

InstructionMnemonicVariationsFunction codeFunction
TRANSMITTXD@TXD236Outputs the specified number of bytes of data from the CPU Unit's built-in RS-232C port or the Serial Option Board port.
SymbolTXD
TXD(236)S: First source word
SC: Control word
CN: Number of bytes 0000 to 0100 hex (0 to 256)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordUINTVariable
CControl wordUINT1
NNumber of bytes 0000 to 0100 hex (0 to 256)UINT1

C: Control word

OMRON CP1E - C: Control word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------
C, NOK

Flags

NameLabelOperation
Error FlagP_ERON if no-protocol mode is not set in the PLC Setup.ON if the value of C is not within range.ON if the value for N is not between 0000 and 0100 hex.ON if a send is attempted when the Send Ready Flag is OFF. (The Send Ready Flag is A392.05 for the CPU Unit's RS-232C port, or A392.13 for Serial Option Board port.)OFF in all other cases.

CPU Unit's Built-in RS-232C Port

PortAddressContents
CPU Unit's built-in RS-232C portA392.05ON when data can be sent in the no-protocol mode.

- Serial Option Board Port

PortAddressContents
Serial Option Board portA392.13ON when data can be sent in the no-protocol mode.

OMRON CP1E - Related PLC Setup Settings - 1

Function

TXD(236) reads N bytes of data from words S to S + (N ÷ 2) - 1 and outputs the raw data in no-protocol mode from the CPU Unit's built-in RS-232C port or the Serial Option Board port. (The output port is specified with bits 8 to 11 of C.)
- The following send-message frame format can be set in the PLC Setup.

1) Start code: None or 00 to FF hex.
2) End code: None, CR+LF, or 00 to FF hex.

The data will be sent with any start and/or end codes specified in the PLC Setup. If start and end codes are specified, the codes will be added to the send data (N). In this case, the maximum number of bytes that can be specified for N is 256 bytes.

Data is sent in the order specified in C0 to C3.
- Specification of control in C4 to C7 for the RS and ER signals take effect as follows:

1) If RS signal control is specified in C, bit 15 of S will be used as the RS signal.
2) If ER signal control is specified in C, bit 15 of S will be used as the ER signal.
3) If RS and ER signal control is specified in C, bit 15 of S will be used as the RS signal and bit 14 of S will be used as the ER signal.

  • If 1, 2, or 3 hex is specified for RS and ER signal control in C, TXD(236) will be executed regardless of the status of the Send Ready Flag (A392.05, or A392.13 depending on the port being used).

  • Up to 259 bytes can be sent, including the send data (N = 256 bytes max.), the start code, and the end code.

  • Specify the size of the send data, not including the start code and end code, in N.

- Start code / end code settings and send data

OMRON CP1E - - Start code / end code settings and send data - 1

Hint

  • When sending data to another device by TXD instruction, the device may require that the data be sent at certain intervals. In that case, a transmission delay time can be set to adjust the transmission intervals.

Precautions

  • TXD(236) can be used only for the CPU Unit's RS-232C port or the Serial Option Board port. In addition, the port must be set to no-protocol mode.
  • Data can be sent only when the port's Send Ready Flag is ON. (The Send Ready Flag is A392.05 for the CPU Unit's RS-232C port, or A392.13 for Serial Option Board port.)
  • Nothing will be sent if 0 is specified for N.

Sample program

- Sending Data to a Code Reader

This example shows how to send data to the V530-R150V3 2D Code Reader as an example of communicating with an external device.

OMRON CP1E - - Sending Data to a Code Reader - 1
Hardware Configuration

In this example, the external device is connected to the RS-232C port built into the CPU Unit.

First, set the reading conditions for the Code Reader.

Communications Settings

The communications settings of the Code Reader are given in the following table. These are the default settings.

ItemSetting
Communications modeNo-protocol
Baud rate38,400 bps
Data bit length8 bits
ParityNone
Stop bits1
Start codeNone
End code#000D (CR)

Set the PLC communications settings to the same values in the PLC Setup. Only the end code needs to be set.

Programming Example

If CIO 0.01 turns ON while the RS-232C Port Send Ready Flag (A392.05) is ON, three bytes of data starting from the upper byte of D10 are sent without conversion to the Code Reader connected to the CPU Unit's built-in RS-232C port. These three bytes contain "@GO", which is the normal read command used as a trigger input to the Code Reader from the RS-232C line.

OMRON CP1E - Programming Example - 1

OMRON CP1E - Programming Example - 2

- Controlling Signals

OMRON CP1E - - Controlling Signals - 1

RXD

InstructionMnemonicVariationsFunction codeFunction
RECEIVERXD@RXD235Reads the specified number of bytes of data from the CPU Unit's built-in RS-232C port or the Serial Option Board port.
SymbolRXD
RXD(235)
D
C
N
N: Number of bytes to store 0000 to 0100 hex (0 to 256 decimal)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
DFirst destination wordUINTVariable
CControl wordUINT1
NNumber of bytes to store 0000 to 0100 hex (0 to 256 decimal)UINT1

C: Control Word

OMRON CP1E - C: Control Word - 1

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
DOKOKOKOKOKOKOKOKOK------------
C, NOK

Flags

NameLabelOperation
Error FlagP_ERON if no-protocol mode is not set in the PLC Setup.ON if the value of C is not within range.ON if the value for N is not between 0000 and 0100 hex.OFF in all other cases.
  • Auxiliary Area Flags for CPU Unit's RS-232C Port
NameAddressContents
RS-232C Port Reception Completed FlagA392.06ON when no-protocol reception is completed.Number of Receive Bytes Specified: The flag will turn ON when the specified number of bytes has been received.End Code Specified: The flag will turn ON when the end code is received or when 256 bytes have been received.
RS-232C Port Reception Overflow FlagA392.07ON when more than the expected number of receive bytes has been received.Number of Receive Bytes Specified: The flag will turn ON when anything is received after reception has been completed and execution of the next RXD(235).End Code Specified: The flag will turn ON when anything is received after the end code has been received and execution of the next RXD(235) or when the 257th byte of data is received before the end code is received.
RS-232C Port Reception CounterA393Counts in hexadecimal the number of bytes received in no-protocol mode (0 to 256 decimal).
  • Auxiliary Area Flags for Serial Option Board Port
NameAddressContents
Serial Option Board port Reception Completed FlagA392.14ON when no-protocol reception is completed.Number of Receive Bytes Specified: The flag will turn ON when the specified num ber of bytes has been received.End Code Specified: The flag will turn ON when the end code is received or when 256 bytes have been received.
Serial Option Board port Reception Overflow FlagA392.15ON when more than the expected number of receive bytes has been received in no-protocol mode.Number of Receive Bytes Specified: The flag will turn ON when more data is received after reception was completed but before the received data was not read from the buffer with RXD(235).End Code Specified: The flag will turn ON when 257 or more bytes of data are received without an end code.
Serial Option Board port Reception CounterA394.00 to A394.15Counts in hexadecimal the number of bytes received in no-protocol mode (0 to 256 decimal).

OMRON CP1E - Related PLC Setup Settings - 1

Function

  • RXD(235) reads data that has been received in no-protocol mode at the CPU Unit's built-in RS-232C port or the Serial Option Board port (the port is specified with bits 8 to 11 of C) and stores N bytes of data in words D to D + (N ÷ 2) - 1 . If N bytes of data has not been received at the port, then only the data that has been received will be stored.
  • The following receive message frame format can be set in the PLC Setup.

1) Start code: None or 00 to FF hex
2) End code: None, CR+LF, or 00 to FF hex. If no end code is specified, the number of bytes to received is set from 00 to FF hex (1 to 256 decimal; 00 specifies 256 bytes).

Data will be stored in memory in the order specified in C0 to C3.
- Cases where the reception completion flag turns ON

The Reception Completed Flag (note (a)) will turn ON when the number of bytes specified in the PLC Setup has been received. When the Reception Completed Flag turns ON, the number of bytes in the Reception Counter (note (b)) will have the same value as the number of receive bytes specified in the PLC Setup.

If an end code is specified in the PLC Setup, the Reception Completed Flag (note (a)) will turn ON when the end code is received or when 256 bytes of data have been received. If more bytes are received than specified, the Reception Overflow Flag (note (c)) will turn ON.

  • When RXD(235) is executed, data is stored in memory starting at D, the Reception Completed Flag (note (a)) will turn OFF (even if the Reception Overflow Flag (note (c)) is ON), and the Reception Counter (note (b)) will be cleared to 0.
  • If the RS-232C Port Restart Bit (note (d)) is turned ON, the Reception Completed Flag (note (a)) will be turned OFF (even if the Reception Overflow Flag is ON), and the Reception Counter (note (b)) will be cleared to 0.
  • Specification of monitor in bits C4 to C7 for the CS and DR signals takes effect as follows:

1) If CS signal monitoring is specified in C, the status of the CS signal will be stored in bit 15 of D.
2) If DR signal monitoring is specified in C, the status of the DR signal will be stored in bit 15 of D.
3) If CS and DR signal monitoring is specified in C, the status of the CS signal will be stored in bit 15 of D and the status of the DR signal will be stored in bit 14 of D.

  • If 1, 2, or 3 hex is specified for CS and DR signal control in C, RXD(235) will be executed regardless of the status of the Receive Completed Flag (note (a)).
  • Receive data will not be stored if CS or DR signal monitoring is specified.
  • Up to 259 bytes can be received, including the receive data (N = 256 bytes max.), the start code, and the end code.
  • Specify the size of the receive data, not including the start code and end code, in N.

Note Related Auxiliary Area and CIO Area Addresses

(a) Reception Completed Flags

Built-in RS232C port A392.06

Serial Option Board port: A392.14

(b) Reception Counters

Built-in RS232C port A393

Serial Option Board port: A394

(c) Reception Overflow Flags

Built-in RS232C port A392.07

Serial Option Board port: A392.15

Built-in RS232C port A526.00

Serial Option Board port: A526.01

- Start Code/End Code Settings and Receive Data

OMRON CP1E - - Start Code/End Code Settings and Receive Data - 1

Hint

  • When RXD(235) is used to read data that was received at one of the Serial Option Board's ports, the port's reception buffer is cleared after RXD(235) is executed. Consequently, RXD(235) can not be executed repeatedly to read a block of data in parts.

Precautions

  • RXD(235) can be used only for the CPU Unit's RS-232C port or the Serial Option Board port. In addition, the port must be set to no-protocol mode.
  • Execute this instruction when the reception completion flag (RS-232C incorporated in the CPU unit: A392.06, Serial Option Board: A392.14) is 1 (ON) to receive data (from the reception buffer).
  • When data is received, the data must be read by an RXD instruction or the next data cannot be received. When the reception completion flag turns ON, read the received data with an RXD instruction before the next reception.
  • Specify the size of the receive data, not including the start code and end code, in N.
  • If 0 is specified for N, the Reception Completed Flag and Reception Overflow Flag (note(a)) will be turned OFF, the Reception Counter (note(b)) will be cleared to 0, and nothing will be stored in memory.

Sample program

- Receiving data

This example shows how to receive data from the V530-R150V3 2D Code Reader as an example of communicating with an external device.

OMRON CP1E - - Receiving data - 1
Hardware Configuration

In this example, the external device is connected to the RS-232C port built into the CPU Unit.

First, set the reading conditions for the Code Reader.

Communications Settings

The communications settings of the Code Reader are given in the following table. These are the default settings.

ItemSetting
Communications modeNo-protocol
Baud rate38,400 bps
Data bit length8 bits
ParityNone
Stop bits1
Start codeNone
End code#000D (CR)

Set the PLC communications settings to the same values in the PLC Setup. Only the end code needs to be set.

Programming Example

If CIO 0.02 turns ON while the RS-232C Port Send Ready Flag (A392.05) is ON, the number of bytes of reading results specified in the RS-232C Port Reception Counter (A393) are read from the Code Reader connected to the CPU Unit's built-in RS-232C port and stored starting from the upper byte of D100.

OMRON CP1E - Programming Example - 1

OMRON CP1E - Programming Example - 2

Controlling Signals

OMRON CP1E - Controlling Signals - 1

Clock Instructions

CADD/CSUB

InstructionMnemonicVariationsFunction codeFunction
CALENDAR ADDCADD@CADD730Adds time to the calendar data in the specified words.
CALENDAR SUBTRACTCSUB@CSUB731Subtracts time from the calendar data in the spec-ified words.
SymbolCADDCSUB
CADD(730)C: First calendar wordT: First time wordR: First result wordCSUB(731)C: First calendar wordT: First time wordR: First result word
CC
TT
RR

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
CFirst calendar wordWORD3
TFirst time wordDWORD2
RFirst result wordWORD3

OMRON CP1E - Operands - 1
- CADD C through C+2: Calendar Data

OMRON CP1E - Operands - 2

OMRON CP1E - Operands - 3

OMRON CP1E - Operands - 4
T and T+1: Time Data

OMRON CP1E - Operands - 5

OMRON CP1E - Operands - 6
R through R+2: Result Data

OMRON CP1E - Operands - 7

OMRON CP1E - Operands - 8

OMRON CP1E - Operands - 9
CSUB
C through C+2: Calendar Data

OMRON CP1E - Operands - 10

OMRON CP1E - Operands - 11

OMRON CP1E - Operands - 12
T and T+1: Time Data

OMRON CP1E - Operands - 13

OMRON CP1E - Operands - 14
R through R+2: Result Data

OMRON CP1E - Operands - 15

OMRON CP1E - Operands - 16

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
COKOKOKOKOKOKOKOKOK------------
TOK
R---

Flags

NameLabelOperation
Error FlagP_ERON if the calendar data in C through C+2 is not within the specified ranges. ON if the time data in T and T+1 is not within the specified ranges. OFF in all other cases.
Equal FlagP_EQON when the result of a CSUB instruction is 0. OFF in all other cases.

Function

CADD

CADD(730) adds the calendar data (words C through C+2) to the time data (words T and T+1) and outputs the resulting calendar data to R through R+2.

OMRON CP1E - CADD - 1

OMRON CP1E - CADD - 2

OMRON CP1E - CADD - 3

CSUB

CSUB(731) subtracts the time data (words T and T+1) from the calendar data (words C through C+2) to and outputs the resulting calendar data to R through R+2.

OMRON CP1E - CSUB - 1

OMRON CP1E - CSUB - 2

OMRON CP1E - CSUB - 3

Sample program CADD

When CIO 0.00 turns ON in the following example, the calendar data in D100 through D102 (year, month, day, hour, minutes, seconds) is added to the time data in D200 and D201 (hours, minutes, seconds) and the result is output to D300 through D302.

OMRON CP1E - Sample program CADD - 1

OMRON CP1E - Sample program CADD - 2

CSUB

When CIO 0.00 turns ON in the following example, the time data in D200 and D201 (hours, minutes, seconds) is subtracted from the calendar data in D100 through D102 (year, month, day, hour, minutes, seconds) and the result is output to D300 through D302.

OMRON CP1E - CSUB - 1

OMRON CP1E - CSUB - 2
18:30:20
10 July, 1998

OMRON CP1E - CSUB - 3
50 hours, 10 minutes, 15 seconds

OMRON CP1E - CSUB - 4
16:20:05
8 July, 1998

DATE

InstructionMnemonicVariationsFunction codeFunction
CLOCK ADJUSTMENTDATE@DATE735Changes the internal clock setting to the setting in the specified source words.
SymbolDATE
— | — DATE(735) — SS: First source word

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
SFirst source wordLWORD4

OMRON CP1E - Operands - 1
S through S+3: New Clock Setting

OMRON CP1E - Operands - 2

OMRON CP1E - Operands - 3

OMRON CP1E - Operands - 4
Note S through S + 3 must be in the same data area.

  • Operand Specifications
AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
SOKOKOKOKOKOKOKOKOK------------

Flags

NameLabelOperation
Error FlagP_ERON if the new clock setting in S through S+3 is not within the specified rangeOFF in all other cases.ON when DATE instruction is executed for CP1E-E□□□□-□.

Related Auxiliary Area Words and Bits

NameAddressOperation
Clock dataA351 to A354A351.00 to A351.07: Seconds (00 to 59) (BCD) A351.08 to A351.15: Minutes (00 to 59) (BCD) A352.00 to A352.07: Hours (00 to 23) (BCD) A352.08 to A352.15: Day of the month (01 to 31) (BCD) A353.00 to A353.07: Month (01 to 12) (BCD) A353.08 to A353.15: Year (00 to 99) (BCD) A354.00 to A354.07: Day of the week (00 to 06) (BCD) 00: Sunday, 01: Monday, 02: Tuesday, 03: Wednesday, 04: Thursday, 05: Friday, 06: Saturday

Function

DATE(735) changes the internal clock setting according to the clock data in the four source words. The new internal clock setting is immediately reflected in the Calendar/Clock Area (A351 to A354).

OMRON CP1E - Function - 1

Hint

The internal clock setting can also be changed from a Peripheral Device or the CLOCK WRITE FINS command (0702).

Precaution

  • An error will not be generated even if the internal clock is set to a non-existent date (such as November 31).
  • In case this instruction is executed for E-type CPU Unit (CP1E-E□□□□-□), the error flag will turn ON and the instruction cannot be executed. For E-type CPU Unit, A351 to A354 is always 01-01-01 01:01:01 Sunday.

Sample program

When CIO 0.00 turns ON in the following example, the internal clock is set to 20:15:30 on Thursday, October 9, 1998.

OMRON CP1E - Sample program - 1

OMRON CP1E - Sample program - 2

OMRON CP1E - Sample program - 3

OMRON CP1E - Sample program - 4

OMRON CP1E - Sample program - 5

Failure Diagnosis Instructions

FAL

InstructionMnemonicVariationsFunction codeFunction
FAILURE ALARMFAL@FAL006Generates or clears user-defined non-fatal errors. Non-fatal errors do not stop PLC operation.
SymbolFAL
Generating or Clearing User-defined Non-fatal ErrorsGenerating Non-fatal System Errors
FAL(006)N: FAL numberFAL(006)N: FAL number (value in A529)
NS: First message word or constant (0000 to FFFF)NS: First word containing the error code and error details

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NFAL numberConstants only1
SFirst message word or constant / First word containing the error code and error detailsWORDVariable

- Generating or Clearing User-defined Non-fatal Errors

Note The value of operand N must be different from the content of A529 (the system-generated FAL/FALS number).

Generates a non-fatal errorClears all non-fatal errors
N1 to 511 (These FAL numbers are shared with FALS numbers.)0
SWord address:Generates a non-fatal error with the corresponding FAL number.The 16-character ASCII message contained in S through S+7 will be displayed on the Programming Device.#0000 to #FFFF:Generates a non-fatal error with the corresponding FAL number (no message).#FFFF: clears all non-fatal errors.#0001 to #01FF: clears the non-fatal error with the corresponding FAL number.Other: clears the most serious non-fatal error.

- Generating Non-fatal System Errors

Note The value of operand N must be the same as the content of A529 (the system-generated FAL/FALS number).

Generates a non-fatal error
N1 to 511 (These FAL numbers are shared with FALS numbers.)
SError code that will be generated. (See Function below.)
S+1Error details code that will be generated. (See Function below.)

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagERON if N is not within the specified range of 0 to 511 decimal.ON if a non-fatal system error is being generated, but the specified error code or error details code is incorrectOFF in all other cases.

- Auxiliary Area Words/Flags for User-defined Errors Only

NameAddressOperation
FAL Error FlagA402.15ON when an error is generated with FAL(006).
Executed FAL Number FlagsA360.01 to A391.15When an error is generated with FAL(006), the corresponding flag will be turned ON. Flags A360.01 to A391.15 correspond to FAL numbers1 to 511 decimal.

- Auxiliary Area Words/Flags for System Errors Only

NameAddressOperation
System-generated FAL/FALS numberA529A dummy FAL/FALS number is used when a system error is generated with FAL(006). Set the same dummy FAL/FALS number in this word (0001 to 01FF hex, 1 to 511 decimal).

- Auxiliary Area Words/Flags for both User-defined and System Errors

NameAddressOperation
Error Log AreaA100 to A199The Error Log Area contains the error codes and time/date of occurrence for the most recent 20 errors, including errors generated by FAL(006).
Error codeA400When an error occurs its error code is stored in A400. The error codes for FAL numbers 0001 to 01FF are 4101 to 42FF, respectively. If two or more errors occur simultaneously, the error code of the most serious error will be stored in A400.

Clearing Non-fatal Errors without a Programming Device

- Clearing User-defined Non-fatal Errors

When FAL(006) is executed with N set to 0, non-fatal errors can be cleared. The value of S will determine the processing, as shown in the following table.

SProcess
&1 to &511 (0001 to 01FF hex)The FAL error of the specified number will be cleared.
FFFF hexAll non-fatal errors (including system errors) will be cleared.
0200 to FFFE hex or word specificationThe most serious non-fatal error (even if it is a non-fatal system error) that has occurred. When more than one FAL error has occurred, the FAL error with the smallest FAL number will be cleared.

- Clearing Non-fatal System Errors

There are two ways to clear non-fatal system errors generated with FAL(006).

  • Turn the PLC OFF and then ON again.
  • When keeping the PLC ON, the system error must be cleared as if the specified error had actually occurred.

Function

- Generating Non-fatal User-defined Errors

The following table shows the error codes and FAL Error Flags for FAL(006).

FAL number1 to 511 decimal
FAL error codes4101 to 42FF
Executed FAL Number FlagsA360.01 to A391.15

When FAL(006) is executed with N set to an FAL number (&1 to &511) that is not equal to the content of A529 (the system-generated FAL/FALS number), a non-fatal error will be generated with that FAL number and the following processing will be performed:

OMRON CP1E - - Generating Non-fatal User-defined Errors - 1

  1. The FAL Error Flag (A402.15) will be turned ON. (PLC operation will continue.)
  2. The Executed FAL Number Flag will be turned ON for the corresponding FAL number. Flags A360.01 to A391.15 correspond to FAL numbers 0001 to 01FF (1 to 511).
  3. The error code will be written to A400. Error codes 4101 to 42FF correspond to FAL numbers 0001 to 01FF (1 to 511).
  4. The error code and the time that the error occurred will be written to the Error Log Area (A100 through A199).

Note The error record will not be written to the Error Log Area if the Don't register FAL to error log Option in the PLC Setup is selected.

  1. The ERR Indicator on the CPU Unit will flash.
  2. If a word address has been specified in S, the message beginning at S will be registered (displayed on the Programming Device).
    Note If a fatal error or a more serious non-fatal error occurs at the same time as the FAL(006) instruction, the more serious error's error code will be written to A400.

- Generating Non-fatal System Errors

When FAL(006) is executed with N set to an FAL number (&1 to &511) that is equal to the content of A529 (the system-generated FAL/FALS number), a non-fatal error will be generated with the error code and error details code specified in S and S+1. The following processing will be performed at the same time:

OMRON CP1E - - Generating Non-fatal System Errors - 1

  1. The specified error code will be written to A400.
  2. The error code and the time that the error occurred will be written to the Error Log Area (A100 through A199).
  3. The appropriate Auxiliary Area Flags are set based on the error code and error details.
  4. The ERR Indicator on the CPU Unit will flash and PLC operation will continue.

Note 1 FAL(006) can be used to generate non-fatal errors from the system when debugging the program. For example, a system error can be generated intentionally to check whether or not error messages are being displayed properly at an interface such as a Programmable Terminal (PT).
2 The value of A529 (the system-generated FAL/FALS number) is a dummy FAL number (FAL and FALS numbers are shared.) used when a non-fatal error is generated intentionally by the system. This number is a dummy FAL number, so it does not change the status of the Executed FAL Number Flags (A360.01 to A391.15) or the error code.

When it is necessary to generate two or more system errors (fatal and/or non-fatal errors), different errors can be generated by executing the FAL/FALS instructions more than once with the same values in A529 and N, but different values in S and S+1.

3 If a more serious error (including a system-generated fatal error or FALS(007) error) occurs at the same time as the FAL(006) instruction, the more serious error's error code will be written to A400.
4 To clear a system error generated by FAL(006), turn the PLC OFF and then ON again. The PLC can be kept ON, but the same processing will be required to clear the error as if the specified error had actually occurred.

Refer to CP1E CPU Unit Hardware Operation Manual or CP1E CPU Unit Software Operation Manual.

The following table shows how to specify error codes and error details in S and S + 1 .

Error nameSS+1
PLC Setup Error009B hexPLC Setup Error Location 0000 to FFFF hex
Built-in Analog Error008A hex--- (not fixed)
Option Board Error00D1 hexOption Board Slot No. 0001 hex
Battery Error00F7 hex--- (not fixed)

- Disabling Error Log Entries of User-defined Errors

Normally when FAL(006) generates a user-defined error, the error code and the time that the error occurred are written to the Error Log Area (A100 through A199). It is possible to set the PLC Setup so that user-defined errors generated by FAL(006) are not recorded in the Error Log.

Note Even though the error will not be recorded in the Error Log, the FAL Error Flag (402.15) will be turned ON, the corresponding flag in the Executed FAL Number Flags (A360.01 to A391.15) will be turned ON, and the error code will be written to A400.

Disable Error Log entries for user-defined FAL(006) errors when you want to record only the system-generated errors. For example, this function is useful during debugging if the FAL(006) instructions are used in several applications and the Error Log is becoming full of user-defined FAL(006) errors.

  • The following screen capture shows the PLC Setup setting from the CX-Programmer.

OMRON CP1E - - Disabling Error Log Entries of User-defined Errors - 1

Note Even if PLC Setup word 129 bit 15 is set to 1 (Do not record FAL Errors in Error Log.), the following errors will be recorded:

  • Fatal errors generated by FALS(007)
  • Non-fatal errors from the system
  • Fatal errors from the system
  • Non-fatal errors from the system generated intentionally with FAL(006)
  • Fatal errors from the system generated intentionally with FALS(007)

- Displaying Messages with Non-fatal User-defined Errors

  • If S is a word address and an ASCII message has been stored at S, that message will be displayed at the Peripheral Device when FAL(006) is executed. (If a message is not required, set S to a constant.)
  • The message beginning at S will be registered when FAL(006) is executed. Once the message is registered, it will be displayed.
  • An ASCII message up to 16 characters long can be stored in S through S+7. The leftmost (most significant) byte in each word is displayed first.
  • The end code for the message is the null character (00 hexadecimal).
  • All 16 characters in words S to S+7 will be displayed if the null character is omitted.
  • If the contents of the words containing the message are changed after FAL(006) is executed, the message will change accordingly.

Sample program

- Generating a Non-fatal Error

When CIO 0.00 is ON in the following example, FAL(006) will generate a non-fatal error with FAL number 31 and execute the following processes.

  1. The FAL Error Flag (A402.15) will be turned ON.
  2. The corresponding Executed FAL Number Flag (A361.15) will be turned ON.
  3. The corresponding error code (411F) will be written to A400.
  4. The error code and the time/date that the error occurred will be written to the Error Log Area (A100 through A199).
  5. The ERR Indicator on the CPU Unit will flash.
  6. The ASCII message in D100 to D107 will be displayed at the Peripheral Device.

Note If a message is not required, specify a constant for S.

OMRON CP1E - - Generating a Non-fatal Error - 1

OMRON CP1E - - Generating a Non-fatal Error - 2

Note If two or more errors occur at the same time, the error code of the most serious error (with the highest error code) will be stored in A400.

- Clearing a Particular Non-fatal Error

When CIO 0.01 is ON in the following example, FAL(006) will clear the non-fatal error with FAL number 31, turn OFF the corresponding Executed FAL Number Flag (A361.15), and turn OFF the FAL Error Flag (A402.15).

OMRON CP1E - - Clearing a Particular Non-fatal Error - 1

- Clearing All Non-fatal Errors

When CIO 0.02 is ON in the following example, FAL(006) will clear all of the non-fatal errors, turn OFF the Executed FAL Number Flags (A360.01 to A391.15), and turn OFF the FAL Error Flag (A402.15).

OMRON CP1E - - Clearing All Non-fatal Errors - 1

Set N to 0 to clear errors.

Set M to FFFF to clear all non-fatal errors (both FAL(006) and system errors).

- Clearing the Most Serious Non-fatal Error

When CIO 0.03 is ON in the following example, FAL(006) will clear the most serious non-fatal error that has occurred and reset the error code in A400. If the cleared error was originally generated by FAL(006), the corresponding Executed FAL Number Flag and the FAL Error Flag (A402.15) will be turned OFF.

OMRON CP1E - - Clearing the Most Serious Non-fatal Error - 1

Set N to 0 to clear errors.

Set M to 0000, another constant between 0200 and FFFE, or a word address to clear the most serious non-fatal error. (In this case, M is set to 0000.)

- Generating a Non-fatal System Error

When CIO 0.00 is ON in the following example, FAL(006) will generate Option Board Error. In this case, dummy FAL number 10 is used and the corresponding value (000A hex) is stored in A529.

  1. The specified error code (00D1) will be written to A400 if it is the most serious error.
  2. The error code and the time/date that the error occurred will be written to the Error Log Area (A100 through A199).
  3. Option Board Error Flag(A315.13) will be turned ON.
  4. The CPU Unit's ERR Indicator will flash.
  5. Option Board Error will occur.

OMRON CP1E - - Generating a Non-fatal System Error - 1

FALS

InstructionMnemonicVariationsFunction codeFunction
SEVERE FAILURE ALARMFALS---007Generates user-defined fatal errors. Fatal errors stop PLC operation.
SymbolFALS
Generating User-defined Fatal ErrorsGenerating Fatal System Errors
FALS(007)N: FAL numberFALS(007)N: FAL number (value in A529)
NS: First message word or constant (0000 to FFFF)NS: First word containing the error code and error details

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
NFAL numberConstants only1
SFirst message word or constant / First word containing the error code and error detailsWORDVariable

- Generating User-defined Fatal Errors

Note The value of operand N must be different from the content of A529 (the system-generated FAL/FALS number).

Generates a non-fatal error
N1 to 511 (These FALS numbers are shared with FALS numbers.)
SSpecifies the first of eight words containing an ASCII message to be displayed on the Programming Device. Specify a constant (0000 to FFFF) if a message is not required.

- Generating Fatal Errors from the System

The following table shows the function of the operands.

Note The value of operand N must be the same as the content of A529 (the system-generated FAL/FALS number).

Generates a non-fatal error
N1 to 511 (These FALS numbers are shared with FAL numbers.)
SError code that will be generated. (See Description below.)
S+1Error details code that will be generated. (See Description below.)

-Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
N---------------------------OK---------
SOKOKOKOKOKOKOKOKOK

Flags

NameLabelOperation
Error FlagP_ERON if N is not within the specified range of 0001 to 01FF (1 to 511 decimal).ON if a fatal system error is being generated, but the specified error code or error details code is incorrectOFF in all other cases.

- Auxiliary Area Words/Flags for User-defined Errors Only

NameAddressOperation
FALS Error FlagA401.06ON when an error is generated with FALS(007).

- Auxiliary Area Words/Flags for System Errors Only

NameAddressOperation
System-generated FAL/FALS numberA529A dummy FAL/FALS number is used when a system error is generated with FALS(007). Set the same dummy FAL/FALS number in this word (0001 to 01FF hex, 1 to 511 decimal).

- Auxiliary Area Words/Flags for both User-defined and System Errors

NameAddressOperation
Error Log AreaA100 to A199The Error Log Area contains the error codes and time/date of occurrence for the most recent 20 errors, including errors generated by FALS(007).
Error codeA400When an error occurs its error code is stored in A400. The error codes for FALS numbers 0001 to 01FF (1 to 511 decimal) are C101 to C2FF, respectively.Note If two or more errors occur simultaneously, the error code of the most serious error will be stored in A400.

Function

- Generating Fatal User-defined Errors

FALS number1 to 511
FALS error codesC101 TO C2FF

When FALS(007) is executed with N set to an FALS number (1 to 511) that is not equal to the content of A529 (the system-generated FAL/FALS number), a fatal error will be generated with that FALS number and the following processing will be performed:

OMRON CP1E - - Generating Fatal User-defined Errors - 1

  1. The FALS Error Flag (A401.06) will be turned ON. (PLC operation will stop.)
  2. The error code will be written to A400. Error codes C101 to C2FF correspond to FALS numbers 0001 to 01FF (1 to 511).

Note If an error more serious than the FALS(007) instruction (one with a higher error code) has occurred, A400 will contain the more serious error's error code.

  1. The error code and the time/date that the error occurred will be written to the Error Log Area (A100 through A199).
  2. The ERR Indicator on the CPU Unit will be lit.
  3. If a word address has been specified in S, the ASCII message beginning at S will be registered (displayed on the Peripheral Device).

Note 1 If an error that is more serious (including fatal system errors) than an error registered with this instruction occurs simultaneously, the error code of that error will be set in error code A400.

2 The end code for the message is the null character (00 hexadecimal). All 16 characters in words S to S+7 will be displayed if the null character is omitted.
3 N must between 0001 and 01FF. An error will occur and the Error Flag will be turned ON if N is outside of the specified range.

4 When a user-defined fatal error is registered, the I/O memory and output status from output units will be as indicated below.

I/O memoryOutput status from output units
IOM Hold Bit (A500.12).ONHoldOFF
OFFHoldOFF

- Generating Non-fatal System Errors

OMRON CP1E - - Generating Non-fatal System Errors - 1

When FALS(007) is executed with N set to an FAL number (1 to 511) that is equal to the content of A529 (the system-generated FAL/FALS number), a fatal error will be generated with the error code and error details code specified in S and S+1. The following processing will be performed at the same time:

  1. The specified error code will be written to A400.
  2. The error code and the time that the error occurred will be written to the Error Log Area (A100 through A199).
  3. The appropriate Auxiliary Area Flags are set based on the error code and error details.
  4. The ERR Indicator on the CPU Unit will light and PLC operation will be stopped.

Note 1 The value of A529 (the system-generated FAL/FALS number) is a dummy FAL number (FAL and FALS numbers are shared.) used when a non-fatal error is generated intentionally by the system. This number is a dummy FAL number, so it is not reflected in the error code.

When it is necessary to generate two or more system errors, different errors can be generated by executing the FAL/FALS instructions more than once with the same values in A529 and N, but different values in S and S+1.

2 If a more serious error (including a system-generated fatal error or another FALS(007) error) occurs at the same time as the FALS(007) instruction, the more serious error's error code will be written to A400.
3 To clear a system error generated by FALS(007), turn the PLC OFF and then ON again. The PLC can be kept ON, but the same processing will be required to clear the error as if the specified error had actually occurred. Refer to CP1E CPU Unit Hardware Operation Manual or CP1E CPU Unit Software Operation Manual for details.
4 The following table shows how the IOM Hold Bit affects the status of I/O memory and the status of outputs on Output Units after a fatal system error has been generated with FALS(007).

Status of I/O memoryStatus of outputs on Output Units
IOM Hold Bit (A500.12)ONRetainedOFF
OFFClearedOFF

The following table shows how to specify error codes and error details in S and S + 1

Error nameSS+1
Error codeError details
Memory Error80F1 hexBits 00 to 09: Memory Error Location Bit 00: User program Bit 01: I/O memory Bit 04: PLC Setup Bits 2, 3, 5 to 15: Invalid
I/O Bus Error80CA hexCP1W Expansion I/O Unit, Expansion Unit #0A0A hex
Too Many I/O Points Error80E1 hexBits 13 to 15: Error Cause Bits 00 to 12: Details • The channel number of CP1W Expansion I/O Unit is too many. Bits 13 to 15: 001 Bits 00 to 12: All zeroes
Program Error80F0 hexBits 08 to 15: Error Cause Bit 15: UM overflow error Bit 14: Illegal instruction error Bit 13: Differentiation overflow error Bit 12: Task error Bit 11: No END error Bit 10: Illegal access error Bit 09: Indirect DM BCD error Bit 08: Instruction error Bits 00 to 07: Invalid
Cycle Time Overrun Error809F hex#0000 hex

- Displaying Messages with Fatal User-defined Errors

  • If S is a word address, the ASCII message beginning at S will be displayed at the Programming Device when FALS(007) is executed. (If a message is not required, set S to a constant.)
  • The message beginning at S will be registered when FALS(007) is executed. Once the message is registered, it will be displayed.
  • An ASCII message up to 16 characters long can be stored in S through S+7. The leftmost (most significant) byte in each word is displayed first.
  • The end code for the message is the null character (00 hexadecimal).
  • All 16 characters in words S to S+7 will be displayed if the null character is omitted.
  • If the contents of the words containing the message are changed after FALS(007) is executed, the message will change accordingly.

- Clearing FALS(007) Fatal System Errors

There are two ways to clear fatal system errors generated with FALS(007).

  1. Turn the PLC OFF and then ON again.
  2. When keeping the PLC ON, the system error must be cleared as if the specified error had actually occurred.

- Clearing FALS(007) User-defined Fatal Errors

To clear errors generated by FALS(007), first eliminate the cause of the error and then either clear the error from a Programming Device or turn the PLC OFF and then ON again.

Precaution

When a fatal system error is registered, if the IOM Hold Bit is OFF, I/O memory will be cleared.

Sample program

- Generating a User-defined Error

When CIO 0.00 is ON in the following example, FALS(007) will generate a fatal error with FAL number 31 and execute the following processes.

  1. The FALS Error Flag (A401.06) will be turned ON.
  2. The corresponding error code (C11F) will be written to A400.
  3. The error code and the time/date that the error occurred will be written to the Error Log Area (A100 through A199).
  4. The ERR Indicator on the CPU Unit will be lit.
  5. The ASCII message in D100 to D107 will be displayed at the Peripheral Device.

Note If a message is not required, specify a constant for S.

OMRON CP1E - - Generating a User-defined Error - 1

OMRON CP1E - - Generating a User-defined Error - 2

Note A400 will contain the error code of the most serious of all of the errors that have occurred, including non-fatal and fatal system errors, as well as errors generated by FAL(006) and FAL(007).

- Generating a Non-fatal System Error

When CIO 0.00 is ON in the following example, FALS(007) will generate Memory Error (User program Error). In this case, dummy FAL number 10 is used and the corresponding value (80F1 hex) is stored in A529.

  1. The specified error code (80F1) will be written to A400 if it is the most serious error.
  2. The error code and the time/date that the error occurred will be written to the Error Log Area (A100 through A199).
  3. The Memory Error Flag (A401.15) will be turned ON.
  4. The CPU Unit's ERR Indicator will light and PLC operation will stop.
  5. Memory Error has occurred.

OMRON CP1E - - Generating a Non-fatal System Error - 1

Other Instructions

STC/CLC

InstructionMnemonicVariationsFunction codeFunction
SET CARRYSTC@STC040Sets the Carry Flag (CY).
CLEAR CARRYCLC@CLC041Turns OFF the Carry Flag (CY).
SymbolSTCCLC
STC(040)CLC(041)

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Flags

OperandDescriptionData type
STCCLC
Carry FlagP_CYONOFF

Function

STC

When the execution condition is ON, STC(040) turns ON the Carry Flag (CY). Although STC(040) turns the Carry Flag ON, the flag will be turned ON/OFF by the execution of subsequent instructions which affect the Carry Flag.

ROL(027) and ROR(028) make use of the Carry Flag in their rotation shift operations.

- CLC

When the execution condition is ON, CLC(040) turns OFF the Carry Flag (CY). Although CLC(040) turns the Carry Flag OFF, the flag will be turned ON/OFF by the execution of subsequent instructions which affect the Carry Flag.

+C(402), +CL(403), +BC(406), +BCL(407), -C(412), -CL(413), -BC(416), and -BCL(417) make use of the Carry Flag in their addition operations. Use CLC(041) just before any of these instructions to prevent any influence from other preceding instructions.

ROL(027) and ROR(028) make use of the Carry Flag in their rotation shift operations.

Hint

The +(400), +L(401), +B(404), +BL(405), -(410), -L(411), -B(414) , and -BL(415) instructions do no include the Carry Flag in their addition and subtraction operations. In general, use these instructions when performing addition or subtraction.

WDT

InstructionMnemonicVariationsFunction codeFunction
EXTEND MAXIMUM CYCLE TIMEWDT@WDT094Extends the maximum cycle time, but only for the cycle in which the instruction is executed. WDT(094) can be used to prevent errors for long cycle times when a longer cycle time is temporarily required for special processing.
SymbolWDT
— |— WDT(094) — T |— T: Timer setting

Applicable Program Areas

AreaStep program areasSubroutinesInterrupt tasks
UsageOKOKOK

Operands

OperandDescriptionData typeSize
TTimer settingConstants only1

T: Timer setting

Specifies the watchdog timer setting between 0000 and 0064 hexadecimal or between &0000 and &0100 decimal.

- Operand Specifications

AreaWord addressesIndirect DM addressesConstantsCFPulse bitsTR bits
CIOWRHRARTCDM@DM*DM
T---------------------------OK---------

Flags

OperandDescriptionData type
Error FlagP_ERON if the watchdog timer setting exceeds 1 second.OFF in all other cases.

CX-Programmer settings

OMRON CP1E - CX-Programmer settings - 1

- PLC Setup settings

NameFunctionSettings
Watch cycle timeA Cycle Time Too Long error (fatal error) will be registered if the cycle time exceeds the maximum setting.0: Default setting (1,000 ms) 1: User time setting
Sets the maximum cycle time. (This setting is valid only when the first setting has been set to 1.)0001 to 0FA0 (10 to 1,000 ms, 10-ms units)

Note The default value for the maximum cycle time is 1,000 ms, although it can be set anywhere from 10 to 1,000 ms in 10-ms units.

  • WDT(094) can be used more than once in a cycle. When WDT(094) is executed more than once the cycle time extensions are added together, although the total must not exceed 1,000 ms. If WDT(094) cannot be executed again if the cycle has already been extended to 1,000 ms.
NameAddressOperation
Cycle Time Too Long FlagA401.08ON when the present cycle time exceeds the maximum cycle time (watch cycle time) set in the PLC Setup. This is a fatal error which causes program execution to stop.
Maximum Cycle TimeA262 and A263These words contain the maximum cycle time in 32-bit binary. This value is updated every cycle.
Present Cycle TimeA264 and A265These words contain the present cycle time in 32-bit binary. This value is updated every cycle.

Function

WDT(094) extends the maximum cycle time for the cycle in which this instruction is executed. The watchdog timer setting in the PLC Setup is extended by an interval of T × 10 ms (0 to 1,000 ms).

When it is likely that the cycle time will increase due to a temporary increase in processing data, this instruction can be used to prevent a cycle time error.

Sample program

OMRON CP1E - Sample program - 1

Operation of WDT(094)

In this example, the watchdog timer setting is set to 500ms.

  • When CIO 0.00 turns ON, the first WDT(094) instruction extends the cycle time by 300ms (30× 10ms) Thus, the total cycle time is 800~ms at this point.
  • When CIO 0.01 turns ON, the second WDT(094) instruction attempts to extend the cycle time by another 500~ms . Since the total cycle time (1,300~ms) exceeds the upper limit of 1,000~ms , the extra 300~ms is ignored. As a result, the second WDT(094) instruction actually extends the total cycle time by 200~ms .
  • When CIO 0.02 turns ON, the third WDT(094) instruction attempts to extend the cycle time by another 10ms . Since the total cycle time has already reached the upper limit of 1,000ms , the third WDT(094) instruction is not executed.

3

Instruction Execution Times and Number of Steps

This section provides the execution times for all instructions used with a CP1E CPU Unit.

3-1 CP1E CPU Unit Instruction Execution Times and Number of Steps 3-2

3-1 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 program execution when calculating the cycle time (See note.).

Note User programs are allocated tasks that can be executed within cyclic tasks and interrupt tasks that satisfy interrupt conditions.

Execution times for most instructions differ depending on the CPU Unit used and the conditions when the 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 of steps required in the user program area for each instructions depends on the instruction and the operands 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)

SymbolCP1E CPU Unit
CPU□□
↑or ↓+4.0
@ or %+2.5

2 Use the following time as a guideline when instructions are not executed.

CP1E CPU Unit
CPU□□
1.4

Sequence Input Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
LOADLD---11.19---
!LD---210.26---
LOAD NOTLD NOT---11.19---
!LD NOT---210.26---
ANDAND---11.19---
!AND---210.26---
AND NOTAND NOT---11.19---
!AND NOT---210.26---
OROR---11.29---
!OR---210.36---
OR NOTOR NOT---11.29---
!OR NOT---210.36---
AND LOADAND LD---10.60---
OR LOADOR LD---10.60---
NOTNOT52010.80---
CONDITION ONUP52134.92---
CONDITION OFFDOWN52245.69---

Sequence Output Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
OUTPUTOUT---11.61---
!OUT---238.06---
OUTPUT NOTOUT NOT---11.61---
!OUT NOT---238.06---
KEEPKEEP01114.72---
DIFFERENTIATE UPDIFU01324.12---
DIFFERENTIATE DOWNDIFD01424.19---
SETSET---12.69---
!SET---239.12---
RESETRSET---12.69Word specified
!RSET---239.12---
MULTIPLE BIT SETSETA530417.60With 1-bit set
253.5With 1,000-bit set
MULTIPLE BIT RESETRSTA531417.60With 1-bit reset
249.5With 1,000-bit reset
SINGLE BIT SETSETB532216.60---
!SETB354.60---
SINGLE BIT OUTPUTRSTB534216.60---
!RSTB354.60---

Sequence Control Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
ENDEND00114.6---
NO OPERATIONNOP00011.2---
INTERLOCKIL00214.3---
INTERLOCK CLEARILC00314.3---
MULTI-INTERLOCK DIFFERENTIATION HOLDMILH517319.4During interlock
19.4Not during interlock and interlock not set
21.5Not during interlock and interlock set
MULTI-INTERLOCK DIFFERENTIATION RELEASEMILR518319.4During interlock
19.4Not during interlock and interlock not set
21.5Not during interlock and interlock set
MULTI-INTERLOCK CLEARMILC51928.9Interlock not cleared
8.9Interlock cleared
JUMPJMP00426.1---
JUMP ENDJME00526.2---
CONDITIONAL JUMPCJP510210.1When JMP condition is satisfied
FOR LOOPFOR51229.7Designating a constant
BREAK LOOPBREAK51414.1---
NEXT LOOPNEXT51315.8When loop is continued
5.7When loop is ended

Timer and Counter Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
TIMERTIM---311.6---
TIMX550When loop is continued
COUNTERCNT---311.5---
CNTX546When loop is continued
HIGH-SPEED TIMERTIMH015311.6---
TIMHX551When loop is continued
ONE-MS TIMERTMHH540310.8---
TMHHX552---
ACCUMULATIVE TIMERTTIM087322.7---
17.4When resetting
15.0When interlocking
TTIMX555322.2---
17.4When resetting
15.2When interlocking
LONG TIMERTIML542424.3---
20.4When interlocking
TIMLX553424.5---
22.2When interlocking
REVERSIBLE COUNTERCNTR012326.2---
CNTRX54825.4---
RESET TIMER/ COUNTERCNR545319.0When resetting 1 word
659.0When resetting 256 words
CNRX547319.0When resetting 1 word
659.0When resetting 256 words

Comparison Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
Input Comparison Instructions (unsigned)LD,AND,OR+=30049.3---
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+=+L301410.8---
LD,AND,OR+<>+L306
LD,AND,OR+<=+L311
LD,AND,OR+<=+L316
LD,AND,OR>+L321
LD,AND,OR>=+L326
Input Comparison Instructions (signed)LD,AND,OR+=+S30249.4---
LD,AND,OR+<>+S307
LD,AND,OR+<=+S312
LD,AND,OR+<=+S317
LD,AND,OR>+S322
LD,AND,OR>=+S327
Input Comparison Instructions (double, signed)LD,AND,OR+=+SL303410.9---
LD,AND,OR+<>+SL308
LD,AND,OR+<=+SL313
LD,AND,OR+<=+SL318
LD,AND,OR>+SL323
LD,AND,OR>=+SL328
Time Comparison Instructions=DT341414.5---
<>DT342414.5---
<DT343414.4---
<=DT344414.4---
>DT345414.6---
>=DT346414.6---
COMPARECMP02038.1---
ICMP020749.1---
DOUBLECOMPARECMPL06039.5---
SIGNED BINARYCOMPARECPS11438.1---
ICPS114749.1---
DOUBLE SIGNED BINARYCOMPARECPSL11539.5---
TABLECOMPARETCMP085461.1---
UNSIGNED BLOCKCOMPAREBCMP0684107.6---
AREA RANGECOMPAREZCP088317.8---
DOUBLE AREA RANGECOMPAREZCPL116320.1---

Data Movement Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
MOVEMOV02138.0---
!MOV021757.7---
DOUBLE MOVEMOVL49838.9---
MOVE NOTMVN022313.7---
MOVE BITMOVB082421.4---
MOVE DIGITMOVD083422.4---
MULTIPLE BIT TRANSFERXFRB06226.4Transferring 1 word
137.3Transferring 255 bits
BLOCK TRANSFERXFER070424.2Transferring 1 word
3747.7Transferring 1,000 words
BLOCK SETBSET071421.3Setting 1 word
2074.4Setting 1,000 words
DATA EXCHANGEXCHG073319.2---
SINGLE WORD DISTRIBUTEDIST080420.8---
DATA COLLECTCOLL081420.6---

Data Shift Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SHIFT REGISTERSFT010314.1Shifting 1 word
1076.0Shifting 290 words
REVERSIBLE SHIFT REGISTERSFTR084418.0Shifting 1 word
3784.4Shifting 1,000 words
WORD SHIFTWSFT016425.8Shifting 1 word
3783.9Shifting 1,000 words
ARITHMETIC SHIFT LEFTASL025213.0---
ARITHMETIC SHIFT RIGHTASR026213.0---
ROTATE LEFTROL027213.3---
ROTATE RIGHTROR028213.5---
ONE DIGIT SHIFT LEFTSLD074321.8Shifting 1 word
3778.3Shifting 1,000 words
ONE DIGIT SHIFT RIGHTSRD075322.2Shifting 1 word
3778.6Shifting 1,000 words
SHIFT N-BITS LEFTNASL580319.5---
DOUBLE SHIFT NBITS LEFTNSLL582320.8---
SHIFT N-BITS RIGHTNASR581319.6---
DOUBLE SHIFT NBITS RIGHTNSRL583321.0---

Increment/Decrement Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
INCREMENT BINARY++590212.3---
DOUBLE INIncrement BINARY++L591213.5---
DECREMENT BINARY--592212.3---
DOUBLE DECREMENT BINARY--L593213.6---
INCREMENT BCD++B594213.2---
DOUBLE INIncrement BCD++BL595214.4---
DECREMENT BCD--B596213.2---
DOUBLE DECREMENT BCD--BL597214.5---

Symbol Math Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SIGNED BINARY ADD WITHOUT CARRY+400411.5---
DOUBLE SIGNED BINARY ADD WITHOUT CARRY+L401413.0---
SIGNED BINARY ADD WITH CARRY+C402411.7---
DOUBLE SIGNED BINARY ADD WITH CARRY+CL403413.2---
BCD ADD WITHOUT CARRY+B404420.6---
DOUBLE BCD ADD WITHOUT CARRY+BL405422.9---
BCD ADD WITH CARRY+BC406420.8---
DOUBLE BCD ADD WITH CARRY+BCL407423.1---
SIGNED BINARY SUBTRACT WITHOUT CARRY-410411.6---
DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY-L411413.2---
SIGNED BINARY SUBTRACT WITH CARRY-C412411.7---
DOUBLE SIGNED BINARY SUBTRACT WITH CARRY-CL413413.3---
BCD SUBTRACT WITHOUT CARRY-B414420.3---
DOUBLE BCD SUBTRACT WITHOUT CARRY-BL415423.6---
BCD SUBTRACT WITH CARRY-BC416420.5---
DOUBLE BCD SUBTRACT WITH CARRY-BCL417423.8---
SIGNED BINARY MULTIPLY*420418.4---
DOUBLE SIGNED BINARY MULTIPLY*L421423.9---
BCD MULTIPLY*B424422.0---
DOUBLE BCD MULTIPLY*BL425433.2---
SIGNED BINARY DIVIDE/430419.8---
DOUBLE SIGNED BINARY DIVIDE/L431425.8---
BCD DIVIDE/B434423.2---
DOUBLE BCD DIVIDE/BL435433.0---

Conversion Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
BCD TO BINARYBIN023315.1---
DOUBLE BCD TO DOUBLE BINARYBINL058316.7---
BINARY TO BCDBCD024315.1---
DOUBLE BINARY TO DOUBLE BCDBCDL059317.3---
2'S COMPLEMENTNEG160314.3---
DATA DECODERMLPX076419.6Decoding 1 digit (4 to 16)
31.0Decoding 4 digits (4 to 16)
79.4Decoding 1 digit (8 to 256)
138.2Decoding 2 digits (8 to 256)
DATA ENCODERDMPX077432.5Encoding 1 digit (16 to 4)
63.0Encoding 4 digits (16 to 4)
68.0Encoding 1 digit (256 to 8)
112.3Encoding 2 digits (256 to 8)
ASCII CONVERTASC086422.8Converting 1 digit into ASCII
24.7Converting 4 digits into ASCII
ASCII TO HEXHEX162418.4Converting 1 digit

Logic Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
LOGICAL ANDANDW034418.6---
DOUBLE LOGICAL ANDANDL610420.4---
LOGICAL ORORW035418.6---
DOUBLE LOGICAL ORORWL611420.4---
EXCLUSIVE ORXORW036418.6---
DOUBLE EXCLUSIVE ORXORL612420.4---
COMPLEMENTCOM029212.4---
DOUBLE COMPLEMENTCOML614213.6---

Special Math Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
ARITHMETIC PROCESSAPR069434.2Designating SIN and COS
25.9Designating line-segment approximation
BIT COUNTERBCNT067419.5Counting 1 word

Floating-point Math Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
FLOATING TO 16-BITFIX450315.9---
FLOATING TO 32-BITFIXL451316.2---
16-BIT TO FLOATINGFLT452316.2---
32-BIT TO FLOATINGFLTL453317.1---
FLOATING-POINT ADD+F454424.1---
FLOATING-POINT SUBTRACT-F455425.2---
FLOATING-POINT DIVIDE/F457425.0---
FLOATING-POINT MULTIPLY*F456424.4---
Floating Symbol ComparisonLD,AND,OR+=F329311.6---
LD,AND,OR+<>F330---
LD,AND,OR+<F331---
LD,AND,OR+<=F332---
LD,AND,OR+>F333---
LD,AND,OR>=F334---
FLOATING- POINT TO ASCIIFSTR448456.8---
ASCII TO FLOATING-POINTFVAL449342.9---

Table Data Processing Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SWAP BYTESSWAP637316.8Swapping 1 word
6250.0Swapping 1,000 words
FRAME CHECKSUMFCS180424.1For 1-word table length
2710.0For 1,000-word table length

Data Control Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
PID CONTROL WITH AUTOTUN-INGPIDAT1914316.0Initial execution of PID processing
270.0PID processing When sampling
228.0PID processing When not sampling
275.5Initial execution of autotuning
276.0Autotuning when sampling
TIME-PROPORTIONAL OUTPUTTPO68545.8OFF execution time
40.8ON execution time with duty designation or displayed output limit
43.4ON execution time with manipulated variable designation and output limit enabled
SCALINGSCL194424.8---
SCALING 2SCL2486420.2---
SCALING 3SCL3487426.4---
AVERAGEAVG195424.2Average of an operation
225.5Average of 64 operations

Subroutine Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SUBROUTINE CALLSBS09126.6---
SUBROUTINE ENTRYSBN09222.6---
SUBROUTINE RETURNRET09313.1---

Interrupt Control Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SET INTERRUPT MASKMSKS690315.1Set
15.1Reset
CLEAR INTERRUPTCLI691314.9Set
18.0Reset
DISABLE INTERRUPTSDI69318.5---
ENABLE INTERRUPTSEI69418.9---

High-speed Counter and Pulse Output Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
MODE CONTROLINI880446.0Starting high-speed counter comparison
31.8Stopping high-speed counter comparison
48.7Changing pulse output PV
35.2Changing high-speed counter PV
27.2Stopping pulse output
13.0Stopping PWM(891) output
HIGH-SPEED COUNTER PV READPRV881440.0Reading pulse output PV
35.0Reading high-speed counter PV
37.2Reading pulse output status
32.6Reading high-speed counter status
24.5Reading PWM(891) status
36.5Reading high-speed counter range comparison results
29.1Reading frequency of high-speed counter 0
COMPARISON TABLE LOADCTBL882469.3Registering target value table and starting comparison for 1 target value
116.3Registering target value table and starting comparison for 6 target values
126.6Registering range table and starting comparison
46.3Only registering target value table for 1 target value
93.3Only registering target value table for 6 target values
122.5Only registering range table
SPEED OUTPUTSPED885469.2Continuous mode
74.0Independent mode
SET PULSESPULS886444.1---
PULSE OUTPUTPLS2887597.6---
ACCELERATION CONTROLACC888475.6Continuous mode
82.8Independent mode
ORIGIN SEARCHORG889352.2Origin search
126.8Origin return
PULSE WITH VARIABLE DUTY FACTORPWM891428.9---

Step Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
STEP DEFINESTEP008210.5Step control bit ON
10.4Step control bit OFF
STEP STARTSNXT00929.6---

I/O Unit Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
I/O REFRESHIORF0973170.7Refreshing 1 input word for CP1W Expansion Unit
146.6Refreshing 1 output word for CP1W Expansion Unit
1725.8Refreshing 12 input words for CP1W Expansion Unit
1359.9Refreshing 12 output words for CP1W Expansion Unit
7-SEGMENT DECODERSDEC078421.9---
MATRIX INPUTMTR213531.6Data input value: 00
31.6Data input value:FF
7-SEGMENT DISPLAY OUTPUT7SEG214527.14 digits
30.88 digits

Serial Communications Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
TRANSMITTXD236425.0Sending 1 byte
25.0Sending 256 bytes
RECEIVERXD235439.2Storing 1 byte
256.6Storing 256 bytes

Clock Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
CALENDAR ADDCADD730456.6---
CALENDAR SUBTRACTCSUB731455.1---
CLOCK ADJUSTMENTDATE735229.9---

Failure Diagnosis Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
FAILURE ALARMFAL006355.6Recording errors
79.6Deleting errors (in order of priority)
61.6Deleting errors (all errors)
60.0Deleting errors (individually)
SEVERE FAILURE ALARMFALS0073------

Other Instructions

InstructionMnemonicFUN No.Length (steps)ON execution time (μs)Conditions
SET CARRYSTC040132.6---
CLEAR CARRYCLC04113.9---
EXTEND MAXIMUM CYCLE TIMEWDT094211.7---

4

Monitoring and Computing the Cycle Time

This section describes how to monitor and calculate the cycle time of a CP1E CPU Unit that can be used in the programs.

4-1 Monitoring the Cycle Time 4-2

4-1-1 Monitoring the Cycle Time 4-2

4-2 Computing the Cycle Time 4-3

4-2-1 CPU Unit Operation Flowchart 4-3
4-2-2 Cycle Time Overview 4-4
4-2-3 I/O Refresh Times for PLC Units 4-5
4-2-4 Cycle Time Calculation Example 4-6
4-2-5 Increase in Cycle Time for Online Editing 4-6

4-1 Monitoring the Cycle Time

4-1-1 Monitoring the Cycle Time

The average, maximum, and minimum cycle times can be monitored when the CX-Programmer is connected online to a CPU Unit.

Monitoring the Average Value

While connected online to the PLC, the average cycle time is displayed in the status bar when the CPU Unit is in any mode other than PROGRAM mode.

OMRON CP1E - Monitoring the Average Value - 1

Monitoring Maximum and Minimum Values

Select PLC Setting - PLC Information - Cycle Time from the PLC Menu.

The following PLC Cycle Time Dialog Box will be displayed.

OMRON CP1E - Monitoring Maximum and Minimum Values - 1

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.

OMRON CP1E - Monitoring Maximum and Minimum Values - 2

Additional Information

The cycle time present value and maximum value are stored in the following Auxiliary Area words.

  • Cycle time present value (0.1-ms increments): A264 (lower bytes) and A265 (upper bytes)
    Maximum Cycle Time (0.1-ms increments): A262 (lower bytes) and A263 (upper bytes)

4-2 Computing the Cycle Time

4-2-1 CPU Unit Operation Flowchart

The CPU Unit processes data in repeating cycles from the overseeing processing up to peripheral servicing as shown in the following diagram.

OMRON CP1E - 4-2-1 CPU Unit Operation Flowchart - 1

4-2-2 Cycle Time Overview

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 the execution 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

OMRON CP1E - 4-2-2 Cycle Time Overview - 1

Precautions for Correct Use

When the mode is switched from MONITOR mode to RUN mode, the cycle time may be extended by 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 following tables.

Cycle time = (1) + (2) + (3) + (4) + (5)

(1) Overseeing

OperationProcessing time and fluctuation cause
Checks the I/O bus and user memory, checks for battery errors, etc.0.4 ms min.

(2) Program Execution

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.

(3) Cycle Time Calculation for Minimum Cycle Time

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

(4) I/O Refreshing

OperationProcessing time and fluctuation cause
CPU Unit built-in I/O, CPU Unit built-in analog I/O (NA-type only), CP-series Expan-sion Units and Expansion I/O UnitsOutputs 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.

(5) Peripheral Servicing

OperationProcessing time and fluctuation cause
Services peripheral USB portIn this servicing, 8% of the previous cycle's cycle time (calculated in step (3)) will be allowed for peripheral servicing.
Services serial port (Built-in RS-232C port, serial option board)

4-2-3 I/O Refresh Times for PLC Units

- I/O Refresh Times for Built-in Analog I/O (NA-type CPU Unit only)

Unit nameModel numbersI/O refresh time per unit
NA-type CPU Unit20-point I/O + Analog I/OCPU UnitCP1E-NA20D□-□0.5 ms

Note No matter whether use analog I/O function or not, the I/O refresh time is the same.

- I/O Refresh Times for CP-series Expansion Units and Expansion I/O Units

Unit nameModel numbersI/O refresh time per unit
Expansion I/O Unit8-point Input UnitCP1W-8ED0.14 ms
8-point Output UnitCP1W-8ER0.06 ms
CP1W-8ET
CP1W-8ET1
16-point Output UnitCP1W-16ER0.17 ms
CP1W-16ET
CP1W-16ET1
20-point I/O UnitCP1W-20EDR10.20 ms
CP1W-20EDT
CP1W-20EDT1
32-point Output UnitCP1W-32ER0.33 ms
CP1W-32ET
CP1W-32ET1
40-point I/O UnitCP1W-40EDR0.45 ms
CP1W-40EDT
CP1W-40EDT1
Expansion UnitAnalog Input UnitCP1W-AD0410.72 ms
Analog Output UnitCP1W-DA0410.33 ms
Analog I/O UnitsCP1W-MAD110.36 ms
Temperature Sensor UnitCP1W-TS0010.30 ms
CP1W-TS0020.57 ms
CP1W-TS1010.30 ms
CP1W-TS1020.57 ms
CompoBus/S I/O Link UnitCP1W-SRT210.20 ms

OMRON CP1E - - I/O Refresh Times for CP-series Expansion Units and Expansion I/O Units - 1

Additional Information

The I/O refresh time for the built-in I/O of the CPU Unit is included in overseeing processing.

4-2-4 Cycle Time Calculation Example

The following example shows the method used to calculate the cycle time when Expansion I/O Units are connected to a CP1E CPU Unit.

- Conditions

ItemDescription
CP1E CPU Unit40-point I/O Unit CP1W-40EDR1 Unit
Ladder diagram5K stepsLD instructions: 2.5K steps OUT instructions: 2.5K steps
Peripheral USB port connectionYes or no
Minimum cycle time processingNone
Serial port connectionNone
Other peripheral servicingNone

- Calculation Example

Process nameEquationProcessing time
Peripheral USB port connectedPeripheral USB port not connected
(1)Overseeing-0.4 ms0.4 ms
(2)Program execution1.19μs×2,500+1.61μs×2,5007.0 ms7.0 ms
(3)Cycle time calculation(Minimum cycle time not set.)0 ms0 ms
(4)I/O refreshing0.45 ms0.45 ms0.45 ms
(5)Peripheral servicing(Only peripheral USB port connected)0.2 ms0 ms
Cycle time(1)+(2)+(3)+(4)+(5)8.15 ms7.85 ms

4-2-5 Increase in Cycle Time for Online Editing

When online editing is executed to change the program from the CX-Programmer while the CPU Unit is operating in MONITOR mode, the CPU Unit will momentarily suspend operation while the program is being changed. The cycle time is extended by the writing programs for the CPU Unit. And the schedule task will not be executed while the CPU Unit suspends operation.

If the program size is 8K steps, the cycle time extension will be as follows:

CPU UnitIncrease in cycle time for online editing
CP1E CPU UnitMaximum: 16 ms, Normal: 6 ms (for a program size of 8K steps)

When editing online, the cycle time will be extended and the schedule task execution may be delayed or become abnormal according to the editing that is performed.

Appendices

Alphabetical List of Instructions by Mnemonic A-2

Alphabetical List of Instructions by Mnemonic

A

Mne-monicInstructionFUN No.Upward differen-tiationDownward differen-tionImmediate refreshing specifica-tionPage
ACCACCELER-ATIONCONTROL888@ACC------2-331
ANDAND---@AND%ANDIAND2-9
ANDLDAND LOAD------------2-13
ANDNOTAND NOT---------IANDNOT2-9
AND<AND LESS THAN310---------2-88
AND<=AND LESS THAN OR EQUAL315---------2-88
AND<=FANDFLOATINGLESS THANOR EQUAL332---------2-241
AND<=DTAND TIMELESS THANOR EQUAL344---------2-91
AND<=LAND DOU-BLE LESS THANOR EQUAL316---------2-88
AND<=SANDSIGNEDLESS THANOR EQUAL317---------2-88
AND<=SLAND DOU-BLE SIGNEDLESS THANOR EQUAL318---------2-88
AND<>AND NOTEQUAL305---------2-88
AND<>DTAND TIMENOTEQUAL342---------2-91
AND<>FANDFLOATINGNOTEQUAL330---------2-241
AND<>LAND DOU-BLE NOTEQUAL306---------2-88
AND<>SANDSIGNEDNOTEQUAL307---------2-88
AND<>SLAND DOU-BLE SIGNEDNOTEQUAL308---------2-88
AND<>DTAND TIMELESS THAN343---------2-91
Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
AND<FAND FLOATING LESS THAN331---------2-241
AND<LAND DOU-BLE LESS THAN311---------2-88
AND<SAND SIGNED LESS THAN312---------2-88
AND<SLAND DOU-BLE SIGNED LESS THAN313---------2-88
AND=AND EQUAL300---------2-88
AND=DTAND TIME EQUAL341---------2-91
AND=FAND FLOATING EQUAL329---------2-241
AND=LAND DOU-BLE EQUAL301---------2-88
AND=SAND SIGNED EQUAL302---------2-88
AND=SLAND DOU-BLE SIGNED EQUAL303---------2-88
AND>AND GREATER THAN320---------2-88
AND>=AND GREATER THAN OR EQUAL325---------2-88
AND>=DTAND TIME GREATER THAN OR EQUAL346---------2-91
AND>=FAND FLOATING GREATER THAN OR EQUAL334---------2-241
AND>=LAND DOU-BLE GREATER THAN OR EQUAL326---------2-88
AND>=SAND SIGNED GREATER THAN OR EQUAL327---------2-88
AND>=SLAND DBL SIGNED GREATER THAN OR EQUAL328---------2-88
AND>DTAND TIME GREATER THAN345---------2-91
AND>FAND FLOATING GREATER THAN333---------2-241
AND>LAND DOU-BLE GREATER THAN321---------2-88
AND>SAND SIGNED GREATER THAN322---------2-88
AND>SLAND DOU-BLE SIGNED GREATER THAN323---------2-88
ANDLDOUBLE LOGICAL AND610@ANDL------2-210
ANDWLOGICAL AND034@ANDW------2-210
APRARITH-METIC PROCESS069@APR------2-218
ASCASCII CON-VERT086@ASC------2-201
ASLARITH-METIC SHIFT LEFT025@ASL------2-133
ASRARITH-METIC SHIFT RIGHT026@ASR------2-134
AVGAVERAGE195---------2-287

B

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
BCDBINARY TO BCD024@BCD------2-187
BCDLDOUBLE BINARY TO DOUBLE BCD059@BCDL------2-187
BCMPBLOCK COMPARE068@BCMP------2-103
BCNTBIT COUNTER067@BCNT------2-227
BINBCD TO BINARY023@BIN------2-185
Mne-monicInstructionFUN No.Upward differen-tiationDownward differenta-tionImmediate refreshing specifica-tionPage
BINLDOUBLE BCD TO DOUBLE BINARY058@BINL------2-185
BREAKBREAK LOOP514---------2-59
BSETBLOCK SET071@BSET------2-119

C

Mne-monicInstructionFUN No.Upward differen-tiationDownward differenta-tionImmediate refreshing specifica-tionPage
CADDCALEN-DAR ADD730@ CADD------2-380
CJPCONDI-TIONAL JUMP510---------2-53
CLCCLEAR CARRY041@ CLC------2-398
CLICLEAR INTER-RUPT691@ CLI------2-303
CMPCOMPARE020------!CMP2-95
CMPLDOUBLE COMPARE060---------2-95
CNRRESET TIMER/COU NTER545@ CNR------2-86
CNRXRESET TIMER/COU NTER547@ CNRX------2-86
CNTCOUNTER------------2-80
CNTRREVERS-IBLE COUNTER012---------2-83
CNTRXREVERS-IBLE COUNTER548---------2-83
CNTXCOUNTER546---------2-80
COLLDATA COL-LECT081@ COLL------2-125
COMCOMPLE-MENT029@ COM------2-216
COMLDOUBLE COMPLE-MENT614@ COML------2-216
CPSSIGNED BINARY COMPARE114------!CPS2-98
CPSLDOUBLE SIGNED BINARY-COMPARE115---------2-98
CSUBCALEN-DAR SUB-TRACT731@ CSUB------2-380
CTBLREGISTER-COMPARI-SON TABLE882@ CTBL------2-315

D

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
DATECLOCK ADJUST-MENT735@DATE------2-385
DIDISABLE INTER-RUPTS693@DI------2-306
DIFDDIFFEREN-TIATE DOWN014------!DIFD2-27
DIFUDIFFEREN-TIATE UP013------!DIFU2-25
DISTSINGLE WORD DISTRIBUTION080@DIST------2-123
DMPXDATA ENCODER077@DMPX------2-196
DOWNCONDI-TION OFF522---------2-17
DSWDIGITAL SWITCH INPUT210---------2-357

E

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
EIENABLE INTER-RUPTS694---------2-307
ENDEND001---------2-38

F

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
FALFAILURE ALARM006@FAL------2-387
FALSSEVERE FAILURE ALARM007---------2-393
FCSFRAME CHECK-SUM180@FCS------2-255
FIXFLOATING TO 16-BIT450@FIX------2-233
FIXLFLOATING TO 32-BIT451@FIXL------2-233
FLT16-BIT TO FLOATING452@FLT------2-235
FLTL32-BIT TO FLOATING453@FLTL------2-235
Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
FOR---512---------2-56
FSTRFLOATING-POINT TO ASCII448@FSTR------2-244
FVALASCII TO FLOATING-POINT449@FVAL------2-249

H

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
HEXASCII TO HEX162@HEX------2-205

1

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
INIMODE CONTROL880@INI------2-308
IORFI/O REFRESH097@IORF------2-352

J

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
JMEJUMP END005---------2-53
JMPJUMP004---------2-53

K

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
KEEPKEEP011------!KEEP2-21

L

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
LDLOAD---@LD%LD!LD2-7
LD=DTLOAD DATE EQUAL341---------2-91
LD=SLOAD SIGNED EQUAL302---------2-88
Mine- monicInstructionFUN differenti- tionDownward immediate speci- cia-Page
LD NOTLOAD NOT.........
LD=LOAD LESS310......
LD=LOAD LESS315......
LD=LOAD LESS315......
LD=LOAD LESS344......
LD=LOAD LESS344......
LD=LOAD LESS344......
LD=LOAD LESS344......
LD=LOAD LESS344......
LD=LOAD LESS344......
LD=LOAD LESS344...2.88
LD=LOAD LESS344...2.88
LD=LOAD LESS344...2.88
LD=LOAD LESS344...2.88
LD=LOAD LESS344...2.88
LD=LOAD LESS344...2.88
LD=SLOAD S317......
LD=FLOAD F318......
LD=FLOAD F318......
LD=FLOAD F318......
LD=FLOAD F318......
LD=FLOAD F318......
LD=FLOAD F318......
LD=FLOAD F318...2.88
LD=FLOAD F318...2.88
LD=FLOAD F318...2.88
LD=FLOAD F318...2.88
LD=FLOAD F318...2.88
LD=FLOAD F318...2.88
LD=SLOAD S317......
LD=SLOAD S317......
LD=SLOAD S317......
LD=SLOAD S317......
LD=SLOAD S317......
LD=SLOAD S317......
LD=SLOAD S317......
LO=LOAD LO=313......
LE=LOAD LO=313......
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.8
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.88
LE=LOAD LO=313...2.91
LE=LOAD LO=313...2.91
LE=LOAD LO=313...2.91
LE=LOAD LO=313...2.91
LE=LOAD LO=313...2.91
LE=LOAD LO=313...2.9
Mine-monieFUMUpward differentia-tionDownward refining specia-ationImmediate Page
LoadFLOATINGLOAD DOU329LOAD DOU329LOAD DOU329
LD=FFLOATINGLOADBLE303------2.241
Ld=LLOAD DOU301--------2.88
LD=SLLOAD DOU303--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.8
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DO U301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301--------2.88
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301--------
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD= SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU3 01----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----2.88
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD=SLLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU3 01----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----2.88
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= SLOAD DOU301----
LD= FFLOATING328----
LD= FFLOATING328----
LD= FFLOATING328----
LD= FFLOATING328----
LD= FFLOATING328----
LO= FFLOATING328----
LO= FFLOATING328----
LO= FFLOATING328----
LO= FFLOATING328----
LO= FFLOATING328--
LO= FFLOATING328--
LO= FFLOATING328--
LO= FFLOATING328--
LO= FFLOATING328--
LO= F

M

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
MILCMULTI-INTER-LOCK CLEAR519---------2-44
MILHMULTI-INTER-LOCK DIFFERENTIAT IONHOLD517---------2-44
MILRMULTI-INTER-LOCK DIFFERENTIAT IONRE-LEASE518---------2-44
MLPXDATA DECODER076@MLPX------2-191
MOVMOVE021@MOV---!MOV2-108
MOVBMOVE BIT082@MOVB------2-111
MOVDMOVE DIGIT083@MOVD------2-113
MOVLDOUBLE MOVE498@MOVL------2-108
MSKSSET INTER-RUPT MASK690@MSKS------2-300
MTRMATRIX INPUT213---------2-361
MVNMOVE NOT022@MVN------2-108

N

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
NASLSHIFT N-BITS LEFT580@NASL------2-141
NASRSHIFT N-BITS RIGHT581@NASR------2-144
NEG2'S COM-PLEMENT160@NEG------2-189
NEXT---513---------2-56
NOPNO OPER-A-TION000---------2-39
NOTNOT520---------2-16
NSLLDOUBLE SHIFT N-BITS LEFT582@NSLL------2-141
NSRLDOUBLE SHIFT N-BITSRIGHT583@NSRL------2-144

0

Mne-monicInstructionFUN No.Upward differen-tiationDownward differen-tionImmediate refreshing specifica-tionPage
OROR---@OR%OR!OR2-11
ORGORIGIN SEARCH889@ORG------2-336
OR LDOR LOAD------------2-13
OR NOTOR NOT---------!OR NOT2-11
OR<OR LESS THAN310---------2-88
OR<=OR LESS THAN OR EQUAL315---------2-88
OR<=DTOR DATE LESS THAN OR EQUAL344---------2-91
OR<=FOR FLOATING LESS THAN OR EQUAL332---------2-241
OR<=LOR DOUBLE LESS THAN OR EQUAL316---------2-88
OR<=SOR SIGNED LESS THAN OR EQUAL317---------2-88
OR<=SLOR DOUBLE SIGNED LESS THAN OR EQUAL318---------2-88
OR<>OR NOT EQUAL305---------2-88
OR<>DTOR DATE NOT EQUA342---------2-91
OR<>FOR FLOAT-ING NOT EQUAL330---------2-241
OR<>LOR DOUBLE NOT EQUAL306---------2-88
OR<>SOR SIGNED NOT EQUAL307---------2-88
OR<>SLOR DOUBLE SIGNED NOT EQUAL308---------2-88
OR<DTOR DATE LESS THAN343---------2-91
OR<FOR FLOATING LESS THAN331---------2-241
OR<LOR DOUBLE LESS THAN311---------2-88
OR<SOR SIGNED LESS THAN312---------2-88
OR<SLOR DOUBLE SIGNED LESS THAN313---------2-88
Mine- monicInstructionFUN different- tionDownward immediate specificationPage
OR= OR EQUALOR or EQUAL300...248
OR=DTOR or EQUAL341...291
OR=FFLOATING329...241
OR=FFLOATING329...241
OR=FFLOATING329...241
OR=FFLOATING329...241
OR=FFLOATING329...241
OR=FFLOATING329...241
OR=FFLOATING
OR=LDOUBLE301...288
OR=LDOUBLE301...288
OR=LDOUBLE301...288
OR=LDOUBLE301...288
OR=LDOUBLE301...288
OR=LDOUBLE301...288
OR=LDOUBLE301...17
OR=LDOUBLE301...17
OR=LDOUBLE301...17
OR=LDOUBLE301...17
OR=LDOUBLE301...17
OR=LDOUBLE301...17
OR=LDOUBLE301...17
ORG-SDOUBLE301...288
ORG-SDOUBLE301...288
ORG-SDOUBLE301...288
ORG-SDOUBLE301...288
ORG-SDOUBLE301...288
ORG-SDOUBLE301...288
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
ORG-SDOUBLE301...17
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...17
OR+SDOUBLE321...17
OR+SDOUBLE321...17
OR+SDOUBLE321...17
OR+SDOUBLE321...17
OR+SDOUBLE321...17
OR+SDOUBLE321...17
ORG-SDOUBLE321...288
ORG-SDOUBLE321...288
ORG-SDOUBLE321...288
ORG-SDOUBLE321...288
ORG-SDOUBLE321...288
ORG-SDOUBLE321...288
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
ORG-SDOUBLE321...17
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE321...288
OR+SDOUBLE17...288
Mine-monieInstructionFUNUpward differentia-tionDownward refining speci-cas-Immediate Page
ORWLDOUBLE611@ORWL...2.212
LOGICAL
OUTOUTPUT.........
NOTOUTPUT.........
NOT.........

P

PUDATPID CON-191......2.257
TROL881@PRV...2.325
WITHAUTO-887@PLS2...2.325
TUNING887@PLS2...2.325
PLS2887@PLS2...2.325
PULSE887@PLS2...2.325
OUTPUT887@PLS2...2.325
PRV881@PRV...2.311
HIGH-881@PRV...2.311
CPEED-886@PLS...2.323
COUNTER886@PLS...2.323
PV READ886@PLS...2.323
PULS886@PLS...2.323
PULSE886@PLS...2.323
FACTOR886@PLS...2.323

R

Mone-moniqueFUNUpward differentia-tionDownward immediate-species-Page
RETTINRETURN
ROLROTATE027@ROL2.295
RORRIGHT028@ROR2.135
RSETRESET...@SET2.29
RSTAMULTIPLE531@RSTA2.31
RSTBRESET533@RSTB2.33
RXDRECEIVE235@RXD2.374

s

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
SBNSUBROU-TINE ENTRY092---------2-295
SBSSUBROU-TINE CALL091@SBS------2-290
SCLSCALING194@SCL------2-276
SCL2SCALING 2486@SCL2------2-280
SCL3SCALING 3487@SCL3------2-284
SDEC7-SEG-MENT DECODER078@SDEC------2-354
SETSET---@SET%SET!SET2-29
SETAMULTIPLE BIT SET530@SETA------2-31
SETBSINGLE BIT SET532@SETB---!SETB2-33
SFTSHIFT REGISTER010---------2-127
SFTRREVERS-IBLE SHIFT REGISTER084@SFTR------2-129
SLDONE DIGIT SHIFT LEFT074@SLD------2-139
SNXTSTEP START009---------2-342
SPEDSPEED OUTPUT885@SPED------2-319
SRDONE DIGIT SHIFT RIGHT075@SRD------2-139
STCSET CARRY040@STC------2-398
STEPSTEP DEFINE008---------2-342
SWAPSWAP BYTES637@SWAP------2-253

T

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
TCMPTABLE COMPARE085@TCMP------2-101
TIMHUNDRED-MS TIMER------------2-66
TIMHTEN-MS TIMER015---------2-69
TIMHXTEN-MS TIMER551---------2-69
TIMLLONG TIMER542---------2-77
TIMLXLONG TIMER553---------2-77
TIMXHUNDRED-MS TIMER550---------2-66
TMHHONE-MS TIMER540---------2-72
Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
TMHHXONE-MS TIMER552---------2-72
TPOTIME-PRO-PORTION-ALOUTPUT685---------2-269
TRTR Bits------------2-20
TTIMACCUMU-LATIVE TIMER087---------2-74
TTIMXACCUMU-LATIVE TIMER555---------2-74
TXDTRANSMIT236@TXD------2-369

U

Mne-monicInstructionFUN No.Upward differen-tiationDown- ward dif-ferentiatio nImmedi- ate refreshing specifica-tionPage
UPCONDI-TION ON521---------2-17

W

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
WDTEXTEND MAXIMUM-CYCLE TIME094@WDT------2-399
WSFTWORD SHIFT016@WSFT------2-131

X

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
XCHGDATA EXCHANGE073@XCHG------2-121
XFERBLOCK TRANSFER070@XFER------2-117
XFRBMULTIPLE BIT TRANS-FER062@XFRB------2-115
XORLDOUBLE EXCLU-SIVE OR612@XORL------2-214
XORWEXCLU-SIVE OR036@XORW------2-214

Z

Mne-monicInstructionFUN No.Upward differen-tiationDownward differentia-tionImmediate refreshing specifica-tionPage
ZCPAREA RANGE COM-PARE088---------2-105
ZCPLDOUBLE AREA RANGE-COMPARE116---------2-105

Symbol

Mne-monicInstructionFUN No.Upward differen-tiationDownward differen-tionImmediate refreshing specifica-tionPage
7SEG7-SEG-MENT DIS-PLAY OUTPUTU214---------2-365
+SIGNED BINARY ADDWITH-OUT CARRY400@+------2-158
++INCREASENMENT BINARY590@++------2-147
++BINCREASENMENT BCD594@++B------2-153
++BLDOUBLE INCREASENMENT BCD595@++BL------2-153
++LDOUBLE INCREASENMENTBI-NARY591@++L------2-147
+BBCD ADD WITHOUT CARRY404@+B------2-162
+BCBCD ADD WITH CARRY406@+BC------2-164
+BCLDOUBLE BCD ADD WITH-CARRY407@+BCL------2-164
+BLDOUBLE BCD ADD WITHOUT-CARRY405@+BL------2-162
+CSIGNED BINARY ADD WITH-CARRY402@+C------2-160
+CLDOUBLE SIGNED BINARY-ADD WITH CARRY403@+CL------2-160
+FFLOATING-POINT ADD454@+F------2-237
Mne-monicInstructionFUN No.Upward differen-tiationDownward differenta-tionImmediate refreshing specifica-tionPage
+LDOUBLE SIGNED BINARY- ADD WITH- OUT CARRY401@+L------2-158
-SIGNED BINARY SUB- TRACTWIT HOUT CARRY410@-------2-166
--DECRE-MENT BINARY592@--------2-150
--BDECRE-MENT BCD596@--B------2-156
--BLDOUBLE DECRE-MENT BCD597@--BL------2-156
--LDECRE-MENT BINARY593@--L------2-150
-BBCD SUB-TRACT WITHOUT- CARRY414@-B------2-172
-BCBCD SUB-TRACT WITH- CARRY416@-BC------2-175
-BCLDOUBLE BCD SUB-TRACTWIT H CARRY417@-BCL------2-175
-BLDOUBLE BCD SUB-TRACTWIT HOUT CARRY415@-BL------2-172
-CSIGNED BINARY SUB-TRACTWIT H CARRY412@-C------2-170
-CLDOUBLE SIGNED BINA- RYSUB- TRACTWIT H CARRY413@-CL------2-170
-FFLOATING- POINT SUBTRACT455@-F------2-237
-LDOUBLE SIGNED BINA- RYSUB- TRACT WITHOUT- CARRY411@-L------2-166
*SIGNED BINARY MULTIPLY420@*------2-177
*BBCD MULTI- PLY424@*B------2-179
*BLDOUBLE BCD MULTI-PLY425@*BL------2-179
*FFLOATING-POINT MULTIPLY456@*F------2-237
*LDOUBLE SIGNED BINARY-MULTIPLY421@*L------2-177
/SIGNED BINARY DIVIDE430@/------2-181
/BBCD DIVIDE434@/B------2-183
/BLDOUBLE BCD DIVIDE435@/BL------2-183
/FFLOATING-POINT DIVIDE457@/F------2-237
/LDOUBLE SIGNED BINARYDI-VIDE431@/L------2-181

ASCII Code Table

A manual revision code appears as a suffix to the catalog number on the front cover of the manual.

Cat. No. W483-E1-03

OMRON CP1E - Alphabetical List of Instructions by Mnemonic - 1

Revision codeDateRevised content
01March 2009Original production
02June 2009Errors were corrected.
03January 2010Information added on E10/14, N14/60 and NA20 CPU Units.

OMRON Corporation Industrial Automation Company

Tokyo, JAPAN

Contact: www.ja.omron.com

Regional Headquarters

OMRON EUROPE B.V.

OMRON ELECTRONICS LLC

One Commerce Drive Schaumburg,

IL 60173-5302 U.S.A.

Tel: (1) 847-843-7900/Fax: (1) 847-843-7787

OMRON ASIA PACIFIC PTE. LTD.

No. 438A Alexandra Road # 05-05/08 (Lobby 2),

Alexandra Technopark,

Singapore 119967

Tel: (65) 6835-3011/Fax: (65) 6835-2711

Room 2211, Bank of China Tower,

200 Yin Cheng Zhong Road,

PuDong New Area, Shanghai, 200120, China

Tel: (86) 21-5037-2222/Fax: (86) 21-5037-2200

Authorized Distributor:

© OMRON Corporation 2009 All Rights Reserved. In the interest of product improvement,

specifications are subject to change without notice.

Table of contents Click a title to access it
Manual assistant
Powered by Anthropic
Waiting for your message
Product information

Brand : OMRON

Model : CP1E

Category : Programmable Controllers