
Cat. No. W483-E1-03
CP1E-E@@D@-@ CP1E-N@@D@-@ CP1E-NA@@D@-@ CP1E CPU Unit


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 con- stantly 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
Revised December 2009

Thank you for purchasing a SYSMAC CP-series CP1E Programmable Controller.
This manual contains information required to use the CP1E. Read this manual completely and be sure you understand the contents before attempting to use the CP1E.
This manual is intended for the following personnel, who must also have knowledge of electrical sys- tems (an electrical engineer or the equivalent).
CP-series CP1E CPU Units
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.

Information on the CP1E CPU Units is provided in the following manuals.
Refer to the appropriate manual for the information that is required.
CP1E CPU Unit Hardware User’s Manual(Cat. No. W479)
CP1E CPU Unit Software User’s Manual(Cat. No. W480)
CP1E CPU Unit Instructions Reference Manual(Cat. No. W483)
· Names and specifications of the parts of all Units · Basic system configuration for each CPU Unit · Connection methods for Expansion I/O Units and Expansion Units
· Wiring methods for the power supply · Wiring methods between external I/O devices and Expansion I/O Units or Expansion Units
Connecting Cables for CX-Programmer Support Software
Procedures for connecting the CX-Programmer Support Software
Software setting methods for the CPU Units (PLC Setup)
· Program types and basic information · CPU Unit operation · Internal memory · Built-in CPU functions · Settings
Detailed information on programming instructions
· Checking I/O wiring, setting the Auxiliary Area settings, and performing trial operation · Monitoring and debugging with the CX-Programmer
Error codes and remedies if a problem occurs

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

Section 15 Analog I/O Function This section describes the built-in analog function for NA-type CPU Units.
Section 16 Built-in Functions This section describes PID temperature control, clock functions, DM backup functions, security functions.
This 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.
Appendices The appendices provide lists of programming instructions, the Auxiliary Area, cycle time response performance, PLC performance at power interruptions.

Page Structure and Icons
The following page structure and icons are used in this manual.
5 Installation and wiring
Gives the current headings.
Step in a procedure
Use a screwdriver to pull down the DIN Track mounting pins from the back of the Units to release them, and mount the Units to the DIN Track.
5-2 Installation 5-2-1 Installation Location
Indicates a step in a procedure.
DIN Track mounting pins
Gives the number of the section.
Fit the back of the Units onto the DIN Track by catching the top of the Units on the Track and then pressing in at the bottom of the Units, as shown below.
Press in all of the DIN Track mounting pins to securely lock the Units in place.
Icons are used to indicate precautions and additional information.
DIN Track mounting pins
Precautions for Correct Use
Tighten terminal block screws and cable screws to the following torques. M4: 1.2 N·m M3: 0.5 N·m
CP1E CPU Unit Hardware User’s Manual(W479)
This illustration is provided only as a sample and may not literally appear in this manual.

Precautions for Safe Use Precautions on what to do and what not to do to ensure using the product safely.
Precautions for Correct Use Precautions on what to do and what not to do to ensure proper operation and performance.
Additional Information Additional information to increase understanding or make operation easier.
References to the location of more detailed or related information.

E-type CPU Unit A basic model of CPU Unit that support basic control applications using instructions such as basic, movement, arithmetic, and comparison instructions.
Basic models of CPU Units are called “E-type CPU Units” in this manual.
N-type CPU Unit An application model of CPU Unit that supports connections to Programmable Terminals, inverters, and servo drives.
Application models of CPU Units are called “N-type CPU Units” in this manual.
NA-type CPU Unit An application model of CPU Unit that supports built-in analog and connections to Pro- grammable Terminals, inverters, and servo drives.
Application models of CPU Units with built-in analog are called “NA-type CPU Units” in this manual.
CX-Programmer A 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.
or higher. E10/14, N14/60 and NA20 CPU Units are supported by CX-Programmer version 9.03 or higher.

Summary of Instructions
Instruction Execution Times and Number of Steps
A
Monitoring and Computing the Cycle Time
A Appendices


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
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
Revision History ....................................................................................... Revision-1

Please read and understand this manual before using the product. Please consult your OMRON representative if you have any questions or comments.
WARRANTY
OMRON’s exclusive warranty is that the products are free from defects in materials and workmanship for a period of one year (or other period if specified) from date of sale by OMRON.
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, REGARDING NON- INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR PARTICULAR PURPOSE OF THE PRODUCTS. ANY BUYER OR USER ACKNOWLEDGES THAT THE BUYER OR USER ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE. OMRON DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR IMPLIED.
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.

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:
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.
OMRON shall not be responsible for the user’s programming of a programmable product, or any consequence thereof.

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 are nominal and are not to be used for manufacturing purposes, even when tolerances are shown.
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.
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.

Definition of Precautionary Information
The following notation is used in this manual to provide precautions required to ensure safe usage of a CP-series PLC. The safety precautions that are provided are extremely important to safety. Always read and heed the information provided in all safety precautions.
Indicates an imminently hazardous situation which, if not avoided, will result in death or serious injury. Additionally, there may be severe property damage.
Indicates a potentially hazardous situation which, if not avoided, may result in minor or moderate injury, or property damage.
Precautions for Safe 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.
The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precau- tion for electric shock.
The circle and slash symbol indicates operations that you must not do. The specific operation is shown in the circle and explained in text.
The filled circle symbol indicates operations that you must do. The specific operation is shown in the circle and explained in text. This example shows a general precau- tion for something that you must do.
The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a general precaution.
The triangle symbol indicates precautions (including warnings). The specific operation is shown in the triangle and explained in text. This example indicates a precau- tion for hot surfaces.

Be sure to sufficiently confirm the safety at the destination when you transfer the program or I/O memory or perform procedures to change the I/O memory.
Devices connected to PLC outputs may incorrectly operate regardless of the operat- ing mode of the CPU Unit.
With an E-type CPU Unit or with an N/NA-type CPU Unit without a Battery, the con- tents of the DM Area (D) *, Holding Area (H), the Counter Present Values (C), the sta- tus 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.
Select the Clear Held Memory (HR/DM/CNT) to Zero Check Box in the Startup Data Read Area in the PLC Setup.
If the data is not initialized, the unit or device may operate unexpectedly because of unstable data.
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.
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 CP1E- N/NAD- 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 out- puts are performed from a ladder program based on the contents of the DM Area or other I/O memory areas.
Sufficiently check safety if I/O bit status or present values are monitored in the Ladder Section Pane or present values are monitored in the Watch Pane.
If bits are set, reset, force-set, or force-reset by inadvertently pressing a shortcut key, devices connected to PLC outputs may operate incorrectly regardless of the operat- ing mode.

Program so that the memory area of the start address is not exceeded when using a word address or symbol for the offset.
For example, write the program so that processing is executed only when the indirect specification does not cause the final address to exceed the memory area by using an input comparison instruction or other instruction.
If an indirect specification causes the address to exceed the area of the start address, the system will access data in other area, and unexpected operation may occur.
Set the temperature range according to the type of temperature sensor con- nected to the Unit.
Temperature data will not be converted correctly if the temperature range does not match the sensor.
Do not set the temperature range to any values other than those for which tem- perature ranges are given in the following table.
An incorrect setting may cause operating errors.

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

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 name Cat. No. Model numbers Application Contents
SYSMAC CP Series CP1E CPU Unit Instruc- tions Reference Manual (this manual)
To learn program- ming instructions in detail
Describes each programming instruction in detail.
When programming, use this manual together with the CP1E CPU Unit Software User’s Man- ual (Cat. No. W480).
SYSMAC CP Series CP1E CPU Unit Soft- ware User’s Manual
To learn the software specifications of the CP1E PLCs
Describes the following information for CP1E PLCs.
Use this manual together with the CP1E CPU Unit Hardware User’s Manual (Cat. No. W479) and Instructions Reference Manual (Cat. No. W483).
SYSMAC CP Series CP1E CPU Unit Hard- ware User’s Manual
To learn the hard- ware specifications of the CP1E PLCs
Describes the following information for CP1E PLCs.
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- ual
To learn communica- tions commands for CS/CJ/CP/NSJ- series Controllers in detail
CS1D-CPU S
Read this manual for details on C-mode and FINS commands addressed to CPU Units.
CS1W-SCB -V1
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).
CJ1G-CPU P
CJ1M-CPU
CJ1G-CPU
CJ1W-SCU -V1
SYSMAC CP Series CP1L/CP1E CPU Unit Introduction Manual
To learn the basic setup methods of the CP1L/CP1E PLCs
Describes the following information for CP1L/CP1E PLCs.
CP1L-L20D -
CP1L-M60D -
CP1E-N D -
CP1E-NA D -
Describes



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.
Type Instruction Mnemonic FUN
No. Function Page
LOAD LD - Indicates a logical start and creates an ON/OFF execution condition based on the ON/OFF status of the specified operand bit.
%LD -
!LD -
!@LD -
!%LD -
LOAD NOT LD NOT - Indicates a logical start and creates an ON/OFF execution condition based on the reverse of the ON/OFF status of the specified operand bit.
%LD NOT -
!LD NOT -
!@LD NOT -
!%LD NOT -
AND AND - Takes a logical AND of the status of the specified operand bit and the current execution condition.
%AND -
!AND -
!@AND -
!%AND -
AND NOT AND NOT - Reverses the status of the specified operand bit and takes a logical AND with the current execution condition.
%AND NOT -
!AND NOT -
!@AND NOT -
!%AND NOT -
OR OR - Takes a logical OR of the ON/OFF status of the specified operand bit and the current execution condition.
%OR -
!OR -
!@OR -
!%OR -
OR NOT OR NOT - Reverses the status of the specified bit and takes a logical OR with the current execution condition.
%OR NOT -
!OR NOT -
!@OR NOT -
!%OR NOT -
AND LOAD AND LD - Takes a logical AND between logic blocks. 2-13
OR LOAD OR LD - Takes a logical OR between logic blocks. 2-13
NOT NOT 520 Reverses the execution condition. 2-16
CONDITION ON UP 521 UP(521) turns ON the execution condition for one cycle when the execution condition goes from OFF to ON.
CONDITION OFF DOWN 522 DOWN(522) turns ON the execution condition for one cycle when the execution condition goes from ON to OFF.
Instrucion · Sequence Input Instruc- tions

Type Instruction Mnemonic FUN
No. Function Page
OUTPUT OUT - Outputs the result (execution condition) of the logical processing to the speci- fied bit.
OUTPUT NOT OUT NOT - Reverses the result (execution condition) of the logical processing, and outputs it to the specified bit.
TR Bits TR - TR bits are used to temporarily retain the ON/OFF status of execution condi- tions in a program when programming in mnemonic code.
KEEP KEEP 011 Operates as a latching relay. 2-21
DIFFERENTIATE UP
DIFU 013 DIFU(013) turns the designated bit ON for one cycle when the execution condi- tion goes from OFF to ON (rising edge).
DIFFERENTIATE DOWN
DIFD 014 DIFD(014) turns the designated bit ON for one cycle when the execution condi- tion goes from ON to OFF (falling edge).
SET SET - SET turns the operand bit ON when the execution condition is ON. 2-29
%SET -
!SET -
!@SET -
!%SET -
RESET RSET - RSET turns the operand bit OFF when the execution condition is ON. 2-29
%RSET -
!RSET -
!@RSET -
!%RSET -
MULTIPLE BIT SET SETA 530 SETA(530) turns ON the specified number of consecutive bits. 2-31
MULTIPLE BIT RESET
RSTA 531 RSTA(531) turns OFF the specified number of consecutive bits. 2-31
SINGLE BIT SET SETB 532 SETB(532) turns ON the specified bit in the specified word when the execution condition is ON.
Unlike the SET instruction, SETB(532) can be used to set a bit in a DM word.
!@SETB
SINGLE BIT RESET RSTB 533 RSTB(533) turns OFF the specified bit in the specified word when the execu- tion condition is ON.
!RSTB
Unlike the RSET instruction, RSTB(533) can be used to reset a bit in a DM word.
Instrucion · Sequence Output Instructions

Type Instruction Mnemonic FUN
No. Function Page
END END 001 Indicates the end of a program. 2-38
NO OPERATION NOP 000 This instruction has no function. (No processing is performed for NOP(000).) 2-39
INTERLOCK IL 002 Interlocks all outputs between IL(002) and ILC(003) when the execution condi- tion for IL(002) is OFF.
ILC 003 All outputs between IL(002) and ILC(003) are interlocked when the execution condition for IL(002) is OFF.
MILH 517 When the execution condition for MILH(517) is OFF, the outputs for all instruc- tions between that MILH(517) instruction and the next MILC(519) instruction are interlocked.
MILR 518 When the execution condition for MILR(518) is OFF, the outputs for all instruc- tions between that MILR(518) instruction and the next MILC(519) instruction are interlocked.
MILC 519 Clears an interlock started by an MILH(517) or MILR(518) with the same inter- lock number.
JUMP JMP 004 When the execution condition for JMP(004) is OFF, program execution jumps directly to the first JME(005) in the program with the same jump number.
JUMP END JME 005 Indicates the end of a jump initiated by JMP(004) or CJP(510). 2-53
CJP 510 The operation of CJP(510) is the basically the opposite of JMP(004). When the execution condition for CJP(510) is ON, program execution jumps directly to the first JME(005) in the program with the same jump number.
FOR LOOP FOR 512 The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.
NEXT LOOP NEXT 513 The instructions between FOR(512) and NEXT(513) are repeated a specified number of times.
BREAK LOOP BREAK 514 Programmed in a FOR-NEXT loop to cancel the execution of the loop for a given execution condition. The remaining instructions in the loop are processed as NOP(000) instructions.
Timer and Counter Instructions
TIMX 550
TEN-MS TIMER TIMH 015 TIMH(015)/TIMHX(551) operates a decrementing timer with units of 10-ms. 2-69
ONE-MS TIMER TMHH 540 TMHH(540)/TMHHX(552) operates a decrementing timer with units of 1-ms. 2-72
ACCUMULATIVE TIMER
TTIM 087 TTIM(087)/TTIMX(555) operates an incrementing timer with units of 0.1-s. 2-74
LONG TIMER TIML 542 TIML(542)/TIMLX(553) operates a decrementing timer with units of 0.1-s. 2-77
COUNTER CNT - CNT/CNTX(546) operates a decrementing counter. 2-80
CNTX 546
REVERSIBLE COUNTER
CNTR 012 CNTR(012)/CNTRX(548) operates a reversible counter. 2-83
RESET TIMER/ COUNTER
CNR/ @CNR
545 CNR(545)/CNRX(547) resets the timers or counters within the specified range of timer or counter numbers.
Instrucion · Sequence Control Instructions

Type Instruction Mnemonic FUN
No. Function Page
Symbol Comparison = , , < , , >=
Symbol comparison instructions compare two values and create an ON execu- tion condition when the comparison condition is true.
Time Comparison LD, AND, OR+=DT
341 Time comparison instructions compare two BCD time values and create an ON execution condition when the comparison condition is true.
LD, AND, OR+<DT
LD, AND, OR+<=DT
LD, AND, OR+>DT
LD, AND, OR+>=DT
UNSIGNED COMPARE
CMP 020 Compares two unsigned binary values (constants and/or the contents of speci- fied words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
DOUBLE UNSIGNED COMPARE
CMPL 060 Compares two double unsigned binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
CPS 114 Compares two signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
DOUBLE SIGNED BINARY COMPARE
CPSL 115 Compares two double signed binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
TABLE COMPARE TCMP 085 Compares the source data to the contents of 16 words and turns ON the corre- sponding bit in the result word when the contents are equal.
UNSIGNED BLOCK COMPARE
BCMP 068 Compares the source data to 16 ranges (defined by 16 lower limits and 16 upper limits) and turns ON the corresponding bit in the result word when the source data is within the range.
AREA RANGE COMPARE
ZCP 088 Compares the 16-bit unsigned binary value in CD (word contents or constant) to the range defined by LL and UL and outputs the results to the Arithmetic Flags in the Auxiliary Area.
ZCPL 116 Compares the 32-bit unsigned binary value in CD and CD+1 (word contents or constant) to the range defined by LL and UL and outputs the results to the Arithmetic Flags in the Auxiliary Area.
MOVE MOV 021 Transfers a word of data to the specified word. 2-108
!MOV
!@MOV
DOUBLE MOVE MOVL/ @MOVL
498 Transfers two words of data to the specified words. 2-108
022 Transfers the complement of a word of data to the specified word. 2-108
082 Transfers the specified bit. 2-111
083 Transfers the specified digit or digits. (Each digit is made up of 4 bits.) 2-113
XFRB/ @XFRB
062 Transfers the specified number of consecutive bits. 2-115
070 Transfers the specified number of consecutive words. 2-117
071 Copies the same word to a range of consecutive words. 2-119
073 Exchanges the contents of the two specified words. 2-121
DIST/ @DIST
080 Transfers the source word to a destination word calculated by adding an offset value to the base address.
081 Transfers the source word (calculated by adding an offset value to the base address) to the destination word.

Type Instruction Mnemonic FUN
No. Function Page
SHIFT REGISTER SFT 010 Operates a shift register. 2-127
SFTR/ @SFTR
084 Creates a shift register that shifts data to either the right or the left. 2-129
016 Shifts data between St and E in word units. 2-131
ASL/ @ASL
025 Shifts the contents of Wd one bit to the left. 2-133
ASR/ @ASR
026 Shifts the contents of Wd one bit to the right. 2-134
027 Shifts all Wd bits one bit to the left including the Carry Flag (CY). 2-135
028 Shifts all Wd bits one bit to the right including the Carry Flag (CY). 2-137
SLD/ @SLD
074 Shifts data by one digit (4 bits) to the left. 2-139
SRD/ @SRD
075 Shifts data by one digit (4 bits) to the right. 2-139
580 Shifts the specified 16 bits of word data to the left by the specified number of bits.
NSLL/ @NSLL
582 Shifts the specified 32 bits of word data to the left by the specified number of bits.
NASR/ @NASR
581 Shifts the specified 16 bits of word data to the right by the specified number of bits.
NSRL/ @NSRL
583 Shifts the specified 32 bits of word data to the right by the specified number of bits.
590 Increments the 4-digit hexadecimal content of the specified word by 1. 2-147
++L/ @++L
591 Increments the 8-digit hexadecimal content of the specified words by 1. 2-147
-- / @ --
592 Decrements the 4-digit hexadecimal content of the specified word by 1. 2-150
593 Decrements the 8-digit hexadecimal content of the specified words by 1. 2-150
594 Increments the 4-digit BCD content of the specified word by 1. 2-153
++BL/ @++BL
595 Increments the 8-digit BCD content of the specified words by 1. 2-153
596 Decrements the 4-digit BCD content of the specified word by 1. 2-156
-- BL/ @ -- BL
597 Decrements the 8-digit BCD content of the specified words by 1. 2-156

Type Instruction Mnemonic FUN
No. Function Page
400 Adds 4-digit (single-word) hexadecimal data and/or constants. 2-158
+L/ @+L
401 Adds 8-digit (double-word) hexadecimal data and/or constants. 2-158
+C/ @+C
402 Adds 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
+CL/ @+CL
403 Adds 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
+B/ @+B
404 Adds 4-digit (single-word) BCD data and/or constants. 2-162
+BL/ @+BL
405 Adds 8-digit (double-word) BCD data and/or constants. 2-162
+BC/ @+BC
406 Adds 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY). 2-164
+BCL/ @+BCL
407 Adds 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY). 2-164
- / @ -
410 Subtracts 4-digit (single-word) hexadecimal data and/or constants. 2-166
- L/ @ - L
411 Subtracts 8-digit (double-word) hexadecimal data and/or constants. 2-166
- C/ @ - C
412 Subtracts 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
- CL/ @ - CL
413 Subtracts 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
- B/ @ - B
414 Subtracts 4-digit (single-word) BCD data and/or constants. 2-172
- BL/ @ - BL
415 Subtracts 8-digit (double-word) BCD data and/or constants. 2-172
- BC/ @ - BC
416 Subtracts 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).
- BCL/ @ - BCL
417 Subtracts 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).
∗/ @∗
420 Multiplies 4-digit signed hexadecimal data and/or constants. 2-177
∗ L/ @ ∗ L
421 Multiplies 8-digit signed hexadecimal data and/or constants. 2-177
424 Multiplies 4-digit (single-word) BCD data and/or constants. 2-179
∗ BL/ @ ∗ BL
425 Multiplies 8-digit (double-word) BCD data and/or constants. 2-179
430 Divides 4-digit (single-word) signed hexadecimal data and/or constants. 2-181
/L @/L
431 Divides 8-digit (double-word) signed hexadecimal data and/or constants. 2-181
434 Divides 4-digit (single-word) BCD data and/or constants. 2-183
/BL @/BL
435 Divides 8-digit (double-word) BCD data and/or constants. 2-183

Type Instruction Mnemonic FUN
No. Function Page
023 Converts BCD data to binary data. 2-185
BINL/ @BINL
058 Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary) data. 2-185
024 Converts a word of binary data to a word of BCD data. 2-187
BCDL/ @BCDL
059 Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD data. 2-187
160 Calculates the 2' complement of a word of hexadecimal data. 2-189
076 Reads the numerical value in the specified digit (or byte) in the source word, turns ON the corresponding bit in the result word (or 16-word range), and turns OFF all other bits in the result word (or 16-word range).
077 FInds the location of the first or last ON bit within the source word (or 16-word range), and writes that value to the specified digit (or byte) in the result word.
086 Converts 4-bit hexadecimal digits in the source word into their 8-bit ASCII equivalents.
162 Converts up to 4 bytes of ASCII data in the source word to their hexadecimal equivalents and writes these digits in the specified destination word.
034 Takes the logical AND of corresponding bits in single words of word data and/or constants.
ANDL/ @ANDL
610 Takes the logical AND of corresponding bits in double words of word data and/or constants.
035 Takes the logical OR of corresponding bits in single words of word data and/or constants.
ORWL/ @ORWL
611 Takes the logical OR of corresponding bits in double words of word data and/or constants.
036 Takes the logical exclusive OR of corresponding bits in single words of word data and/or constants.
XORL/ @XORL
612 Takes the logical exclusive OR of corresponding bits in double words of word data and/or constants.
029 Turns OFF all ON bits and turns ON all OFF bits in Wd. 2-216
COML/ @COML
614 Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1. 2-216
APR/ @APR
069 Calculates the sine, cosine, or a linear extrapolation of the source data. 2-218
067 Counts the total number of ON bits in the specified word(s). 2-227

Type Instruction Mnemonic FUN
No. Function Page
450 Converts a 32-bit floating-point value to 16-bit signed binary data and places the result in the specified result word.
451 Converts a 32-bit floating-point value to 32-bit signed binary data and places the result in the specified result words.
FLT/ @FLT
452 Converts a 16-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
FLTL/ @FLTL
453 Converts a 32-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
+F/ @+F
454 Adds two 32-bit floating-point numbers and places the result in the specified result words.
455 Subtracts one 32-bit floating-point number from another and places the result in the specified result words.
∗ F/ @ ∗ F
456 Multiplies two 32-bit floating-point numbers and places the result in the speci- fied result words.
/F @/F
457 Divides one 32-bit floating-point number by another and places the result in the specified result words.
=F 329 Compares the specified single-precision data (32 bits) or constants and creates an ON execution condition if the comparison result is true. Three kinds of sym- bols can be used with the floating-point symbol comparison instructions: LD (Load), AND, and OR.
<F 331 2-241
<=F 332 2-241
>F 333 2-241
>=F 334 2-241
FLOATINGPOINT TO ASCII
FSTR/ @FSTR
448 Converts the specified single-precision floating-point data (32-bit decimal- point or exponential format) to text string data (ASCII) and outputs the result to the destination word.
FVAL/ @FVAL
449 Converts the specified text string (ASCII) representation of single-precision floating-point data (decimal-point or exponential format) to 32-bit single-preci- sion floating-point data and outputs the result to the destination words.
Table Data Processing Instructions
637 Switches the leftmost and rightmost bytes in all of the words in the range. 2-253
FCS/ @FCS
180 Calculates the ASCII FCS value for the specified range. 2-255
PIDAT 191 Executes PID control according to the specified parameters. The PID constants can be auto-tuned with PIDAT(191).
TPO 685 Inputs the duty ratio or manipulated variable from the specified word, converts the duty ratio to a time-proportional output based on the specified parameters, and outputs the result from the specified output.
194 Converts unsigned binary data into unsigned BCD data according to the speci- fied linear function.
486 Converts signed binary data into signed BCD data according to the specified linear function. An offset can be input in defining the linear function.
487 Converts signed BCD data into signed binary data according to the specified linear function. An offset can be input in defining the linear function.
AVERAGE AVG 195 Calculates the average value of an input word for the specified number of cycles.
SBS/ @SBS
091 Calls the subroutine with the specified subroutine number and executes that program.
SBN 092 Indicates the beginning of the subroutine program with the specified subroutine number.
RET 093 Indicates the end of a subroutine program. 2-295
MSKS/ @MSKS
690 Sets up interrupt processing for I/O interrupts or scheduled interrupts. 2-300
CLI/ @CLI
691 Clears or retains recorded interrupt inputs for I/O interrupts or sets the time to the first scheduled interrupt for scheduled interrupts.
DI/ @DI
693 Disables execution of all interrupt tasks except the power OFF interrupt. 2-306
EI 694 Enables execution of all interrupt tasks that were disabled with DI(693). 2-307

Type Instruction Mnemonic FUN
No. Function Page
High-speed Counter and Pulse Output Instructions
880 INI(880) is used to start and stop target value comparison, to change the present value (PV) of a high-speed counter, to change the PV of an interrupt input (counter mode), to change the PV of a pulse output, or to stop pulse out- put.
PRV/ @PRV
881 PRV(881) is used to read the present value (PV) of a highspeed counter, pulse output, or interrupt input (counter mode).
CTBL/ @CTBL
882 CTBL(882) is used to perform target value or range comparisons for the present value (PV) of a high-speed counter.
885 SPED(885) is used to specify the frequency and perform pulse output without acceleration or deceleration.
886 PULS(886) is used to set the number of pulses for pulse output. 2-323
887 PLS2(887) is used to set the pulse frequency and acceleration/deceleration rates, and to perform pulse output with acceleration/deceleration (with different acceleration/deceleration rates). Only positioning is possible.
ACC/ @ACC
888 ACC(888) is used to set the pulse frequency and acceleration/deceleration rates, and to perform pulse output with acceleration/deceleration (with the same acceleration/deceleration rate). Both positioning and speed control are possible.
889 ORG(889) is used to perform origin searches and returns. 2-336
PWM/ @PWM
891 PWM(891) is used to output pulses with a variable duty factor. 2-339
FACTOR
STEP START SNXT 009 SNXT(009) is used in the following three ways:
(1)To start step programming execution.
(2)To proceed to the next step control bit.
(3)To end step programming execution.
STEP DEFINE STEP 008 STEP(008) functions in following 2 ways, depending on its position and whether or not a control bit has been specified.
(1)Starts a specific step.
(2)Ends the step programming area (i.e., step execution).
Basic I/O Unit Instructions
097 Refreshes the specified I/O words. 2-352
SDEC/ @SDEC
078 Converts the hexadecimal contents of the designated digit(s) into 8-bit, 7-seg- ment display code and places it into the upper or lower 8-bits of the specified destination words.
DSW 210 Reads the value set on an external digital switch (or thumbwheel switch) con- nected to an Input Unit or Output Unit and stores the 4-digit or 8-digit BCD data in the specified words.
MATRIX INPUT MTR 213 Inputs up to 64 signals from an 8 ⋅ 8 matrix connected to an Input Unit and Output Unit (using 8 input points and 8 output points) and stores that 64-bit data in the 4 destination words.
7SEG 214 Converts the source data (either 4-digit or 8-digit BCD) to 7-segment display data, and outputs that data to the specified output word.
236 Outputs the specified number of bytes of data from the RS-232C port built into the CPU Unit or the serial port of a Serial Communications Board (version 1.2 or later).
235 Reads the specified number of bytes of data from the RS-232C port built into the CPU Unit or the serial port of a Serial Communications Board (version 1.2 or later).
730 Adds time to the calendar data in the specified words. 2-380
CSUB/ @CSUB
731 Subtracts time from the calendar data in the specified words. 2-380
DATE/ @DATE
735 Changes the internal clock setting to the setting in the specified source words. 2-385
006 Generates or clears user-defined non-fatal errors. 2-387
FALS 007 Generates user-defined fatal errors. 2-393

Type Instruction Mnemonic FUN
No. Function Page
040 Sets the Carry Flag (CY). 2-398
041 Turns OFF the Carry Flag (CY). 2-398
WDT/ @WDT
094 Extends the maximum cycle time, but only for the cycle in which this instruction is executed.
Instrucion · Other Instructions


This section describes the functions, operands and sample programs of the instruc- tions that are supported by a CP1E CPU Unit.
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

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 instruc- tion.
The description of each instruction is organized as described in the following table.
Instruction Indicates the name of the instruction. Example: MOVE BIT
Mnemonic Indicates the mnemonic.
@ Instruction that differentiates when the execution condition turns ON.
% Instruction that differentiates when the execution condition turns OFF.
! Refreshes data in the I/O area specified by the operands or the Special I/O Unit words when the instruction is executed.
repeatedly as long a execution condition
N
Function code Indicates the function code.
Function The basic purpose of the instruction is described after the section heading.
Symbol The 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.
S
S: Source word or data
C: Control word D: Destination word
Applicable Program Areas The program areas in which the instruction can be used are specified. “OK” indicates the areas in which the instruction can be used.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operands Indicates 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.
15 8 0 7 C m n
Source bit: 00 to 0F (0 to 15 decimal) Destination bit: 00 to 0F (0 to 15 decimal)
Operand Specifications The 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.
Word addresses Indirect DM
Area Con- stants CF TR bits Pulse
CIO WR HR AR T C DM @DM *DM S
OK --- --- C D ---

Flags The 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 instruc- tion.
Error Flag ER OFF
Function Indicates the function of the instruction.
Precautions Indicates important points when using an instruction.
Sample program An example of using the instruction with specific operands is provided to further explain the function of the instruction.
Constants input for operands are given as listed below.
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.
The input methods for constants for the Programming Devices are given in the following table.
Operands specifying bit strings (normally input as hexadeci- mal)
Input as decimal with an & prefix or input as hexadecimal with an # prefix. (See note.)
Operands specifying numeric values (normally input as deci- mal)
Operands specifying control numbers (except for jump num- bers)
Input as decimal with an # prefix. (See note.)
ate prefixes.
Name Label Operation · &10

With the CX-Programmer, the condition flags are registered in advance as global symbols with “P_” in front of the symbol name.
Access Error Flag P_AER
Greater Than Flag P_GT
Less Than Flag P_LT
Greater Than or Equals Flag P_GE
Not Equal Flag P_NE
Less Than or Equals Flag P_LE
Always ON Flag P_On
Always OFF Flag P_Off
Some of the C/CV-series PLC instructions have been changed to different instructions with the same functionality for the CP1E-series PLCs.
Data Movement MOVQ MOV
INCB ++
INBL ++L
DEC --B
DECL --BL
DECB --
DCBL --L
Symbol Math ADB +C
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 Control INT MSKS / CLIDI / EI

Differentiated and Immediate Refreshing Instructions
Ordinary LD, AND, OR, LD NOT, AND NOT, OR NOT
The ON/OFF status of the specified bit is taken by the CPU with cyclic refreshing, and it is reflected in the next instruction execution.
OUT, OUT NOT After the instruction is executed, the ON/OFF status of the specified bit is out- put with the next cyclic refreshing.
Differentiated up @LD, @AND, @OR The 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, %OR The instruction is executed once when the specified bit turns from ON to OFF and the ON state is held for one cycle.
The input data for the specified bit is taken by the CPU and the instruction is executed.
!OUT, !OUT NOT After the instruction is executed, the data for the specified bit is output.
Differentiated up / immediate refresh
!@LD, !@AND, !@OR The 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.
Differentiated down / immediate refresh
!%LD, !%AND, !%OR The 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.

The following chart shows the differences in the timing of instruction operations for a program config- ured from LD and OUT.
B1
A
B1
B2
A
B2
B3
A
B3
B4
A
B4
B5
A
B5
B6
A
B6
Input received Input received
A
B7
B8
A
B8
B9
A
B9
B10
A
B10
B11
A
B11
B12 !
A
B12
I/O refreshing Instruction execution

Instruction Mnemonic Variations Function
code Function
Indicates a logical start and creates an ON/OFF execution condition based on the ON/OFF status of the specified operand bit.
@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.
LD LD NOT
Bus bar Starting point of block Bus bar Starting point of block
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
OK --- OK OK
Flags
There are no flags affected by this instruction.
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 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 ter- minal is read, reversed, and used.
Symbol · Area

0.01 0.00
AND LD
LD
LD 0.01
OR LD
LD 0.02
AND 0.03
OR LD
OR LD --
AND LD --
0.05 LD NOT
LD NOT 0.04
AND 0.05
OR LD --
OUT 100.00
Instruction Operand

Instruction Mnemonic Variations Function
code Function
@AND, %AND, !AND, !@AND, !%AND
--- Takes a logical AND of the status of the specified operand bit and the current execution condition.
@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.
AND AND NOT
AND/AND NOT
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK --- OK OK --- AND NOT
There are no flags affected by this instruction.
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 specifica- tion, 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 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.
Symbol · Area

AND
0.01 0.00 100.00
0.03 0.02
AND 0.01
LD 0.02
AND 0.03
LD 0.04
AND NOT
AND NOT 0.05
OR LD --
AND LD --
OUT 100.00
Instruction Operand

Instruction Mnemonic Variations Function
code Function
@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 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.
OR OR NOT
Bus bar Bus bar
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK --- OK OK --- OR NOT
There are no flags affected by this instruction.
OR
OR is used for a normally open bit connected in parallel. A normally open bit is configured to form a log- ical 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 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.
Symbol · Area

0.00 100.00
0.01 0.02 0.04 0.05
0.03 0.07
AND 0.01
AND 0.02
OR OR NOT
OR 0.03
AND 0.04
LD 0.05
AND 0.06
OR NOT 0.07
AND LD --
OUT 100.00
Instruction Operand

Instruction Mnemonic Variations Function
code Function
AND LOAD AND LD --- --- Takes a logical AND between logic blocks.
OR LOAD OR LD --- --- Takes a logical OR between logic blocks.
Logic block Logic block
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
There are no flags affected by this instruction.
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.
Serial connection between logic block A and logic block B.
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.
Parallel connection between logic block A and logic block B.
AND LD

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.
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).
0.00 0.02
LD 0.00
0.03 0.01
LD 0.02
OR NOT 0.03
AND LD ---
OUT 100.00
Second LD: Used for first bit of next block connected in series to previous block.
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 exe- cution condition is ORed with the last unused execution condition.
0.00 0.01
0.03 0.02
AND NOT 0.01
LD 0.02
AND 0.03
OR LD ---
OUT 100.01
Second LD: Used for first bit of next block connected in series to previous block.

100.00 Coding Example (1) Coding Example (2)
0.00 0.02
Instruction Operand
0.05 0.01
LD 0.00
OR NOT 0.01
OR NOT 0.01
LD NOT 0.02
LD NOT 0.02
OR 0.03
OR 0.03
AND LD ---
LD 0.04
LD 0.04
OR 0.05
OR 0.05
AND LD ---
AND LD ---
AND LD ---
OUT 100.00
OUT 100.00
0.00 0.01
Instruction Operand
LD 0.00
LD 0.00
0.03 0.02
AND NOT 0.01
0.05 0.04
LD NOT 0.02
AND NOT 0.03
AND NOT 0.03
OR LD ---
LD 0.04
LD 0.04
AND 0.05
AND 0.05
OR LD ---
OR LD ---
OR LD ---
OUT 100.01
OUT 100.01

code Function
NOT NOT --- 520 Reverses the execution condition.
NOT(520)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
There are no flags affected by NOT(520).
NOT(520) is placed between an execution condition and another instruction to invert the execution con- dition.
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).
0.00 0.01
100.00 NOT(520) reverses the execution condition in the following example.
Symbol

Instruction Mnemonic Variations Function
code Function
CONDITION ON UP --- 521 UP(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 OFF DOWN --- 522 DOWN(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.
UP(521) DOWN(522)
UP/DOWN
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
There are no flags affected by UP(521) and DOWN(522).
UP
UP(521) is placed between an execution condition and another instruction to turn the execution condi- tion 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(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 exe- cuted just once when the execution condition goes from ON to OFF.
0.00 100.01
When CIO 0.00 goes from OFF to ON, CIO 100.01 is turned ON for just one cycle.
Symbol · Cycle · time

OUT/OUT NOT
code Function
Outputs the result (execution condition) of the
logical processing to the specified bit.
Reverses the result (execution condition) of the logical processing, and outputs it to the specified bit.
OUT OUT NOT
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK --- --- OK --- OK OUT NOT
There are no flags affected by this instruction.
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.
Symbol · Area

0.00 100.00
Instruction Operand
LD 0.00
OUT 100.00
OUT NOT 100.01

code Function
TR bits are used to temporarily retain the ON/OFF status of execution conditions in a program when programming in mnemonic code.
TR Bits TR --- ---
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.
Instruction Operands 0.00 0.01 0.02
LD 0.00
OUT
TR0
AND 0.01
OUT TR1
AND 0.02
OUT 100.00
LD TR1
AND 0.03
OUT 100.01
LD TR0
AND 0.04
OUT 100.02
LD TR0
AND NOT 100.00
OUT 100.03
TR0 to TR15 Temporary Relay
0.02 0.03

Instruction Mnemonic Variations Function
code Function
KEEP KEEP !KEEP 011 Operates like a latching relay.
S(SET)
KEEP(011)
Applicable Program Areas
KEEP
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
R Bit BOOL ---
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
R OK --- OK
No flags are affected by KEEP(011).
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.
= C A
A
B
B
ON OFF
ON OFF
ON OFF Status of C

100.00 0.02
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).
C A B A
B
Output bit C will maintain its previous status in an interlock.
Output bit C will be turned OFF in an interlock.
B
KEEP
B
A
B
A
B
↑ · ↑

KEEP
H0.00
H0.00
KEEP
ON OFF
ON OFF
ON OFF
ON OFF
S
R A
NEVER

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.
0.02 0.03
Coding
Instruction Operand
LD 0.00
LD 0.01
KEEP (011) 100.00
LD 0.02
AND NOT 0.03
LD 0.04
OR 0.05
KEEP (011) 100.01
KEEP(011), and then the reset input. In mnemonic form, input the set input, the reset input, and then KEEP(011).

Instruction Mnemonic Variations Function
code Function
DIFFERENTIATE UP DIFU !DIFU 013 DIFU(013) turns the designated bit ON for one cycle when the execution condition goes from OFF to ON (rising edge).
DIFU(013)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
R Bit BOOL ---
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
R OK ---
No flags are affected by DIFU(013).
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.

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

Instruction Mnemonic Variations Function
code Function
DIFFERENTIATE DOWN DIFD !DIFD 014 DIFD(014) turns the designated bit ON for one cycle when the execution condition goes from ON to OFF (falling edge).
DIFD(014)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
R Bit BOOL ---
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
B OK ---
No flags are affected by DIFD(014).
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.

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

Instruction Mnemonic Variations Function
code Function
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.
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.
RESET RSET
SET RSET
SET/RSET
RSET
SET
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
R Bit BOOL ---
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
R OK ---
No flags are affected by SET and RSET.
SET
SET turns the operand bit ON when the execution con- dition is ON, and does not affect the status of the oper- and bit when the execution condition is OFF. Use RSET to turn OFF a bit that has been turned ON with SET. RSET
Execution condition of SET
ON OFF Status of R
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
ON OFF Status of R
Symbol · Area

100.00 0.00 CIO 100.00 is turned ON/OFF when CIO 0.00 goes ON/OFF.
CIO 100.00 is turned ON when CIO 0.01 goes ON; it remains ON until CIO 0.02 goes ON.

Instruction Mnemonic Variations Function
code Function
MULTIPLE BIT SET SETA @SETA 530 SETA(530) turns ON the specified number of consecutive bits.
MULTIPLE BIT RESET RSTA @RSTA 531 RSTA(531) turns OFF the specified number of consecutive bits.
SETA(530)
RSTA(531)
D: Beginning word
D: Beginning word
N2
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
D Beginning Word UINT Variable
N1 Beginning Bit UINT 1
N2 Number of Bits UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
Operand Description Data type
Error Flag P_ER • ON if N1 is not within the specified range of 0000 to 000F (&0 to &15).
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.)
N2 bits are set to 1 (ON).
Bits turned ON by SETA(530) can be turned OFF by any other instructions, not just RSTA(531).
Symbol · Area

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.)
N2 bits are reset to 0 (OFF).
Bits turned OFF by RSTA(531) can be turned ON by any other instructions, not just SETA(530).
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.
15 11 12 4 7 8 3 5 0
1
1
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.
15 11 12 4 7 8 3 0
0 N2: 20 bits
0

Instruction Mnemonic Variations Function
code Function
SINGLE BIT SET SETB @SETB, !SETB, !@SETB 532 SETB(532) turns ON the specified bit.
SINGLE BIT RESET RSTB @RSTB, !RSTB, !@RSTB 533 RSTB(533) turns OFF the specified bit.
SETB(532)
RSTB(533)
D: Word address
D: Word address
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
D Word address UINT 1
N Bit number UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
Operand Description Data type
Error Flag P_ER • ON if N is not within the specified range of 0000 to 000F (&0 to &15).
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.
This bit is turned OFF.
Execution condition ON OFF
Bit N of word D ON OFF
Symbol · Area

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.)
This bit is turned OFF.
Execution condition ON OFF
Bit N of word D ON OFF
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.
&2 · &2

Overview of Interlock Instructions Interlock Instructions
The following instruction combinations can be used to interlock outputs in a program section.
executed after the interlock is cleared. • MULTI-INTERLOCK DIFFERENTIATION RELEASE and MULTI-INTERLOCK CLEAR (MILR(518) and MILC(519))*
locked are not executed after the interlock is cleared.
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.
Interlocks with MILH and MILC Interlocks with IL and ILC
A1
A1
MILH
A2
A2
MILH
A3
A3
MILC
MILC
MILC

Differentiated instructions (DIFU, DIFD, or instructions with a @ or % prefix) operate differently in inter- locks 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 DIFFEREN- TIATION RELEASE, and MULTI-INTERLOCK CLEAR: MILH(517), MILR(518), and MILC(519).
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).
MILH(517) is in an interlocked area between IL(002) and ILC.(003).
locked program sections do not overlap.
For example, all three interlock methods can be used without overlapping, as shown in the following diagram.
Different interlock methods can be used as long as the interlocked areas do not overlap.
MILR
MILC

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).
Treatment in JMP(004)/JME(005)
Item
MILH(517)/MILC (519), or
MILR(518)/MILC (519)
Instruction execution Except OUT, OUT NOT, and timer instructions, all instructions are not executed.
No instructions are executed.
Output status in instructions Except 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 NOT OFF All outputs retain their previous status.
Reset Operating 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.

code Function
END END --- 001 Indicates the end of a program.
END(001)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed Not allowed OK
There are no flags affected by this instruction.
END(001) completes the execution of a program for that cycle. No instructions written after END(001) will be executed.
Symbol

Instruction Mnemonic Variations Function
code Function
NO OPERATION NOP --- 000 This instruction has no function.
Symbol NOP (There is no ladder symbol associated with NOP(000).)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
No flags are affected by NOP(000).

code Function
INTERLOCK IL --- 002 Interlocks all outputs between IL(002) and ILC(003) when the execution condition for IL(002) is OFF.
INTERLOCK CLEAR ILC --- 003 Indicates the end of the interlock range.
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed OK OK
There are no flags affected by this instruction.
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).
Bits specified in OUT, OUT NOT OFF
TIM, TIMX(550), TIMH(015), TIMHX(551), TMHH(540), TMHHX(552), TIML(542), and TIMXL(553)
Completion Flag OFF (reset)
PV Time set value (reset)
Bits/words specified in all other instructions (See note.) Retain previous status.
CNTR(012), CNTRX(548), SFT, and KEEP(011) retain their previous status.
Interlocked section of the program
Normal Outputs execution interlocked.

condition Program section
a b A B OFF ON Interlocked Interlocked OFF OFF Interlocked Interlocked ON OFF Not interlocked Interlocked ON ON Not interlocked Not interlocked
B
B
B
a · b

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 differenti- ation condition of the instruction is satisfied by means of a change in the input condition between start- ing 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.
Reference: An IL(002) instruction operates in the same way as an MILH(517) instruction in relation to differentiated instruction operation.
OFF
ON ON Differentiation condition is satisfied
OFF
The DIFU(013) instruction is executed.
OFF
Not interlocked Interlocked · Not interlocked · 1 cycle

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.
0.00 OFF
OFF
H0
OFF
TIM
IL/ILC
SET
CNT

code Function
MULTI-INTERLOCK DIFFER- ENTIATION HOLD MILH --- 517 Interlocks all outputs between MILH(517) and MILC(519) when the execution condition for MILH(517) is OFF.
MULTI-INTERLOCK DIFFER- ENTIATION RELEASE MILR --- 518 Interlocks all outputs between MILR(518) and MILC(519) when the execution condition for MILR(518) is OFF.
MULTI-INTERLOCK CLEAR MILC --- 519 Indicates the end of a multi-interlock range by means of an MILH or MILR instruction with the same interlock number.
MILH(517)
MILR(518)
MILC(519)
N
N
N
N: Interlock Number
N: Interlock Number
N: Interlock Number
D: Interlock Status Bit
D: Interlock Status Bit
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed OK OK
Operand Description Data type Size
N Interlock number -- 1
D Interlock status bit BOOL --
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.
When the interlock is engaged, the Interlock Status Bit can be force-set to release the interlock. Con- versely, when the interlock is not engaged, the Interlock Status Bit can be force-reset to engage the interlock.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- D OK ---
---
Error Flag P_ER OFF
Symbol · Area · Name Label Operation

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 instruc- tions 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).
Instruction Treatment Bits specified in OUT, OUT NOT OFF TIM, TIMX(550), TIMH(015), TIMHX(551), TMHH(540), TMHHX(552), TIML(542), and TIMXL(553)
Bits/words specified in all other instructions (See note.) Retain previous status.
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 inter- lock for a given interlock number is engaged.
Input condition ON (Normal operation) Input condition OFF
Normal operation Interlock Status Bit (d) ON
Outputs interlocked. (Outputs OFF, timers reset, etc.) Interlock Status Bit (d) OFF
Nesting
Interlocks are nested when an interlocked program section (MILH(517)/MILR(518) and MILC(519) com- bination) 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.
Global interlock (Emergency stop)
Interlocking the entire program with one con- dition and interlocking a part of the program with another condition (1 nesting level)
Partial interlock (Conveyor RUN)

Global interlock (Emergency stop)
When the Emergency Stop is ON (input condition OFF), both A1 and A2 are interlocked. When the Emergency Stop is OFF (input condition ON), A1 is executed normally and A2 is controlled by the Conveyor RUN switch as described below.
Partial interlock (Conveyor RUN)
When the Conveyor RUN switch is OFF (input condition OFF), A2 is interlocked. When the Conveyor RUN switch is ON (input condition ON), A2 is executed normally.
MILC
Example 2
Global interlock (Emergency stop)
Interlocking the entire program with one condition and interlocking two overlapping parts of the program with other conditions (2 nesting levels)
Partial interlock (Conveyor RUN)
Global interlock (Emergency stop)
When the Emergency Stop is ON (input condition OFF), A1, A2, and A3 are interlocked. When the Emergency Stop is OFF (input condition ON), A1 is executed normally and A2 and A3 are controlled by the Conveyor RUN and Arm RUN switches as described below.
Partial interlock (Conveyor RUN)
When the Conveyor RUN switch is OFF (input condition OFF), both A2 and A3 are interlocked. When the Conveyor RUN switch is ON (input condition ON), A2 is executed normally and A3 is controlled by the Arm RUN switch as described below.
When the Arm RUN switch is OFF (input condition OFF), A3 is interlocked. When the Arm RUN switch is ON (input condition ON), A3 is executed normally.
MILC
MILC

Differentiated instructions (DIFU, DIFD, or instructions with a @ or % prefix) operate differently in inter- locks 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 inter- lock 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 (compar- ing the status of the execution condition when the interlock started to its status when the interlock was cleared).
A 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 RELEASE
A 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.
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.)
Not interlocked Interlocked Not interlocked
ON 0.00
Status (OFF) at start of interlock Differentiation condition established
ON
OFF
DIFU W0.0
OFF
Status (ON) when interlock is cleared
DIFU(013) is executed. MILH(517) interlock
ON
W0.0
OFF
1 cycle

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.
Not interlocked Interlocked Not interlocked
ON 0.00
OFF
ON
OFF
DIFU W0.0
OFF
DIFU(013) is not executed. MILR(518) interlock
ON
W0.0
OFF
Controlling Interlock Status from a Programming Device
An interlock can be engaged or released manually by force-resetting or force-setting the Interlock Sta- tus 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.
Force-set: Releases the interlock. Force-reset: Engages the interlock.
ON
MILH
MILH
n 100.00
CIO 100.00 is OFF when the interlock is engaged.
CIO 100.00 is ON when the interlock is not engaged.
Program section controlled by interlock
Program section controlled by interlock
If CIO 100.00 is force-reset (OFF), the interlock is engaged.
If CIO 100.00 is force-set (ON), the interlock is released.
MILC
n · n · n

condition Program section
a b A1 A2 A3 OFF ON Interlocked Interlocked Interlocked OFF ON OFF Not interlocked Interlocked Interlocked ON Not interlocked Not interlocked Not interlocked
MILH
MILH/MILR/MILC
A2
MILC
A3
The nested program section must not go beyond the outer program section.
A1
MILH
A2
MILC
Other instructions can be inserted between two MILC(519) instructions. In this case, sections A1 and A3 operate together. (They are interlocked when “a” is OFF, regardless of the ON/OFF status of “b”.)
MILC
When input condition “a” is OFF, only program section A1 is interlocked.
If there is an ILC(003) instruction, the interlock is cleared at that point.
The MILC(519) instruction is ignored.

When input condition “a” is OFF, program sections A1 and A2 are interlocked.
The ILC(003) instruction is ignored.
MILC
When input condition “a” is OFF, program sections A1 and A2 are both interlocked, even if input condition “b” is ON.
MILH
When input condition “a” is ON and “b” is OFF, only program section A2 is interlocked.
MILC
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.
When input condition “a” is OFF, program sections A1 and A2 are both interlocked.
This MILC(519) instruction is ignored.
A2
MILC
When input condition “a” is OFF, program sections A1 and A2 are both interlocked.
MILH
If the program section is not interlocked by IL(002) and “b” is OFF, program section A2 is interlocked.
When input condition “a” is OFF, program sections A1 and A2 are both interlocked.
The MILC(519) instruction is ignored.
A2



a b A1 A2 A3 OFF ON Interlocked Interlocked Not interlocked OFF ON OFF Not interlocked Interlocked Not interlocked ON ON Not interlocked Not interlocked Not interlocked

a b A1 A2 A3 OFF ON Interlocked Interlocked Not interlocked (Not controlled by the IL(002)/ILC(003) interlock.)
A3 This program section is not controlled by the interlock.

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.
W0.00 and W0.01 both ON
W0.00 ON and W0.01 OFF
W0.00
MILH
Executed normally.
W0.01
MILH
H0
Executed normally.
Outputs interlocked. Outputs interlocked. Held
MILC
CNT
Held Executed normally.
#0010

Instruction Mnemonic Variations Function
code Function
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.
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.
JUMP END JME --- 005 Indicates the end position of a jump by JMP or CJP instruction.
JMP JME
JMP(004)
JME(005)
N N:Jump number N: Jump number
CJP
CJP(510)
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed OK OK
Operand Description Data type Size
N Jump number UINT 1
The jump number must be 0000 to 007F (&0 to &127 decimal).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
JMP/CJP N OK
OK --- --- --- JME N ---
Error Flag P_ER • ON if N is not within the specified range of 0000 to 007F.
There are no flags affected by this instruction.
Symbol · Area · Name Label Operation

JMP
When the execution condition for JMP(004) is ON, no jump is made and the program is exe- cuted consecutively as written.
N
Instructions in this section are not executed and output status is maintained. The instruction execution time for these instructions is eliminated.
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 exe- cution condition. CJP
N
Execution condition ON Execution condition OFF
When the execution condi- tion for CJP(510) is OFF, no jump is made and the pro- gram is executed consecu- tively as written. When the execution condi- tion for CJP(510) is ON, pro- gram execution jumps directly to the first JME(005) in the program with the same jump number.
N
Instructions in this section are not executed and output status is maintained. The instruction execution time for these instructions is eliminated.
N
Hint
CJP(510) JME(005) Execution condition for jump OFF ON Number allowed 128 Instruction processing when jumped
Not executed.
None
Status of outputs (bits and words) when jumped
Bits and words maintain their previous status.
Operating timers continue timing.
Processing in block programs Always jump. Jump when ON.

Sequence Control Instructions
N
Program section A is executed repeatedly as long as execution condition a is OFF.
N
JMP/CJP/JME
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.
CIO 0.00
CIO 0.00
OFF &1
ON
Instructions not executed. (Outputs remain unchanged.)
SET
CNT
JME

code Function
FOR --- 512 The instructions between FOR(512) and NEXT(513) are repeated a specified number of times. NEXT --- 513
FOR(512)
NEXT(513)
Area Step program areas Subroutines Interrupt tasks
Usage --- OK OK
Operand Description Data type Size
N Number of loops UINT 1
The number of loops must be 0000 to FFFF (0 to 65,535 decimal).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N OK --- --- ---
Error Flag P_ER • ON if more than 15 loops are nested.
Equals Flag P_EQ OFF
Negative Flag P_N OFF
The instructions between FOR(512) and NEXT(513) are executed N times and then program execution con- tinues 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.
N
NEXT

There are two ways to repeat a program section until a given execution condition is input.
A
FOR
B
NEXT
NEXT
In the example above, program sections A, B, and C are executed as follows: A → B → B → C, A → B → B → C, and A → B → B → C
&3 · &2



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.

Instruction Mnemonic Variations Function
code Function
Programmed in a FOR-NEXT loop to cancel the execution of the loop for a given execution condi- tion. The remaining instructions in the loop are processed as NOP(000) instructions.
BREAK
BREAK(514)
Applicable Program Areas
BREAK
Area Step program areas Subroutines Interrupt tasks
Usage --- OK OK
Error Flag P_ER OFF
Equals Flag P_EQ OFF
Negative Flag P_N OFF
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).
N
Repetitions forced to end.
Processed as NOP(000).
Precautions

Refresh Methods for Timer/Counter PV Overview
There are two PV refresh methods for instructions related to timer/counters, “BCD” and “BINARY”.
Method Description Setting range Set value
BCD Sets the timer set value in BCD. 0~9.999 #0000~9999
Binary Sets 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.)
Classification Instruction
BCD Binary
Timer/counter instructions
HUNDRED-MS TIMER TIM TIMX(550)
TEN-MS TIMER TIMH(015) TIMHX(551)
ONE-MS TIMER TMHH(540) TMHHX(552)
ACCUMULATIVE TIMER TTIM(087) TTIMX(555)
LONG TIMER TIML(542) TIMLX(553)
COUNTER CNT CNTX(546)
REVERSIBLE COUNTER CNTR(012) CNTRX(548)
RESET TIMER/COUNTER CNR(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.
TMHH(540)/ TMHHX(552)
TTIM(087)/ TTIMX(555)
TIML(542)/ TIMLX(553)
Timing method Decrementing Decrementing Decrementing Incrementing Decrementing
Timing units 100 ms 10 ms 1 ms 100 ms 100 ms
TIML:115 days
Outputs/instruction 1
Timer numbers Used Not used
When the instruction is executed
When the instruction is executed
When the instruction is executed
When the instruction is executed
When the instruction is executed
Timer PV refreshing (See note)
When the instruction is executed
When the instruction is executed
When the instruction is executed
When the instruction is executed
When the instruction is executed
PVs SV SV SV 0 SV

TIMH(015)/ TIMHX(551)
TMHH(540)/ TMHHX(552)
TTIM(087)/ TTIMX(555)
TIML(542)/ TIMLX(553)
Operating mode change PV = 0 Completion Flag = OFF
Power interrupt/reset PV = 0 Completion Flag = OFF
Execution of CNR(545)/CNRX(547) Binary: PV = FFFF, Completion Flag = OFF BCD: PV = FFFF or 9999, Completion Flag = OFF
Operation in jumped program sec- tion (JMP(004)-JME(005))
Operating timers continue timing. Timer status is maintained.
Operation in interlocked program section (IL(002)-ILC(003))
PV = SV Completion Flag = OFF
Timer status main- tained.
PV = SV Completion Flag = OFF
Completion Flag ON ---
PVs Set to 0. ---
PVs Reset to SV. Set to 0. ---

The following program examples show three ways to create long-term timers with standard TIM and CNT instructions.
In this example, two TIM instructions are combined to make a 30-minute timer.
LD
TM
T0001
TIM
LD
T0001
TM
T0002 100.00
LD
T000
OUT
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 combi- nation is the timer interval × counter SV. In this case, the timer SV would be 5 s × 100 = 500 s. With this combination, the long-term timer’s PV is actually the PV of a counter, which is maintained through power interruptions.
LD
LD
CNT
0.00 100.00 C0002
LD
TIM
AND NOT
AND NOT
TIM
T0001
LD
T0001
OUT
LD
OUT
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 pre- vious PV.
P_1s (1-s clock) Instruction Operands
LD
AND
LD NOT
CNT
A200.11
C0001 100.02

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.
0.00 0.01
LD
0.01 AND
0.02 LD NOT
C0001 OR
C0002 OR
1 CNT
C0001 LD
0.02 LD NOT
CNT
2 CNT
C0002 LD
C0002 100.03
100.03 OUT
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.
LD 0.00
TIM 1
5.00 0.00
TIM
LD NOT 0.00
TIM 2
T0001
LD T0001
KEEP
LD T0002
T0002
KEEP(011) 100.05
5.0 s 3.0 s

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.

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.


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).
0.00 100.06
P. 1s (1-s clock pulse)
AND
OUT
B
A,B=0.5s
There are two methods for resetting a 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.
When CIO 0.01 turns ON, the timer starts timing. When CIO 0.01 turns OFF, the timer is reset.
CIO 0.01
OFF
T0010
The timer cannot be reset and then restarted within the same cycle.
OFF
The specified instruction will be reset when the RESET TIMER/COUNTER instruction (CNR/CNRX) is executed.

code Function
HUNDRED-MS TIMER TIM/TIMX --- 550 TIM or TIMX(550) operates a decrementing timer with units of 0.1-s.
TIM
TIMX(550)
N:Timer number
N: Timer number
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
N Timer Number TIMER TIMER 1
S Set Value WORD UINT 1
The timer number must be between 0000 and 0255 (decimal).
TIM (BCD): #0000 to #9999.
TIMX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- --- --- S OK
Flags
Error Flag P_ER • ON if in BCD mode and S does not contain BCD data.

SV
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.
ON OFF
SV
1-s clock pulse bit
N
S

Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*1
Power off and reset 0 OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions *2
BCD: 9999 Binary: FFFF
OFF
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 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.
TIMX
ON OFF
ON OFF
T0000
ON OFF
T0000

Instruction Mnemonic Variations Function
code Function
TIMH --- 015 TIMH(015)/TIMHX(551) operates a decrementing timer with units of 10-ms. TIMHX --- 551
TIMH TIMHX
TIMH(015)
TIMHX(551)
N
N: Timer number
N: Timer number
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
N Timer Number TIMER TIMER 1
S Set Value WORD UINT 1
The timer number must be between 0000 and 0255 (decimal). S: Set Value
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- --- --- S OK
Flags
Error Flag ER • ON if in BCD mode and S does not contain BCD data.

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

Condition PV Completion Flag
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*1
Power off and reset 0 OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions *2
BCD: 9999 Binary: FFFF
OFF
Operation in interlocked program section (IL(002)-ILC(003))
Reset to SV. OFF
Operation in jumped program section
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 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.
0.00 0.00
TIMH
100 (1.00 s) or
ON
TIMHX
OFF
T0000

code Function
TMHH --- 540 TMHH(540)/TMHHX(552) operates a decrement- ing timer with units of 1-ms. TMHHX --- 552
TMHH TMHHX
TMHH(540)
TMHHX(552)
N
N: Timer number
N: Timer number
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
N Timer Number TIMER TIMER 1
S Set Value WORD UINT 1
The timer must be between 0000 and 0015 decimal.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- --- --- S OK
Flags
Error Flag P_ER • ON if in BCD mode and S does not contain BCD data.

The timer PV and timeup used in TMHH/TMHHX instructions are refreshed at the timing below.
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*1
Power supply interrupted and reset 0 OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions *2
BCD: 9999 Binary: FFFF
OFF
Operation in interlocked program section (IL(002)-ILC(003))
Reset to SV. OFF
Operation in jumped program section
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.

code Function
TTIM --- 087 TTIM(087)/TTIMX(555) operates an incrementing timer with units of 0.1-s. TTIMX --- 555
TTIM TTIMX
TTIM(087)
TTIMX(555)
N
N: Timer number
N: Timer number
S: Set value
S: Set value
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
N Timer Number TIMER TIMER 1
S Set Value WORD UINT 1
The timer number must be between 0000 to 0255 (decimal).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- --- --- S OK
Flags
Error Flag P_ER • ON if in BCD mode and S does not contain BCD data.

SV
Timing resumes.
PV maintained.
ON OFF
TTIM/TTIMX
Operating mode changed from RUN or MONITOR mode to PROGRAM mode or vice versa.*1
Power supply interrupted and reset 0 OFF
Execution of CNR(545)/CNRX(547), the RESET TIMER/COUNTER instructions *2
BCD: 9999 Binary: FFFF
OFF
Operation in interlocked program section (IL(002)-ILC(003))
Retains previous status.
Retains previous status.
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 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.
TTIM
ON OFF
ON OFF
T0001
Timing resumes.
PV maintained.
ON OFF
ON OFF
ON OFF
ON OFF

Instruction Mnemonic Variations Function
code Function
TIML --- 542 TIML(542)/TIMLX(553) operates a decrementing timer with units of 0.1s. TIMLX --- 553
TIML TIMLX
TIML(542)
TIMLX(553)
S: SV word
S: SV word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
D1 Completion Flag WORD UINT 1
D2 PV word DWORD UDINT 2
S SV word DWORD UDINT 2
The PV and SV can range from #00000000 to #99999999 for TIML(542) and &00000000 to &4294967294 (decimal) or #00000000 to #FFFFFFFF (hexadecimal) for TIMLX(553).
Completion Flag Do not use.
D2: PV Word
data area.
D2 D2+1 D2 D2+1 is the leftmost 4 digits, D2 is the rightmost 4 digits
S S+1 S S+1 is the leftmost 4 digits, S is the rightmost 4 digits
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- S OK OK OK
OK OK OK OK
OK OK OK
Flags
Error Flag P_ER • ON if in BCD mode and D2 does not contained BCD data.

SV
Completion Flag (Bit 00 of D1)
Timer input · Timer PV

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.
TIML
Timer PV (D101 and D100)
ON OFF
Timer Completion Flag (CIO 200.00)
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
D2:D100
D200 D201

code Function
COUNTER CNT/CNTX --- 546 CNT/CNTX(546) operates a decrementing counter.
CNT
CNTX(546)
S
S: Set value
S: Set value
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
N Counter Number COUNTER COUNTER 1
S Set Value WORD UINT 1
The counter number must be between 0000 and 0255 (decimal).
CNT (BCD): #0000 to #9999 CNTX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex) Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- S OK
Flags
Error Flag P_ER • ON if in BCD mode and S does not contain BCD data.

OFF
ON
SV
ON
CNT/CNTX
N
S
First Cycle Flag (A200.11)
the following, the Counters PVs and Countup Flags are unfixed. E-type CPU Unit 9 hours (60°C), 50 hours (25°C) N/NA-type CPU Unit 7 hours (60°C), 40 hours (25°C)
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/NAD-) can be equipped with a battery. With the battery installed, the Counters PVs and Countup Flags can be retained during power OFF.

OFF
ON
OFF
SV
ON
OFF
Ready to start counting
OFF
ON
ON
ON
OFF
OFF
OFF
SV
ON
OFF
Count input can be received.
Reset input takes precedence.
Count input can be received.

Instruction Mnemonic Variations Function
code Function
CNTR --- 012 --- CNTRX --- 548
REVERSIBLE COUNTER
CNTR CNTRX
CNTR(012)
CNTRX(548)
N
N: Counter number
S: Set value
S: Set value
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
N Counter Number COUNTER COUNTER 1
S Set Value WORD UINT 1
The counter number must be between 0000 and 0255(decimal).
CNTR (BCD):#0000 to #9999 CNTRX (Binary): &0 to &65535 (decimal) or #0000 to #FFFF (hex) Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
---
--- --- --- S OK
Flags
Error Flag P_ER • ON if in BCD mode and S does not contain BCD data.

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.
OFF
SV -1 Counter PV
OFF
Precautions
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.

CNTR
ON
Increment input 0.00
ON
Decrement input 0.01
ON
Reset input 0.02
OFF
SV
CNTR/CNTRX
ON
OFF
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.
LD
LD
CNTR (012)
LD
OUT
LD
LD
LD
CNTR
CNTR (012)
SV: CIO 0001
LD NOT
OUT
4999 5000 0 1 2
4999 5000 0 1

code Function
CNR @CNR 545 Resets the timers or counters within the specified range of timer or counter numbers. CNRX @CNRX 547
CNR CNRX
CNR(545)
CNRX(547)
N1
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
N1 First number in range TIMER/COUNTER*1 Variable
N2 Last number in range TIMER/COUNTER*1 Variable
N1 must be a timer number between T000 and T255 or a counter number between C000 and C255.
N2 must be a timer number between T000 and T255 or a counter number between C000 and C255. Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N1,N2 --- OK OK ---
Error Flag P_ER • ON if N1 and N2 are not in the same data area.
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.)

BCD TIM: HUNDRED-MS TIMER TIMH(015): TEN-MS TIMER TMHH(540): ONE-MS TIMER TTIM(087): ACCUMULATIVE TIMER CNT: COUNTER CNTR(012): REVERSIBLE COUNTER
The PV is set to its maximum value (9,999 BCD) and the Completion Flag is turned OFF.
Binary TIMX(550): HUNDRED-MS TIMER TIMHX(551): TEN-MS TIMER TMHHX(552): ONE-MS TIMER TTIMX(555): ACCUMULATIVE TIMER CNTX(546): COUNTER CNTRX(548): REVERSIBLE COUNTER
The PV is set to its maximum value (FFFF hex) and the Completion Flag is turned OFF.
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).
T0005
CNR
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).
T0005
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).
T

=, <>, <, <=, >, >=
code Function
Input 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.
Input Comparison Instructions =, , = --- 300 to 328
=, <>, <, <=, >, >=
LD connection AND connection OR connection
S 1
S 1
S 2
S 2
S 2
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Unsigned Unsigned double length Signed Signed double length One-word Double length
S1 Comparison data 1 UINT UDINT INT DINT 1 2
S2 Comparison data 2 UINT UDINT INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S1,S2 OK --- --- ---
Error Flag P_ER OFF or unchanged OFF or unchanged
Greater Than Flag P_GT • ON if S1 > S2 with one-word data.
Greater Than or Equal Flag P_GE • ON if S1 ≥ S2 with one-word data.
Equal Flag P_EQ • ON if S1 = S2 with one-word data.
Not Equal Flag P_NE • ON if S1 ≠ S2 with one-word data.

Less Than Flag P_LT • ON if S1 < S2 with one-word data.
Less Than or Equal Flag P_LE • ON if S1 ≤ S2 with one-word data.
Negative Flag P_N OFF or unchanged OFF or unchanged
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.
ON execution condition when comparison result is true.
S2
The input comparison instructions are treated just like the LD, AND, and OR instructions to control the execution of subsequent instructions.
ON execution condition when comparison result is true.
=, , =
LD The instruction can be connected directly to the left bus bar.
S2
AND The instruction cannot be connected directly to the left bus bar.
OR The instruction can be connected directly to the left bus bar.
ON execution condition when comparison result is true.
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.
Symbol Option (data format) Option (data length)
< > (Not equal)
S: Signed data
L: Double-length data
>= (Greater than or equal)
True if C1 = C2 LD/AND/OR = EQUAL 300
LD/AND/OR =S SIGNED EQUAL 302
LD/AND/OR =SL DOUBLE SIGNED EQUAL 303
True if C1 ≠ C2 LD/AND/OR NOT EQUAL 305
LD/AND/OR <>S SIGNED NOT EQUAL 307
LD/AND/OR <>SL DOUBLE SIGNED NOT EQUAL 308
True if C1 < C2 LD/AND/OR < LESS THAN 310
LD/AND/OR<S SIGNED LESS THAN 312
LD/AND/OR <SL DOUBLE SIGNED LESS THAN 313

True if C1 ≤ C2 LD/AND/OR
LD/AND/OR <=S SIGNED LESS THAN OR EQUAL 317
LD/AND/OR
True if C1 > C2 LD/AND/OR > GREATER THAN 320
LD/AND/OR >S SIGNED GREATER THAN 322
LD/AND/OR >SL DOUBLE SIGNED GREATER THAN 323
True if C1 ≥ C2 LD/AND/OR >= GREATER THAN OR EQUAL 325
LD/AND/OR >=S SIGNED GREATER THAN OR EQUAL 327
LD/AND/OR>=SL DBL SIGNED GREATER THAN OR EQUAL 328
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.
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.
0.00 100.00
8714 3A1C
<S
(Will not proceed to next line.)
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 exe- cution 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.
0.00 100.00
Signed LESS THAN Comparison
8714 3A1C
−30,956 < 14,876
(Will proceed to next line.)
< · 34,580 > 14,876 ·

Instruction Mnemonic Variations Function
code Function
=DT <>DT <DT <=DT >DT >=DT
341 342 343 344 345 346
Time comparison instructions compare two BCD time values and create an ON execution condition when the comparison condition is true.
LD AND OR
=DT, <>DT, <DT, <=DT, >DT, >=DT
C: Control word S1: First word of present time S2: First word of comparison time
C: Control word S1: First word of present time S2: First word of comparison time S1
C: Control word S1: First word of present time S2: First word of comparison time
S 1
S 2
S 2
S 2
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C Control word WORD 1
S1 First word of present time WORD 3
S2 First word of comparison time WORD 3
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.
0 1 2 3 4 5 6 7 8 15
0 C
Masks seconds data when ON. Masks minutes data when ON. Masks hours data when ON. Masks day data when ON. Masks month data when ON. Masks year data when ON.

S 2 through S 2 +2: Comparison Time Data
S1 through S1+2 contain the present time data. S1 through S1+2 must be in the same data area.
S2 through S2+2 contain the comparison time data. S2 through S2+2 must be in the same data area.
15 8 0 7 S 2
15 8 0 7 S 2 +1
15 8 0 7 S 2 +2
Note The year value indicates the last two digits
data for the comparison, set S1 to A351 to specify the CPU Unit’s internal clock data (A351 to A353).
of the year. Values 00 to 97 are interpreted as 2000 to 2097. Values 98 and 99 are interpreted as 1998 and 1999.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- S1, S2 OK OK ---
OK OK OK OK OK OK OK
Flags
Error Flag P_ER • ON if all 6 of the mask bits (C bits 00 to 05) are ON.
Greater Than Flag P_GT • ON if S1 > S2.
Greater Than or Equal Flag P_GE • ON if S1 ≥ S2.
Equal Flag P_EQ • ON if S1 = S2.
Not Equal Flag P_NE • ON if S1 ≠ S2.
Less Than Flag P_LT • ON if S1 < S2.
Less Than or Equal Flag P_LE • ON if S1 ≤ S2.
Area · Name Label Operation

The time comparison instruction compares the unmasked values (corresponding bit of C set to 0) of the present time data in S1 to S1+2 with the comparison time data in S2 to S2+2 and creates an ON execu- tion 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.
= <> < <= > >=
S1 = S2 ON OFF OFF ON OFF ON
S1 > S2 OFF ON OFF OFF ON ON
S1 < S2 OFF ON ON ON OFF OFF
(=, , =)
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, min- utes, 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.
Present time data Comparison time data
00 07 08 15
00 07 08 15
Second (00 to 59, BCD) Minute (00 to 59, BCD)
Second (00 to 59, BCD) Minute (00 to 59, BCD)
Hour (00 to 23, BCD) Day of month (01 to 31, BCD)
Hour (00 to 23, BCD) Day of month (01 to 31, BCD)
Month (01 to 12, BCD) Year (00 to 99, BCD)
Month (01 to 12, BCD) Year (00 to 99, BCD)
S 2 +2
Compares only hours and minutes data.
Year, month, day, and seconds data is masked.
A351.00 to A351.07 Second (00 to 59, BCD)
A351.08 to A351.15 Minute (00 to 59, BCD)
A352.00 to A352.07 Hour (00 to 23, BCD)
A352.08 to A352.15 Day of 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)

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.
S 1
A352
S 2
0 1 2 3 4 5 6 7
D0 set to 0038 hex
Seconds compared. Minutes compared. Hours compared. Day masked. Month masked. Year masked.
Shaded data is compared.
0 7 8 15
0 7 8 15
S 2 : D100
A352
Day of month Hour
A353
S 2 +2:D102
Conditions Flags set as soon as execution condition is turned ON.
Minute Second · Year Month


Compares two unsigned binary values (constants and/or the contents of specified words) and out- puts the result to the Arithmetic Flags in the Auxil- iary Area.
Compares two double unsigned binary values (constants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S1, S2 OK --- --- ---

Greater Than Flag P_GT • ON if S1 > S2.
Greater Than or Equal Flag P_GE • ON if S1 ≥ S2.
Equal Flag P_EQ • ON if S1 = S2.
Not Equal Flag P_NE • ON if S1 ≠ S2.
Less Than Flag P_LT • ON if S1 < S2.
Less Than or Equal Flag P_LE • ON if S1 ≤ S2.
Area

The following table shows the status of the Arithmetic Flags after execution of CMP(020).
> > = = < = < < >
S1 > S2 ON ON OFF OFF OFF ON
S1 = S2 OFF ON ON ON OFF OFF
S1 < S2 OFF OFF OFF ON ON ON
* A status of “---” indicates that the Flag may be ON or OFF.
(>, >=, =,
The following table shows the status of the Arithmetic Flags after execution of CMPL(060).
> > = = < = < < >
S1 +1, S1 > S2+1, S2 ON ON OFF OFF OFF ON
S1+1, S1 = S2+1, S2 OFF ON ON ON OFF OFF
S1+1, S1 < S2+1, S2 OFF OFF OFF ON ON ON
* A status of “---” indicates that the Flag may be ON or OFF.
(>, >=, =,
CMP(020) compares the unsigned binary data in S1 and S2 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(060) compares the unsigned binary data in S1 +1, S1 and S2+1, S2 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.

CMP
S1
S2
CMP/CMPL
S1
S2
A
Arithmetic Flag (Example: Equal Flag) In this case, the results of instruction B might change the results of CMP(020).
S1+1=11CH
S1=10CH
1 2 3 4
5 6 7 8
= OFF (0)
S2+1=9CH
S2=8CH
< ON (1)
A B C D
E F 1 2


Compares two signed binary values (constants and/or the contents of specified words) and out- puts the result to the Arithmetic Flags in the Auxil- iary Area.
Compares two double signed binary values (con- stants and/or the contents of specified words) and outputs the result to the Arithmetic Flags in the Auxiliary Area.

Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK

TR bits CIO WR HR AR T C DM @DM *DM
Word addresses Indirect DM addresses
S1, S2 OK --- --- ---

Greater Than Flag P_GT • ON if S1 > S2.
Greater Than or Equal Flag P_GE • ON if S1 ≥ S2.
Equal Flag P_EQ • ON if S1 = S2.
Not Equal Flag P_NE • ON if S1 ≠ S2.
Less Than Flag P_LT • ON if S1 < S2.
Less Than or Equal Flag P_LE • ON if S1 ≤ S2.
Constants CF Pulse · Area · bits

The following table shows the status of the Arithmetic Flags after execution of CPS(114).
> > = = < = < < >
S1 > S2 ON ON OFF OFF OFF ON
S1 = S2 OFF ON ON ON OFF OFF
S1 < S2 OFF OFF OFF ON ON ON
* A status of “---” indicates that the Flag may be ON or OFF.
(>, >=, =,
The following table shows the status of the Arithmetic Flags after execution of CPSL(115).
> > = = < = < < >
S1 +1, S1 > S2+1, S2 ON ON OFF OFF OFF ON
S1+1, S1 = S2+1, S2 OFF ON ON ON OFF OFF
S1+1, S1 < S2+1, S2 OFF OFF OFF ON ON ON
* A status of “---” indicates that the Flag may be ON or OFF.
(>, >=, =,
CPS(114) compares the signed binary data in S1 and S2 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 S1 +1, S1 and S2+1, S2 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.

S1
S2
A
Arithmetic Flag (Example: Equal Flag) In this case, the Equals Flag and output A will be turned ON when S1 = S2 or S1 +1, S1 = S2+1, S2.
S1
S2
A
Arithmetic Flag (Example: Equal Flag) In this case, the results of instruction B might change the results of CPS(114)/CPSL(115).
When CIO 0.00 is ON in the following example, the eight-digit signed binary data in D2 and D1 is com- pared to the eight-digit signed binary data in D6 and D5 and the result is output to the Arithmetic Flags.
5678 > ON (1)
= OFF (0)
< OFF (0) D6
ABCD
EF12

Instruction Mnemonic Variations Function
code Function
Compares the source data to the contents of 16 consecutive words and turns ON the correspond- ing bit in the result word when the contents of the words are equal.
TCMP
TCMP(085)
S
S: Source data
T: First word of table
R
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source data WORD 1
T First word of table WORD 16
R Result word UINT 1
R
T+1
Comparison result for S and T
Comparison result for S and T+1
Comparison result for S and T+14
Comparison result for S and T+15
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- T, R ---
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the result word is 0000. (The two 16-word sets contain the same data.)

TCMP(085) compares the source data (S) to each of the 16 words T through T+15 and turns ON the corre- sponding 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 0
T
T+1
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 T+15 and bit 15 of R is turned ON if they are equal or OFF if they are not equal.
T+15
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.
S: D100
0 3 A 1 T: D200
0 2 A 1
TCMP
0
0 1 2 0
0 3 A 1
0
1 2 3 4
5 6 7 8
D E F 0
0 3 A 1
1 2 3 4
5 6 7 8
D E F 0
0 3 A 1
Comparison

Instruction Mnemonic Variations Function
code Function
Compares the source data to 16 ranges (defined by 16 lower limits and 16 upper limits) and turns ON the corresponding bit in the result word when the source data is within a range.
BCMP
BCMP(068)
S
S: Source data B: First word of block
R: Result word
R
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source data WORD 1
B First word of block WORD 32
R Result word UINT 1
Lower limit value 0
Upper limit value 0
Comparison result for S and range B ↔ B+1 Comparison result for S and range B+2 ↔ B+3 Comparison result for S and range B+28 ↔ B+29 Comparison result for S and range B+30 ↔ B+31
Lower limit value 1
Upper limit value 1
Lower limit value 15
Upper limit value 15
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- B
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the result word is 0000. (S is not within any of the 16 ranges.)

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 (inclu- sive 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.
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

1 when inside the range 0 when outside of range
greater than the upper limit, but 0 (not within the range) will be output to the cor- responding bit of R.
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.



Compares 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.
Compares 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.
CD: First word of Comparison Data LL: First word of Lower Limit UL: First word of Upper Limit
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
CD, LL, UL OK --- --- ---

Error Flag P_ER ON if LL > UL. ON if LL+1, LL > UL+1, UL.
Greater Than Flag P_GT • ON if CD > UL.
Greater Than or Equal Flag P_GE Left unchanged. Left unchanged.
Equal Flag P_EQ • ON if LL ≤CD ≤UL.
Less Than Flag P_LT • ON if CD < LL.
Less Than or Equal Flag P_LE Left unchanged. Left unchanged.
Area

ZCP(088) compares the 16-bit signed binary data in CD with the range defined by LL and UL and out- puts 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.
CD = UL OFF ON
LL < CD < UL
CD = LL
CD < LL OFF ON
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.
CD+1, CD = UL+1, UL OFF ON
LL+1, LL < CD+1, CD < UL+1, UL
CD+1, CD = LL+1, LL
CD+1, CD < LL+1, LL OFF ON
Precautions
CD
UL
A
In this case, the Equals Flag and output A will be
turned ON when LL ≤CD ≤UL.

ZCPL
CD
UL
A
In this case, the results of instruction B might change the results of ZCP(088)/ZCPL(116).
Sample program
LL CD UL
CD
= ON(1)
UL
#001F
> ON(1)
< ON(1)

MOV/MOVL/MVN

!@MOV 021 Transfers a word of data to the specified word.
DOUBLE MOVE MOVL @MOVL 498 Transfers two words of data to the specified words.
MOVE NOT MVN @MVN 022 Transfers the complement of a word of data to the specified word.

Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK


Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK

Equal Flag P_EQ • ON if the data being transferred (D) is 0.
Negative Flag P_N • ON if the leftmost bit of the data being transferred (D) is 1.

MOV
S
Transfers S to D. If S is a constant, the value can be used for a data setting.
S
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.
MOV/MOVL/MVN
MVN(022) inverts the bits in S and transfers the result to D. The content of S is left unchanged.
1 0 0 1 Bit status inverted.
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 trans- ferred to D and immediately out-refreshed when the instruction is executed. It is also possible to in- refresh S and out-refresh D at the same time.
When CIO 0.00 is ON in the following example, the content of CIO 100 is copied to D100.
100CH D100

When CIO 0.00 is ON in the following example, the content of D101 and D100 are copied to D201 and D200.
MOV
MOV
D11 0 4 8 11 12 15 D 2 0 3 4 7
8 11 12 15 2 E
0 3 4 7
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.
100CH
F

Instruction Mnemonic Variations Function
code Function
MOVE BIT MOVB @MOVB 082 Transfers the specified bit.
MOVB(082)
S
S: Source word or data
C: Control word
D: Destination word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word or data WORD 1
C Control word UINT 1
D Destination word WORD 1
0 7 8 15
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
OK
Error Flag P_ER • ON if the rightmost and leftmost two digits of C are not within the specified range of 00 to 0F.

MOVB(082) copies the specified bit (n) from S to the specified bit (m) in D. C m n
Hint
The same word can be specified for both S and D to copy a bit within a word.
The other bits in the destination word are left unchanged.
When CIO 0.00 is ON in the following example, the 5th bit of the source word (W0) is copied to the 12th bit of the destination word (W100) in accordance with the control word’s value of 0C05.
S
W0
W100
C:D200 0C 05
0 1 5 14 15
0 1 14 15
n · m

Instruction Mnemonic Variations Function
code Function
MOVE DIGIT MOVD @MOVD 083 Transfers the specified digit or digits. (Each digit is made up of 4 bits.)
MOVD(083)
S
S: Source word or data
C: Control word
D: Destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word or data WORD 1
C Control word UINT 1
D Destination word UINT 1
8 11 12 15
0 3 4 7 D Digit 3 Digit 2
8 11 12 15
0 3 4 7
S Digit 3 Digit 2
Digit 1 Digit 0
Digit 1 Digit 0
The source digits are read from right to left, wrapping back to the rightmost digit (digit 0) if necessary.
The destination digits are written from right to left, wrapping back to the rightmost digit (digit 0) if necessary.
15 8 0 11 3 7 4 12
First digit in D ( ): 0 to 3
Always 0.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
OK
Symbol · n m · Area

Error Flag P_ER • ON if one of the first three digits of C is not within the specified range of 0 to 3.
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.
8 11 12 15 n m
0 3 4 7
S
R
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.
When CIO 0.00 is ON in the following example, four digits of data are copied from W0 to W100. The trans- fer begins with the digit 1 of W0 and digit 0 of W100, in accordance with the control word’s value of 31.
S
W0
Digit no.
3 2 1 0
S: W0 1 2 8 11 12 15 3 4 0 3 4 7
Digit no.
3 2 1 0
D: W100 4 1 8 11 12 15 2 3
0 3 4 7
The following diagram shows examples of data transfers for various values of C.
C 㧦 30
C 㧦 312
C 㧦 230
S
D S
D S
D S

Instruction Mnemonic Variations Function
code Function
MULTIPLE BIT TRANSFER XFRB @XFRB 062 Transfers the specified number of consecutive bits.
XFRB(062)
C: Control word
S: First source word
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C Control word UINT 1
S First source word WORD Variable
D First destination word WORD Variable
15 8 0 3 7 4
First bit in S ( ): 0 to F
D+16 max.
(0 to 15) Number of bits (n): 00 to FF (0 to 255)
S+16 max.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- S, D ---
OK
Error Flag P_ER OFF

XFRB(062) transfers up to 255 consecutive bits from the source words (beginning with bit l 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 dia- gram.
8 15 m l
0 3 4 7
Hint
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.
S
D C:D100 1 4 8 15 0 6 0 3 4 7
W100
0 1 2 3 4 5 6 14 15 7 8
W1
D:W100
W101

Instruction Mnemonic Variations Function
code Function
BLOCK TRANSFER XFER @XFER 070 Transfers the specified number of consecutive words.
XFER(070)
N
N: Number of words
S: First source word
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Number of words UINT 1
S First source word WORD Variable
D First destination word WORD Variable
Specifies the number of words to be transferred. The possible range for N is 0000 to FFFF (0 to 65,535 decimal).
S+(N-1)
D+(N-1)
Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- S, D ---
OK
Error Flag P_ER OFF

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)).
S+(N-1)
D+(N-1)
Hint
Sample Program
When CIO 0.00 is ON in the following example, the 10 words D100 through D109 are copied to D200 through D209.

Instruction Mnemonic Variations Function
code Function
BLOCK SET BSET @BSET 071 Copies the same word to a range of consecutive words.
BSET(071)
S
S: Source word
E: End word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word WORD 1
St Starting word WORD Variable
E End word WORD Variable
Specifies the first word in the destination range.
Specifies the last word in the destination range.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- St, E ---
OK
Error Flag P_ER • ON if St is greater than E.

BSET(071) copies the same source word (S) to all of the destination words in the range St to E.
Destination words Source word
E
Precautions
BSET
BSET
Sample program
When CIO 0.00 is ON in the following example, the source data in D100 is copied to D200 through D209.
S
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4

Instruction Mnemonic Variations Function
code Function
DATA EXCHANGE XCHG @XCHG 073 Exchanges the contents of the two specified words.
XCHG(073)
E1
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
E1 First exchange word WORD 1
E2 Second exchange word WORD 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
E1,E2 OK ---
Error Flag P_ER Unchanged
Equals Flag P_EQ Unchanged
Negative Flag P_N Unchanged
XCHG(073) exchanges the contents of E1 and E2.
Symbol · Area · Name Label Operation

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.
1st XFER(070) operation
2nd XFER(070) operation
3rd XFER(070) operation
When CIO 0.00 is ON in this example, the con- tent of D100 is exchanged with the content of D200.
D100 D200
1 2 3 4
D100 D200
A B C D 1 2 3 4
Buffer

Instruction Mnemonic Variations Function
code Function
SINGLE WORD DISTRIBUTE DIST @DIST 080 Transfers the source word to a destination word calculated by adding an offset value to the base address.
DIST(080)
S
S: Source word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word WORD 1
Bs Destination base address WORD 1
Of Offset UINT 1
Of: Offset
The offset can be any value from 0000 to FFFF (0 to 65,535 decimal).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- Bs ---
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the source data is 0000.
Negative Flag P_N • ON if the leftmost bit of the source data is 1.

DIST(080) copies S to the destination word calculated by adding Of to Bs. n
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.
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.
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 chang- ing the offset in D300.
DIST
S Copied by DIST(080).
Bs:D200

Instruction Mnemonic Variations Function
code Function
DATA COLLECT COLL @COLL 081 Transfers the source word (calculated by adding an offset value to the base address) to the desti- nation word.
COLL(081)
D: Destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Bs Source base address WORD 1
Of Offset WORD 1
D Destination word WORD 1
Of: Offset
The offset can be any value from 0000 to FFFF (0 to 65,535 decimal).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- Of OK
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the source data is 0000.
Negative Flag P_N • ON if the leftmost bit of the source data is 1.

COLL(081) copies the source word (calculated by adding Of to Bs) to the destination word. Bs
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.
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.
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.
COLL
Bs:D100
Copied by COLL(081).

SFT

SHIFT REGISTER SFT --- 010 Operates a shift register.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
St Starting word UINT Variable
E End word UINT Variable
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
St,E OK OK OK ---
Error Flag P_ER OFF

Area · Name Label Operation

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.
E: 130CH 129CH 128CH
0 15 0 15 0 15 14 14 14

Data Shift Instructions
code Function
REVERSIBLE SHIFT REGIS- TER SFTR @SFTR 084 Creates a shift register that shifts data to either the right or the left.
SFTR(084)
C: Control word
E: End word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C Control word UINT 1
St Starting word UINT Variable
E End word UINT Variable
15 14 13 12
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
C,St,E OK ---
Error Flag P_ER • ON when St is greater than E.
Carry Flag P_CY • ON when 1 is shifted into it.

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)

0 15 CY 0 15 0 15 E St
0 15 CY 0 15 0 15 E St Shift direction
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).

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.
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.
0
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 start- ing 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.
1/0 0 15 CY Data input
Data input · 1/0

Data Shift Instructions
code Function
WORD SHIFT WSFT @WSFT 016 Shifts data between St and E in word units.

Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK


Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
Error Flag P_ER • ON when St is greater than E.
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.
0 15 0 15 0 15 0 15 S
Name Label Operation · E St · Lost

When CIO 0.00 is ON, data from CIO 100 through CIO 102 will be shifted one word toward E. The con- tents of W0 will be stored in CIO 100 and the contents of CIO 102 will be lost.
S
W0
E
E: CIO 100 St: CIO 101 St: CIO 102
St · Lost


ARITHMETIC SHIFT LEFT ASL @ASL 025 Shifts the contents of Wd one bit to the left.
Operand Description Data type Size
Wd Word UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---

Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
Negative Flag P_N • ON when the leftmost bit is 1 as a result of the shift.
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).

1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
0 0 1 1 0 0 0 1 0 0 0 1 0 1
Area

code Function
ARITHMETIC SHIFT RIGHT ASR @ASL 026 Shifts the contents of Wd one bit to the right.

Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Wd Word UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---

Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
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).

1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0
Area

Data Shift Instructions
code Function
ROTATE LEFT ROL @ROL 027 Shifts all Wd bits one bit to the left
including the Carry Flag (CY).
ROL(027)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Wd Word UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
Negative Flag P_N • ON when the leftmost bit is 1 as a result of the shift.
ROL(027) shifts all bits of Wd including the Carry Flag (CY) to the left (from rightmost bit to leftmost bit).
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.

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 con- tents will be shifted to CIO 100.00.
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
1 0 0 1 0 0 0 1 0 0 0 1 0 1
Wd · Instruction executed once

Data Shift Instructions
code Function
ROTATE RIGHT ROR @ROR 028 Shifts all Wd bits one bit to the right including the Carry Flag (CY).
ROR(028)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
Wd Word UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
Negative Flag P_N • ON when the leftmost bit is 1 as a result of the shift.
ROR(028) shifts all bits of Wd including the Carry Flag (CY) to the right (from leftmost bit to rightmost bit).
0 15 14 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.

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.
0 15 14 1
1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0
0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
Wd · Instruction executed once


ONE DIGIT SHIFT LEFT SLD @SLD 074 Shifts data by one digit (4 bits) to the left.
ONE DIGIT SHIFT RIGHT SRD @SRD 075 Shifts data by one digit (4 bits) to the right.

Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
St Starting Word UINT Variable
E End Word UINT Variable
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
St,E OK ---
Error Flag P_ER • ON when St is greater than E.
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.

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.
E
15 12 11 8 7 4 3 0 15 12 11 8 7 4 3 0 15 12 11 8 7 4 3 0
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.
E
15 12 11 8 7 4 3 0 15 12 11 8 7 4 3 0 15 12 11 8 7 4 3 0

Data Shift Instructions
code Function
SHIFT N-BITS LEFT NASL @NASL 580 Shifts the specified 16 bits of word data to the left by the specified number of bits.
DOUBLE SHIFT N-BITS LEFT NSLL @NSLL 582 Shifts the specified 32 bits of word data to the left by the specified number of bits.
NASL(580)
NSLL(582)
D: Shift word
D: Shift word
C: Control word
C: Control word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
D Shift Word UINT UDINT 1 2
C Control word UINT UDINT 1 1
15 8 0 11 7 12 C
Always 0.
Always 0. Data shifted into register 0 Hex: 0 shifted in 8 Hex: Contents of rightmost bit shifted in
Data shifted into register 0 Hex: 0 shifted in 8 Hex: Contents of rightmost bit shifted in
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
D OK ---
C OK --- --- ---


Error Flag P_ER • ON when the control word C (the number of bits to shift) is not within range.
Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
Negative Flag P_N • ON when the leftmost bit is 1 as a result of the shift.
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.

C 0 8 11 12 15 0 3 4 7
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.

C 0 8 11 12 15 0 3 4 7

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 con- tents of bit 0 of CIO 100 is copied into bits from which data was shifted and the contents of the right- most bit which was shifted out of range is shifted into the Carry Flag (CY). All other data is lost.

Data shifted into register 8 Hex: Contents of right-most bit shifted in
0 15 14 13 12 10 11 4 3 9 8 2 1
100 1
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 con- tents 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.

Data shifted into register 8 Hex: Contents of right-most bit shifted in
101 1 1 0 0 1 0 0 1
1 0 0 1 0 0 1 0 0
101 1 0 0 1 0 0 1 0 1 0
100 1

code Function
SHIFT N-BITS RIGHT NASR @NASR 581 Shifts the specified 16 bits of word data to the right by the specified number of bits.
DOUBLE SHIFT N-BITS RIGHT NSRL @NSRL 583 Shifts the specified 32 bits of word data to the right by the specified number of bits.
NASR(581)
NSRL(583)
D: Shift word
D: Shift word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
D Shift Word UINT UDINT 1 2
C Control word UINT UDINT 1 1
15 8 0 11 7 12
Always 0.
Always 0.
Data shifted into register 0 Hex: 0 shifted in 8 Hex: Contents of rightmost bit shifted in
Data shifted into register 0 Hex: 0 shifted in 8 Hex: Contents of rightmost bit shifted in
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK


Error Flag P_ER • ON when the control word C (the number of bits to shift) is not within range.
Equals Flag P_EQ • ON when the shift result is 0.
Carry Flag P_CY • ON when 1 is shifted into the Carry Flag (CY).
Negative Flag P_N • ON when the leftmost bit is 1 as a result of the shift.
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.

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.

C 0 8 11 12 15 0 3 4 7

W0
12 15 0 7 4 3
Always 0.
Data shifted into register 8 Hex: Contents of leftmost bit shifted in
1 0 0 1 0 0
0 15 14 13 12 10 11 4 3 9 8 2 1
100 1
1 0 0 1 0 0
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.
W0
12 15 0 7 4 3
Always 0.
Data shifted into register 8 Hex: Contents of leftmost bit shifted in
8 7 0 15 8 7 9
1 0 0 1 0 0
0 1 0 0 0 1 0 0 0
0 0 0 1 0 0
15 8 7 6 0
101 0 1 0 0 0 1 0 0 1 0 CY 1
100 1
1 0 0 1 0 0
0 0 0 1 0 0
Leftmost bit Lost · Leftmost bit Lost

++/++L
Instruction Mnemonic Variations Function
code Function
INCREMENT BINARY ++ @++ 590 Increments the 4-digit hexadecimal content of the specified word by 1.
DOUBLE INCREMENT BINARY ++L @++L 591 Increments the 8-digit hexadecimal content of the specified words by 1.
++ + +L
++L(591)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the result is 0000/0000 0000 after execution.
Carry Flag P_CY • ON if a digit in Wd/Wd+1 or Wd went from F to 0 during execution.
Negative Flag P_N • ON if bit 15 of Wd/Wd+1 is ON after execution.

++
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 condi- tion has gone from OFF to ON.
The ++L(591) instruction adds 1 to the 8-digit hexa- decimal 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 execu- tion condition has gone from OFF to ON.
Wd Wd+1 Wd+1 Wd +1
In the following example, the content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.
Incremented every cycle while CIO 0.00 is ON.
In the following example, the content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.
Incremented every cycle while CIO 0.00 is ON.
0 F 0 0 0 1 0
: Execution of ++(590) or ++L(591)
Increment

The up-differentiated variation is used in the following example, so the content of D100 will be incre- mented by 1 only when CIO 0.00 has gone from OFF to ON.
Incremented every cycle while CIO 0.00 is ON.
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.
Incremented only for up-differentiation.
0 F 0 0 0 1 0
: Execution of @++(590) or @++L(591)

code Function
DECREMENT BINARY -- @-- 592 Decrements the 4-digit hexadecimal content of the specified word by 1.
DOUBLE DECREMENT BINARY --L @--L 593 Decrements the 8-digit hexadecimal content of the specified words by 1.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
TR bits CIO WR HR AR T C DM @DM *DM
Word addresses Indirect DM addresses
Wd OK ---
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the result is 0000/0000 0000 after execution.
Carry Flag P_CY • ON if a digit in Wd/Wd+1 or Wd went from 0 to F during execution.
Negative Flag P_N • ON if bit 15 of Wd/Wd+1 is ON after execution.

--
The --(592) instruction subtracts 1 from the binary content of Wd. The specified word will be decre- mented by 1 every cycle as long as the execution condition of --(592) is ON. When the up-differenti- ated variation of this instruction (@ --(592)) is used, the specified word is decremented only when the execution condition has gone from OFF to ON.
--L
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.
Wd Wd+1 Wd+1 Wd -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 decre- mented by 1 only when CIO 0.00 has gone from OFF to ON.
Decremented every cycle while CIO 0.00 is ON.
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.
Decremented every cycle while CIO 0.00 is ON.
0 0 0 1 0 F
: Execution of --L(593)
Decrement
-1 Wd Wd

In the following example, the content of D100 will be decremented by 1 every cycle as long as CIO 0.00 is ON.
Decremented every cycle while CIO 0.00 is ON.
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.
Decremented only for up-differentiation.
0 0 0 1 0 F
: Execution of @--L(593)

Increment/Decrement Instructions
code Function
INCREMENT BCD ++B @++B 594 Increments the 4-digit BCD content of the speci- fied word by 1.
DOUBLE INCREMENT BCD ++BL @++BL 595 Increments the 8-digit BCD content of the speci- fied words by 1.
++B(594)
++BL(595)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Word addresses Indirect DM addresses
TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---
Error Flag P_ER • ON if the content of Wd/Wd+1 and Wd is not BCD.
Equals Flag P_EQ • ON if the result is 0000/0000 0000 after execution.
Carry Flag P_CY • ON if a digit in Wd/Wd+1 or Wd went from 9 to 0 during execution.

++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 condi- tion has gone from OFF to ON.
The ++BL(595) instruction adds 1 to the 8-digit BCD content of Wd+1 and Wd. The content of the speci- fied 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 instruc- tion (@++BL(595)) is used, the content of the speci- fied words is incremented only when the execution condition has gone from OFF to ON.
Wd Wd+1 Wd+1 Wd +1
In the following example, the BCD content of D100 will be incremented by 1 every cycle as long as CIO 0.00 is ON.
Incremented every cycle while CIO 0.00 is ON.
0 0 2 0
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.
Incremented every cycle while CIO 0.00 is ON.
0 9 0 0 0 1 0
: Execution of ++B(594) / ++BL(595)
Increment
+1 Wd Wd · +1 · +1

The up-differentiated variation is used in the following example, so the content of D100 will be incre- mented by 1 only when CIO 0.00 has gone from OFF to ON.
@ ++B
Incremented only for up-differentiation.
0 0 2 0
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.
Incremented only for up-differentiation.
0 9 0 0 0 1 0
: Execution of @++B(594) or @++BL(595)
+1 · +1 · Increment Increment


DECREMENT BCD --B @--B 596 Decrements the 4-digit BCD content of the speci- fied word by 1.
DOUBLE DECREMENT BCD --BL @--BL 597 Decrements the 8-digit BCD content of the speci- fied words by 1.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
TR bits CIO WR HR AR T C DM @DM *DM
Word addresses Indirect DM addresses
Wd OK ---

Error Flag P_ER • ON if the content of Wd/Wd+1 and Wd is not BCD.
Equals Flag P_EQ • ON if the result is 0000/0000 0000 after execution.
Carry Flag P_CY • ON if a digit in Wd/Wd+1 or Wd went from 0 to 9 during execution.
--B
The --B(596) instruction subtracts 1 from the BCD content of Wd. The specified word will be decre- mented by 1 every cycle as long as the execution condition of --B(596) is ON. When the up-differenti- ated variation of this instruction (@--B(596)) is used, the specified word is decremented only when the exe- cution condition has gone from OFF to ON.
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 condi- tion has gone from OFF to ON.
Wd Wd+1 Wd+1 Wd -1

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

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.

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

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.

0 0 0 1 0 9

+/+L
code Function
SIGNED BINARY ADD WITHOUT CARRY + @+ 400 Adds 4-digit (single-word) hexadecimal data and/or constants.
DOUBLE SIGNED BINARY ADD WITHOUT CARRY +L @+L 401 Adds 8-digit (double-word) hexadecimal data and/or constants.
+L(401)
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
+: Augend word
+: Addend word
+: Result word
INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK

+ +L
Error Flag P_ER OFF OFF
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the addition results in a carry.
Overflow Flag P_OF • ON when the result of adding two positive num- bers is in the range 8000 to FFFF hex.
Underflow Flag P_UF • ON when the result of adding two negative num- bers is in the range 0000 to 7FFF hex.
Negative Flag P_N • ON when the leftmost bit of the result is 1.
Function +
+(400) adds the binary values in Au and Ad and outputs the result to R.
(Signed binary) CY will turn ON when there is a carry.
+L
+L(401) adds the binary values in Au and Au+1 and Ad and Ad+1 and outputs the result to R.
(Signed binary) CY will turn ON when there is a carry.
Sample program
+ 0.00
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.
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.

code Function
SIGNED BINARY ADD WITH CARRY +C @+C 402 Adds 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
DOUBLE SIGNED BINARY ADD WITH CARRY +CL @+CL 403 Adds 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
+C(402)
+CL(403)
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER OFF OFF
Equals Flag P_EQ • ON when the addition result is 0.
Carry Flag P_CY • ON when the addition results in a carry.
Overflow Flag P_OF • ON when the addition result of adding two positive numbers and CY is in the range 8000 to FFFF hex.
Underflow Flag P_UF • ON when the addition result of adding two nega- tive numbers and CY is in the range 0000 to 7FFF hex.
Negative Flag P_N • ON when the leftmost bit of the result is 1.

+C(402) adds the binary values in Au, Ad, and CY and outputs the result to R.
(Signed binary) CY will turn ON when there is a carry.
+CL
+CL(403) adds the binary values in Au and Au+1, Ad and Ad+1, and CY and outputs the result to R.
+ CY
(Signed binary) CY will turn ON when there is a carry.
R+1
Hint
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.
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.

code Function
BCD ADD WITHOUT CARRY +B @+B 404 Adds 4-digit (single-word) BCD data and/or con- stants.
DOUBLE BCD ADD WITHOUT CARRY +BL @+BL 405 Adds 8-digit (double-word) BCD data and/or con- stants.
+B(404)
+BL(405)
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Au is not BCD.
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the addition results in a carry.

+B(404) adds the BCD values in Au and Ad and outputs the result to R.
(BCD)
CY will turn ON when there is a carry.
(BCD)
+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.
+B/+BL
(BCD)
CY will turn ON when there is a carry.
(BCD) R+1
Sample program
+B
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.
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.

code Function
BCD ADD WITH CARRY +BC @+BC 406 Adds 4-digit (single-word) BCD data and/or con- stants with the Carry Flag (CY).
DOUBLE BCD ADD WITH CARRY +BCL @+BCL 407 Adds 8-digit (double-word) BCD data and/or con- stants with the Carry Flag (CY).
+BC(406)
+BCL(407)
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Au is not BCD.
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the addition results in a carry.

+BC(406) adds BCD values in Au, Ad, and CY and outputs the result to R.
(BCD)
+ CY
CY will turn ON when there is a carry.
(BCD)
+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.
(BCD)
(BCD)
CY
CY will turn ON when there is a carry.
R+1
(BCD)
Hint
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.
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.

code Function
SIGNED BINARY SUBTRACT WITHOUT CARRY – @– 410 Subtracts 4-digit (single-word) hexadecimal data and/or constants.
–L @–L 411 Subtracts 8-digit (double-word) hexadecimal data and/or constants.
R: Result word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
–: Minuend word
–: Subtrahend word
–: Result word
INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER OFF OFF
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the subtraction results in a borrow.
Overflow Flag P_OF • ON when the result of subtracting a negative num- ber from a positive number is in the range 8000 to FFFF hex.
Underflow Flag P_UF • ON when the result of subtracting a negative num- ber from a positive number is in the range 0000 to 7FFF hex.
Negative Flag P_N • ON when the leftmost bit of the result is 1.

–(400) subtracts the binary values in Su from Mi and outputs the result to R. When the result is nega- tive, it is output to R as a 2’s complement.
(Signed binary) CY will turn ON when there is a borrow.
–L
–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.
(Signed binary) CY will turn ON when there is a borrow.
R+1

FFFF Hex 0001 Hex
Since the Negative Flag is ON, the result (FFFE hex) is a negative value (2’s complement) and is thus -2.
FFFE Hex 65534 Note 2
Since the Carry Flag is OFF, the result (FFFE hex) is an unsigned positive value of 65534.
FFFD Hex FFFF Hex
Since the Negative Flag is ON, the result (FFFE hex) is a negative value (2’s complement) and is thus -2.
FFFE Hex 65534 Note 4
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.
− L
P_CY
− L
P_CY
SET
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 nega- tive, the instruction at (2) will be executed, and the actual result will then be output to D101 and D100.

A
Symbol Math Instructions
A
E
CY
R+1: D101 R+1: D100 The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000 to obtain the actual number.
6 8 5 1 F 9 2 D 1
0
CY
R+1: D101 R+1: D100
–/–L
9 7 A E 0 6 D 3 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.
R+1: D101 R+1: D100
9 7 A E 0 6 D 3 1

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

code Function
SIGNED BINARY SUBTRACT WITH CARRY –C @–C 412 Subtracts 4-digit (single-word) hexadecimal data and/or constants with the Carry Flag (CY).
DOUBLE SIGNED BINARY SUBTRACT WITH CARRY –CL @–CL 413 Subtracts 8-digit (double-word) hexadecimal data and/or constants with the Carry Flag (CY).
R: Result word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER OFF OFF
Equals Flag P_EQ • ON when the subtraction result is 0.
Carry Flag P_CY • ON when the subtraction results in a borrow.
Overflow Flag P_OF • ON when the result of subtracting a negative num- ber and CY from a positive number is in the range 8000 to FFFF hex.
Underflow Flag P_UF • ON when the result of subtracting a positive num- ber and CY from a negative number is in the range 0000 to 7FFF hex.
Negative Flag P_N • ON when the leftmost bit of the result is 1.

–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.
(Signed binary) CY will turn ON when there is a borrow.
–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.
CY
(Signed binary) CY will turn ON when there is a borrow.
R+1
Hint
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.
0.00 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.
0.00 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

code Function
BCD SUBTRACT WITHOUT CARRY –B @–B 414 Subtracts 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD SUBTRACT WITHOUT CARRY –BL @–BL 415 Subtracts 8-digit (double-word) BCD data and/or constants.
–B(414)
–BL(415)
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Mi is not BCD.
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the subtraction results in a borrow.

–B(414) subtracts the BCD values in Su from Mi and outputs the result to R. If the result of the subtrac- tion is negative, the result is output as a 10’s complement.
(BCD)
CY will turn ON when there is a borrow.
(BCD)
–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.
(BCD)
(BCD)
CY will turn ON when there is a borrow.
(BCD)
Hint
− BL
P_CY
− BL
P_CY
SET
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 nega- tive, so the instruction at (2) will be executed, and the true value will then be output to D101 and D100.

R+1: D101 R+1: D100
The Carry Flag (CY) is ON, so the result is subtracted from 0000 0000.
9 2 5 1 1 3 1 9 1
0
9 2 5 1 1 3 1 9
R+1: D101 R+1: D100
0 7 4 8 8 6 8 1 1
0 9 5 8 3 9 6 0
1 7 0 7 2 6 4 1
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.
R+1: D101 R+1: D100
0 7 4 8 8 6 8 1
0.00 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.
0.00 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
09583960+(100000000-17072641) · 00000000+(100000000-92511319)

Instruction Mnemonic Variations Function
code Function
BCD SUBTRACT WITH CARRY –BC @–BC 416 Subtracts 4-digit (single-word) BCD data and/or constants with the Carry Flag (CY).
DOUBLE BCD SUBTRACT WITH CARRY –BCL @–BCL 417 Subtracts 8-digit (double-word) BCD data and/or constants with the Carry Flag (CY).
–BC(416)
–BCL(417)
R
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Mi is not BCD.
Equals Flag P_EQ • ON when the result is 0.
Carry Flag P_CY • ON when the subtraction results in a borrow.

–BC(416) subtracts BCD values in Su and CY from Mi and outputs the result to R. If the result is nega- tive, it is output to R as a 10’s complement.
(BCD)
– CY
CY will turn ON when there is a borrow.
(BCD)
–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.
(BCD)
CY
CY will turn ON when there is a borrow.
R+1
(BCD)
Hint
0.00 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.
0.00 When CIO 0.00 is ON in thefollowing 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

Instruction Mnemonic Variations Function
code Function
SIGNED BINARY MULTIPLY * @* 420 Multiplies 4-digit signed hexadecimal data and/or constants.
DOUBLE SIGNED BINARY MULTIPLY *L @*L 421 Multiplies 8-digit signed hexadecimal data and/or constants.
*L(421)
R
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
*: Multiplicand word
*: Multiplier word
R First result word DINT LINT 2 4
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER OFF OFF
Equals Flag P_EQ • ON when the result is 0.
Negative Flag P_N • ON when the leftmost bit of the result is 1.

*(420) multiplies the signed binary values in Md and Mr and outputs the result to R, R+1.
*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.
Md + 1 Md
Mr + 1 Mr
R + 1 R R + 3 R + 2
0.00 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.
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.

Instruction Mnemonic Variations Function
code Function
BCD MULTIPLY *B @*B 424 Multiplies 4-digit (single-word) BCD data and/or constants.
DOUBLE BCD MULTIPLY *BL @*BL 425 Multiplies 8-digit (double-word) BCD data and/or constants.
*B(424)
*BL(425)
R
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
R First result word DWORD LWORD 2 4
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Md is not BCD.
Equals Flag P_EQ • ON when the result is 0.

*B(424) multiplies the BCD content of Md and Mr and outputs the result to R, R+1.
(BCD)
R + 1 R
(BCD)
*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.
Md + 1 Md
Mr + 1 Mr
R + 1 R R + 3 R + 2
Sample program
0.00 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.
0.00 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.

Instruction Mnemonic Variations Function
code Function
SIGNED BINARY DIVIDE / @/ 430 Divides 4-digit (single-word) signed hexadecimal data and/or constants.
DOUBLE SIGNED BINARY DIVIDE /L @/L 431 Divides 8-digit (double-word) signed hexadecimal data and/or constants.
/L(431)
R
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
/: Dividend word
/: Divisor word
R First result word DWORD LWORD 2 4
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when the divisor is 0.
Equals Flag P_EQ • ON when as a result of the division, R/R+1, R is 0.
Negative Flag P_N • ON when the leftmost bit of the R/R+1, R is 1.

/(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.
/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.
Dd + 1 Dd
Dr + 1 Dr
R + 1 R R + 3 R + 2
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.
0.00 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.

Instruction Mnemonic Variations Function
code Function
BCD DIVIDE /B @/B 434 Divides 4-digit (single-word) BCD data and/or con- stants.
DOUBLE BCD DIVIDE /BL @/BL 435 Divides 8-digit (double-word) BCD data and/or constants.
/B(434)
/BL(435)
R
R: Result word
R: 1st result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
R First result word DWORD LWORD 2 4
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R ---
OK
Error Flag P_ER • ON when Dd is not BCD.
Equals Flag P_EQ • ON when as a result of the division R is 0.

/B(434) divides the BCD content of Dd by those of Dr and outputs the quotient to R and the remainder to R+1.
÷
(BCD)
R +1 R
(BCD)
/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.
÷
(BCD)
R + 1 R R + 3 R + 2
Sample program
/B
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.
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.

BIN/BINL
Instruction Mnemonic Variations Function
code Function
BCD TO BINARY BIN @BIN 023 Converts BCD data to binary data.
DOUBLE BCD TO DOUBLE BINARY BINL @BINL 058 Converts 8-digit BCD data to 8-digit hexadecimal (32-bit binary) data.
BIN/BINL
BIN(023)
BINL(058)
S
S: Source word
S: First source word
R: Result word
R: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S,R OK ---
Error Flag P_ER • ON if the content of S is not BCD.
Equals Flag P_EQ • ON if the result is 0000.
Negative Flag P_N OFF OFF

BIN
BIN(023) converts the BCD data in S to binary data and writes the result to R. The following diagram shows an example BCD-to-binary conversion.
0 3 4 7 8 11 12 15 0 3 4 7 8 11 12 15
R S 3 4 5 2 0 D 7 C
×103 ×102 ×101 ×100 ×163 ×162 ×161 ×160
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. The following diagram shows an example of 8-digit BCD-to-binary conversion.
R R+1
(BCD) (BCD)
(BIN) (BIN)
R+1 R
S+1 S
×103×102×101×100 ×107×106×105×104
×163×162×161×160 ×167×166×165×164
When CIO 0.00 is ON in the following example, the 8-digit BCD value in CIO 0010 and CIO 0011 is con- verted to hexadecimal and stored in D200 and D201.
S+1 : CIO 11 S : CIO 10
200050=3×164+13×162+7×161+2×160

Instruction Mnemonic Variations Function
code Function
BINARY TO BCD BCD @BCD 024 Converts a word of binary data to a word of BCD data.
BCDL @BCDL 059 Converts 8-digit hexadecimal (32-bit binary) data to 8-digit BCD data.
BCD BCDL
BCD(024)
BCDL(059)
S: Source word
S
S: First source word
D: Result word
D: First result word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S,R OK ---
Error Flag P_ER • ON if the content of S exceeds 270F (9999 dec- imal).
Equals Flag P_EQ • ON if the result is 0000.

BCD
BCD(024) converts the binary data in S to BCD data and writes the result to R. The following diagram shows an example BCD-to-binary conversion.
0 3 4 7 8 11 12 15 0 3 4 7 8 11 12 15
R S 1 0 E C 4 3 3 2
×163 ×162 ×161 ×160
×103 ×102 ×101 ×100
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. The following diagram shows an example of 8-digit BCD-to-binary conversion.
R R+1
(BCD) (BCD)
(BIN) (BIN)
S+1 S R+1 R
0 0 D 3 2 A 0 2 0 2 6 1 9 0 3 9
×163×162×161×160 ×167×166×165×164
×103×102×101×100 ×107×106×105×104
When CIO 0.00 is ON in the following example, the hexadecimal value in CIO 11 and CIO 10 is con- verted to a BCD value and stored in D100 and D101.
S+1 : CIO 11 S: CIO 10
MBS LSB
0 ×167
3 ×163
2×165+13×164+3×163+2×162+10=2961930
× 10 0 MBS
0 ×107
1 ×103

Instruction Mnemonic Variations Function
code Function
2’S COMPLEMENT NEG @NEG 160 Calculates the 2’s complement of a word of hexa- decimal data.
NEG(160)
S
S: Source word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word WORD 1
R Result word UINT 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if the result is 0000/0000 0000.
Negative Flag P_N • ON if bit 15 of the result is ON.
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)
Symbol · Area · Name Label Operation

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.
0
1 2 3 4
E D C C

Instruction Mnemonic Variations Function
code Function
Reads 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 corre- sponding bit in the result word, and turns OFF all other bits in the result word.
MLPX
MLPX(076)
S
S: Source word
C: Control word
R
R: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word UINT 1
C Control word UINT 1
R First result word UINT Variable
S: Source Word R: First Result Word
8 11 12 15
0 3 4 7
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
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)
8 11 12 15
0 3 4 7
Specifies the first digit/byte to be converted 0 to 3 (digit 0 to 3)
Number of digits/bytes to be converted 0 to 3 (1 to 4 digits)
Always 0.
Symbol · l n

S: Source Word R: First Result Word
8 15 Digit 1 Digit 0
Digits from the starting digit going left are decoded (Returns to digit 0 after digit 1)
8 11 12 15
0 3 4 7
Specifies the first digit/byte to be converted 0 or 1 (byte 0 or 1)
Number of digits/bytes to be converted 0 or 1 (1 or 2 bytes)
Always 0.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- C OK
OK
Flags
Error Flag P_ER • ON if C is not within the specified ranges.
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.
C 0 l n
When the leftmost digit of C is 0, MLPX(076) takes the value of the speci- fied 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.
R=1 (Convert 2 digits.)
n=2 (Start with third digit.)
4-to-16 bit decoding (Bit m of R is turned ON.)
m p 0 15

C 1 l n
When the leftmost digit of C is 1, MLPX(076) takes the value of the speci- fied 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.
R=1 (Convert 2 bytes.)
n=1 (Start with second byte.)
8-to-256 bit decoding (Bit m of R to R+15 is turned ON.)
224 239 240 255
MLPX
P
R+30 R+31
Hint
As shown at right, 4 to 16 decoding con- sists of taking the 4-bit binary value as the bit number and setting 1 in that bit num- ber and 0 in the other bit numbers of the 16 bits.
As shown at right, 8 to 256 decoding con- sists of taking the 8-bit binary value as the bit number and setting 1 in that bit num- ber and 0 in the other bit numbers of the 256 bits.
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.

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.
S
0 3 4 7 8 15 12 11
1 2 0 0 C: #
S: 100 Digits
0 1 2 3 4 5 6 7 8 9 15 14 13 12 11
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.
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.
S
R
0 3 4 7 8 15 1211
Byte 0 Byte 1
A 1 D 2
0 1 2 3 4 5 6 7 8 9 1514131211
Byte 1 contains 2D, so bit 13 (D) of R+2 is turned ON.
Byte 0 contains 1A, so bit 10 (A) of R+1 is turned ON.
#0021 · #1011

Conversion Instructions
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
Digit 2 Digit 1 Digit 0 Digit 3 Digit 2 Digit 1 Digit 0 Digit 3 Digit 2 Digit 1 Digit 0
S
R
R
R
R+1
R+1
R+1
R+2
R+2
R+3
R+3
8 11 12 15 0
8 11 12 15 0
S
Digit 1 Digit 0 Digit 1 Digit 0
S Digit 3

code Function
FInds 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.
DMPX
DMPX(077)
S
S: First source word
R: Result word
C: Control word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word UINT Variable
R Result word UINT 1
C Control word UINT 1
S: First Source Word
R: Result 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
8 11 12 15
0 3 4 7
R Digit 3 Digit 2
Digit 1 Digit 0
The results of encoding of S to S+3 are stored from the starting digit going left (returns to digit 0 after digit 3).
area.
8 11 12 15
0 3 4 7
Specifies the first digit/byte to receive converted data. 0 to 3 (digit 0 to 3)
Number of digits/bytes to be converted 0 to 3 (1 to 4 digits)
Symbol · l n

S: First Source Word
R: Result Word
8 15 Digit 1 Digit 0
S+15 to S: 1st digit of digits to be encoded S+31 to S+16: 2nd digit of digits to be encoded
The results of encoding of S to S+15, S+16 to S+31 are stored from the starting digit going left (returns to digit 0 after digit 1).
data area.
8 11 12 15
0 3 4 7
Specifies the first digit/byte to receive converted data. 0 or 1 (byte 0 or 1)
Number of digits/bytes to be converted 0 or 1 (1 or 2bytes)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- C OK
OK
Error Flag P_ER • ON if any of the source words contains 0000 hex (i.e., no bit to encode).
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.
0 0 l n
FInds leftmost bit (Highest bit address)
2 words.)
16-to-4 bit decoding (Location of leftmost bit (m) is written to R.)
n=2 (Start with digit 2.)

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.
0 I/0 l n
R=0 (Convert one 16-word range.)
0 15 16 31
S+1
224 239 240 255
Finds leftmost bit (Highest bit address)
256-to-8 bit decoding (The location of the leftmost bit in the 16-word range (m) is written to R.)
n=1 (Start with byte 1.)
Hint
As shown at right, 16 to 4 encoding con- sists 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.
As shown at right, 256 to 8 encoding con- sists 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.
Rightmost ON bit Leftmost ON bit
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.

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).
DMPX
S
R
0 3 4 7 8 15 12 11 1 2 0 0
DMPX(077) finds the leftmost ON bits.
0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10
Starting digit (Digit 1)
0 1 2 3
0 3 4 7 8 15 12 11
5 A 2
Example of multi-digit decoding
S
S
S
S+1
S+1
S+1
S+2
S+3
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
R Digit 1 Digit 3 Digit 1 Digit 3
Digit 2 Digit 0
Digit 2 Digit 0
8 11 12 15 0 3 4 7
Digit 1 Digit 3
Digit 2 Digit 0
S
S+1
S+2
S+3
8 11 12 15 0 3 4 7
Digit 1 Digit 3
Digit 2 Digit 0
#0021 · Digits

S
S
S+15
S+15
S+16
S+16
S+31
S+31
Digit 1 Digit 0 Digit 1 Digit 0 S
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.
⇓
DMPX(077) D0 D100 #0000
DMPX(077) D1 D100 #0001
DMPX(077) D2 D100 #0002
DMPX(077) D3 D100 #0003

Instruction Mnemonic Variations Function
code Function
ASCII CONVERT ASC @ASC 086 Converts 4-bit hexadecimal digits in the source word into their 8-bit ASCII equivalents.
ASC(086)
S
S: Source word
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word UINT 1
DI Digit designator UINT 1
D First destination word UINT Variable
8 11 12 15 Digit 1 Digit 0
0 3 4 7
8 15 Leftmost byte Rightmost byte
S Digit 3 Digit 2
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)
Leftmost byte Rightmost byte
Leftmost byte Rightmost 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.
data area.
The digit designator specifies various parameters for the conversion, as shown in the following dia- gram.
Specifies the first digit in S to be converted (0 to 3).
Number of digits to be converted (0 to 3)
First byte of D to be used.
Symbol

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- DI OK
OK
Error Flag P_ER • ON if the content of Di is not within the specified ranges.
ASC(086) treats the contents of S as 4 hexadec- imal 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 pos- sible in the leftmost bit of the ASCII code data, and this can be converted to an odd or even par- ity bit (the number of bits that are 1 of the eight bits is adjusted to odd or even).
0 1/0 n m
First digit to convert
HEX
Number of digits (n+1)
Right (0) Left (1)

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 read- ing) = digit 1.
ASC
S
0 3 4 7 8 15 12 11 1 2 1 0
0 1 2 3
0 3 4 7 8 15 12 11
HEX
Starting byte (leftmost byte)
0 7 8 15 33
Example of ASCII code conversion
Content of conversion data digits Conversion output data
Value Bit content Code (MSB) bit content (LSB)
0 #30 * 0 1 1 0
1 0 0 0 1 #31 * 0 1 1 0 0 0 1
2 0 0 1 0 #32 * 0 1 1 0 0 1 0
3 0 0 1 1 #33 * 0 1 1 0 0 1 1
4 0 1 0 0 #34 * 0 1 1 0 1 0 0
5 0 1 0 1 #35 * 0 1 1 0 1 0 1
6 0 1 1 0 #36 * 0 1 1 0 1 1 0
7 0 1 1 1 #37 * 0 1 1 0 1 1 1
8 1 0 0 0 #38 * 0 1 1 1 0 0 0
9 1 0 0 1 #39 * 0 1 1 1 0 0 1
A 1 0 1 0 #41 * 1 0 1
B 1 0 1 1 #42 * 1 0 1 0
C 1 1 0 0 #43 * 1 0 1 1
E 1 1 1 0 #45 * 1 0 0 0 1 0 1
F 1 #46 * 1 0 0 0 1 1 0
* Parity bit - changes according to the parity specification.

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.
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
Digit 3 Digit 2 Digit 1 Digit 0
Digit 3 Digit 2 Digit 1 Digit 0 Digit 3 Digit 2 Digit 1 Digit 0
8 15 0 7 8 15 0 7 8 15 0 7
8 11 12 15 0 3 4 7
Digit 3 Digit 2 Digit 1 Digit 0
8 15 0 7

Instruction Mnemonic Variations Function
code Function
ASCII TO HEX HEX @HEX 162 Converts up to 4 bytes of ASCII data in the source word to their hexadecimal equivalents and writes these digits in the specified destination word.
HEX(162)
S: First source word
DI
D: Destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word UINT Variable
DI Digit designator UINT 1
D Destination word UINT 1
8 15 Leftmost byte Rightmost byte
8 11 12 15 Digit 1 Digit 0
0 3 4 7
D Digit 3 Digit 2
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.
The results of conversion to hex are stored from the starting digit going left (returns to digit 0 after digit 3)
The digit designator specifies various parameters for the conversion, as shown in the following dia- gram.
Specifies the first digit in D to receive converted data (0 to 3).
Number of bytes to be converted (0 to 3)
First byte of S to be converted.
Symbol

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- DI OK
OK
Error Flag P_ER • ON if there is a parity error in the ASCII data.
HEX(162) treats the contents of the source word(s) as ASCII data representing hexa- decimal digits (0 to 9 and A to F), converts the specified number of bytes to hexadeci- mal, 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.
Di 0 0/1 n m
First byte to convert
Right (0) Left (1)
Number of digits (n+1)
First digit to write
Hint
ASCII data (2 hexadecimal digits) Hexadecimal digits
30 to 39 0 to 9
41 to 46 A to F

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.
S
0 3 4 7 8 15 12 11
Di:# 1 2 1 0
Starting byte (leftmost byte)
0 7 8 15
Starting digit (digit 1)
0 1 2 3
0 3 4 7 8 15 12 11
Di:D200
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.

Conversion data Output result (hex data)
code (MSB) bit content (LSB) Value Bit content
#30 * 0 1 1 0
#31 * 0 1 1 0 0 0 1 1 0 0 0 1
#32 * 0 1 1 0 0 1 0 2 0 0 1 0
#33 * 0 1 1 0 0 1 1 3 0 0 1 1
#34 * 0 1 1 0 1 0 0 4 0 1 0 0
#35 * 0 1 1 0 1 0 1 5 0 1 0 1
#36 * 0 1 1 0 1 1 0 6 0 1 1 0
#37 * 0 1 1 0 1 1 1 7 0 1 1 1
#38 * 0 1 1 1 0 0 0 8 1 0 0 0
#39 * 0 1 1 1 0 0 1 9 1 0 0 1
#41 * 1 0 1 A 1 0 1 0
#42 * 1 0 1 0 B 1 0 1 1
#43 * 1 0 1 1 C 1 1 0 0
#45 * 1 0 0 0 1 0 1 E 1 1 1 0
#46 * 1 0 0 0 1 1 0 F 1
* 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.)
1 1 0 1
S: D100 1 1 0 1 1 1 0 1 1 1 0 0 0
Starting digit (digit 1)
0 3 4 7 8 15 12 11
Number of bytes (2 bytes)

8 8 15 0 15 0 7 7 8 15 0 7
S
S
Conversion Instructions
S+1
S+1
S+1
S+2
8 11 12 15 0 3 4 7
8 11 12 15 0 3 4 7
Digit 3 Digit 2 Digit 1 Digit 0
Digit 3 Digit 2 Digit 1 Digit 0
8 11 12 15 0 3 4 7
Digit 3 Digit 2 Digit 1 Digit 0

ANDW/ANDL
code Function
LOGICAL AND ANDW @ANDW 034 Takes the logical AND of corresponding bits in sin- gle words of word data and/or constants.
DOUBLE LOGICAL AND ANDL @ANDL 610 Takes the logical AND of corresponding bits in double words of word data and/or constants.
ANDW(034)
ANDL(610)
R: Result word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
I1 Input 1 WORD DWORD 1 2
I2 Input 2 WORD DWORD 1 2
R Result word WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the result is 0.
Negative Flag P_N • ON when the leftmost bit of R is 1.

ANDW
ANDW(034) takes the logical AND of data spec- ified in I1 and I2 and outputs the result to R.
ANDL
(I1, I1+1) • (I2, I2+1) → (R, R+1)
ANDL(610) takes the logical AND of data speci- fied in I1, I1+1 and I2, I2+1 and outputs the result to R, R+1.
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.
D: D200 D+ 1 : D201
ANDL
10.00 0
20.00 1
10.01 1
20.01 1
10.02 0
20.02 0
10.03 1
20.03 0
10.04 0
20.04 1
11.13 1
21.13 1
11.14 1
21.14 0
11.15 0
21.15 0

code Function
LOGICAL OR ORW @ORW 035 Takes the logical OR of corresponding bits in sin- gle words of word data and/or constants.
DOUBLE LOGICAL OR ORWL @ORWL 611 Takes the logical OR of corresponding bits in dou- ble words of word data and/or constants.
ORW(035)
ORWL(611)
R: Result word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
I1 Input 1 WORD DWORD 1 2
I2 Input 2 WORD DWORD 1 2
R Result word WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
I1, I2 OK
--- --- --- R ---
Flags
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the result is 0.
Negative Flag P_N • ON when the leftmost bit of R is 1.

ORW
ORW(035) takes the logical OR of data speci- fied in I1 and I2 and outputs the result to R.
ORWL
(I1, I1+1) + (I2, I2+1) → (R, R+1)
ORWL(611) takes the logical OR of data specified in I1 and I2 as double-word data and outputs the result to R, R+1.
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.
D: D500 D+1: D501 D500
ORWL

code Function
EXCLUSIVE OR XORW @XORW 036 Takes the logical exclusive OR of corresponding bits in single words of word data and/or constants.
DOUBLE EXCLUSIVE OR XORL @XORL 612 Takes the logical exclusive OR of corresponding bits in double words of word data and/or con- stants.
XORW(036)
XORL(612)
R: Result word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
I1 Input 1 WORD DWORD 1 2
I2 Input 2 WORD DWORD 1 2
R Result word WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
I1, I2 OK
--- --- --- R ---
Flags
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the result is 0.
Negative Flag P_N • ON when the leftmost bit of R is 1.

XORW
XORW(036) takes the logical exclusive OR of data specified in I1 and I2 and outputs the result to R.
XORL
XORL(612) takes the logical exclusive OR of data specified in I1 and I2 as double-word data and outputs the result to R, R+1.
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.
D: D1200 D+1: D1201 D1200
XORL

code Function
COMPLEMENT COM @COM 029 Turns OFF all ON bits and turns ON all OFF bits in Wd.
DOUBLE COMPLEMENT COML @COML 614 Turns OFF all ON bits and turns ON all OFF bits in Wd and Wd+1.
COM(029)
COML(614)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Wd Word WORD DWORD 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Wd OK ---
Error Flag P_ER OFF
Equals Flag P_EQ • ON when the result is 0.
Negative Flag P_N • ON when the leftmost bit of R is 1.
COM(029) reverses the status of every specified bit in Wd.
execution condition is ON.
COML(614) reverses the status of every specified bit in Wd and Wd+1.
execution condition is ON.

When CIO 0.00 is ON in the following example, the status of each bit D100 will be reversed.
0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10
COM
0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10
When CIO 0.00 is ON in the following example, the status of each bit in D100 and D101 will be reversed.
1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10
COM/COML
0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10
0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 2 3 4 5 6 7 8 9 15 14 13 12 11 10

APR
code Function
ARITHMETIC PROCESS APR @APR 069 Calculates the sine, cosine, or a linear extrapola- tion of the source data.
APR(069)
C: Control word
S: Source word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C Control word UINT Variable
S Source data WORD 1
R Result word WORD 1
Operand Value Data range
C 0000 hex ---
R 0000 to 9999 (BCD) 9999 (BCD) 0.0000 to 0.9999 1.0000
Operand Value Data range
C 0001 hex ---
R 0000 to 9999 (BCD) 9999 (BCD) 0.0000 to 0.9999 1.0000
Symbol

Operand Value Data range
C Data area address ---
16-bit unsigned BCD data 0000 to 9999
16-bit unsigned binary data 0 to 65,535
16-bit signed binary data -32,768 to 32,767
32-bit signed binary data -2,147,483,648 to
Floating-point data - ∞ ,
-3.402823 × 10 38 to
-1.175494 × 10 -38 ,
1.175494 × 10 -38 to
3.402823 × 10 38 ,
+ ∞
APR
16-bit unsigned BCD data 0000 to 9999
16-bit unsigned binary data 0 to 65,535
16-bit signed binary data -32,768 to 32,767
32-bit signed binary data -2,147,483,648 to
Floating-point data - ∞ ,
-3.402823 × 10 38 to
-1.175494 × 10 -38 ,
1.175494 × 10 -38 to
3.402823 × 10 38 ,
+ ∞
The following 5 kinds of I/O data can be used:
3 14 13 12 11 9 10 8 7 6 5 4 2 1 15
Number of coordinates minus one (m-1), 00 to FF hex (1 ≤ m ≤ 256)
Floating-point specification for S and D 0: Integer data
Signed data specification for S and D 0: Unsigned binary data
2,147,483,647 · 2,147,483,647

3 14 13 12 11 9 10 8 7 6 5 4 2 1 15
0 0 1 0 0
Number of coordinates minus one (m-1), 00 to FF hex (1 ≤ m ≤ 256)
Floating-point specification for S and D 0: Integer data
Data length specification for S and D (note 1) 0: 16-bit signed binary data 1: 32-bit signed binary data
Signed data specification for S and D 1: Signed binary data
3 14 13 12 11 9 10 8 7 6 5 4 2 1 15
1 0
Number of coordinates minus one (m-1), 00 to FF hex (1 ≤ m ≤ 256)
Floating-point specification for S and D 1: Single-precision floating-point data
16-bit BCD16-bit binary (signed or unsigned) or 16-bit BCD data
32-bit signed binary data Floating-point data
C+1
X0 (rightmost 16 bits)
X0 (rightmost 16 bits)
C+2
X0 (leftmost 16 bits)
X0 (leftmost 16 bits)
Y0
C+3
Y0 (rightmost 16 bits)
Y0 (rightmost 16 bits)
C+4
Y0 (leftmost 16 bits)
Y0 (leftmost 16 bits)
Y1
C+5
X1 (rightmost 16 bits)
X1 (rightmost 16 bits)
C+6
X1 (leftmost 16 bits)
X1 (leftmost 16 bits)
Y2
C+7
Y1 (rightmost 16 bits)
Y1 (rightmost 16 bits)
Y1 (leftmost 16 bits)
Y1 (leftmost 16 bits)
Xn (rightmost 16 bits)
Xn (rightmost 16 bits)
Xn (leftmost 16 bits)
Xn (leftmost 16 bits)
Yn (rightmost 16 bits)
Yn (rightmost 16 bits)
Yn (leftmost 16 bits)
Yn (leftmost 16 bits)
Xm (rightmost 16 bits)
Xm (rightmost 16 bits)
Xm (leftmost 16 bits)
Xm (leftmost 16 bits)
Ym (rightmost 16 bits)
Ym (rightmost 16 bits)
Ym (leftmost 16 bits)
Ym (leftmost 16 bits)
all values of (Xn, Yn) as binary data, regardless of the data format specified in control word C.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK

Error Flag P_ER • ON if C is a constant greater than 0001.
Equals Flag P_EQ • ON if the result is 0.
Negative Flag P_N • ON if bit 15 of R is ON.
APR(069) processes the input data specified in S with the following equation and the line-segment data (Xn, Yn) specified in the table beginning at C+1. The result is output to the destination word(s) specified with D.
X max X (Binary data)
Up to 256 endpoints can be stored in the line-segment data table beginning at C+1.
Equation:
Xn+1-Xn
Xn Xn+1 S

Setting name Bit in C Setting
The input data and/or the output data can be 16-bit unsigned BCD data. Also, the lin- ear extrapolation function can be set to operate on the value specified in S directly or on Xm-S. (Xm is the maximum value of X in the line-segment data.)
Input data (S) format
Output data (D) format
Signed data specification for S and D 11 0: Unsigned data
Data length specification for S and D 10 Invalid (fixed at 16 bits)
Setting name Bit in C Setting
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 Xm-S. (Xm is the maximum value of X in the line-segment data.)
Input data (S) format
Output data (D) format
Signed data specification for S and D 11 0: Unsigned data
Data length specification for S and D 10 Invalid (fixed at 16 bits)
Setting name Bit in C Setting
Input data (S) format 15 0: Binary
Output data (D) format 14 0: Binary
Source data form 13 0
Signed data specification for S and D 11 1: Signed data
Data length specification for S and D 10 0: 16-bit signed binary data
Setting name Bit in C Setting
Input data (S) format 15 0: Binary
Output data (D) format 14 0: Binary
Source data form 13 0
Signed data specification for S and D 11 1: Signed data
Data length specification for S and D 10 1: 32-bit signed binary data
a 16-bit constant is input for S, the input data will be converted to 32-bit signed binary before the linear extrapolation calculation.
Source data form · Source data form

Setting name Bit in C Setting
Input data (S) format 15 0
Output data (D) format 14 0
Source data form 13 0
Signed data specification for S and D 11 0
Data length specification for S and D 10 0
cannot be input for S.
The following example shows APR(069) used to calculate the sine of 30°.
0.00 Source data Result
S: D0 R: D100
0 ×101 ×100 ×10–1 ×10–1 ×10–2 ×10–3 ×10–4
0 3 0 0 5 0 0 0
Set the source data in ×10 –1 degrees. (0000 to 0900, BCD)
Result data has four significant digits, fifth and higher digits are ignored. (0000 to 9999, BCD)
The following example shows APR(069) used to calculate the cosine of 30°.
APR
0 ×101 ×100 ×10–1 ×10–1 ×10–2 ×10–3 ×10–4
0 3 0 0 8 6 6 0
Set the source data in ×10–1 degrees. (0000 to 0900, BCD)
Result data has four significant digits, fifth and higher digits are ignored. (0000 to 9999, BCD)
Y 4
Y 3 Y 1
Y 2 Y 0
X0 X1 X2 X3 X4 Xm

C+1 Xm (max. X value)
C+3 X 1
C+4 Y 1
C+5 X 2
C+6 Y 2
C+(2m+1) Xm (max. X value)
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.
Bit Bit Content Coordinate
0 1 0 1 1
Y 1
Output and input both binary
Y 12
In this case, the source word, CIO 0010, contains 0014, and f(0014) = 0726 is output to R, CIO 0011.
$1F20
$0F00
$0005 $0014 $001A $05F0
The linear-extrapolation calculation is shown below.
Y 0F00 0402 0F00 – 001A 0005 – 0014 0015 – ( ) × + =
Ω 0726 =
Values are all hexadecimal (Hex).

Fluid height to volume conversion table (32-bit signed binary data)
X0 (rightmost 16 bits)
X0 (leftmost 16 bits)
Y0 (rightmost 16 bits)
Y0 (leftmost 16 bits)
X1 (rightmost 16 bits)
Variation from standard = X
X1 (leftmost 16 bits)
Y1 (rightmost 16 bits)
Y1 (leftmost 16 bits)
Xn (rightmost 16 bits)
Xn (leftmost 16 bits)
Yn (rightmost 16 bits)
Yn (leftmost 16 bits)
Xm (rightmost 16 bits)
Xm (leftmost 16 bits)
Ym (rightmost 16 bits)
Ym (leftmost 16 bits)
Linear extrapolation of table
R
Y: Fluid volume
R R+1
X: Variation from standard
The linear extrapolation can use signed source data if 32-bit signed binary data is used.
X m
S S+1
High-resolution 32-bit signed binary data

Fluid height to volume conversion table (Floating-point data)
X0 (rightmost 16 bits)
X0 (leftmost 16 bits)
Y0 (rightmost 16 bits)
Y0 (leftmost 16 bits)
X1 (rightmost 16 bits)
X1 (leftmost 16 bits)
Y1 (rightmost 16 bits)
Y1 (leftmost 16 bits)
Fluid height = X Fluid volume = Y
Xn (rightmost 16 bits)
Xn (leftmost 16 bits)
Yn (rightmost 16 bits)
Yn (leftmost 16 bits)
Xm (rightmost 16 bits)
Xm (leftmost 16 bits)
Ym (rightmost 16 bits)
Ym (leftmost 16 bits)
Linear extrapolation of table
R
Y: Fluid volume
X: Fluid height
Y data range: −∞, −3.402823 × 1038 to −1.175494 × 10−38, 1.175494 × 10−38 to 3.402823 × 1038, or +∞
The linear extrapolation can provide a smooth, high-resolution curve floating-point data is used.
X m
S S+1
High-resolution floating point data
X data range: −∞, −3.402823 × 1038 to −1.175494 × 10−38, 1.175494 × 10−38 to 3.402823 × 1038, or +∞

Instruction Mnemonic Variations Function
code Function
BIT COUNTER BCNT @BCNT 067 Counts the total number of ON bits in the specified word(s).
BCNT(067)
N
N: Number of words
S: First source word
R: Result word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Number of words UINT 1
S First source word UINT Variable
R Result word UINT 1
The number of words must be 0001 to FFFF (1 to 65,535 words).
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- S,R ---
OK
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.
Counts the number of ON bits.
R
T

BCNT
W0
W1
W2
W2
W0
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.
10 words Counts the number of ON bits (35). to
S
R
R: D100 23 hexadecimal (35 decimal)
0 0 2 3

The Floating-point Math Instructions convert data and perform floating-point arithmetic operations.
Floating-point data expresses real numbers using a sign, exponent, and mantissa. When data is expressed in floating-point format, the following formula applies.
s: Sign e: Exponent f: Mantissa
The floating-point data format conforms to the IEEE754 standards. Data is expressed in 32 bits, as follows:
31 30 23 22 0
s: sign 1 0: positive; 1: negative
e: exponent 8 The 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: mantissa 23 The mantissa portion of binary floating-point data fits the formal 2.0 > 1.f ≥1.0.
The number of effective digits for floating-point data is seven digits for decimal.
–1.175494 × 10–38 1.175494 × 10–38
– ∞ + ∞ –3.402823 × 1038 3.402823 × 1038 –1 0 1
* NaN (not a number) is not a valid floating-point number. Executing floating-point calculation instructions will not result in NaN.
Sign Exponent Mantissa · e s f

When floating-point is specified for the data format in the I/O memory edit display in the CX-Program- mer, standard decimal numbers input in the display are automatically converted to the floating-point for- mat 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.
0 6 7 15 f n
It is not necessary for the user to be aware of the IEEE754 data format when reading and writing float- ing-point data. It is only necessary to remember that floating point values occupy two words each.
The following types of floating-point numbers can be used.
Mantissa (f)
0 Not 0 and not all 1’s All 1’s (255)
0 0 Normalized number
Not 0 Non-normalized number NaN
ber. 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.
Normalized numbers express real numbers. The sign bit will be 0 for a positive number and 1 for a neg- ative 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 233 – 1, and it is assume that, in the real mantissa, bit 233 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)
31 30 23 22 0
1 1 0 1 1 0
Sign: – Exponent: 128 – 127 = 1 Mantissa: 1 + (222 + 221) × 2–23 = 1 + (2–1 + 2–2) = 1 + 0.75 = 1.75 Value: –1.75 × 21 = –3.5
n+1 s e · Infinity

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 233 – 1, and it is assume that, in the real mantissa, bit 233 is 0 and the binary point follows immediately after it.
Non-normalized numbers are expressed as follows: (–1)(sign s) × 2–126 × (mantissa x 2–23)
31 30 23 22 0
0 1 1 0
Sign: – Exponent: –126 Mantissa: 0 + (222 + 221) × 2–23 = 0 + (2–1 + 2–2) = 0 + 0.75 = 0.75 Value: –0.75 × 2–126
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.
Values of +∞ and –∞ can be expressed by setting the sign to 0 for positive or 1 for negative. The expo- nent will be 255 (28 – 1) and the mantissa will be 0.
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 (28 – 1) and the mantissa will be not 0.
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.
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.

The following precautions apply to handling zero, infinity, and NaN.
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 pos- itive, 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 cal- culation. 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.

code Function
Floating-point Math Instructions
FLOATING TO 16-BIT FIX @FIX 450 Converts a 32-bit floating-point value to 16-bit signed binary data and places the result in the specified result word.
FLOATING TO 32-BIT FIXL @FIXL 451 Converts a 32-bit floating-point value to 32-bit signed binary data and places the result in the specified result words.
FIX(450)
FIXL(451)
S
S: First source word
S: First source word
R
R: Result word
R: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
S First source word REAL REAL 2 2
R First result word INT DINT 1 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK
Error Flag P_ER • FIX ON if the integer portion of S+1 and S is not within the range of -32,768 to 32,767.
Equals Flag P_EQ • ON if the result is 0000.
Negative Flag P_N • ON when the leftmost bit of the result is 1.

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.
Floating-point data (32 bits)
Signed binary data (16 bits)
Only the integer portion of the floating-point data is converted, and the fraction portion is truncated.
A floating-point value of 3.5 is converted to 3. A floating-point value of –3.5 is converted to –3.
FIXL(451) converts the integer portion of the 32-bit floating-point number in S+1 and S (IEEE754-for- mat) to 32-bit signed binary data and places the result in R+1 and R.
Floating-point data (32 bits)
Signed binary data (32 bits)
Only the integer portion of the floating-point data is converted, and the fraction portion is truncated.
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.

code Function
Floating-point Math Instructions
16-BIT TO FLOATING FLT @FLT 452 Converts a 16-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
32-BIT TO FLOATING FLTL @FLTL 453 Converts a 32-bit signed binary value to 32-bit floating-point data and places the result in the specified result words.
FLT(452)
FLTL(453)
S
S: Source word
S: First source word
R
R: First result word
R: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
S First source word INT DINT 1 2
R First result word REAL REAL 2 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK
Error Flag P_ER OFF
Equals Flag P_EQ • ON if both the exponent and mantissa of the result are 0.
Negative Flag P_N • ON if the result is negative.

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.
Signed binary data (16 bits)
Floating-point data (32 bits)
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).
A signed binary value of 3 is converted to 3.0. A signed binary value of -3 is converted to -3.0.
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.
6 5 1 F 9 2 D 1 CY R+1: D00100
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).
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.
−


FLOATING-POINT ADD +F @+F 454 Adds two 32-bit floating-point numbers and places the result in the specified result words.
FLOATING-POINT SUBTRACT –F @–F 455 Subtracts one 32-bit floating-point number from another and places the result in the specified result words.
FLOATING-POINT MULTIPLY *F @*F 456 Multiplies two 32-bit floating-point numbers and places the result in the specified result words.
FLOATING-POINT DIVIDE /F @/F 457 Divides one 32-bit floating-point number by another and places the result in the specified result words.
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK


Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Md, Mr, Dd, Dr OK

Error Flag P_ER +F
OFF in all other cases.
Equals Flag P_EQ • ON if both the exponent and mantissa of the result are 0.
Overflow Flag P_OF • ON if the absolute value of the result is too large to be expressed as a 32-bit floating-point value.
Underflow Flag P_UF • ON if the absolute value of the result is too small to be expressed as a 32-bit floating-point value.
Negative Flag P_N • ON if the result is negative.
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.
Augend (floating-point data, 32 bits)
Addend (floating-point data, 32 bits)
Result (floating-point data, 32 bits)
Minuend (floating-point data, 32 bits)
Subtrahend (floating-point data, 32 bits)
Result (floating-point data, 32 bits)

Md Multiplicand (floating-point data, 32 bits) Md+1
Mr Multiplier (floating-point data, 32 bits) Mr+1
Result (floating-point data, 32 bits)
Dd Dividend (floating-point data, 32 bits) Dd+1
Dr Divisor (floating-point data, 32 bits) Dr+1
R+1 R
Result (floating-point data, 32 bits)
The result of an operation is output as shown below depending on the combination of floating-point data.
Addend 0 Numeral +∞ –∞ NaN
0 0 Numeral +∞ –∞
Numeral Numeral See note 1. +∞ –∞
+∞ +∞ +∞ +∞ ER
–∞ –∞ –∞ ER –∞
ER The Error Flag will be turned ON and the instruction will not be executed.
Subtrahend 0 Numeral +∞ –∞ NaN
0 0 Numeral +∞ –∞
Numeral Numeral See note 1. +∞ –∞
+∞ –∞ –∞ ER –∞
–∞ +∞ +∞ +∞ ER
ER The Error Flag will be turned ON and the instruction will not be executed.

Multiplier 0 Numeral +∞ –∞ NaN
Numeral 0 See note 1. +/–∞ +/–∞
+∞ ER +/–∞ +∞ –∞
–∞ ER +/–∞ –∞ +∞
ER The Error Flag will be turned ON and the instruction will not be executed.
Divisor 0 Numeral +∞ –∞ NaN
Numeral 0 See note 2. +/–∞ +/–∞
+∞ 0 0 (See note 1) ER ER
–∞ 0 0 (See note 1) ER ER
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.

code Function
Floating-point Math Instructions
=F <>F <F <=F >F >=F
329 330 331 332 333 334
These 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.
LD connection AND connection OR connection
S1
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S1 Comparison data 1 REAL 2
S2 Comparison data 2 REAL 2
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S1, S2 OK --- --- ---
Error Flag P_ER • ON if S1+1, S1 or S2+1, S2 is not a number (NaN).
Greater Than Flag P_GT • ON if S1+1, S1 > S2+1, S2.
Greater Than or Equal Flag P_GE • ON if S1+1, S1 ≥ S2+1, S2.
Equal Flag P_EQ • ON if S1+1, S1 = S2+1, S2.
Not Equal Flag P_NE • ON if S1+1, S1 ≠ S2+1, S2.
Less Than Flag P_LT • ON if S1+1, S1 < S2+1, S2.
Less Than or Equal Flag P_LE • ON if S1+1, S1 ≤ S2+1, S2.
Negative Flag P_N Unchanged

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 condi- tion 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 con- stant.
ON execution condition when comparison result is true.
S1
S2
ON execution condition when comparison result is true.
S1
S2
The input comparison instructions are treated just like the LD, AND, and OR instructions to control the execu- tion of subsequent instructions.
LD: The instruction can be con- nected directly to the left bus bar.
AND: The instruction cannot be con- nected directly to the left bus bar.
ON execution condition when comparison result is true.
OR: The instruction can be con- nected directly to the left bus bar.
With the three input types and six symbols, there are 18 different possible combinations.
Option (data format)
used in a ladder program)
LD=, AND=, OR=, LD, AND, OR, LD=
Code Mnemonic Name Function
329 LD=F LOAD FLOATING EQUAL True if S1+1, S1 = S2+1, S2 AND=F AND FLOATING EQUAL
330 LDF LOAD FLOATING NOT EQUAL True if S1+1, S1≠ S2+1, S2 ANDF AND FLOATING NOT EQUAL
331 LD
332 LD
333 LD>F LOAD FLOATING GREATER THAN True if S1+1, S1 > S2+1, S2 AND>F AND FLOATING GREATER THAN
LD connection · AND connection · OR connection

334 LD>=F LOAD FLOATING GREATER THAN OR EQUAL True if S1+1, S1 ≥ S2+1, S2 AND>=F AND FLOATING GREATER THAN OR EQUAL
Precautions
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, execu- tion 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.
0.00 50.00
SINGLE FLOATING LESS THAN Comparison (<F)
15 0 S1: D100 S1+1:D101
15 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1
0 1 1 0 1 1 0
2.3>−3.5
Does not yield an ON condition.
15 0 1 0 0 1 0
1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1
Yields an ON condition.
4294967296

code Function
FLOATING-POINT TO ASCII FSTR @FSTR 448 Expresses a 32-bit floating-point value (IEEE754- format) in standard decimal notation or scientific notation and converts that value to ASCII text.
FSTR(448)
S
S: First source word
C: First control word
D: First destination word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word REAL 2
C First control word UINT 3
D First destination word UINT Variable
2 to 18 hex (2 to 24 characters, see note)
0 to 7 hex (see note)
and the number of fractional digits.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- C, D ---
OK
Error Flag P_ER • ON if the data in S+1 and S is not a valid floating-point number (NaN).
Equals Flag P_EQ • ON if the conversion result is 0.

FSTR(448) expresses the 32-bit floating-point number in S+1 and S (IEEE754-format) in decimal nota- tion 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 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.

Stored in destination words beginning with D. Total characters = 8 (C+1 = 8 hex) Fractional digits = 3 (C+2 = 3 hex)
ASCII characters are stored in order. (Leftmost byte → rightmost byte)
Stored in destination words beginning with D. Total characters = 10 (C+1 = A hex) Fractional digits = 2 (C+2 = 2 hex)
ASCII characters are stored in order. (Leftmost byte → rightmost byte)

After the floating-point number is converted to ASCII text, the ASCII characters are stored in the desti- nation words beginning with D, as shown in the following diagrams. Different storage methods are used for decimal notation and scientific notation.
Total number of characters
Integer part Fractional part Sign Decimal point
If there are more fractional digits in the source data than specified in C+1, the extra digits will be rounded off. If there are fewer fractional digits, zeroes (ASCII: 30 hex) will added to the end of the source data.
A decimal point (ASCII: 2E hex) is added if the number fractional digits is greater than 0. Spaces (ASCII: 20 hex) are added if the integer part of the floating-point data is shorter than the integer part of the result (total number of characters - sign digit - decimal point - fractional digits).
Total number of characters
Integer part Fractional part Exponential part Sign Decimal point Sign
Total number of characters Total number of characters
0 to 9 are written as 00 to 09. Positive: Plus sign (2B hex) Negative: Minus sign (2D hex) Letter E (ASCII: 45 hex) is written here. If there are more fractional digits in the source data than specified in C+1, the extra digits will be rounded off. If there are fewer fractional digits, zeroes (ASCII: 30 hex) will added to the end of the source data.
A decimal point (ASCII: 2E hex) is added if the number fractional digits is greater than 0. Spaces (ASCII: 20 hex) are added if the integer part of the floating-point data is shorter than the integer part of the result (total number of characters - sign digit - decimal point - fractional digits - E digit).
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.

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).
D0 D10 D100
15 0 D0 D1
1 0 1 0 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 1
0.327457
Decimal notation Total characters = 7 characters Fractional digits = 3 digits (characters)
Total number of characters Rounded off
20(Space) 30(0) 33(3) 37(7)
20(Space) 2E(.) 32(2) 00

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).
D0 D10 D100
15 0 D0 D1
1 0 1 0 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 1 1 1
0.327457
Scientific notation Total characters = 11 characters Fractional digits = 3 digits (characters)
Total number of characters
Spaces Fractional part Rounded off
20(Space) 33(3) 32(2) 35(5) 2D(-) 31(1)
20(Space) 2E(.) 37(7) 45(E) 30(0) 00
Conversion · Storage conditions · 0001(Hex) 000B(Hex) 0003(Hex)

code Function
Floating-point Math Instructions
Converts a number expressed in ASCII text (deci- mal or scientific notation) to a 32-bit floating-point value (IEEE754-format) and outputs the floating- point value to the specified words.
FVAL
FVAL(449)
S
S: First source word
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word UINT Variable
D First destination word REAL 2
TR bits CIO WR HR AR T C DM @DM *DM
Word addresses Indirect DM addresses
S, D OK ---
Error Flag P_ER • ON if the digits (integer and fractional parts) in the source data starting at S are not 30 to 39 hex (0 to 9).
Equals Flag P_EQ • ON if the conversion result is 0.
FVAL(449) converts the specified ASCII text number (starting at word S) to a 32-bit floating-point num- ber (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.

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.
Conversion of ASCII text number to 32-bit floating-point data 32-bit floating-point data
2D 20 20 31 32 33 2E 34 35 36 37 38 00 00
1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 0 1 1 0
Stored in D and D+1.
1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 0 1 1 0
Spaces are ignored during conversion
If there are more than 6 digits, the 7th and higher digits are ignored. (Digits do not include the sign, decimal point, and exponent characters.)
Conversion of ASCII text number to 32-bit floating-point data
20 31 32 34 2B 32 00
-1.234×102 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 0
Stored in D and D+1.
− SP SP 1 . 2 3 4 E + 0 2
1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 0
Spaces are ignored during conversion

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.
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.)
15 0 7 8
Integer part Fractional part Sign
Decimal point The 7th and higher digits are ignored. (The sign, decimal point, and exponent characters are not counted as digits.) Any spaces (20 hex) or zeroes (30 hex) before the first digit are ignored.
15 0 7 8
25 characters max.
Integer part Fractional part Exponential part
00 SP E
The 7th and higher digits are ignored. (The sign, decimal point, and exponent characters are not counted as digits.)
Any spaces (20 hex) or zeroes (30 hex) before the first digit are ignored.

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 des- tination words D100 and D101.

D0 D100 The 7th and higher digits are ignored. (The sign, decimal point, and leading zeroes/spaces are not counted.) Ignored
20 (Space) 31 (1) 32 (2) 34 (4) 32 (2) 00
0 1 0 0 1 1 0 1 0 1 0 0 1 0
0 1 0 0 1 1 0 1 0 1 0 0 1 0
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 des- tination words D100 and D101.

0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0
0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0

SWAP
Instruction Mnemonic Variations Function
code Function
SWAP BYTES SWAP @SWAP 637 Switches the leftmost and rightmost bytes in all of the words in the range.
SWAP
SWAP(637)
N
N: Number of words
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Number of words UINT 1
R1 First word in range UINT Variable
N specifies the number of words in the range and must be 0001 to FFFF hexadecimal (or &1 to &65,535).
Leftmost byte Rightmost byte
15 0 8 7
R1+(N–1)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK ---
--- --- R1 ---
OK
Error Flag P_ER • ON if the N is 0.

SWAP(637) switches the position of the two bytes in all of the words in the range of mem- ory from R1 to R1+N-1.
Byte position is swapped.
N
Hint
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.
N
R1
W0
0 7 8 15
0 7 8 15
4 1 4 2
4 2 4 1
4 3 4 4
4 4 4 3
4 5 4 6
4 6 4 5
3 0 3 1
3 1 3 0

Table Data Processing Instructions
code Function
FRAME CHECKSUM FCS @FCS 180 Calculates the FCS value for the specified range and outputs the result in ASCII.
FCS(180)
C: First control word
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C First control word UDINT 2
R1 First word in range UINT Variable
D First destination word UINT Variable
W: Number of words/bytes in range &1 to &65535 (decimal) or #0001 to #FFFF (hex)
D: First destination word
C+1
0000 0000 0000 00
0 15 When bytes are specified as the operation units:
Starting byte (Valid only when bit 13 is 1.)
When words are specified as the operation units:
The leftmost four digits are stored in D+1 and the rightmost four digits are stored in D.
must be in the same data area.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- R1, D ---
OK
Error Flag P_ER • ON if the content of C is not within the specified range of 0001 through FFFF.

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).
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.
14 13 12 11 10 9 8 7
6 5 4 3 2 1
C+1: D301
Always 0.
Starting byte (Effective only if bit 13 is 1.) 1: Rightmost byte
Always 0.
0 0 0 A
0 15 8 7
The FCS value for the shaded bytes is calculated and converted to ASCII.

PIDAT
Instruction Mnemonic Variations Function
code Function
PID CONTROL WITH AUTOTUNING PIDAT --- 191 Executes PID control according to the specified parameters. The PID constants can be autotuned.
PIDAT
PIDAT(191)
S
S: Input word
C: First parameter word
D: Output word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Operand Description Data type Size
S Input word UINT 1
C First parameter word WORD 41
D Output word UINT 1
Manipulated variable output lower limit
C+8
Manipulated variable output upper limit
0 15 12 1413 0 0 0
C+9
C+4
Sampling period(τ)
15 8 0 7
Forward/reverse designation PID constant update timing designation Manipulated variable output setting
2-PID parameter(α)
8 11 12 13 14 15
0 3 4 7
C+6
Integral and derivative unit
Manipulated variable output limit control

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S, C, D OK ---
Error Flag P_ER • ON if the C data is out of range.
Greater Than Flag P_GT • ON if the manipulated variable after the PID action exceeds the upper limit.
Less Than Flag P_LT • ON if the manipulated variable after the PID action is below the lower limit.
Carry Flag P_CY • ON while PID control is being executed.
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 subse- quent 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 pro- cessing is performed.
Parameters (C to C+8)
PV input (S) PID control
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 con- trolled 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 Com- mand 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.
Area · Name Label Operation · Manipulated variable (D)

The AT Command Bit (bit 15 of C+9) is ON at the start of PIDAT(191) execution or it is turned ON during execution.
PID control is interrupted, the PV is forcibly changed, and the PID constants are calculated automatically.
The calculated P, I, and D constants are set in C+1, C+2, and C+3 respectively. The AT Command Bit is turned OFF.
PID control starts (or restarts) with the new PID constants.
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 calcu- lated when autotuning was interrupted.

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 constant Proportional band P 0.1 to 999.9%
Integral constant Tik 1 to 8191, 9999 (No integral action for sampling period multiple, 9999.)
Derivative constant Tdk 0 to 8191 (No derivative action for sampling period multiple, 0.)
Set value SV 0 to 65535 (Valid up to maximum value of input range.)
Measured value PV 0 to 65535 (Valid up to maximum value of input range.)
Manipulated variable MV 0 to 65535 (Valid up to maximum value of output range.)
Calculations in PID control are performed by the target value filtered control 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).
Target value filter Proportional + integral elements
Set value (target value)
1 + (1 – λ) Ti · s
1 + Ti · s
Kp:Proportional constant Ti:Integral time Td:Derivative time s:Laplace operator α:2-PID parameter λ:Incomplete derivative coefficient
PV
1 + λ · Td · s
Simple PID Control Feed-forward PID Control
As the target response is slowed, the disturbance response worsens.
As the disturbance response is slowed, the target response worsens. Overshoot
Control data Item Contents Setting range Change with ON
C Set value (SV) The target value of the process being controlled. Binary data (of the same number of bits as specified for the input range)
C+1 Proportional band The parameter for P action expressing the pro- portional control range/total control range.
Can be changed with input condi- tion ON if bit 1 of C+5 is 1. C+2 Tik Integral Constant
0001 to 270F hex (1 to 9999); (0.1% to 999.9%, in units of 0.1%)
A 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+3 Tdk Derivative Constant
A 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+4 Sampling 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)
Bits 04 to 15 of C+5
2-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+5 Manipulated variable output designation
Designates the manipulated variable output for when the PV equals the SV.
Bit 01 of C+5 PID constant change enable setting
The timing of enabling changes made to the pro- portional band (P), integral constant (Tik), and derivative constant (Tdk) for use in PID calcula- tions.

Control data Item Contents Setting range Change with ON
Bit 00 of C+5 PID forward/reverse designation
Determines the direction of the proportional action.
Bit 12 of C+6 Manipulated variable output limit control
Determines whether or not limit control will apply to the manipulated variable output.
Bits 08 to 11 of C+6
Input range The number of input data bits. 0: 8 bits 5: 13 bits 1: 9 bits 6: 14 bits 2: 10 bits 7: 15 bits 3: 11 bits 8: 16 bits 4: 12 bits
Bits 04 to 07 of C+6
Integral and deriva- tive unit
Determines the unit for expressing the integral and derivative constants.
Bits 00 to 03 of C+6
Output range The number of output data bits. (The number of output bits is automatically the same as the num- ber of input bits.)
C+7 Manipulated variable output lower limit
The lower limit for when the manipulated variable output limit is enabled.
0000 to FFFF (binary) (See note 3.)
C+8 Manipulated variable output upper limit
The upper limit for when the manipulated variable output limit is enabled.
0000 to FFFF (binary) (See note 3.)
Bit 15 of C+9 AT Command Bit This control bit starts autotuning.
As a Control Bit:
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 Flag: 0: Autotuning is not being executed. 1: Autotuning is being executed.
Bits 00 to 11 of C+9
AT Calculation Gain Set this parameter to adjust the contribution of the PID calculation results to the stored values. Normally, leave this parameter set to its default (0000).
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+10 Limit-cycle Hysteresis Sets 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%
input range.
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
input condition · Not allowed · Allowed

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:
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 20 ms 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.
1 cycle 1 cycle 1 cycle 1 cycle 1 cycle
PID
PID
PID PID
Initial processing (60 ms) (60 ms + 60 ms = 120 ms) (20 ms + 60 ms = 80 ms) (80 ms + 60 ms = 140 ms)
(PID processing with initial values)
Not executed. Executed Not executed. Executed
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.

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 propor- tional band, the larger the proportional constant and the stronger the corrective action will be. With pro- portional 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.
Adjusting the Proportional Band Proportional Action (Reverse Action)
Proportional band when MV output designation is 0 (output 0%) Proportional band when MV output designation is 1 (output 50%)
Proportional band too narrow (hunting occurring)
Proportional band just right
Proportional band too wide (large offset)
Proportional band when MV output designation is 0 (output 0%)
Proportional band when MV output designation is 1 (output 50%)
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.
Pi Action and Integral Time

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.
PD Action and Derivative Time
PD action P action D 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.
Step Response of PID Control Action Output
PID action I action P action D action
Ramp Response of PID Control Action Output
P action D 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 Reverse Action
SV SV High temperature
The general relationship between PID parameters and control status is shown below.
When P is narrowed
Control by measured PID
SV
When P is enlarged
Control by measured PID
Control by measured PID (when hunting occurs in a short period)
Control by measured PID (when loose hunting occurs)
SV
Enlarge I or P.
Lower D.

S
SETB
C:D200
0 1 2 C
0 0 6 4
0 4 B 0
0 1 9 0
0 0 3 2
0
Reverse operation (bit 00: 0), PID constant change enable setting = OFF (bit 01: 0), set value = manipulated variable output 50% (bit 03: 1), 2-PID parameter = 0.65 (bits 04 to 15: 000 hex)
0 4 9 4
0
Manipulated variable output range: 12 bits (bits 00 to 03: 4 hex), Integral/derivative constant: time designation (bits 04 to 07: 9 hex) Input range: 12 bits (bits 08 to 11: 4 hex), Manipulated variable output limit control disabled (bit 12: 0)
0
C+9:D209
0
0
AT Command Bit OFF (bit 15: 0), AT Calculation Gain = 1.00 (bits 00 to 11: 000 hex)
Limit-cycle Hysteresis = 0.20% PID starting integral manipulated variable designation = start from same integral manipulated value as manipulated variable output designation (bit 14: 0 and bit 13: 0)
PID control starts Calculated PID constants are set.
PID control PID control AT executing
Bit 15 of D209
SV
MV

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.
S
PID control and autotuning start.
Calculated PID constants are set.
AT executing PID control
Bit 15 of D209
SV
MV
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.
PID control starts.
PID control AT executing PID control
AT starts AT is interrupted.
Bit 15 of D209
SV
PID control is restarted with the existing PID constants.
Time · Time · Time

Instruction Mnemonic Variations Function
code Function
Inputs the duty ratio or manipulated variable from the specified word, converts the duty ratio to a time-proportional output based on the specified parameters, and outputs the result from the speci- fied output.
TPO
TPO
S
S: Input word
C: First parameter word
R: Pulse output bit
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Input word UINT 1
C First parameter word WORD 7
R Pulse output bit BOOL ---
Specifies the input word containing the input duty ratio or manipulated variable.
PIDAT(191) instruction.
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 manip- ulated variable.)
The following diagram shows the locations of the parameter data.
8 15 12 11 0 3 4 7
C+2
C+3
C+4
Work area (3 words, cannot be used by user)
C+6

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.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
OK OK OK OK OK
--- --- --- C
OK OK OK OK
--- R --- --- --- --- ---
Flags
Error Flag ER • ON if the input data in S is out of range. (The input data setting range depends on the input type set- ting.)
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.
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 allo- cated 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).
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-propor- tional output, and pulses are output.
S
MV D0
TPO
MV
MV ÷ MV range
Duty ratio (0.00% to 100.00%)
Conversion to time-proportional output

In this case, set the same value for the PID Control instruction’s output range and the TPO(685) instruc- tion’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.
12 to 24 VDC
TPO
AC
Parameter Settings
ON input condition Word Bits
Item Contents Setting range
C 00 to 03 Manipulated variable range
Specifies the number of input data bits. 0 hex: 8 bits 5 hex: 13 bits 1 hex: 9 bits 6 hex: 14 bits 2 hex: 10 bits 7 hex: 15 bits 3 hex: 11 bits 8 hex: 16 bits 4 hex: 12 bits
04 to 07 Input type Specifies whether S contains a duty ratio or manipulated variable.
1 hex: Manipulated variable Setting 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.)
08 to 11 Input read tim- ing
Specifies the input read timing. 0 hex: Use the beginning value of the control period
12 to 15 Output limit control
Specifies whether the output limit function is enabled or disabled.
C+1 00 to 15 Control period Control period (Time period in which the ON/OFF changes are made.)
0064 to 270F hex (1.00 to 99.99 s)
0001 hex.
C +2 00 to 15 Output lower limit
Specifies the lower limit when the output limit is enabled.
0000 to 2710 hex (0 to 100.00%) Allowed
C +3 00 to 15 Output upper limit
Specifies the upper limit when the output limit is enabled.
0000 to 2710 hex (0 to 100.00%) Allowed
C+4 00 to 15 Work area This work area is used by the system. It cannot be used by the user.
Cannot be used. ---
C+5 00 to 15
C+6 00 to 15
0000 hex ≤ lower limit ≤ upper limit ≤ 2710 hex.

The duty ratio input is read at the beginning of the control period and the ratio cannot be changed during the control period.
The following diagrams show the operation of each input read timing setting.
Read only at the beginning of the control period.
Duty ratio (MV/MV range)
a × 0.55 s a × 0.45 s a × 0.70 s a × 0.30 s
Each control period’s output is determined by the duty ratio at the beginning of that period. Use this setting for general applications.
Control period (a) Control period (a)
Duty ratio (MV/MV range)
55% target cut to 35%. 70% target is kept.
a × 0.35 s a × 0.65 s a × 0.70 s a × 0.30 s
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. Use this setting for applications such as avoiding overshooting when using time-proportional control to control heating and using a relatively long control period.

Control period (a) Control period (a)
70% target is kept.
Duty ratio (MV/MV range)
70% target raised to 80%.
a × 0.20 s
a × 0.45 s a × 0.55 s a × 0.80 s
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.
Control period (a) Control period (a)
Duty ratio (MV/MV range)
: Output ON
: Output OFF
0% a × 0.20 s a × 0.20 s a × 0.20 s
a × 0.35 s
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.

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.
PIDAT
S
TPO
S
R
EI
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), con- verts 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.
When CIO 0.00 goes from OFF to ON, PID(190) reads the parameters, performs the PID calculation with the PV input in CIO 10, and outputs the manipulated variable (MV) to D0.
TPO
TPO(685) calculates the duty ratio by dividing the MV in D0 by the MV range (0FFF Hex since the range is set to 12 bits), converts that duty ratio to a time-proportional output, and outputs the pulse output to bit 01 of CIO 100.
R
:
:
:

When CIO 0.00 is ON, TPO(685) takes the duty ratio in D10, converts the duty ratio to a time-propor- tional 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%.
TPO(685) takes the duty ratio in D10, converts that duty ratio to a time-proportional output, and outputs the pulse output to bit 00 of CIO 100.
R
Duty ratio input, read initial value, and enable output limit function.
Control period = 1.00 s
Output lower limit = 20.00%
Output upper limit = 80.00%
Do not set.
Do not set.
Do not set.
:
:
0 to 2710 hex
0 to 100.00%
Duty ratio · Parameters · Pulse output

code Function
SCALING SCL @SCL 194 Converts unsigned binary data into unsigned BCD data according to the specified linear function.
SCL(194)
S
S: Source word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word UINT 1
P1 First parameter word LWORD 4
R Result word WORD 1
Scaled value for point A (Ar) 0000 to 9999 (4-digit BCD)
Unscaled value for point A (As) 0000 to FFFF (binary)
Scaled value for point B (Br) 0000 to 9999 (4-digit BCD)
Unscaled value for point B (Bs) 0000 to FFFF (binary)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S, P1, R OK ---
Symbol · Area

Error Flag P_ER • ON if the contents of P1 (Ar) or P1+1 (Br) is not BCD.
Equals Flag P_EQ • ON if the result is 0.
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 scal- ing and 2 values (Ar and Br) after scaling.
The following equations are used for the conversion.
× BCD conversion of (Bs – S) (Br – Ar) R = Bd –
BCD conversion of (Bs – As)
Points A and B can define a line with either a positive or negative slope. Using a negative slope enables reverse scaling.
Scaling is performed according to the linear function defined by points A and B.
P1+1
P1+2
P1+3
Hint

In the following example, it is assume that an analog signal from 1 to 5 V 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.
0.00 S
P1
R
Contents of D200 (R)
0
0
0 3 0 0
0 F A 0
Contents of D0 (S)
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.
1068 Hex 0FA0 Hex
SCL
The value in CIO 0200 plus 00C8 hexadecimal
0000 Hex FF38 Hex
Contents of D 200 (R)
Point A (00C8 Hex → 0000 (BCD)) Point B (1068 Hex → 0300 (BCD))
0
0 0 C 8
P1+2:D102
0 3 0 0
1 0 6 8
Point A Contents of D0 (S)

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 when- ever 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.
Reverse scaling can be used, for example, to convert (reverse scale) 1 to 5 V (0000 to 0FA0 hexadeci- mal) to 0300 to 0000, respectively, as shown in the following diagram.
R

code Function
SCALING 2 SCL2 @SCL2 486 Converts signed binary data into signed BCD data according to the specified linear function. An offset can be input in defining the linear function.
SCL2(486)
S
S: Source word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word INT 1
P1 First parameter word WORD 3
R Result word WORD 1
Offset of linear function 8000 to 7FFF (signed binary)
8000 to 7FFF (signed binary)
0000 to 9999 (BCD)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S, P1, R OK ---
Symbol · Area

Error Flag P_ER • ON if the contents of C+1 (∆X) is 0000.
Equals Flag P_EQ • ON if the result is 0.
Carry Flag P_CY • ON if the result is negative.
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.
∆Y × [(BCD conversion of S) – (BCD conversion of offset)] BCD conversion of ∆X
The offset and slope can be a positive value, 0, or a negative value. Using a negative slope enables reverse scaling.
Positive Offset Negative Offset
∆ Y
∆ X
∆ X
P1
P1+1
∆ Y
P1+2
∆ X
∆ Y
Offset = 0000 hex

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 5 V 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.
S
P1
Contents of R (D200)
P1: D100
0
1 7 7 0
P1+2:D102
0 3 0 0
∆ Y
Contents of S (CIO 3)
Offset · 0000 -0015 · 1770Hex (∆X)

In the following example, it is assume that an analog signal from 1 to 5 V 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.
S
P1
R
P1: D100
P1+1:D101
1 7 7 0
SCL2
P1+2:D102
0 4 0 0
0400(∆Y) Contents of S (CIO 200)
1770 Hex (∆X)
Contents of R(D200) · Offset · Offset 07D0 Hex

code Function
SCALING 3 SCL3 @SCL3 487 Converts signed BCD data into signed binary data according to the specified linear function. An offset can be input in defining the linear function.
SCL3(487)
S
S: Source word
R: Result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word WORD 1
P1 First parameter word WORD 5
R Result word INT 1
Offset of linear function 8000 to 7FFF (signed binary)
∆ X
0001 to 9999 (BCD)
∆ Y
8000 to 7FFF (signed binary)
Maximum conversion 8000 to 7FFF (signed binary)
Minimum conversion 8000 to 7FFF (signed binary)
Symbol

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S. P1,R OK ---
Error Flag P_ER • ON if the contents of S is not BCD.
Equals Flag P_EQ • ON if the result is 0.
Negative Flag P_N • ON when the MSB of the R (the result) is 1.
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.
∆Y × ((Binary conversion of S) + (Offset)) Binary conversion of ∆X
Area · Name Label Operation

∆ Y
∆ X
∆ X
Min. conversion
Min. conversion
∆ X
Min. conversion
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 °C to 0000 to 1770 (hex) and output an analog output signal 1 to 5 V from the Analog Output Unit.
When a value from 0 to 200 is scaled to an analog signal (1 to 5 V, 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.
S
P1
R
Contents of R (2011, signed binary)
0
0 2 0 0
P1+2:D102
1 7 7 0
1770 189C
P1+3:D103
1 8 9 C
Max. conversion
F E D 4
Min. conversion
Contents of S (D0, signed BCD)
FED4

Instruction Mnemonic Variations Function
code Function
AVERAGE AVG --- 195 Calculates the average value of an input word for the specified number of cycles.
AVG(195)
S
S: Source word
N: Number of cycles
R: Result first word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word UINT 1
N Number of cycles UINT 1
R Result first word UINT Variable
The number of cycles must be between 0001 and 0040 hexadecimal (0 to 64 cycles).
R: Average R+1: Processing information
Used by system.
Average Valid Flag OFF: Not valid (AVG(195) has not yet been executed the specified number of cycles.) ON: Valid.
R+N+1:
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
--- --- --- R ---
OK
Error Flag P_ER • ON if the contents of N is 0.

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 Pre- vious 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.
S: Source word
N: Number of cycles
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 Aver- age 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.
R+1
R+2
R+3
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.
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.
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.
AVG
S
N
N:D200 (10 times)
R
R:D300
15 7 8 0 Pointer
Average Average Valid Flag
R+3:D303
R+11:D311

AVG
AVG
CLC(41)
1st cycle 2nd cycle 3rd cycle 4th cycle
3 previous values of IR 40

SBS
code Function
SUBROUTINE CALL SBS @SBS 091 Calls the subroutine with the specified subroutine number and executes that program.
SBS(091)
N
N: Subroutine number
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Subroutine number --- 1
Specifies the subroutine number between 0 and 127 decimal.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N --- OK --- --- ---
Flags
Error Flag P_ER • ON if nesting exceeds 16 levels.
Symbol · Area · Name Label Operation

SBS(091) calls the subroutine with the specified subroutine number. The subrou- tine is the program section between SBN(092) and RET(093). When the sub- routine is completed, program execution continues with the next instruction after SBS(091). A subroutine can be called more than once in a program.
SBS
B
B
SBN
Subroutine program (SBN(092) to RET(093))
A
SBS
RET
END
Subroutines can be nested up to 16 lev- els. 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.
SBN 10
SBN 11
SBN 12
SBN
SBS 11
SBS 12
A
A
RET
RET RET
SBS
RET
SBN
B Subroutine program m
RET
END

The subroutine is executed again.
SBS
SBN
The subroutine is not executed in following cycles. 2
Subroutine 1

A
CIO 0.00 ON
SBS
B
CIO 0.01 ON
SBS
SBS
SBN
ON
ON
A→S1→B→S2→C
A → S1 → B → C
ON
OFF
A → B → S2 → C
OFF
ON
A → B → C
RET
OFF
OFF
SBN
S2
RET
END
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.

CIO 0.00 ON
SBS
B
SBN
S1-1
0.01 Subroutine 1
ON
A→S1-1→S2→S1-2→B
SBS
ON
OFF
A → S1-1 → S1-2 → B
OFF
ON
A → B
OFF
OFF
A → B
S1-2
RET
SBN
S2
RET
END
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 execu- tion returns to the next instruction after SBS(091) 1 when subroutine 1 is completed.
Order of execution · Subroutine 2

Instruction Mnemonic Variations Function
code Function
SUBROUTINE ENTRY SBN --- 092 Indicates the beginning of the subroutine program with the specified subroutine number.
SUBROUTINE RETURN RET --- 093 Indicates the end of a subroutine program.
SBN(092)
RET(093)
N
N: Subroutine number
Applicable Program Areas SBN
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed Not allowed OK
Area Step program areas Subroutines Interrupt tasks
Usage Not allowed OK OK
N Subroutine number --- 1
N: Subroutine number
Specifies the subroutine number between 0 and 127 decimal. Operand Specifications
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
SBN N --- OK --- --- ---

There are no flags affected by this instruction.
SBN(092) indicates the beginning of the sub- routine 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) .
SBN
RET
RET
When program execution reaches RET(093), it is automatically returned to the next instruction after the SBS(091) instruction that called the subroutine.
SBS
SBS
SBN
RET
END
END
SBN
RET
END

SBN
SNXT
STEP
RET
Note The input method for the subroutine number, N, is dif-
ferent for the CX-Programmer. Input #0 to #127 on the CX-Programmer.
SBN
RET
This part of the program won’t be executed.
Sample program
When CIO 0.00 is ON in the following exam- ple, subroutine 10 is executed and program execution returns to the next instruction after the SBS(091) or MCRO(099) instruction that called the subroutine.
SBN
RET
END

CP1E CPU Units support the following interrupts.
Type Execution condition Setting procedure
I/O Interrupts Interrupt 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 Interrupts Scheduled (fixed intervals) Use the MSKS instruction to set the interrupt interval.
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 sched- uled interrupts.
CLI(691) clears or retains recorded interrupt inputs for I/O interrupts or sets the time to the first sched- uled interrupt for scheduled interrupts. It also clears or retains recorded high-speed counter interrupts.
DI(693) disables execution of all interrupt tasks.
EI(694) enables execution of all interrupt tasks.

Maximum Interrupt Task Processing Time
A440 The 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 Time
A441 The 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 process- ing time for subsequent interrupt tasks will be stored in the rightmost two digits in hexadecimal and will be cleared at the start of operation.
Name Address Operation

code Function
SET INTERRUPT MASK MSKS @MSKS 690 Controls whether I/O interrupt tasks and sched- uled interrupt tasks are executed.
MSKS(690)
N
N: Interrupt identifier
C: Control data
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Interrupt identifier --- 1
C Control data UINT 1
Disabling/Enabling Interrupt Input Setting Specifying Up/Down Differentiation of an Interrupt Input
I/O Interrupt No. I/O Interrupt No.
(Cannot be used in CP1E-E10D-)
(Cannot be used in CP1E-E10D-)
(Cannot be used in CP1E-E10D-)
(Cannot be used in CP1E-E10D-)
Interrupt Mask Interrupt Mask
0000 hex: Enable (unmask) the interrupt (direct mode).
0001 hex: Disable (mask) the interrupt (direct mode).
Scheduled Interrupt No.
Scheduled interrupt time units Scheduled interrupt set time
Any time unit setting 0 decimal (0000 hex):
Disable interrupt. (Stop internal timer.)
0.1 ms 10 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.)

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N ---
OK --- --- --- C OK
Error Flag P_ER ON if N is not within the specified range.
Errors when specifying I/O Interrupts:
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
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).
Area · Name Label Operation

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) unmasks the interrupt.
MSKS
N
S
MSKS
N
S
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.
MSKS
N
S

Instruction Mnemonic Variations Function
code Function
CLEAR INTERRUPT CLI @CLI 691 Clears/retains recorded interrupt inputs, sets the time to the first scheduled interrupt for scheduled interrupt tasks.
N: Interrupt number
C: Control data
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N Interrupt number --- 1
C Control data UINT 1
Interrupt Input No.
0000 hex: Retain the recorded interrupt.
0001 hex: Clear the recorded interrupt.
Scheduled Interrupt No.
Scheduled interrupt time units
(Set in the PLC Setup.) Scheduled interrupt set time
0.1 ms 10 to 9,999 decimal (000A to 270F hex): Sets time to first interrupt between 1.0 and 999.9 ms.

0000 hex: Retain the recorded interrupt.
0001 hex: Clear the recorded interrupt.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N ---
OK --- --- --- C OK
Error Flag P_ER • ON if N is not within the specified range.
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 inter- rupts.
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.
Recorded interrupt retained Recorded interrupt cleared
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.

When N is 4, the content of C specifies the time interval to the first scheduled interrupt task.
Execution of scheduled interrupt task.
Time to first scheduled interrupt
When N is 10 or 15, CLI(691) clears or retains the recorded high-speed counter interrupt (target comparison) specified by N.
When W0.00 turns ON in the following example, CLI(691) clears all interrupts stored for input interrupt 2.
N
S
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).
N
0 15 9 0 6 0
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.
N
S
#0001 · #0001

code Function
DISABLE INTERRUPTS DI @DI 693 Disables execution of all interrupt tasks except the power OFF interrupt.
DI(693)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Error Flag P_ER • ON if DI(693) is executed from an interrupt task.
DI(693) is executed from the main program to temporarily disable all interrupt tasks (I/O interrupts, scheduled interrupts).
All interrupt tasks will remain disabled until EI(694) is executed.
DI(693) cannot be executed from an interrupt task.
When CIO 0.00 is ON in the following example, DI(693) disables all interrupt tasks.
Disables execution of all interrupt tasks
Symbol · Name Label Operation

Instruction Mnemonic Variations Function
code Function
ENABLE INTERRUPTS EI --- 694 Enables execution of all interrupt tasks that were disabled with DI(693).
EI(694)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Flags
Error Flag P_ER • ON if EI(694) is executed from an interrupt task.
Disables execution of all interrupt tasks.
Enables execution of all disabled interrupt tasks.
Symbol · Name Label Operation

INI
Varia-
Function
code Function
tions
INI(880) can be used to execute the following operations
INI(880)
P
P: Port specifier
C: Control data
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier WORD 1
C Control data UINT 1
NV First word with new PV DWORD 2
0000 hex Pulse output 0
0001 hex Pulse output 1
0010 hex High-speed counter 0
0011 hex High-speed counter 1
0012 hex High-speed counter 2
0013 hex High-speed counter 3
0014 hex High-speed counter 4
0015 hex High-speed counter 5 (Cannot be used in CP1E-E10D-)
1000 hex PWM(891) output 0
Symbol · P Port

0000 hex Starts comparison.
0001 hex Stops comparison.
0002 hex Changes the PV.
0003 hex Stops pulse output.
If C is 0002 hex (i.e., when changing a PV), NV and NV+1 contain the new PV. Any val- ues in NV and NV+1 are ignored when C is not 0002 hex.
Lower word of new PV
Upper word of new PV
For Pulse Output or High-speed Counter Input: 0000 0000 to FFFF FFFF hex
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P, C --- OK
--- --- --- NV OK ---
Error Flag P_ER • ON if the specified range for P, C, or NV is exceeded.
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.
C: Control data
P: Port specifier
0010 to 0015 hex: High-speed counter input OK OK OK Not allowed.
If C is 0000 hex, INI(880) starts comparison of a high-speed counter’s PV to the comparison table reg- istered with CTBL(882).
out 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 regis- tered with CTBL(882).
C INI(880) function · Area · Name Label Operation

Port and mode Operation Setting range
The present value of the pulse output is changed. The new value is specified in NV and NV+1.
8000 0000 to 7FFF FFFF hex (-2,147,483,648 to 2,147,483,647)
Pulse output (P = 0000 or 0001 hex)
when pulse output is stopped. An error will occur if it is executed during pulse output.
Differential inputs, increment/decre- ment pulses, or pulse + direction inputs
The present value of the high-speed counter is changed. The new value is specified in NV and NV+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)
Increment pulse input 0000 0000 to FFFF FFFF hex (0 to 4,294,967,295)
specified port is not set for a high-speed counter.
Ring Mode 0000 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 exe- cuted when pulse output is already stopped, then the pulse amount setting will be cleared.
When CIO 0.00 turns ON in the following example, SPED(885) starts outputting pulses from pulse out- put 0 in Continuous Mode at 500 Hz. When CIO 0.01 turns ON, pulse output is stopped by INI(880).
01F4
D101 Pulse output 0
Pulse + Direction output, CW, Continuous Mode
(Not used.)

Instruction Mnemonic Variations Function
code Function
HIGH-SPEED
PRV @PRV 881 PRV(881) reads the High-speed counter PV and pulse output PV and interrupt input PV in counter mode.
PRV
PRV(881)
P
P: Port specifier
C: Control data
D: First destination word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
C Control data --- 1
D First destination word WORD Variable
0000 hex Pulse output 0
0001 hex Pulse output 1
0010 hex High-speed counter 0
0011 hex High-speed counter 1
0012 hex High-speed counter 2
0013 hex High-speed counter 3
0014 hex High-speed counter 4
0015 hex High-speed counter 5 (Cannot be used in CP1E-E10D-)
1000 hex PWM(891) output 0
0000 hex Reads the PV.
0001 hex Reads status.
0002 hex Reads range comparison results.
P = 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.

Lower word of PV
Upper word of PV
2-word PV Pulse output PV, high-speed counter input PV, high-speed counter input frequency for high-speed counter input 0
1-word PV Status, range comparison results
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
Word addresses Indirect DM addresses
P, C --- OK
--- --- --- D OK ---
Error Flag P_ER • ON if the specified range for P or C is exceeded.
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.
C: Control data
P: Port specifier
0000 or 0001 hex: Pulse output OK OK Not allowed.
1000 hex: PWM (891) output Not allowed. OK Not allowed.
P: Port specifier
0000 or 0001 hex: Pulse output OK Not allowed. Not allowed. Not allowed.
0010 or 0015 hex: High-speed counter input Not allowed.
OK (high-speed counter 0
OK (high-speed counter 0
OK (high-speed counter 0
1000 hex: PWM (891) output Not allowed. Not allowed. Not allowed. Not allowed.

Port and mode Operation Setting 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 Mode The 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 Mode 0000 0000 to FFFF FFFF hex (0 to 4,294,967,295)
Port and mode Operation Results of reading
Pulse output The pulse output status is stored in D.
Pulse Output Amount Set Flag OFF: Not set ON: Set Pulse Output Completed Flag OFF: Output not completed ON: Output completed
Pulse Output Stopped Error Flag OFF: No error ON: Pulse output stopped due to error
High-speed counter input The high-speed counter status is stored in D.
PWM(891) output The PWM(891) output is stored in D.
(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.

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)
0010 hex (Reading the frequency of high-speed counter 0)
hex.
Result = 00000000 to 00030D40 hex (0 to 200,000)
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 time Value of C Description
10 ms 0013 hex Counts the number of pulses every 10 ms. The error is 10% max. at 1 kHz.
100 ms 0023 hex Counts the number of pulses every 100 ms. The error is 1% max. at 1 kHz.
1 s 0033 hex Counts the number of pulses every 1 s. The error is 0.1% max. at 1 kHz.
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.
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.
High-speed counter input 0
Range comparison table registration and comparison start
High-speed counter input 0
Read range comparison results
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.
High-speed counter input 0

Instruction Mnemonic Variations Function
code Function
REGISTER COMPARISON TABLE CTBL @CTBL 882 CTBL(882) is used to register a comparison table and perform comparisons for a high-speed counter PV.
CTBL(882)
P
P: Port specifier
C: Control data
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
C Control data --- 1
TB First comparison table word LWORD Variable
0000 hex High-speed counter 0
0001 hex High-speed counter 1
0002 hex High-speed counter 2
0003 hex High-speed counter 3
0004 hex High-speed counter 4
0005 hex High-speed counter 5 (Cannot be used in CP1E-E10D-)
0000 hex Registers a target value comparison table and starts comparison.
0001 hex Registers a range comparison table and performs one comparison.
0002 hex Registers a target value comparison table. Comparison is started with INI(880).
0003 hex Registers a range comparison table. Comparison is started with INI(880).
Symbol · P Port · C CTBL(882) function

Number of target values 0001 to 6 hex (1 to 6 target values)
Lower word of target value 1
00000000 to FFFFFFFF hex
Upper word of target value 1
Interrupt task number for target value 1
Lower word of target value 6
00000000 to FFFFFFFF hex
Upper word of target value 6
Interrupt task number for target value 6
0 3 4 7 8 0 11 12 14 15
Interrupt task number 00 to 0F hex (0 to 15) Direction OFF: Incrementing, ON: Decrementing
Lower word of range 1 lower limit
0000 0000 to FFFF FFFF hex (See note.)
Upper word of range 1 lower limit
Lower word of range 1 upper limit
0000 0000 to FFFF FFFF hex (See note.)
Upper word of range 1 upper limit
Range 1 interrupt task number
Lower word of range 6 lower limit
0000 0000 to FFFF FFFF hex (See note.)
Upper word of range 6 lower limit
Lower word of range 6 upper limit
0000 0000 to FFFF FFFF hex (See note.)
Upper word of range 6 upper limit
Range 6 interrupt task number
Interrupt task number 0000 to 000F hex: Interrupt task number 0 to 15 AAAA hex: Do not execute interrupt task. FFFF hex: Ignore the settings for this range.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P, C --- OK
--- --- --- TB OK ---
Interrupt Task Number · Area

Error Flag P_ER • ON if the specified range for P or C is exceeded.
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 regis- tered 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.
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 compar- ison. Target Value Comparison
The corresponding interrupt task is called and executed when the PV matches a target value.
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.
Name Label Operation

The corresponding interrupt task is called and executed when the PV enters a set range.
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 exe- cuted. When the PV is incremented to 1000, it equals target value 2 and interrupt task 2 is executed.
Two target values Target value 1: 0000 01F4 hex (500) Incrementing, Interrupt task number 1 Target value 2: 0000 03E8 hex (1000)
High-speed counter input 0
Register target comparison table and start comparison
Incrementing, Interrupt task number 2
#0000 · #0000

Instruction Mnemonic Variations Function
code Function
SPEED OUTPUT SPED @SPED 885 SPED(885) is used to set the output pulse frequency for a specific port and start pulse output without acceleration or deceleration.
SPED(855)
P
P: Port specifier
M: Output mode
F: First pulse frequency word
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier UINT 1
M Output mode WORD 1
F First pulse frequency word UDINT 2
0000 hex Pulse output 0
0001 hex Pulse output 1
0 3 4 7 8 11 12 15
0 15 Lower word of target frequency
F
0 to 100,000 Hz (0000 0000 to 0001 86A0 hex)
Upper word of target frequency
Specify the pulse frequency in Hz.
Always 0 hex.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P, M --- OK
--- --- --- F OK ---
Symbol · P Port · Area

Error Flag P_ER • ON if the specified range for P, M, or F is exceeded.
SPED(885) starts pulse output on the port specified in P using the method specified in M at the frequency specified in F. Pulse out- put 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.
SPED(885) executed.
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.
In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.
When continuous mode operation is started, pulse output will be continued until it is stopped from the program.
Operation Purpose Application Frequency changes Description Procedure/ instruction
To output with speci- fied speed
Changing the speed (fre- quency) in one step
Outputs pulses at a specified frequency.
To change speed in one step
Changing the speed during operation
Changes the fre- quency (higher or lower) of the pulse out- put in one step.

Operation Purpose Application Frequency changes Description Procedure/ instruction
Immediate stop Stops the pulse output immediately.
↓ INI(880)
Immediate stop Stops the pulse output immediately.
↓ 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.
Operation Purpose Application Frequency changes Description Procedure/ instruction
To output with specified speed
Positioning without accel- eration or deceleration
Starts outputting pulses at the specified fre- quency and stops immediately when the specified number of pulses has been out- put.
Specified number of pulses (Specified with PULS(886).)
tion (number of pulses) cannot be changed during positioning (pulse output).
Outputs the specified number of pulses and then stops.
To change speed in one step
Changing the speed in one step during operation
SPED(885) can be exe- cuted during position- ing to change (raise or lower) the pulse output frequency in one step.
Specified number of pulses (Specified with PULS(886).) Number of pulses specified with PULS(886) does not change.
Pulse frequency New target frequency Original target frequency
The target position (specified number of pulses) is not changed.
Execution of SPED(885) (independent mode) SPED(885) (independent mode) executed again to change the target frequency. (The target position is not changed.)

Operation Purpose Application Frequency changes Description Procedure/ instruction
To stop pulse output (Num- ber of pulses setting is not preserved.)
Immediate stop Stops the pulse output immediately and clears the number of output pulses setting.
↓ INI(880)
Stop pulse output (Num- ber of pulses setting is not preserved.)
Immediate stop Stops the pulse output immediately and clears the number of output pulses setting.
↓ SPED(885), (Independent, Target fre- quency of 0 Hz)
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 tar- get frequency of 500 Hz. .
Target frequency:
PULS(881) and the SPED(885) executed.


SET PULSES PULS @PULS 886 PULS(886) is used to set the pulse output amount (number of out- put pulses).

Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK

0000 hex Pulse output 0
0001 hex Pulse output 1
N and N+1: Number of pulses


Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P, T ---
OK --- --- --- N OK
0000 hex Relative · 0001 hex Absolute

Error Flag P_ER • ON if the specified range for P, T, or N is exceeded.
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.
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 tar- get frequency of 500 Hz.

Instruction Mnemonic Variations Function
code Function
PLS2(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 star- tup frequency.
PLS2
PLS2(887)
PLS2
P
P: Port specifier
M: Output mode
S: First word of settings table
F: First word of starting frequency
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
M Output mode --- 1
S First word of settings table WORD 6
F First word of starting frequency UDINT 2
0000 hex Pulse output 0
0001 hex Pulse output 1
0 3 4 7 8 11 12 15
Always 0 hex.
Symbol · P Port


Specify the increase or decrease in the frequency per pulse control period (4 ms).
0 to 100,000 Hz (0000 0000 to 0001 86A0 hex)
The actual number of movement pulses that will be output are as follows:
The starting frequency is given in F and F+1.
Lower word with starting frequency
0 to 100,000 Hz (0000 0000 to 0001 86A0 hex)
Upper word with starting frequency
Specify the starting frequency in Hz.

Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P, M --- OK
OK

Error Flag P_ER • ON if the specified range for P, M, S, or F is exceeded.

PLS2(887) starts pulse output on the port specified in P using the mode specified in M at the start fre- quency 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 deceler- ation rate specified in S until the starting frequency specified in S is reached, at which point pulse out- put is stopped (4 in diagram).
Pulse output is started each time PLS2(887) is executed. It is thus normally sufficient to use the differ- entiated version (@PLS2(887)) of the instruction or an execution condition that is turned ON only for one scan.
PLS2(887) executed.
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 inde- pendent 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, con- stant speed, or deceleration.
quency 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.

tion Purpose Application Frequency changes Description Procedure/ instruction
Positioning with trapezoidal accel- eration and decel- eration (Separate rates used for acceleration and deceleration; start- ing speed) The number of pulses can be changed during positioning.
Accelerates and deceler- ates at a fixed rates. The pulse output is stopped when the specified num- ber of pulses has been output. (See note.)
Specified number of pulses
(specified number of pulses) can be changed during positioning.
Execution of PLS2(887) Target frequency reached.
Output stops.
To change speed smoothly (with unequal accelera- tion and decelera- tion rates)
Changing the tar- get speed (fre- quency) during positioning (different accelera- tion and decelera- tion rates)
PLS2(887) can be exe- cuted during positioning to change the accelera- tion rate, deceleration rate, and target fre- quency.
Specified number of pulses (Specified with PULS(886).)
Pulse frequency Changed target frequency Target frequency
PULS(886)
get position from being changed intentionally, the original target posi- tion must be speci- fied in absolute coordinates.
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.)
To change target posi- tion
Changing the tar- get position during positioning (multi- ple start function)
PLS2(887) can be exe- cuted during positioning to change the target position (number of pulses), acceleration rate, deceleration rate, and target frequency.
Number of pulses changed with PLS2(887).
Specified number of pulses
PULS(886)
Target frequency Acceleration/ deceleration rate
cannot be main- tained after chang- ing the settings, an error will occur and the original opera- tion will continue to the original target position.
Execution of PLS2(887) PLS2(887) executed to change the target position. (The target frequency and acceleration/deceleration rates are not changed.)
To change target posi- tion and speed smoothly
Changing the tar- get position and target speed (fre- quency) during positioning (multi- ple start function)
PLS2(887) can be exe- cuted during positioning to change the target position (number of pulses), acceleration rate, deceleration rate, and target frequency.
Number of pulses changed with PLS2(887).
Number of pulses specified with PLS2(887).
Execution of PLS2(887) PLS2(887) executed to
cannot be main- tained after chang- ing the settings, an error will occur and the original opera- tion will continue to the original target position.
change the target frequency, acceleration rate and deceleration rate.

tion Purpose Application Frequency changes Description Procedure/ instruction
To change target posi- tion and speed smoothly, continued
Changing the acceleration and deceleration rates during positioning (multiple start function)
PLS2(887) can be exe- cuted during positioning (acceleration or deceler- ation) to change the acceleration rate or deceleration rate.
High-speed Counter/Pulse Output Instructions
Number of pulses specified by PLS2(887) #N.
Pulse frequency New target frequency Original target frequency
Acceleration rate 3 Acceleration rate 2 Acceleration rate 1
Execution of PLS2(887) #1
Execution of PLS2(887) #N
Execution of PLS2(887) #3
Execution of PLS2(887) #2
Changing the direction during positioning
PLS2(887) can be exe- cuted during positioning with absolute pulse spec- ification to change to absolute pulses and reverse direction.
Specified number of pulses
Change of direction at the specified deceleration rate
PLS2
Number of pulses (position) changed by PLS2(887)
Execution of PLS2 (887)
Stop pulse output (Number of pulses set- ting is not preserved.)
Immediate stop Stops the pulse output immediately and clears the number of output pulses.
INI(880)
Stop pulse output smoothly. (Number of pulses set- ting is not preserved.)
Decelerate to a stop
Decelerates the pulse output to a stop.
ACC(888) (Independent, target fre- quency of 0 Hz)
Target frequency = 0
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.
Specified number of pulses (Specified with PLS2(887).)

Example application Frequency changes Description Procedure/ instruction
Change from speed control to fixed distance positioning during operation
PLS2(887) can be executed during a speed control operation started with ACC(888) to change to positioning oper- ation.
Outputs the number of pulses specified in PLS2(887) (Both relative and absolute pulse specification can be used.)
Execution of ACC(888) (continuous mode)
Fixed distance feed interrupt
Execution of ACC(888) (continuous mode)
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
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 500 Hz every 4 ms starting at 200 Hz until the target speed of 50 kHz is reached. From the deceleration point, the pulse output is decelerated at a rate of 250 Hz every 4 ms starting until the start- ing speed of at 200 Hz is reached, at which point pulse output is stopped.
01F4
PLS2(887) executed.

Instruction Mnemonic Variations Function
code Function
ACCELERATION CONTROL ACC @ACC 888 ACC(888) outputs pulses to the specified output port at the specified frequency using the specified acceleration and deceleration rate.
ACC(888)
P
P: Port specifier
M: Output mode
S: First word of settings table
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
M Output mode --- 1
S First word of settings table WORD 3
0000 hex Pulse output 0
0001 hex Pulse output 1
0 3 4 7 8 11 12 15
Always 0 hex.
1 to 65535 Hz (#0001 to FFFF)
Specify the increase or decrease in the frequency per pulse control period (4 ms).
Lower word with target frequency
0 to 100,000 Hz (0000 0000 to 0001 86A0 hex)
Upper word with target frequency
Specify the frequency after acceleration or deceleration in Hz.
Symbol · P Port · Acceleration/deceleration rate

Word addresses Indirect DM addresses
TR bits CIO WR HR AR T C DM @DM *DM
P, M --- OK
--- --- --- S OK ---
Error Flag P_ER • ON if the specified range for P, M, or S is exceeded.
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 differen- tiated version (@ACC(888)) of the instruction or an execution condition that is turned ON only for one scan.
ACC(888) executed.
ACC(888) executed.
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 exe- cuted 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 0 Hz 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.
quency 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.

Pulse output will continue until it is stopped from the program.

Outputs pulses and changes the frequency at a fixed rate.
Changes the frequency from the present fre- quency at a fixed rate. The frequency can be accelerated or deceler- ated.
Changing the speed in a polyline curve during oper- ation
Changes the accelera- tion or deceleration rate during acceleration or deceleration.
quency is set to 0 Hz, the current deceleration rate will be used.
quency of the sec- ond ACC(888) instruction is 0 Hz, the deceleration rate from the first ACC(888) instruc- tion will be used.

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 deceler- ation rate specified in S until the specified number of points has been output, at which point pulse out- put is stopped.
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.
tion Purpose Application Frequency changes Description Procedure/ instruction
Positioning with trapezoidal accel- eration and decel- eration (Same rate used for accelera- tion and decelera- tion; no starting speed) The number of pulses cannot be changed during positioning.
Accelerates and deceler- ates at the same fixed rate and stops immedi- ately when the specified number of pulses has been output. (See note.)
Specified number of pulses (Specified with PULS(886).)
(specified number of pulses) cannot be changed during positioning.
Outputs the specified number of pulses and then stops.
To change speed smoothly (with the same accel- eration and decelera- tion rates)
Changing the tar- get speed (fre- quency) during positioning (acceleration rate = deceleration rate)
ACC(888) can be exe- cuted during positioning to change the accelera- tion/deceleration rate and target frequency. The target position (specified number of pulses) is not changed.
Specified number of pulses (Specified with PULS(886).)
Number of pulses specified with PULS(886) does not change.
ACC(888) or SPED(885) (Independent)
Changed target frequency 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.)
To stop pulse out- put. (Num- ber of pulses set- ting is not preserved.)
Immediate stop Pulse output is stopped immediately and the remaining number of out- put pulses is cleared.
INI(880)

tion Purpose Application Frequency changes Description Procedure/ instruction
Stopping pulse out- put, con- tinued
To stop pulse out- put smoothly. (Number of pulses set- ting is not preserved.)
Decelerating to a stop
Decelerates the pulse output to a stop.
High-speed Counter/Pulse Output Instructions
ACC(888) or SPED(885) (Independent)
the operation, the original accelera- tion/deceleration rate will remain in effect. If SPED(885) started the opera- tion, the accelera- tion / deceleration rate will be invalid and the pulse out- put will stop imme- diately.
Target frequency = 0
ACC(888) (Independent, independent, target fre- quency of 0)
ACC(888) (Independent, target fre- quency 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.
Specified number of pulses (Specified with PULS(886).)
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 20 Hz every 4 ms until the target frequency of 500 Hz is reached. When CIO 0.01 turns ON, ACC(888) changes to an acceleration rate of 10 Hz every 4 ms until the tar- get frequency of 1,000 Hz is reached.
@ACC
10 Hz/4 ms
ACC(888) executed. ACC(888) executed.

code Function
ORIGIN SEARCH ORG @ORG 889 ORG(889) performs an origin search or origin return operation.
ORG(889)
P
P: Port specifier
C: Control data
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
C Control data --- 1
0000 hex Pulse output 0
0001 hex Pulse output 1
0 3 4 7 8 11 12 15
Always 0 hex.
Always 0 hex.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P,C --- OK --- --- ---

Error Flag P_ER • ON if the specified range for P or C is exceeded.
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 search Origin return
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.
In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.
ORG(889) starts outputting pulses using the specified method at the Origin Search Initial Speed (1 in diagram).
Origin Proximity Input Signal
Pulse output is accelerated to the Origin Search High Speed using the Origin Search Accelera- tion Rate (2 in diagram).
Origin search high speed
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).
Origin search deceleration rate
Origin search acceleration rate
Origin search proximity speed
Origin search initial speed
Pulses are then output at constant speed until the Origin Input Signal turns ON (5 in diagram).
ORG(889) executed.
Pulse output is stopped when the Origin Input Signal turns ON (6 in diagram).

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.
ORG(889) starts outputting pulses using the specified method at the Origin Return Initial Speed (1 in diagram).
Origin return target speed
Origin return deceleration rate
Origin return acceleration rate
Pulse output is accelerated to the Origin Return Target Speed using the Origin Return Accelera- tion Rate (2 in diagram) and pulse output is con- tinued at constant speed (3 in diagram).
Origin return initial speed
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 ori- gin (5 in diagram).
ORG(889) executed.
When CIO 0.00 turns ON in the following programming example, ORG(889) starts an origin return oper- ation 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 50 Hz/4 ms.
Origin return, pulse + direction output method
ORG(889) executed. Output stopped.
Pulse Output 0 Starting Speed for Origin Search and Origin Return 0000 0064 hex: 100 pps
Pulse Output 0 Origin Return Target Speed 0000 00C8 hex: 200 pps
Pulse Output 0 Origin Return Acceleration Rate 0032 hex: 50 hex/4 ms
Pulse Output 0 Origin Return Deceleration Rate 0032 hex: 50 hex/4 ms

Instruction Mnemonic Variations Function
code Function
PULSE WITH VARIABLE DUTY FACTOR PWM @PWM 891 PWM(891) is used to output pulses with the speci- fied duty factor from the specified port.
PWM
P
P: Port specifier
F: Frequency
D: Duty factor
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
P Port specifier --- 1
F Frequency --- 1
D Duty factor --- 1
1000 hex PWM output 0 (duty factor: in increments of 1%, frequency 0.1 Hz)
1100 hex PWM output 0 (duty factor: in increments of 1%, frequency 1 Hz)
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 specifies the duty factor of the PWM output, i.e., the percentage of time that the output is ON.
Symbol · P Port

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
P ---
OK --- --- --- F, D OK
Error Flag P_ER • ON if the specified range for P, F, or D is exceeded.
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 stop- ping 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 differ- entiated 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 out- put) or until the CPU Unit is switched to PROGRAM mode.
In case of transistor output type of CP1E E-type CPU Unit or relay output type, NOP processing is applied.
When CIO 0.00 turns ON in the following programming example, PWM(891) starts PWM output from PWM output 0 at 200 Hz with a duty factor of 50%. When CIO 0.01 turns ON, the duty factor is changed to 25%.

In CP1E series PLCs, STEP(008)/SNXT(009) can be used together to create step programs.

Controls progression to the next step of the program. Step Ladder section start instruction
Indicates the start of a step. Repeats the same step pro- gram until the conditions for progression to the next step are established.

Proceeds to the end of the ladder step programming area

code Function
STEP START SNXT --- 009 SNXT(009) is used to control progression of step execution in the step program area.
STEP DEFINE STEP --- 008 STEP(008) is used to define the beginning and the end of the step program area.
When defining the beginning of a step, a control bit is specified as follows:
B
B: Bit
B
B: Bit
When defining the end of a step, a control bit is not specified as follows:
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK Not allowed Not allowed
Operand Description Data type Size
B Bit --- 1
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
B --- OK ---
Error Flag P_ER • ON when the specified bit B is not in the WR area.
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.

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 execu- tion of a step begins.
After the first cycle, step execution will continue until the conditions for changing the step are estab- lished, 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 status Handling
ON Instructions in the step are executed normally.
ON→OFF Bits and instructions in the step are interlocked as shown in the next table.
OFF All instructions in the step are processed as NOPs.
Bits specified for OUT, OUT NOT All OFF
TIM, TIMX(551), TIMH(015), TIMHX(551), TMHH(540), TIMHHX(552), TIML(542), and TIMLX(553)
PV 0000 hex (reset)
Completion Flag OFF (reset)
Bits or words specified for other instructions (see note) Holds the previous status (but the instructions are not executed)
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).
Instruction output Status

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 exe- cution has started.


Step Flag A200.12 ON 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.
When d turns ON, b starts (A is interlocked)

Sequence Control Instructions END(001) END
ILC(003) INTERLOCK CLEAR
JMP(004) JUMP
JME(005) JUMP END
CJP(510) CONDITIONAL JUMP
Subroutine Instructions SBN(092) SUBROUTINE ENTRY
Sample program
SNXT/STEP
0.00 SNXT
CIO 0.00 turns ON, step W0.00 starts
STEP
Step W0.00 starts from the next instruction
Step W0.00
Step (A) ladder program
End of step programming area
W0.00 turns OFF, W0.01 turns ON and step W0.01 starts
STEP
Step W0.01 starts from the next instruction
Step (B) ladder program
Step W0.01
W0.01 turns OFF and dummy bit W30.0 turns ON
STEP
End of step programming area
Function Mnemonic Name · Normal ladder program

0.01 (Step (A) starting condition)
Step (A) W0.00
W0.00
0.02 (Step (A) → Step (B) transition condition)
Step W0.00 (A)
Step (A) ladder program
Step (B) W0.01
0.03 (Step (B) → Step (C) transition condition)
Step (C) W0.02
W0.01
0.04 (Step (C) reset conditions)
Step (B) ladder program
Step W0.01 (B)
W0.02
STEP
W0.02
Step W0.02 (C) Step (C) ladder program
W30.0
STEP
End

0.02 (Step (B) starting condition)
0.01 (Step (A) starting condition)
Step Instructions
Step (A) W0.00 Step (B) W0.01
W0.01
0.03 (Step (A) → Step (C) transition condition)
0.04 (Step (B) → Step (C) transition condition) STEP
Step (C) W0.02
Step W0.00 (A)
0.05 (Step (C) reset conditions)
Step (A) ladder program
SNXT/STEP
W0.02
STEP
W0.01
Step W0.01 (B)
Step (B) ladder program
W0.02
STEP
W0.02
Step W0.02 (C)
Step (C) ladder program
W30.0
STEP
Additional Information:
0.02 0.01
End

0.01 (Step (A), (C) simultaneous starting condition)
Step (A) W0.00
Step (C) W0.02
W0.02
0.02 (Step (A) → Step (B) transition condition)
0.03 (Step (C) → Step (D) transition condition)
W0.00
Step (B) W0.01
Step (D) W0.02
Step (A) ladder program Step W0.00 (A)
0.04 (When both Step (B) and Step (D) are complete, moves to Step (E)
Step (E) W0.04
0.05 (Step (C) reset conditions)
W0.01
Step W0.01 (B) Step (B) ladder program
SNXT
W0.04
STEP
W0.02
Step W0.02 (C) Step (C) ladder program
W0.03
STEP
W0.03
Step W0.03 (D) Step (D) ladder program
W0.04
Step W0.04 (E) Step (E) ladder program
W30.0
STEP
End


SNXT/STEP
Explanation of operation (1) SW1 ON: Solenoid 1 operates Conveyor 1 operates (2) SW2 ON stops the previous process Robot hand operates 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.


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 (3) SWA2 ON stops process A Printing machine operates (down) UP by SWC2 ON (4) SWB2 ON stops process B Printing machine operates (down) UP by SWC2 ON (5) SWD ON stops the printing machine

SW3
SW5 SW7
Step Instructions
Conveyer C Conveyer D
SW2
0.01(SW1, SW2)
Process A started.
0.01(SW 1 and SW2 both ON)
W0.00
Process C started.
SNXT
W0.02
0.02(SW3) 0.03(SW4)
STEP
W0.00
Process B Process D
Programming for process A
0.04(SW5 and SW6 both ON)
Process A reset.
W0.01
Process B started.
STEP
W0.01
Programming for process B
W0.03
Used to turn off process D.
Work (A) operates Conveyor (C) operates
Process E started.
Process C
Work (C) operates (2) SW3 ON: Process (A) stops Conveyor (B) operates
W0.04
STEP
W0.02
Process B
Work (B) operates (3) SW4 ON: Process (C) stops Conveyor (D) operates
Programming for process C
Process C reset.
Work (D) operates (4) SW5, SW6 ON: Process (B) stops Process (D) stops Conveyor (E) operates
Process D started.
W0.03
Process E
Work (E) operates (5) SW7 ON: Process (E) stops
Programming for process D
Note When processes (B) and (D) are in operation and SW5 and
W0.04
W0.04
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).
Programming for process E
Process E reset.
W30.0
Additional Information The STEP instruction turns all outputs in its process OFF when ON changes to OFF.

IORF
code Function
I/O REFRESH IORF @IORF 097 Refreshes the specified I/O words.
IORF(097)
E: End word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
St Starting word --- Variable
E End word --- Variable
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)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
St, E OK ---
Error Flag P_ER • ON if St is greater than E.

Unit type CH Refreshable by IORF(097)
CPU Unit with 30 or 40 I/O Points
CPU Unit with 60 I/O Points CP1E CPU Unit built-in I/O: 0CH, 1CH, 2CH, 100CH, 101CH and 102CH No
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 allo- cated 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.
CP1W Expansion Units, CP1W Expansion I/O Units
Precaution
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).
E
Processing CPM1A Expansion I/O Units
CIO 2 and CIO 3
IORF
CIO 3 E CIO 4
E
CIO 102 and CIO 103
CIO 104

code Function
Converts the hexadecimal contents of the desig- nated digit(s) into 8-bit, 7-segment display code and places it into the upper or lower 8-bits of the specified destination words.
SDEC
SDEC(078)
S
S: Source word
D: First destination word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S Source word UINT 1
Di Digit designator UINT 1
D First destination word UINT Variable
15 12 11 8 7 4 3 0
0 1/0 m n
First digit of S to convert (0 to 3)
Number of digits to convert
First half of D to receive converted data
Not used; set to 0.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- Di OK
OK
Error Flag P_ER • ON if settings in Di are not within the specified ranges.

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.
Di 0 1/0 8 11 12 15 m n
0 3 4 7
First digit to convert S S+1
Rightmost 8 bits (0)
SDEC
Precaution
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.
S
1 8 11 12 15
0 3 4 7
3 2 1 0
8 11 12 15
0 3 4 7
2 1 F
Hexadecimal to 7-segment data conversion (F → 71, 1 → 06, and 2 → 5B)
7 1 5 B 0 6

The following table shows the data conversions from a hexadecimal digit (4 bits) to 7-segment code (8 bits).

Display Original data Digit Bits – g f e d c b a Hex
0 1 3F
1 0 0 0 1 0 1 1 0 06
2 0 0 1 0 0 1 0 1 1 0 1 1 5B
3 0 0 1 1 0 1 0 0 1 4F
4 0 1 0 0 0 1 1 0 0 1 1 0 66
7 0 1 1 1 0 0 1 0 0 1 1 1 27
8 1 0 1 7F
9 1 0 0 1 0 1 1 0 1 6F
A 1 0 1 0 0 1 1 1 0 1 1 1 77
B 1 0 1 1 0 1 0 0 7C
C 1 1 0 1 1 1 0 0 1 39
D 1 1 0 1 0 1 0 1 0 5E
E 1 1 1 0 0 1 0 0 1 79
F 1 0 1 1 1 0 0 0 1 71

Instruction Mnemonic Variations Function
code Function
Reads 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.
DSW
DSW(210)
I: Input word
O: Output word
D: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Operand Description Data type Size
I Input word UINT 1
O Output word UINT 1
D First result word WORD Variable
C1 Number of digit UINT 1
C2 System word WORD 1
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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 I
D0 D1 D2 D3
Rightmost 4 digits Leftmost 4 digits
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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 O
CS signals One Round Flag RD0 Read signal
Symbol

Specifies the leading word address where the external digital switch’s set values will be stored.
8 15 12 11 0 3 4 7
Digit 1 Digit 2 Digit 3 Digit 4
8 15 12 11 0 3 4 7
(See note.)
Digit 5 Digit 6 Digit 7 Digit 8
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.
System word (Cannot be accessed by the user.)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
I, O, D OK ---
--- --- --- C1 ---
C2 OK ---
Error Flag P_ER OFF
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 contin- ues reading the data. The One Round Flag (bit 05 of O) is turned ON once every 16 CPU Unit cycles.
Area · Name Label Operation

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 Thum- bwheel Switch.

00 01 02 03 04 05 06 07 08 09 10 11
No. 1 No. 2 No. 3 No. 4 No. 5 No. 6 No. 7 No. 8
Timing Chart

When only 4 digits are read, only word D is used.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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.
O
P_On · Always ON Flag · #0001

Instruction Mnemonic Variations Function
code Function
Inputs 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.
MTR
MTR(213)
I: Input word
O: Output word
MTR
D: First destination word
C: System word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Operand Description Data type Size
I Input word UINT 1
O Output word UINT 1
D First destination word ULINT 4
C System word WORD 1
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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 I
0 1 2 3 4 5 6 7
Bits 00 to 07 correspond to Input Unit inputs 0 to 7.
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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 O
0 1 2 3 4 5 6 7
Bits 00 to 07 correspond to Output Unit outputs 0 to 7.
Symbol

Specifies the leading word address of the 4 words that contain the data from the 8 × 8 matrix.
15 14 13 12 11 10 9 8
0 1 2 3 4 5 6 7
Bits 00 to 15 correspond to matrix elements 0 to 15.
15 14 13 12 11 10 9 8
0 1 2 3 4 5 6 7
Bits 00 to 15 correspond to matrix elements 16 to 31.
15 14 13 12 11 10 9 8
0 1 2 3 4 5 6 7
Bits 00 to 15 correspond to matrix elements 32 to 47.
15 14 13 12 11 10 9 8
0 1 2 3 4 5 6 7
Bits 00 to 15 correspond to matrix elements 48 to 63.
Specifies a work word used by the instruction. This word cannot be used in any other application.
System word (Cannot be accessed by the user.)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
I, O, D, C OK ---
Area

Error Flag P_ER OFF
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.

Timing Chart

00 01 02 03 04 05 06 07 00 32 64 00 32 64 08
Bits indicating status of inputs (Bit ON when input is ON)
Name Label Operation

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.
O
W0
P_On · Always ON Flag

Instruction Mnemonic Variations Function
code Function
7-SEGMENT DISPLAY OUTPUT 7SEG --- 214 Converts the source data (either 4-digit or 8-digit BCD) to 7-segment display data, and outputs that data to the specified output word.
7SEG(214)
S
S: Source word
O: Output word
C: Control data
D: System word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK Not allowed
Operand Description Data type Size
S Source word WORD Variable
O Output word UINT 1
C Control word #+10 decimal only 1
D System word WORD 1
Specify the first source word containing the data that will be converted to 7-segment display data.
8 15 12 11 0 3 4 7
Digit 1 Digit 2 Digit 3 Digit 4
8 15 12 11 0 3 4 7
Digit 5 Digit 6 Digit 7 Digit 8
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.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 O
D0 D1 D2 D3
4-digit data output Latch outputs
Symbol · One Round Flag

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 O
D0 D1 D2 D3
Leftmost 4-digit data output
Rightmost 4-digit data output
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 data Display’s data input logic Display’s latch input logic C
4 digits (S) Same as Output Unit Same as Output Unit 0000
Different from Output Unit 0001
Different from Output Unit Same as Output Unit 0002
Different from Output Unit 0003
8 digits (S, S+1) Same as Output Unit Same as Output Unit 0004
Different from Output Unit 0005
Different from Output Unit Same as Output Unit 0006
Different from Output Unit 0007
Specifies a work word used by the instruction. This word cannot be used in any other application.
System word (Cannot be accessed by the user.)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S, O OK ---
--- --- --- C --- OK
D OK ---
Error Flag P_ER OFF
7SEG(214) reads the source data, converts it to 7-segment display data, and outputs that data (as left- most 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 display- ing 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 sig- nals.

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 out- puts 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.
COM
IN@ CH IN@ CH
CP1W-40EDT
OUT@ CH OUT@ CH
COM
COM
COM
COM
COM
COM
7SEG
LE3 LE2 LE1 LE0 D0 D1 D2 D3
LE3 LE2 LE1 LE0 VDD (+) VSS (0)
VDD
D0 D1 D2 D3
(+) VSS
Leftmost 4 digits Rightmost 4 digits
Output status (Data and latch logic depends on C) (4 digits, 1 block) (4 digits, 2 blocks)
Data output 00 to 03 00 to 03
10 0 10 1 10 2 10 3
Latch output 0 04 08
Latch output 1 05 09
Latch output 2 06 10
Latch output 3 07 11
One Round Flag 08 12
1 2 3 4 5 6 7 8 9 10 11 12 1
12 cycles required to complete one round

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.
S
O
P_On · Always ON Flag

TXD
Instruction Mnemonic Variations Function
code Function
TRANSMIT TXD @TXD 236 Outputs the specified number of bytes of data from the CPU Unit’s built-in RS-232C port or the Serial Option Board port.
TXD
TXD(236)
S
S: First source word
C: Control word
0000 to 0100 hex (0 to 256)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word UINT Variable
C Control word UINT 1
N Number of bytes 0000 to 0100 hex (0 to 256) UINT 1
15 8 0 11 3 7 4 12 C
RS and ER signal control 0: No RS and ER signal control 1: RS signal control 2: ER signal control 3: RS and ER signal control Serial port specifier 1: CPU Unit’s RS-232C port 2: Serial Option Board port
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- C, N OK
OK
Symbol · Always 0 · Area

Error Flag P_ER • ON if no-protocol mode is not set in the PLC Setup.
CPU Unit’s Built-in RS-232C Port
CPU Unit’s built-in RS-232C port A392.05 ON when data can be sent in the no-protocol mode.
Serial Option Board port A392.13 ON when data can be sent in the no-protocol mode.

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.
Port Address Contents · Port Address Contents

Start code / end code settings and send data
15 7 0 8 N bytes of data is sent in the following order when sending the most significant bytes first is specified: ,
S+1
S+2
No Start or End Code
. . .
N send bytes: 256 max.
. . . ST
Send bytes after ST: 256 max.
. . . ED
. . . ST
Send bytes between ST and ED: 256 max.
LF . . . CR
Send bytes before CR+LF: 256 max.
Start and CR+LF End Code
. . . ST CR LF
Send bytes between ST and CR+LF: 256 max.
CPU Unit’s built-in RS-232C port or Serial Option Board port
Data sent.

This example shows how to send data to the V530-R150V3 2D Code Reader as an example of commu- nicating with an external device.

Power Supply (24 VDC)
XW2Z-200T (2 m) XW2Z-500T (5 m) V530-R150V3
CJ1G-CPU @@ H CJ1H-CPU @@ H CJ1M-CPU @@
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.
The communications settings of the Code Reader are given in the following table. These are the default settings.
Baud rate 38,400 bps
Data bit length 8 bits
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.

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 com- mand used as a trigger input to the Code Reader from the RS-232C line.
0.01 A392.05
@TXD
RS-232C Port Send Ready Flag
&3 N
0.02 A392.06
@RXD
RS-232C Port Receive Ready Flag
A393
RS-232C Port Reception Counter
Lower byte Upper byte
15 8 7 11 12 3 4 0
4 0 3 5
Sent @ G L
4 E 0 0
15 8 7 11 12 3 4 0
0 1 0 0
RS and ER Signal Control #0: No RS and ER signal control.
Always #0.
When CIO 0.01 turns ON, the status of bit 15 of D300 is output as the RS signal and the status of bit 14 is output as the ER signal.
&0 N
15 13 14 12
Turns OFF ER signal.
Turns ON RS signal.
15 8 7 11 12 3 4 0
0 1 0 3
RS and ER Signal Control #3: RS and ER signal control
Always #0.
Three bytes

code Function
RECEIVE RXD @RXD 235 Reads the specified number of bytes of data from the CPU Unit’s built-in RS-232C port or the Serial Option Board port.
RXD(235)
D: First destination word
C: Control word
N: Number of bytes to store 0000 to 0100 hex (0 to 256 decimal)
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
D First destination word UINT Variable
C Control word UINT 1
N Number of bytes to store 0000 to 0100 hex (0 to 256 decimal) UINT 1
8 12 3 4 15 0 7 11
Byte order 0 Hex: Most significant byte to least significant byte 1 Hex: Lest significant byte to most significant byte
CS and DR signal monitoring 0: No CS and DR signal monitoring 1: CS signal monitoring 2: DR signal monitoring 3: CS and DR signal monitoring.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
OK
Error Flag P_ER • ON if no-protocol mode is not set in the PLC Setup.

Auxiliary Area Flags for CPU Unit’s RS-232C Port
RS-232C Port Reception Completed Flag A392.06 ON 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 Flag A392.07 ON 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 Counter A393 Counts in hexadecimal the number of bytes received in no-protocol mode (0 to 256 decimal).
Auxiliary Area Flags for Serial Option Board Port
Serial Option Board port Reception Completed Flag
A392.14 ON 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 Flag
A392.15 ON 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 Counter A394.00 to A394.15 Counts in hexadecimal the number of bytes received in no-protocol mode (0 to 256 decimal).
Name Address Contents · Name Address Contents

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.
(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
(d) RS-232C Port Restart Bit
Built-in RS232C port A526.00
Serial Option Board port: A526.01

No Start or End Code
1 2 3 4 5 6 0...
ST
1 2 3 4 5 6 0...
1 2 3 4 5 6 0...
Receive bytes before ED: 256 max.
Start and End Code
1 2 3 4 5 6 0...
Receive bytes between ST and ED: 256 max.
1 2 3 4 5 6 0...
Receive bytes before CR+LF: 256 max.
Start and CR+LF End Code
ST CR LF
1 2 3 4 5 6 0...
Receive bytes between ST and CR+LF: 256 max.
CPU Unit’s built-in RS-232C port or Serial Option Board port
When receiving the most significant bytes first is specified (0):
N bytes stored in the specified Max: 256 bytes order.
15 7 0 8
When receiving the least significant bytes first is specified (1):
15 7 0 8

This example shows how to receive data from the V530-R150V3 2D Code Reader as an example of communicating with an external device.
Power Supply (24 VDC)
XW2Z-200T (2 m) XW2Z-500T (5 m) V530-R150V3
CJ1G-CPU H CJ1H-CPU H CJ1M-CPU
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.
The communications settings of the Code Reader are given in the following table. These are the default settings.
Baud rate 38,400 bps
Data bit length 8 bits
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.

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.
0.01 A392.05
TXD
RS-232C Port Send Ready Flag
RXD
S
RS-232C Port Receive Ready Flag
RS-232C Port Reception Counter
A393
RXD
Lower byte Upper byte
15 8 7 11 12 3 4 0
S: D100
3 0 6 3
D102 3 8 F 2
15 8 7 11 12 3 4 0
0 1 0 0
RS and ER Signal Control
Always #0.
When CIO 0.00 turns ON, the status of the CS signal is output to bit 15 of D100 and the status of the DR signal is output to bit 14 of D100.
15 13 14 12
15 8 7 11 12 3 4 0
0 1 0 3
CS and DR Signal Monitor #3: CS and DR signal monitor
Always #0.

CADD/CSUB
code Function
CALENDAR ADD CADD @CADD 730 Adds time to the calendar data in the specified words.
CALENDAR SUBTRACT CSUB @CSUB 731 Subtracts time from the calendar data in the spec- ified words.
CADD(730)
CSUB(731)
C: First calendar word
C: First calendar word
T: First time word
T: First time word
R: First result word
R: First result word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
C First calendar word WORD 3
T First time word DWORD 2
R First result word WORD 3
Symbol

C through C+2: Calendar Data T and T+1: Time Data
15 8 0 7
15 8 0 7
Clock Instructions
T+1
15 8 0 7
15 8 0 7
15 8 0 7
15 8 0 7

C through C+2: Calendar Data T and T+1: Time Data
15 8 0 7
15 8 0 7
T+1
15 8 0 7
15 8 0 7
15 8 0 7
15 8 0 7

Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
--- --- --- T OK
OK
Flags
Error Flag P_ER • ON if the calendar data in C through C+2 is not within the specified ranges.
Equal Flag P_EQ • ON when the result of a CSUB instruction is 0.
Function CADD
15 7 0 8 Minutes Seconds
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.
C+2
15 7 0 8
T+1
15 7 0 8
R+1
R+2
CSUB
15 7 0 8 Minutes Seconds
CSUB(731) subtracts the time data (words T and T+1) from the cal- endar data (words C through C+2) to and outputs the resulting calen- dar data to R through R+2.
C+2
15 7 0 8
T+1
15 7 0 8
R+2

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, sec- onds) and the result is output to D300 through D302.
15 7 0 8
D101 D102
18:30:20
R
T:D200
10 minutes, 15 seconds 600 hours
18:40:35
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.
15 7 8 0
D101 D102
18:30:20
R
15 7 8 0
10 00 15 50
50 hours, 10 minutes, 15 seconds
15 7 8 0
16:20:05

code Function
Clock Instructions
CLOCK ADJUSTMENT DATE @DATE 735 Changes the internal clock setting to the setting in the specified source words.
DATE(735)
S
S: First source word
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word LWORD 4
15 8 0 7
15 8 0 7
S+2
15 8 0 7
15 8 0 7
S+3
01 = Monday 02 = Tuesday 03 = Wednesday 04 = Thursday 05 = Friday 06 = Saturday
Always set to 00.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
S OK ---
Error Flag P_ER • ON if the new clock setting in S through S+3 is not within the specified range.
Symbol · Area · Name Label Operation

Clock data A351 to A354 A351.00 to A351.07: Seconds (00 to 59) (BCD)
DATE(735) changes the internal clock setting according to the clock data in the four source words. The new inter- nal clock setting is immediately reflected in the Calendar/Clock Area (A351 to A354).
S+1
S+2
S+3
Hint
The internal clock setting can also be changed from a Peripheral Device or the CLOCK WRITE FINS command (0702).
When CIO 0.00 turns ON in the following example, the internal clock is set to 20:15:30 on Thursday, October 9, 1998.
S
S:D100 15 30 15 7 8
Day of the month
Always set to 00.
Day of the week

FAL
Instruction Mnemonic Variations Function
code Function
FAILURE ALARM FAL @FAL 006 Generates or clears user-defined non-fatal errors. Non-fatal errors do not stop PLC operation.
Generating or Clearing User-defined Non-fatal Errors Generating Non-fatal System Errors
FAL(006)
FAL(006)
N
N: FAL number
N: FAL number (value in A529)
S: First message word or
S: First word containing the
constant (0000 to FFFF)
error code and error details
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N FAL number Constants only 1
S First message word or constant / First word containing the error code and error details WORD Variable
Generates a non-fatal error Clears all non-fatal errors
N 1 to 511 (These FAL numbers are shared with FALS numbers.) 0
Word 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.
FAL number.
Other: Clears the most serious non-fatal error.
Generates a non-fatal error
N 1 to 511 (These FAL numbers are shared with FALS numbers.)
S Error code that will be generated. (See Function below.)
S+1 Error details code that will be generated. (See Function below.)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N ---
OK --- --- --- S OK
Symbol · Area

Error Flag ER • ON if N is not within the specified range of 0 to 511 decimal.
Related Auxiliary Area Words and Bits Auxiliary Area Words/Flags for User-defined Errors Only
FAL Error Flag A402.15 ON when an error is generated with FAL(006).
Executed FAL Number Flags A360.01 to A391.15
When 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.
A529 A 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).
Error Log Area A100 to A199 The 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 code A400 When 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.
When FAL(006) is executed with N set to 0, non-fatal errors can be cleared. The value of S will deter- mine the processing, as shown in the following table.
&1 to &511 (0001 to 01FF hex) The FAL error of the specified number will be cleared.
FFFF hex All non-fatal errors (including system errors) will be cleared.
0200 to FFFE hex or word specification The 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.
There are two ways to clear non-fatal system errors generated with FAL(006).

The following table shows the error codes and FAL Error Flags for FAL(006).
FAL number 1 to 511 decimal
FAL error codes 4101 to 42FF
Executed FAL Number Flags A360.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 num- ber and the following processing will be performed:
FAL Error Flag ON
Corresponding Executed FAL Number Flag ON
Execution of FAL(006) generates a non-fatal er- ror with FAL number N.
Error code written to A400
Error code and time written to Error Log Area
PLC Setup is selected.
serious error’s error code will be written to A400.
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:
Error code written to A400
Error code and time written to Error Log Area
Execution of FAL(006) generates a non-fatal system error with the error code/details specified in S and S+1.
The corresponding Auxiliary Area Flags are set based on the error code and error details.
ERR Indicator flashes. Matching values
S
S+1
ERR Indicator flashes · Error code · Error details

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 name S S+1
PLC Setup Error 009B hex PLC Setup Error Location 0000 to FFFF hex
Built-in Analog Error 008A hex --- (not fixed)
Option Board Error 00D1 hex Option Board Slot No. 0001 hex
Battery Error 00F7 hex --- (not fixed)
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.
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.


When CIO 0.00 is ON in the following example, FAL(006) will generate a non-fatal error with FAL num- ber 31 and execute the following processes.
N
4F
M
M:
M: D100
4F
MESSAGE LOW VOLTAGE
code) will be stored in A400.
Disregarded

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).
N
Set N to 0 to clear errors.
M Set M to the desired FAL number (031(001F)).
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).
N
Set N to 0 to clear errors.
M 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.
N
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.)
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.
#000A
A529
FAL
D200 N
S
000A A529CH
S: D200
#0000 · Matching values · #0001

Instruction Mnemonic Variations Function
code Function
SEVERE FAILURE ALARM FALS --- 007 Generates user-defined fatal errors. Fatal errors stop PLC operation.
Generating User-defined Fatal Errors Generating Fatal System Errors
FALS(007)
N: FAL number
N: FAL number (value in A529)
N
S
S: First message word or
S: First word containing the
constant (0000 to FFFF)
error code and error details
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
N FAL number Constants only 1
S First message word or constant / First word containing the error code and error details WORD Variable
Generates a non-fatal error
N 1 to 511 (These FALS numbers are shared with FALS numbers.)
S Specifies 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.
The following table shows the function of the operands.
Generates a non-fatal error
N 1 to 511 (These FALS numbers are shared with FAL numbers.)
S Error code that will be generated. (See Description below.)
S+1 Error details code that will be generated. (See Description below.)
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
N ---
OK --- --- --- S OK
Error Flag P_ER • ON if N is not within the specified range of 0001 to 01FF (1 to 511 decimal).
Symbol · Area · Name Label Operation

Related Auxiliary Area Words and Bits Auxiliary Area Words/Flags for User-defined Errors Only
FALS Error Flag A401.06 ON when an error is generated with FALS(007).
A529 A 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).
Error Log Area A100 to A199 The 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 code A400 When 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.
in A400.
FALS number 1 to 511
FALS error codes C101 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:
FALS Error Flag ON
Execution of FALS(007) generates a fatal error with FALS number N.
Error code written to A400
Error code and time/date written to Error Log Area
will contain the more serious error’s error code.
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 memory Output status from output units
IOM Hold Bit (A500.12).
Error code written to A400
Execution of FALS(007) generates a fatal system error with the error code/details specified in S and S+1.
Error code and time written to Error Log Area
N
The corresponding Auxiliary Area Flags are set based on the error code and error details.
ERR Indicator flashes.
FALS
S
S+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:
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 execut- ing 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 memory Status of outputs on Output Units
IOM Hold Bit (A500.12)

The following table shows how to specify error codes and error details in S and S+1.
Error code Error details
Memory Error 80F1 hex Bits 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 Error 80CA hex CP1W Expansion I/O Unit, Expansion Unit
Too Many I/O Points Error 80E1 hex Bits 13 to 15: Error Cause Bits 00 to 12: Details
Program Error 80F0 hex Bits 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 Error 809F hex #0000 hex
There are two ways to clear fatal system errors generated with FALS(007).
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.
When a fatal system error is registered, if the IOM Hold Bit is OFF, I/O memory will be cleared.
Error name · #0A0A hex

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.
FALS
N
M
4C 4F
M: D100
4F
MESSAGE LOW VOLTAGE
and fatal system errors, as well as errors generated by FAL(006) and FAL(007).
When CIO 0.00 is ON in the following example, FALS(007) will generate Memory Error (User programe Error). In this case, dummy FAL number 10 is used and the corresponding value (80F1 hex) is stored in A529.
#000A
A529
FALS
N
000A A529CH
S: D200
#80F1
Disregarded · S Matching values · #0001

STC/CLC
code Function
SET CARRY STC @STC 040 Sets the Carry Flag (CY).
CLEAR CARRY CLC @CLC 041 Turns OFF the Carry Flag (CY).
STC(040) CLC(041)
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Carry Flag P_CY ON OFF
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 pre- vent any influence from other preceding instructions. ROL(027) and ROR(028) make use of the Carry Flag in their rotation shift operations.
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.
Symbol · Data type · Operand Description

code Function
Other Instructions
Extends 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.
WDT
WDT(094)
T
T: Timer setting
Applicable Program Areas
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
T Timer setting Constants only 1
Specifies the watchdog timer setting between 0000 and 0064 hexadecimal or between &0000 and &0100 decimal.
Word addresses Indirect DM addresses
Constants CF Pulse bits TR bits CIO WR HR AR T C DM @DM *DM
T --- OK --- --- ---
Operand Description Data type
Error Flag P_ER • ON if the watchdog timer setting exceeds 1 second.

Symbol · Area

Watch cycle time A Cycle Time Too Long error (fatal error) will be registered if the cycle time exceeds the maximum 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)
Cycle Time Too Long Flag A401.08 ON 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 Time A262 and A263 These words contain the maximum cycle time in 32-bit binary. This value is updated every cycle.
Present Cycle Time A264 and A265 These words contain the present cycle time in 32-bit binary. This value is updated every cycle.
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.
WDT
WDT
Operation of WDT(094)
In this example, the watchdog timer setting is set to 500ms.

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.).
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 oper- ands used with it.
The number of steps in a program is not the same as the number of instructions.
Specifying differentiation will increase the execution times by the following amounts.
Symbol
CPU
↓
or ↓ +4.0
@ or % +2.5
2 Use the following time as a guideline when instructions are not executed.
CPU

Sequence Input Instructions
time (µs) Conditions
No.
!LD --- 2 10.26 ---
LOAD NOT LD NOT --- 1 1.19 ---
!LD NOT --- 2 10.26 ---
AND AND --- 1 1.19 ---
!AND --- 2 10.26 ---
AND NOT AND NOT --- 1 1.19 ---
!AND NOT --- 2 10.26 ---
OR OR --- 1 1.29 ---
!OR --- 2 10.36 ---
OR NOT OR NOT --- 1 1.29 ---
!OR NOT --- 2 10.36 ---
AND LOAD AND LD --- 1 0.60 ---
OR LOAD OR LD --- 1 0.60 ---
NOT NOT 520 1 0.80 ---
CONDITION ON UP 521 3 4.92 ---
CONDITION OFF DOWN 522 4 5.69 ---
Sequence Output Instructions
No.
time (µs) Conditions
!OUT --- 2 38.06 ---
OUTPUT NOT OUT NOT --- 1 1.61 ---
!OUT NOT --- 2 38.06 ---
KEEP KEEP 011 1 4.72 ---
DIFFERENTIATE UP DIFU 013 2 4.12 ---
DIFFERENTIATE DOWN DIFD 014 2 4.19 ---
SET SET --- 1 2.69 ---
!SET --- 2 39.12 ---
RESET RSET --- 1 2.69 Word specified
MULTIPLE BIT SET SETA 530 4 17.60 With 1-bit set
253.5 With 1,000-bit set
MULTIPLE BIT RESET RSTA 531 4 17.60 With 1-bit reset
249.5 With 1,000-bit reset
!SETB 3 54.60 ---
SINGLE BIT OUTPUT RSTB 534 2 16.60 ---
!RSTB 3 54.60 ---

Sequence Control Instructions
time (µs) Conditions
No.
NO OPERATION NOP 000 1 1.2 ---
INTERLOCK IL 002 1 4.3 ---
INTERLOCK CLEAR ILC 003 1 4.3 ---
MULTI-INTERLOCK
MILH 517 3 19.4 During interlock
19.4 Not during interlock and interlock not set
21.5 Not during interlock and interlock set
MILR 518 3 19.4 During interlock
19.4 Not during interlock and interlock not set
21.5 Not during interlock and interlock set
MULTI-INTERLOCK CLEAR MILC 519 2 8.9 Interlock not cleared
8.9 Interlock cleared
JUMP END JME 005 2 6.2 ---
CONDITIONAL JUMP CJP 510 2 10.1 When JMP condition is satisfied
FOR LOOP FOR 512 2 9.7 Designating a constant
NEXT LOOP NEXT 513 1 5.8 When loop is continued
5.7 When loop is ended
time (µs) Conditions
No.
TIMX 550 When loop is continued
CNTX 546 When loop is continued
TIMHX 551 When loop is continued
TMHHX 552 ---
ACCUMULATIVE TIMER TTIM 087 3 22.7 ---
17.4 When resetting
15.0 When interlocking
17.4 When resetting
15.2 When interlocking
20.4 When interlocking
22.2 When interlocking
CNTRX 548 25.4 ---
RESET TIMER/ COUNTER CNR 545 3 19.0 When resetting 1 word
659.0 When resetting 256 words
CNRX 547 3 19.0 When resetting 1 word
659.0 When resetting 256 words

Comparison Instructions
Instruction Mnemonic FUN No. Length (steps)
time (µs) Conditions
LD,AND,OR+= 300 4 9.3 ---
LD,AND,OR+ <> 305
LD,AND,OR+ < 310
LD,AND,OR+ < = 315
LD,AND,OR+ > 320
LD,AND,OR+ > = 325
LD,AND,OR+=+L 301 4 10.8 ---
LD,AND,OR+ <> +L 306
LD,AND,OR+ < +L 311
LD,AND,OR+ < =+L 316
LD,AND,OR+ > +L 321
LD,AND,OR+ > =+L 326
LD,AND,OR+=+S 302 4 9.4 ---
LD,AND,OR+ <> +S 307
LD,AND,OR+ < +S 312
LD,AND,OR+ < =+S 317
LD,AND,OR+ > +S 322
LD,AND,OR+ > =+S 327
LD,AND,OR+=+SL 303 4 10.9 ---
LD,AND,OR+ <> +SL 308
LD,AND,OR+ < +SL 313
LD,AND,OR+ < =+SL 318
LD,AND,OR+ > +SL 323
LD,AND,OR+ > =+SL 328
Time Comparison Instructions =DT 341 4 14.5 ---
<DT 343 4 14.4 ---
<=DT 344 4 14.4 ---
>DT 345 4 14.6 ---
>=DT 346 4 14.6 ---
COMPARE CMP 020 3 8.1 ---
!CMP 020 7 49.1 ---
DOUBLE COMPARE CMPL 060 3 9.5 ---
SIGNED BINARY COMPARE CPS 114 3 8.1 ---
!CPS 114 7 49.1 ---
DOUBLE SIGNED BINARY
CPSL 115 3 9.5 ---
COMPARE
TABLE COMPARE TCMP 085 4 61.1 ---
UNSIGNED BLOCK COMPARE BCMP 068 4 107.6 ---
AREA RANGE COMPARE ZCP 088 3 17.8 ---
DOUBLE AREA RANGE
ZCPL 116 3 20.1 ---
COMPARE

Data Movement Instructions
time (µs) Conditions
No.
!MOV 021 7 57.7 ---
DOUBLE MOVE MOVL 498 3 8.9 ---
MOVE NOT MVN 022 3 13.7 ---
MOVE BIT MOVB 082 4 21.4 ---
MOVE DIGIT MOVD 083 4 22.4 ---
MULTIPLE BIT TRANSFER XFRB 062 26.4 Transferring 1 word
137.3 Transferring 255 bits
BLOCK TRANSFER XFER 070 4 24.2 Transferring 1 word
3747.7 Transferring 1,000 words
BLOCK SET BSET 071 4 21.3 Setting 1 word
2074.4 Setting 1,000 words
SINGLE WORD DISTRIBUTE DIST 080 4 20.8 ---
DATA COLLECT COLL 081 4 20.6 ---
Data Shift Instructions
No.
time (µs) Conditions
SHIFT REGISTER SFT 010 3 14.1 Shifting 1 word
1076.0 Shifting 290 words
REVERSIBLE SHIFT REGISTER SFTR 084 4 18.0 Shifting 1 word
3784.4 Shifting 1,000 words
WORD SHIFT WSFT 016 4 25.8 Shifting 1 word
3783.9 Shifting 1,000 words
ARITHMETIC SHIFT RIGHT ASR 026 2 13.0 ---
ROTATE LEFT ROL 027 2 13.3 ---
ROTATE RIGHT ROR 028 2 13.5 ---
ONE DIGIT SHIFT LEFT SLD 074 3 21.8 Shifting 1 word
3778.3 Shifting 1,000 words
ONE DIGIT SHIFT RIGHT SRD 075 3 22.2 Shifting 1 word
3778.6 Shifting 1,000 words
DOUBLE SHIFT NBITS LEFT NSLL 582 3 20.8 ---
DOUBLE SHIFT NBITS RIGHT NSRL 583 3 21.0 ---

Increment/Decrement Instructions
time (µs) Conditions
No.
DOUBLE INCREMENT BINARY ++L 591 2 13.5 ---
DECREMENT BINARY -- 592 2 12.3 ---
DOUBLE DECREMENT BINARY -- L 593 2 13.6 ---
INCREMENT BCD ++B 594 2 13.2 ---
DOUBLE INCREMENT BCD ++BL 595 2 14.4 ---
DECREMENT BCD -- B 596 2 13.2 ---
DOUBLE DECREMENT BCD -- BL 597 2 14.5 ---
Symbol Math Instructions
time (µs) Conditions
No.
SIGNED BINARY ADD WITHOUT CARRY + 400 4 11.5 ---
DOUBLE SIGNED BINARY ADD WITHOUT CARRY +L 401 4 13.0 ---
SIGNED BINARY ADD WITH CARRY +C 402 4 11.7 ---
DOUBLE SIGNED BINARY ADD WITH CARRY +CL 403 4 13.2 ---
BCD ADD WITHOUT CARRY +B 404 4 20.6 ---
DOUBLE BCD ADD WITHOUT CARRY +BL 405 4 22.9 ---
BCD ADD WITH CARRY +BC 406 4 20.8 ---
DOUBLE BCD ADD WITH CARRY +BCL 407 4 23.1 ---
DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY - L 411 4 13.2 ---
SIGNED BINARY SUBTRACT WITH CARRY - C 412 4 11.7 ---
DOUBLE SIGNED BINARY SUBTRACT WITH CARRY - CL 413 4 13.3 ---
BCD SUBTRACT WITHOUT CARRY - B 414 4 20.3 ---
DOUBLE BCD SUBTRACT WITHOUT CARRY - BL 415 4 23.6 ---
BCD SUBTRACT WITH CARRY - BC 416 4 20.5 ---
DOUBLE BCD SUBTRACT WITH CARRY - BCL 417 4 23.8 ---
DOUBLE SIGNED BINARY MULTIPLY ∗L 421 4 23.9 ---
DOUBLE BCD MULTIPLY ∗BL 425 4 33.2 ---
DOUBLE SIGNED BINARY DIVIDE /L 431 4 25.8 ---
DOUBLE BCD DIVIDE /BL 435 4 33.0 ---

Conversion Instructions
time (µs) Conditions
No.
DOUBLE BCD TO DOUBLE BINARY
BINL 058 3 16.7 ---
BINARY TO BCD BCD 024 3 15.1 ---
DOUBLE BINARY TO
BCDL 059 3 17.3 ---
DOUBLE BCD
2’S COMPLEMENT NEG 160 3 14.3 ---
DATA DECODER MLPX 076 4 19.6 Decoding 1 digit (4 to 16)
31.0 Decoding 4 digits (4 to 16)
79.4 Decoding 1 digit (8 to 256)
138.2 Decoding 2 digits (8 to 256)
DATA ENCODER DMPX 077 4 32.5 Encoding 1 digit (16 to 4)
63.0 Encoding 4 digits (16 to 4)
68.0 Encoding 1 digit (256 to 8)
112.3 Encoding 2 digits (256 to 8)
ASCII CONVERT ASC 086 4 22.8 Converting 1 digit into ASCII
24.7 Converting 4 digits into ASCII
ASCII TO HEX HEX 162 4 18.4 Converting 1 digit
time (µs) Conditions
No.
DOUBLE LOGICAL AND ANDL 610 4 20.4 ---
LOGICAL OR ORW 035 4 18.6 ---
DOUBLE LOGICAL OR ORWL 611 4 20.4 ---
EXCLUSIVE OR XORW 036 4 18.6 ---
DOUBLE EXCLUSIVE OR XORL 612 4 20.4 ---
COMPLEMENT COM 029 2 12.4 ---
DOUBLE COMPLEMENT COML 614 2 13.6 ---
Special Math Instructions
time (µs) Conditions
No.
ARITHMETIC PROCESS APR 069 4 34.2 Designating SIN and COS
25.9 Designating line-segment approximation
BIT COUNTER BCNT 067 4 19.5 Counting 1 word

Floating-point Math Instructions
time (µs) Conditions
No.
FLOATING TO 32-BIT FIXL 451 3 16.2 ---
16-BIT TO FLOATING FLT 452 3 16.2 ---
32-BIT TO FLOATING FLTL 453 3 17.1 ---
FLOATING-POINT ADD +F 454 4 24.1 ---
FLOATING-POINT SUBTRACT - F 455 4 25.2 ---
FLOATING-POINT DIVIDE /F 457 4 25.0 ---
FLOATING-POINT MULTIPLY ∗ F 456 4 24.4 ---
Floating Symbol Comparison LD,AND,OR+=F 329 3 11.6 ---
LD,AND,OR+ < F 331 ---
LD,AND,OR+ <= F 332 ---
LD,AND,OR+ > F 333 ---
LD,AND,OR+ >= F 334 ---
FLOATINGPOINT TO ASCII FSTR 448 4 56.8 ---
ASCII TO FLOATING-POINT FVAL 449 3 42.9 ---
Table Data Processing Instructions
time (µs) Conditions
No.
SWAP BYTES SWAP 637 3 16.8 Swapping 1 word
6250.0 Swapping 1,000 words
FRAME CHECKSUM FCS 180 4 24.1 For 1-word table length
2710.0 For 1,000-word table length
time (µs) Conditions
No.
PIDAT 191 4 316.0 Initial execution of PID processing
270.0 PID processing When sampling
228.0 PID processing When not sampling
275.5 Initial execution of autotuning
276.0 Autotuning when sampling
TIME-PROPORTIONAL OUTPUT TPO 685 4 5.8 OFF execution time
40.8 ON execution time with duty designation or displayed output limit
43.4 ON execution time with manipulated vari- able designation and output limit enabled
SCALING 2 SCL2 486 4 20.2 ---
SCALING 3 SCL3 487 4 26.4 ---
AVERAGE AVG 195 4 24.2 Average of an operation
225.5 Average of 64 operations

Subroutine Instructions
time (µs) Conditions
No.
SUBROUTINE ENTRY SBN 092 2 2.6 ---
SUBROUTINE RETURN RET 093 1 3.1 ---
Interrupt Control Instructions
time (µs) Conditions
No.
SET INTERRUPT MASK MSKS 690 3 15.1 Set
15.1 Reset
CLEAR INTERRUPT CLI 691 3 14.9 Set
18.0 Reset
ENABLE INTERRUPTS EI 694 1 8.9 ---
High-speed Counter and Pulse Output Instructions
time (µs) Conditions
No.
MODE CONTROL INI 880 4 46.0 Starting high-speed counter comparison
31.8 Stopping high-speed counter comparison
48.7 Changing pulse output PV
35.2 Changing high-speed counter PV
27.2 Stopping pulse output
13.0 Stopping PWM(891) output
PRV 881 4 40.0 Reading pulse output PV
35.0 Reading high-speed counter PV
37.2 Reading pulse output status
32.6 Reading high-speed counter status
24.5 Reading PWM(891) status
36.5 Reading high-speed counter range comparison results
29.1 Reading frequency of high-speed counter 0
COMPARISON TABLE LOAD CTBL 882 4 69.3 Registering target value table and starting comparison for 1 target value
116.3 Registering target value table and starting comparison for 6 target values
126.6 Registering range table and starting com- parison
46.3 Only registering target value table for 1 target value
93.3 Only registering target value table for 6 target values
122.5 Only registering range table
SPEED OUTPUT SPED 885 4 69.2 Continuous mode
74.0 Independent mode
PULSE OUTPUT PLS2 887 5 97.6 ---

No.
time (µs) Conditions
ACCELERATION CONTROL ACC 888 4 75.6 Continuous mode
82.8 Independent mode
ORIGIN SEARCH ORG 889 3 52.2 Origin search
126.8 Origin return
PWM 891 4 28.9 ---
Step Instructions
time (µs) Conditions
No.
STEP DEFINE STEP 008 2 10.5 Step control bit ON
10.4 Step control bit OFF
I/O Unit Instructions
time (µs) Conditions
No.
I/O REFRESH IORF 097 3 170.7 Refreshing 1 input word for CP1W Expansion Unit
146.6 Refreshing 1 output word for CP1W Expansion Unit
1725.8 Refreshing 12 input words for CP1W Expansion Unit
1359.9 Refreshing 12 output words for CP1W Expansion Unit
MATRIX INPUT MTR 213 5 31.6 Data input value: 00
7-SEGMENT DISPLAY OUTPUT 7SEG 214 5 27.1 4 digits
30.8 8 digits
time (µs) Conditions
No.
TRANSMIT TXD 236 4 25.0 Sending 1 byte
25.0 Sending 256 bytes
RECEIVE RXD 235 4 39.2 Storing 1 byte
256.6 Storing 256 bytes
time (µs) Conditions
No.
CALENDAR SUBTRACT CSUB 731 4 55.1 ---
CLOCK ADJUSTMENT DATE 735 2 29.9 ---

Failure Diagnosis Instructions
time (µs) Conditions
No.
FAILURE ALARM FAL 006 3 55.6 Recording errors
79.6 Deleting errors (in order of priority)
61.6 Deleting errors (all errors)
60.0 Deleting errors (individually)
Other Instructions
time (µs) Conditions
No.
CLEAR CARRY CLC 041 1 3.9 ---
EXTEND MAXIMUM CYCLE TIME WDT 094 2 11.7 ---

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 con- nected online to a CPU Unit.
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.
Select PLC Setting - PLC Information - Cycle Time from the PLC Menu.
The following PLC Cycle Time Dialog Box will be displayed.

The average (mean), maximum, and minimum cycle times will be displayed in order from the top.
Click the Reset Button to recalculate and display the cycle time values.
The cycle time present value and maximum value are stored in the following Auxiliary Area words.

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.
Checks Unit connection status
Startup initialization Overseeing processing Program execution Cycle time calculation
Checks hardware and user program memory
4-2-1 CPU Unit Operation Flowchart
ERR/ALM indicator ON or flashing?
User program executed Cyclic task executed
YES
Waits until the set cycle time
has elapsed (when the minimum cycle time is valid)

4-2-2 Cycle Time Overview
The cycle time depends on the following conditions.
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.
(1) Overseeing
Operation Processing time and
fluctuation cause
Checks the I/O bus and user memory, checks for battery errors, etc.
0.4 ms min.
Operation Processing time and
fluctuation cause
Executes the instructions in the user program. The time required is the total of the executions times for all instructions.
Total instruction execution time.
Operation Processing time and fluctuation cause
Waits for the specified cycle time to elapse when a minimum (constant) cycle time has been set in the PLC Setup.
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)).
Calculates the cycle time.
Processing time
Operation
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 Units
Outputs from the CPU Unit to the actual outputs are refreshed first for each Unit, and then inputs.
I/O refresh time for each Unit multiplied by the number of Units used.

Operation Processing time and fluctuation cause Services peripheral USB port
In this servicing, 8% of the previous cycle’s cycle time (calculated in step (3)) will be allowed for peripheral servicing.
(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 name Model numbers I/O refresh time per unit NA-type CPU Unit 20-point I/O + Analog I/O CPU Unit
4-2-3 I/O Refresh Times for PLC Units
Unit name Model numbers I/O refresh time per unit Expansion I/O Unit 8-point Input Unit CP1W-8ED 0.14 ms 8-point Output Unit CP1W-8ER 0.06 ms CP1W-8ET CP1W-8ET1 16-point Output Unit CP1W-16ER 0.17 ms CP1W-16ET CP1W-16ET1 20-point I/O Unit CP1W-20EDR1 0.20 ms CP1W-20EDT CP1W-20EDT1 32-point Output Unit CP1W-32ER 0.33 ms CP1W-32ET CP1W-32ET1 40-point I/O Unit CP1W-40EDR 0.45 ms CP1W-40EDT CP1W-40EDT1 Expansion Unit Analog Input Unit CP1W-AD041 0.72 ms Analog Output Unit CP1W-DA041 0.33 ms Analog I/O Units CP1W-MAD11 0.36 ms Temperature Sensor Unit CP1W-TS001 0.30 ms CP1W-TS002 0.57 ms CP1W-TS101 0.30 ms CP1W-TS102 0.57 ms CompoBus/S I/O Link Unit CP1W-SRT21 0.20 ms
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.
CP1E CPU Unit 40-point I/O Unit
1 Unit
CP1W-40EDR
Ladder diagram 5K steps LD instructions: 2.5K steps
OUT instructions: 2.5K steps
Peripheral USB port connection Yes or no
Minimum cycle time processing None
Serial port connection None
Other peripheral servicing None
Calculation Example
Processing time
Process name Equation
Peripheral USB
Peripheral USB port connected
port not connected
(1)Overseeing − 0.4 ms 0.4 ms
(2)Program execution 1.19µs×2,500+1.61µs×2,500 7.0 ms 7.0 ms
(3)Cycle time calculation (Minimum cycle time not set.) 0 ms 0 ms
(4)I/O refreshing 0.45 ms 0.45 ms 0.45 ms
(5)Peripheral servicing (Only peripheral USB port connected) 0.2 ms 0 ms
Cycle time (1)+(2)+(3)+(4)+(5) 8.15 ms 7.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:
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
No.
No.
331 --- --- --- 2-241
888 @ACC --- --- 2-331
AND<L AND DOUBLE LESS THAN
311 --- --- --- 2-88
AND LD
AND LOAD --- --- --- --- 2-13
AND<S AND SIGNED LESS THAN
312 --- --- --- 2-88
AND NOT --- --- --- !AND NOT
AND< SL
AND DOUBLE SIGNED LESS THAN
313 --- --- --- 2-88
310 --- --- --- 2-88
315 --- --- --- 2-88
300 --- --- --- 2-88
AND TIME EQUAL
341 --- --- --- 2-91
332 --- --- --- 2-241
329 --- --- --- 2-241
AND TIME LESS THAN OR EQUAL
344 --- --- --- 2-91
301 --- --- --- 2-88
316 --- --- --- 2-88
302 --- --- --- 2-88
AND DOUBLE SIGNED EQUAL
303 --- --- --- 2-88
317 --- --- --- 2-88
320 --- --- --- 2-88
AND DOUBLE SIGNED LESS THAN OR EQUAL
318 --- --- --- 2-88
325 --- --- --- 2-88
305 --- --- --- 2-88
AND TIME GREATER THAN OR EQUAL
346 --- --- --- 2-91
AND TIME NOT EQUAL
342 --- --- --- 2-91
330 --- --- --- 2-241
334 --- --- --- 2-241
306 --- --- --- 2-88
326 --- --- --- 2-88
307 --- --- --- 2-88
327 --- --- --- 2-88
AND DOUBLE SIGNED NOT EQUAL
308 --- --- --- 2-88
AND TIME LESS THAN
343 --- --- --- 2-91

No.
No.
AND DBL SIGNED GREATER THAN OR EQUAL
328 --- --- --- 2-88
058 @BINL --- --- 2-185
BREAK BREAK LOOP
514 --- --- --- 2-59
AND TIME GREATER THAN
345 --- --- --- 2-91
AND>F AND FLOATING GREATER THAN
333 --- --- --- 2-241
321 --- --- --- 2-88
No.
322 --- --- --- 2-88
730 @CADD --- --- 2-380
CJP CONDITIONAL JUMP
510 --- --- --- 2-53
AND DOUBLE SIGNED GREATER THAN
323 --- --- --- 2-88
041 @CLC --- --- 2-398
CLI CLEAR INTERRUPT
691 @CLI --- --- 2-303
ANDL DOUBLE LOGICAL AND
610 @ANDL --- --- 2-210
CMP COMPARE 020 --- --- !CMP 2-95
ANDW LOGICAL AND
034 @ANDW --- --- 2-210
CMPL DOUBLE COMPARE
060 --- --- --- 2-95
545 @CNR --- --- 2-86
APR ARITHMETIC PROCESS
069 @APR --- --- 2-218
CNRX RESET TIMER/COU NTER
547 @CNRX --- --- 2-86
ASC ASCII CONVERT
086 @ASC --- --- 2-201
ASL ARITHMETIC SHIFT LEFT
025 @ASL --- --- 2-133
CNT COUNTER --- --- --- --- 2-80
CNTR REVERSIBLE COUNTER
012 --- --- --- 2-83
026 @ASR --- --- 2-134
CNTRX REVERSIBLE COUNTER
548 --- --- --- 2-83
CNTX COUNTER 546 --- --- --- 2-80
COLL DATA COLLECT
081 @COLL --- --- 2-125
B
COM COMPLEMENT
029 @COM --- --- 2-216
COML DOUBLE COMPLEMENT
614 @COML --- --- 2-216
No.
024 @BCD --- --- 2-187
CPS SIGNED BINARY COMPARE
114 --- --- !CPS 2-98
BCDL DOUBLE BINARY TO DOUBLE BCD
059 @BCDL --- --- 2-187
CPSL DOUBLE SIGNED BINARYCOMPARE
115 --- --- --- 2-98
068 @BCMP --- --- 2-103
CSUB CALENDAR SUBTRACT
731 @CSUB --- --- 2-380
BCNT BIT COUNTER
067 @BCNT --- --- 2-227
BIN BCD TO BINARY
023 @BIN --- --- 2-185
CTBL REGISTERCOMPARISON TABLE
882 @CTBL --- --- 2-315
A-3



No.
No.
LD NOT LOAD NOT --- --- --- !LD NOT 2-7
329 --- --- --- 2-241
310 --- --- --- 2-88
315 --- --- --- 2-88
301 --- --- --- 2-88
303 --- --- --- 2-88
LOAD DATE LESS THAN OR EQUAL
344 --- --- --- 2-91
320 --- --- --- 2-88
332 --- --- --- 2-241
325 --- --- --- 2-88
316 --- --- --- 2-88
LOAD DATE GREATER THAN OR EQUAL
346 --- --- --- 2-91
317 --- --- --- 2-88
334 --- --- --- 2-241
LOAD DOUBLE SIGNED LESS THAN OR EQUAL
318 --- --- --- 2-88
326 --- --- --- 2-88
305 --- --- --- 2-88
LOAD DATE NOT EQUAL
342 --- --- --- 2-91
327 --- --- --- 2-88
330 --- --- --- 2-241
LOAD DBL SIGNED GREATER THAN OR EQUAL
328 --- --- --- 2-88
306 --- --- --- 2-88
307 --- --- --- 2-88
345 --- --- --- 2-91
LOAD DOUBLE SIGNED NOT EQUAL
308 --- --- --- 2-88
333 --- --- --- 2-241
321 --- --- --- 2-88
343 --- --- --- 2-91
331 --- --- --- 2-241
322 --- --- --- 2-88
311 --- --- --- 2-88
323 --- --- --- 2-88
312 --- --- --- 2-88
313 --- --- --- 2-88
300 --- --- --- 2-88

M
O
No.
No.
519 --- --- --- 2-44
ORG ORIGIN SEARCH
889 @ORG --- --- 2-336
OR LD OR LOAD --- 2-13
517 --- --- --- 2-44
OR NOT OR NOT --- --- --- !OR NOT 2-11
310 --- --- --- 2-88
315 --- --- --- 2-88
518 --- --- --- 2-44
OR DATE LESS THAN OR EQUAL
344 --- --- --- 2-91
076 @MLPX --- --- 2-191
OR<=F OR FLOATING LESS THAN OR EQUAL
332 --- --- --- 2-241
MOVB MOVE BIT 082 @MOVB --- --- 2-111
OR<=L OR DOUBLE LESS THAN OR EQUAL
316 --- --- --- 2-88
083 @MOVD --- --- 2-113
MOVL DOUBLE MOVE
498 @MOVL --- --- 2-108
OR<=S OR SIGNED LESS THAN OR EQUAL
317 --- --- --- 2-88
690 @MSKS --- --- 2-300
OR<= SL
OR DOUBLE SIGNED LESS THAN OR EQUAL
318 --- --- --- 2-88
213 --- --- --- 2-361
OR<> OR NOT EQUAL
305 --- --- --- 2-88
OR DATE NOT EQUA
342 --- --- --- 2-91
330 --- --- --- 2-241
No.
306 --- --- --- 2-88
580 @NASL --- --- 2-141
NASR SHIFT NBITS RIGHT
581 @NASR --- --- 2-144
OR<>S OR SIGNED NOT EQUAL
307 --- --- --- 2-88
160 @NEG --- --- 2-189
NEXT --- 513 --- --- --- 2-56
OR<> SL
OR DOUBLE SIGNED NOT EQUAL
308 --- --- --- 2-88
000 --- --- --- 2-39
NSLL DOUBLE SHIFT NBITS LEFT
582 @NSLL --- --- 2-141
OR<DT OR DATE LESS THAN
343 --- --- --- 2-91
331 --- --- --- 2-241
583 @NSRL --- --- 2-144
OR<L OR DOUBLE LESS THAN
311 --- --- --- 2-88
312 --- --- --- 2-88
313 --- --- --- 2-88

No.
No.
ORWL DOUBLE LOGICAL OR
611 @ORWL --- --- 2-212
OR=DT OR DATE EQUAL
341 --- --- --- 2-91
329 --- --- --- 2-241
Alphabetical List of Instructions by Mnemonic App
OUT NOT
OUTPUT NOT
--- --- --- !OUT NOT
OR=L OR DOUBLE EQUAL
301 --- --- --- 2-88
302 --- --- --- 2-88
303 --- --- --- 2-88
No.
191 --- --- --- 2-257
320 --- --- --- 2-88
325 --- --- --- 2-88
887 @PLS2 --- --- 2-325
PRV HIGHSPEEDCOUNTER PV READ
881 @PRV --- --- 2-311
OR>= DT
OR DATE GREATER THAN OR EQUAL
346 --- --- --- 2-91
886 @PULS --- --- 2-323
OR>=F OR FLOATING GREATER THAN OR EQUAL
334 --- --- --- 2-241
891 @PWM --- --- 2-339
OR>=L OR DOUBLE GREATER THAN OR EQUAL
326 --- --- --- 2-88
327 --- --- --- 2-88
No.
093 --- --- --- 2-295
OR DBL SIGNED GREATER THAN OR EQUAL
328 --- --- --- 2-88
027 @ROL --- --- 2-135
ROR ROTATE RIGHT
028 @ROR --- --- 2-137
OR>DT OR DATE GREATER THAN
345 --- --- --- 2-91
RSTA MULTIPLE BIT RESET
531 @RSTA --- --- 2-31
OR>F OR FLOATING GREATER THAN
333 --- --- --- 2-241
533 @RSTB --- !RSTB 2-33
OR>L OR DOUBLE GREATER THAN
321 --- --- --- 2-88
OR>S OR SIGNED GREATER THAN
322 --- --- --- 2-88
323 --- --- --- 2-88
035 @ORW --- --- 2-212
A-7




Z
No.
No.
401 @+L --- --- 2-158
ZCP AREA RANGE COMPARE
088 --- --- --- 2-105
410 @- --- --- 2-166
116 --- --- --- 2-105
592 @-- --- --- 2-150
596 @--B --- --- 2-156
No.
597 @--BL --- --- 2-156
7SEG 7-SEGMENT DISPLAY OUTPU
214 --- --- --- 2-365
593 @--L --- --- 2-150
+ SIGNED BINARY ADDWITHOUT CARRY
400 @+ --- --- 2-158
414 @-B --- --- 2-172
++ INCREMENT BINARY
590 @++ --- --- 2-147
416 @-BC --- --- 2-175
++B INCREMENT BCD
594 @++B --- --- 2-153
-BCL DOUBLE BCD SUBTRACTWIT H CARRY
417 @-BCL --- --- 2-175
++BL DOUBLE INCREMENT BCD
595 @++BL --- --- 2-153
-BL DOUBLE BCD SUBTRACTWIT HOUT CARRY
415 @-BL --- --- 2-172
++L DOUBLE INCREMENTBINARY
591 @++L --- --- 2-147
+B BCD ADD WITHOUT CARRY
404 @+B --- --- 2-162
-C SIGNED BINARY SUBTRACTWIT H CARRY
412 @-C --- --- 2-170
+BC BCD ADD WITH CARRY
406 @+BC --- --- 2-164
-CL DOUBLE SIGNED BINARYSUBTRACT WITH CARRY
413 @-CL --- --- 2-170
+BCL DOUBLE BCD ADD WITHCARRY
407 @+BCL --- --- 2-164
+BL DOUBLE BCD ADD WITHOUTCARRY
405 @+BL --- --- 2-162
-F FLOATINGPOINT SUBTRACT
455 @-F --- --- 2-237
+C SIGNED BINARY ADD WITHCARRY
402 @+C --- --- 2-160
-L DOUBLE SIGNED BINARYSUBTRACT WITHOUTCARRY
411 @-L --- --- 2-166
+CL DOUBLE SIGNED BINARYADD WITH CARRY
403 @+CL --- --- 2-160
* SIGNED BINARY MULTIPLY
420 @* --- --- 2-177
454 @+F --- --- 2-237
*B BCD MULTIPLY
424 @*B --- --- 2-179
A-9




A manual revision code appears as a suffix to the catalog number on the front cover of the manual.
Revision code Date Revised content 01 March 2009 Original production 02 June 2009 Errors were corrected. 03 January 2010 Information added on E10/14, N14/60 and NA20 CPU Units.


Contact: www.ia.omron.com
Regional Headquarters OMRON EUROPE B.V. Wegalaan 67-69-2132 JD Hoofddorp The Netherlands Tel: (31)2356-81-300/Fax: (31)2356-81-388
OMRON ELECTRONICS LLC One Commerce Drive Schaumburg, IL 60173-5302 U.S.A. Tel: (1) 847-843-7900/Fax: (1) 847-843-7787
OMRON (CHINA) CO., LTD. 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
© OMRON Corporation 2009 All Rights Reserved.
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
In the interest of product improvement, specifications are subject to change without notice.
Cat. No. W483-E1-03 0110
Tokyo, JAPAN
Owners and our team usually reply within a day — and your question helps the next person too.
Be the first to ask — other owners or our team will answer.