Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

MELSEC iQ-R Programming Manual
(Instructions, Standard Functions/Function Blocks)

Advertisement

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC iQ-R Series

  • Page 1 MELSEC iQ-R Programming Manual (Instructions, Standard Functions/Function Blocks)
  • Page 3: Safety Precautions

    (Read these precautions before using this product.) Before using MELSEC iQ-R series programmable controllers, please read the manuals for the product and the relevant manuals introduced in those manuals carefully, and pay full attention to safety to handle the product correctly.
  • Page 4 • When the Safety CPU is used (1) Although MELCO has obtained the certification for Product's compliance to the international safety standards IEC61508, EN954-1/ISO13849-1 from TUV Rheinland, this fact does not guarantee that Product will be free from any malfunction or failure. The user of this Product shall comply with any and all applicable safety standard, regulation or law and take appropriate safety measures for the system in which the Product is installed or used and shall take the second or third safety measures other than the Product.
  • Page 5: Introduction

    Before using this product, please read this manual and the relevant manuals carefully and develop familiarity with the functions and performance of the MELSEC iQ-R series programmable controller to handle the product correctly. When applying the program examples provided in this manual to an actual system, ensure the applicability and confirm that it will not cause system control problems.
  • Page 6: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 CONDITIONS OF USE FOR THE PRODUCT .
  • Page 7 CC-Link Instructions ..............139 Serial Communication Instructions .
  • Page 8 No operation (NOPLF)..............217 CHAPTER 6 BASIC INSTRUCTIONS Comparison Operation Instructions .
  • Page 9 Bit Processing Instructions ............. . 340 Setting a bit in the word device .
  • Page 10 Converting hexadecimal ASCII data to 32-bit binary data ......... 448 Converting decimal ASCII data to BCD 4-digit data .
  • Page 11 Disabling interrupt programs with specified priority or lower ........544 Interrupt program mask .
  • Page 12 Replacing the specified string data ............695 Searching string data.
  • Page 13 Calculating the arc cosine of BCD data............803 Calculating the arc tangent of BCD data .
  • Page 14 7.17 Pulse Related Instructions ............. . . 894 Measuring the density of pulses .
  • Page 15 7.25 Clock Instructions ..............1001 Reading clock data .
  • Page 16 Reading socket communications receive data ..........1107 Predefined Protocol Support Function Instruction .
  • Page 17 Pulse integration ............... 1227 11.3 Control Operation Instructions .
  • Page 18 Reading device data from another CPU module ..........1405 Writing device data to another CPU module .
  • Page 19 Reading receive data (for interrupt programs)..........1550 Sending data .
  • Page 20 20.9 Sending Data by Using User Frames............1699 20.10 Clearing Receive Data.
  • Page 21 25.19 Converting INT to BOOL ..............1814 25.20 Converting INT to WORD .
  • Page 22 CHAPTER 26 SINGLE VARIABLE FUNCTIONS 1893 26.1 Calculating the Absolute Value ............1893 26.2 Calculating the Square Root .
  • Page 23 32.8 Searching String Data ..............1960 CHAPTER 33 TIME DATA TYPE FUNCTIONS 1962 33.1...
  • Page 24 INDEX 2092 INSTRUCTION INDEX 2093 REVISIONS ................2104 WARRANTY .
  • Page 25: Relevant Manuals

    System configuration, parameter settings, and online e-Manual [SH-081215ENG] operations of GX Works3 e-Manual refers to the Mitsubishi Electric FA electronic book manuals that can be browsed using a dedicated tool. e-Manual has the following features: • Required information can be cross-searched in multiple manuals.
  • Page 26: Terms

    CPU module The abbreviation for the MELSEC iQ-R series CPU module D/A converter module A generic term for the MELSEC iQ-R series digital-analog converter module, channel isolated digital-analog converter module, and high speed digital-analog converter module Engineering tool The product name of the software package for the MELSEC programmable controllers...
  • Page 27 A generic term for the safety global label, safety local label, and standard/safety shared label ( MELSEC iQ-R Programming Manual (Program Design)) Standard CPU A generic term for MELSEC iQ-R series CPU modules (other than Safety CPU) that perform standard control (This term is used to distinguish from the Safety CPU.) Standard control Machine control by standard programs and standard data communications.
  • Page 28 Instruction symbols Unless otherwise specified, this manual uses the following generic symbols for some instructions. Classification Instruction symbol Generic symbol PID control instruction S(P).PIDINIT, PIDINIT(P) PIDINIT S(P).PIDCONT, PIDCONT(P) PIDCONT S(P).PIDPRMW, PIDPRMW(P) PIDPRMW Multiple CPU dedicated instruction D(P).DDRD, M(P).DDRD DDRD D(P).DDWR, M(P).DDWR DDWR Network common instruction JP.READ, GP.READ...
  • Page 29: Manual Page Organization

    MANUAL PAGE ORGANIZATION In this manual, pages are organized and the symbols are used as shown below. How to read Part 3 and Part 4 The following illustration is for explanation purpose only, and should not be referred to as an actual documentation. Ò...
  • Page 30  Instruction symbol • An instruction symbol followed by parentheses indicates multiple instructions. For example, "GRY(P)(_U)" indicates four instructions: GRY, GRYP, GRY_U, and GRYP_U. Instruction symbol Meaning Instruction symbol followed by "(P)" This instruction is executed only on the rising edge (off to on). Instruction symbol followed by "(_U)"...
  • Page 31  Precautions  Error code and error details if the instruction has any possible operation error • A device in which an error code is stored is provided in the error code column. When an error code is stored in SD0, an error flag (SM0) turns on.
  • Page 32 How to read Part 5 and Part 6 The following illustration is for explanation purpose only, and should not be referred to as an actual documentation. Ò Ó Ô Õ Ö ×  Function symbol A function symbol followed by parentheses indicates multiple functions or function blocks. For example, "BOOL_TO_DINT(_E)"...
  • Page 33  Description of operands, types, data types, and label data types • For the data type, refer to the following. Page 36 Data Specification Method  Processing details of the standard function or standard function block  Error code and error details if the standard function or standard function block has any possible operation error A device in which an error code is stored is provided in the error code column.
  • Page 34 MEMO...
  • Page 35: Part 1 Overview

    PART 1 OVERVIEW This part consists of the following chapter. 1 OVERVIEW...
  • Page 36: Instruction Configuration

    OVERVIEW Instruction Configuration Many instructions available for programmable controllers are each divided into the instruction part and device part. The instruction part and device part are used as follows. • Instruction part: Indicates the function of the relevant instruction. • Device part: Indicates the data used for the instruction. The device part is further classified to source data, destination data, and numerical data.
  • Page 37 Numerical value (n) For the numerical values of the numbers of devices, transfers, data, and character strings, specify those used by an instruction which uses multiple devices or an instruction which specifies the numbers of repetitions, data to be processed, and character strings.
  • Page 38: Data Specification Method

    Data Specification Method The following table lists the types of data that can be used for instructions in CPU modules. Data Classification Bit data Bit data 16-bit data (word data) 16-bit signed binary data 16-bit unsigned binary data 32-bit data (double word data) 32-bit signed binary data 32-bit unsigned binary data 64-bit data (quad-word data)
  • Page 39 Device data The following table lists devices and constants that can be used to specify the setting data of instructions. Data type Description Specifiable device/constant Bit data can be handled. • Bit device Page 40 Bit data • Bit specification of word device Word Word data can be handled.
  • Page 40 Label data The following table lists labels that can be used to specify the setting data of instructions. ■Primitive data type Data type (label) Specifiable label • Bit type label (BOOL) • Bit-specified word [unsigned]/bit string [16 bits] type label •...
  • Page 41 ■Generic data type The generic data type is the data type of the labels which summarize several primitive data types. Generic data types are used when multiple data types are allowed for arguments and return values of functions or function blocks.
  • Page 42: Bit Data

    Bit data Data size and data range Bit data is handled in increments of bits such as contacts and coils. Data name Data size Value range Bit data 1 bit 0, 1 Handling bit data with bit devices and labels Bit data of one point per point can be handled.
  • Page 43 Handling bit data with word type labels By specifying a bit number for a word type label, bit data of the specified bit number can be handled. A bit in a word type label can be specified by "Label name.Bit number". L_INT.0 L_INT[1].0 L_STRUCT[1].S_INT.0...
  • Page 44: 16-Bit Data (Word Data)

    16-bit data (word data) Data size and data range 16-bit data includes signed and unsigned 16-bit data. In signed 16-bit data, a negative number is represented in two's complement. Data name Data size Value range Decimal notation Hexadecimal notation Signed 16-bit data 16 bits (1 word) -32768 to 32767 0000H to FFFFH...
  • Page 45 Digit specification range The following table lists the range of 16-bit data for each digit specification. Digit Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH Signed 16-bit data: -32768 to 32767 0000H to FFFFH Unsigned 16-bit data: 0 to 65535...
  • Page 46 Handling 16-bit data with word devices/labels ■Word device One point of word device can handle 16-bit data. ■Word type label One point of word type label can handle 16-bit data. 1 OVERVIEW 1.2 Data Specification Method...
  • Page 47: 32-Bit Data (Double Word Data)

    32-bit data (double word data) Data size and data range 32-bit data includes signed and unsigned 32-bit data. In signed 32-bit data, a negative number is represented in two's complement. Data name Data size Value range Decimal notation Hexadecimal notation Signed 32-bit data 32 bits (2 word) -2147483648 to 2147483647...
  • Page 48 Digit specification range The following table lists the range of 32-bit data for each digit specification. Digit Decimal notation Hexadecimal notation specification 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095 000H to FFFH 0 to 65535 0000H to FFFFH 0 to 1048575...
  • Page 49 ■Specifying a bit device with digit specification in the source (s) When a bit device with digit specification is specified in the source of an instruction, 0 is stored in the bits, which follow the bit for which digit specification is made in the source, in the word device of the destination. Ladder example Processing •...
  • Page 50: Real Number Data (Floating-Point Data)

    Real number data (floating-point data) Data size and data range Real number data includes single-precision 32-bit real number data and double-precision 64-bit real number data. Real number data can be stored only in devices other than bit devices or in single-precision or double-precision real data type labels.
  • Page 51 Configuration of double-precision real number data Double-precision real number data consists of a sign, mantissa, and exponent, and is expressed as shown below. Exponent × 2 Sign Mantissa The following figure shows the bit configuration of the internal expression of double-precision real number data and the meaning of each part.
  • Page 52 The monitor function of the engineering tool can monitor real number data of CPU modules. To represent "0" in real number data, set all numbers in each of the following range to 0. • Single-precision real number data: b0 to b31 •...
  • Page 53: String Data

    String data Format of character string data The following table lists the types of character string data, each of which ends with a NULL code to be handled as a character string. Type Character code Last character Character string ASCII code, Shift JIS code NULL(00H) Unicode character string Unicode (UTF-16 (little endian))
  • Page 54 Number of words required for storing data Character string data can be stored in word devices. The following table lists the numbers of words required for storing character string data. Number of Number of words required for storing character Number of words required for storing Unicode character string strings character strings...
  • Page 55: Execution Condition

    Execution Condition Types of execution conditions The following table lists the execution conditions of instructions. Execution condition Description An instruction is executed during on. It is executed only while the precondition of the instruction is on. When the precondition is off, the instruction is not executed. Rising edge An instruction is executed one time when turned on.
  • Page 56: High-Speed Instruction Processing

    High-speed Instruction Processing Subset processing Subset processing can reduce the number of steps or speed up the instruction processing when the device and label specified by each operand of an instruction satisfy the specified conditions. Instruction symbols and the number of operands do not change whether subset processing is applicable or not. Instructions that support subset processing For the availability of subset processing for each instruction, refer to the following.
  • Page 57: Precautions On Programming

    Precautions on Programming Errors common to instructions The following table lists the conditions under which an error occurs when the instruction is executed. Error content Error code An I/O number which is out of range (other than 000H to FFFH and 3E0H to 3E3H) is specified. 2800H An I/O number which corresponds to no module is specified.
  • Page 58 Checking the range of file register When a file register is specified in an instruction, a range check is performed, so a program needs to be created so that the operation result falls within the range of the relevant file register. If a range exceeding that of the file register (ZR) is specified, an error (error code: 2820) occurs.
  • Page 59: Operation When A Long Timer Or Long Retentive Timer Device Is Used

    Operation when a long timer or long retentive timer device is used When the data to be handled exceeds the width (32 bits) of the current value, the long timer or long retentive timer operates by using not only the area of the current value but also the areas of the previous value, contact, and coil. Device Configuration Timer (T)
  • Page 60 To batch-transfer the current values of the long timer device When the BMOV instruction is used, all current values, contacts, and coils are batch-transferred. BMOVP Current value Coil Contact FRT previous value Current value Coil Contact FRT previous value Current value Contact Coil FRT previous value...
  • Page 61: Operations Arising When The Out, Set/Rst, And Pls/Plf Instructions Of The Same Device Are Used

    Operations arising when the OUT, SET/RST, and PLS/PLF instructions of the same device are used This section describes the operation when two or more OUT, SET/RST, and PLS/PLF instructions that use the same device are executed within one scan. In safety programs executed by the Safety CPU, replace some words as follows: •...
  • Page 62 If SET/RST instructions of the same device are used ■For SET instructions The SET instruction turns on the specified device if the execution command is on, and causes no operation if it is off. Thus, if two or more SET instructions of the same device are executed during one scan, the specified device turns on even if one execution command is on.
  • Page 63 If PLS instructions of the same device are used The PLS instruction turns on the specified device when the execution command specifies an off-to-on change. The specified device is turned off unless the execution command specifies an off-to-on change (i.e. off to off, on to on, on to off). Thus, if two or more PLS instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLS instruction specifies an off-to-on change.
  • Page 64 • If the off-to-on changes of X0 and X1 are at the same timing PLS M0 PLS M0 PLS M0 (1) Since X0 turns on, M0 turns on. (2) Since X1 turns on, M0 remains off. (3) Since X0 is other than turning on, M0 turns off. (4) Since X1 is other than turning on, M0 remains off.
  • Page 65 If PLF instructions of the same device are used The PLF instruction turns on the specified device when the execution command specifies an off-to-on change. The specified device is turned off unless the execution command specifies an on-to-off change (i.e. off to off, off to on, on to on). Thus, if two or more PLS instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLS instruction specifies an on-to-off change.
  • Page 66 • If the on-to-off changes of X0 and X1 are at the same timing PLF M0 PLF M0 PLF M0 (1) Since X0 turns off, M0 turns on. (2) Since X1 turns off, M0 remains on. (3) Since X0 is other than turning off, M0 turns off. (4) Since X1 is other than turning off, M0 remains off.
  • Page 67: Restrictions On Using File Registers

    Restrictions on using file registers When a file register is specified for the refresh device, note the following restrictions. When a file register having the same name as a program is specified If the use of a file register having the same name as a program is specified in the parameter, refresh cannot be performed correctly.
  • Page 68 MEMO 1 OVERVIEW 1.5 Precautions on Programming...
  • Page 69: Part 2 Lists Of Instructions And Fun/Fb

    PART 2 LISTS OF INSTRUCTIONS AND FUN/FB This part consists of the following chapters. 2 CPU MODULE INSTRUCTIONS 3 MODULE DEDICATED INSTRUCTIONS 4 STANDARD FUNCTIONS/FUNCTION BLOCKS...
  • Page 70: Chapter 2 Cpu Module Instructions

    CPU MODULE INSTRUCTIONS The following table summarizes how to read the instruction lists. Item Description Instruction symbol An instruction name Processing details An overview of the instruction Reference Section where detailed information is described Sequence Instructions Contact instructions ■Operation start, series connection, parallel connection Instruction symbol Processing details Reference...
  • Page 71 ■Pulse NOT operation start, pulse NOT series connection, pulse NOT parallel connection Instruction symbol Processing details Reference LDPI Turns on when the specified device is off, on, or at the falling edge (on to off). (Rising edge pulse Page 165 LDPI, LDFI, NOT operation start instruction) ANDPI, ANDFI, ORPI, ORFI...
  • Page 72 Output instructions ■Out (excluding the timer, counter, and annunciator) Instruction symbol Processing details Reference Outputs the operation result to the specified device. Page 175 OUT ■Timer, long timer Instruction symbol Processing details Reference OUT T Starts time measurement when the operation result up to the OUT instruction is on. When time is Page 177 OUT T, up, the normally open contact turns on (continuity state) and the normally closed contact turns off OUTH T, OUT ST,...
  • Page 73 Shift instructions ■Shifting bit devices Instruction symbol Processing details Reference Shifts the on/off state of the device area just before the one specified to the specified device area, Page 205 SFT(P) and turns off the shift source device. SFTP Master control instructions ■Setting/resetting a master control Instruction symbol Processing details...
  • Page 74: Basic Instructions

    Basic Instructions Comparison operation instructions ■Comparing 16-bit binary data Instruction symbol Processing details Reference LD=, AND=, OR= Compares the two sets of 16-bit binary data specified. (Devices are used as normally open Page 218 LD(_U), contacts.) AND(_U), OR(_U) LD=_U, AND=_U, OR=_U LD<>, AND<>, OR<>...
  • Page 75 ■Outputting a comparison result of 32-bit binary data Instruction symbol Processing details Reference DCMP Compares the 32-bit binary data specified by (s1) with the 32-bit binary data specified by (s2), Page 224 DCMP(P)(_U) and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on. DCMPP DCMP_U DCMPP_U...
  • Page 76 Arithmetic operation instructions ■Adding/subtracting 16-bit binary data Instruction symbol Processing details Reference Adds the two sets of 16-bit binary data specified. (Two operands) Page 235 +(P)(_U) [when two operands are set] +P_U Adds the two sets of 16-bit binary data specified. (Three operands) Page 237 +(P)(_U) [when three operands are set]...
  • Page 77 ■Multiplying/dividing 32-bit binary data Instruction symbol Processing details Reference Multiplies the two sets of 32-bit binary data specified. Page 255 D*(P)(_U) D*_U D*P_U Performs division between the two sets of 32-bit binary data specified. Page 257 D/(P)(_U) D/_U D/P_U ■Adding/subtracting BCD 4-digit data Instruction symbol Processing details Reference...
  • Page 78 ■Adding/subtracting 16-bit binary block data Instruction symbol Processing details Reference Adds the two 16-bit binary data blocks specified. Page 282 BK+(P)(_U) BK+P BK+_U BK+P_U Performs subtraction between the two 16-bit binary data blocks specified. Page 284 BK-(P)(_U) BK-P BK-_U BK-P_U ■Adding/subtracting 32-bit binary block data Instruction symbol Processing details...
  • Page 79 Logical operation instructions ■Performing an AND operation on 16-bit/32-bit data Instruction symbol Processing details Reference WAND Performs an AND operation on the two sets of 16-bit binary data specified. (Two operands) Page 300 WAND(P) [when two operands WANDP are set] WAND Performs an AND operation on the two sets of 16-bit binary data specified.
  • Page 80 ■Performing an XOR operation on 16-bit block data Instruction symbol Processing details Reference BKXOR Performs an XOR operation on the two 16-bit binary data blocks specified. Page 328 BKXOR(P) BKXORP (s1) (s2) ■Performing an XNOR operation on 16-bit/32-bit data Instruction symbol Processing details Reference WXNR...
  • Page 81 Bit processing instructions ■Setting/resetting a bit in the word device Instruction symbol Processing details Reference BSET Sets the 'n'th bit in the specified word device to 1. Page 340 BSET(P) BSETP BRST Resets the 'n'th bit in the specified word device to 0. Page 342 BRST(P) BRSTP ■Performing a bit test...
  • Page 82 ■Converting BCD 4-digit/8-digit data to 16-bit/32-bit binary data Instruction symbol Processing details Reference Converts the specified BCD 4-digit data (0 to 9999) to 16-bit binary data. Page 382 BIN(P) BINP DBIN Converts the specified BCD 8-digit data (0 to 99999999) to 32-bit binary data. Page 384 DBIN(P) DBINP (s)+1, (s)
  • Page 83 ■Converting double-precision real number to 16-bit/32-bit unsigned binary data Instruction symbol Processing details Reference DBL2UINT Converts the specified double-precision real number (0 to 65535) to 16-bit unsigned binary data. Page 396 DBL2UINT(P) DBL2UINTP (s)+3, (s)+2, (s)+1, (s) (1) Real number DBL2UDINT Converts the specified double-precision real number (0 to 4294967295) to 32-bit unsigned binary Page 400...
  • Page 84 ■Converting 32-bit unsigned binary data to 16-bit unsigned binary data Instruction symbol Processing details Reference UDINT2UINT Converts the 32-bit unsigned binary data in the device specified by (s) to 16-bit unsigned binary Page 422 data, and stores the converted data in the device specified by (d). UDINT2UINT(P) UDINT2UINTP ■Converting 16-bit/32-bit binary data to 16-bit/32-bit binary Gray code data...
  • Page 85 ■Converting BCD 4-digit data block to 16-bit binary data block Instruction symbol Processing details Reference BKBIN Batch-converts the (n) points of BCD data in the device starting from the one specified by (s) to Page 436 BKBIN(P) binary data, and stores the converted data in the device specified by (d) and later. BKBINP ■Converting decimal ASCII data to 16-bit/32-bit binary data Instruction symbol...
  • Page 86 ■Two's complement of 16-bit/32-bit binary data (sign inversion) Instruction symbol Processing details Reference Inverts the sign of 16-bit binary device. Page 467 NEG(P) NEGP DNEG Inverts the sign of 32-bit binary device. Page 469 DNEG(P) DNEGP (d)+1, (d) (d)+1, (d) ■Decoding 8-bit data to 256-bit data Instruction symbol Processing details...
  • Page 87 Shift instructions ■Shifting 16-bit binary data to the right/left by n bit(s) Instruction symbol Processing details Reference Shifts the 16-bit binary data in the specified device to the right. Page 350 SFR(P) SFRP bn-1 (SM700) 0∙∙∙0 Shifts the 16-bit binary data in the specified device to the left. Page 352 SFL(P) SFLP bn+1 bn...
  • Page 88 ■Shifting n-bit data to the right/left by n bit(s) Instruction symbol Processing details Reference SFTBR Shifts the n-bit data starting from the specified device to the right by n bit(s). Page 362 SFTBR(P) SFTBRP (n1) (n2) (SM700) SFTR Shifts the (n2) bit(s) of area to the right within the (n1) bits of data area starting from the specified Page 364 SFTR(P) device.
  • Page 89 ■Shifting n-word data to the right/left by n word(s) Instruction symbol Processing details Reference SFTWR Shifts the n-word data starting from the specified device to the right by n word(s). Page 370 SFTWR(P) SFTWRP (n1) (n2) WSFR Shifts the (n2) word(s) of area to the right within the (n1) words of data area starting from the Page 372 WSFR(P) specified device.
  • Page 90 Data transfer instructions ■Transferring 16-bit/32-bit binary data Instruction symbol Processing details Reference Transfers the 16-bit binary data in the device specified. Page 490 MOV(P) MOVP DMOV Transfers the 32-bit binary data in the device specified. Page 492 DMOV(P) DMOVP (s)+1, (s) (d)+1, (d) ■Inverting and transferring 16-bit/32-bit binary data Instruction symbol...
  • Page 91 ■Transferring the same 16-bit binary data block (32 bits) Instruction symbol Processing details Reference FMOVL Transfers 16-bit binary data to the (n) points starting from the device specified. Page 509 FMOVL(P) FMOVLP (n) = 1 to 4294967295 ■Transferring the same 32-bit binary data block (16 bits) Instruction symbol Processing details Reference...
  • Page 92 ■Exchanging the upper and lower bytes of 32-bit binary data Instruction symbol Processing details Reference DSWAP Exchanges upper and lower 8-bit data in the specified device. Page 522 DSWAP(P) ··· b8 b7 ··· ··· b8 b7 ··· (d)+1 8 bits 8 bits 8 bits 8 bits...
  • Page 93: Application Instructions

    Application Instructions Rotation instructions ■Rotating 16-bit binary data to the right Instruction symbol Processing details Reference Rotates the 16-bit binary data to the right by (n) bit(s) (not including the carry flag). Page 527 ROR(P), RCR(P) RORP (SM700) (1) Right rotation by (n) bits Rotates the 16-bit binary data to the right by (n) bit(s) (including the carry flag).
  • Page 94 ■Rotating 32-bit binary data to the left Instruction symbol Processing details Reference DROL Rotates the 32-bit binary data to the left by (n) bit(s) (not including the carry flag). Page 535 DROL(P), DRCL(P) DROLP (d)+1 (SM700) ∙∙∙ b16 b15 ∙∙∙ (1) Left rotation by (n) bits DRCL Rotates the 32-bit binary data to the left by (n) bit(s) (including the carry flag).
  • Page 95 ■Resetting the watchdog timer Instruction symbol Processing details Reference Resets the watchdog timer. Page 554 WDT(P) WDTP Structure creation instructions ■Performing the FOR to NEXT instruction loop Instruction symbol Processing details Reference Executes the processing between FOR to NEXT (n) times. Page 555 FOR, NEXT NEXT ■Forcibly terminating the FOR to NEXT instruction loop...
  • Page 96 Data table operation instructions ■Reading the oldest data from the data table Instruction symbol Processing details Reference FIFR Stores the data first stored in the table in the specified device. Page 583 FIFR(P) FIFRP (d)+1 N: Number of data ■Reading the newest data from the data table Instruction symbol Processing details Reference...
  • Page 97 Reading/writing data instructions ■Reading data from the data memory Instruction symbol Processing details Reference S.DEVLD Reads data from the device data storage file in data memory. Page 594 S(P).DEVLD SP.DEVLD ■Writing data to the data memory Instruction symbol Processing details Reference SP.DEVST Writes the specified number of points of data to the device data storage file in data memory.
  • Page 98 ■Transferring string data Instruction symbol Processing details Reference $MOV Transfers the character strings in the device specified by (s) to the device specified by (d) and later. Page 638 $MOV(P) $MOVP $MOV_WS Transfers the Unicode character strings in the device specified by (s) to the device specified by (d) Page 640 and later.
  • Page 99 ■Converting Unicode character string to Shift JIS character string Instruction symbol Processing details Reference WS2SJIS Converts the Unicode character string in the device specified by (s) to the shift JIS character string, Page 681 WS2SJIS(P) and stores the converted data in the device specified by (d). WS2SJISP ■Converting shift JIS character string to Unicode character string (without byte order mark) Instruction symbol...
  • Page 100 Real number instructions ■Comparing single-precision real numbers Instruction symbol Processing details Reference LDE=, ANDE=, ORE= Performs a comparison operation of a single-precision real number. (Devices are used as a Page 704 LDE, normally open contact.) ANDE, ORE LDE<>, ANDE<>, ORE<> LDE>, ANDE>, ORE>...
  • Page 101 ■Adding/subtracting double-precision real numbers Instruction symbol Processing details Reference Adds double-precision real numbers. (Using two operands) Page 725 ED+(P) [when two operands ED+P are set] Adds double-precision real numbers. (Using three operands) Page 727 ED+(P) [when three operands ED+P are set] Performs subtraction between double-precision real numbers.
  • Page 102 ■Converting 16-bit/32-bit signed binary data to double-precision real number Instruction symbol Processing details Reference INT2DBL Converts the 16-bit signed binary data in the device specified by (s) to a double-precision real Page 751 INT2DBL(P) number, and stores the real number in the device specified by (d). INT2DBLP DINT2DBL Converts the 32-bit signed binary data in the device specified by (s) to a double-precision real...
  • Page 103 ■Transferring double-precision real number Instruction symbol Processing details Reference EDMOV Transfers double-precision real number data to the specified device. Page 770 EDMOV(P) EDMOVP (s)+3, (s)+2, (s)+1, (s) (d)+3, (d)+2, (d)+1, (d) (1) Real number ■Calculating the sine of single-precision real number Instruction symbol Processing details Reference...
  • Page 104 ■Calculating the arc cosine of double-precision real number Instruction symbol Processing details Reference ACOSD Calculates the angle from the cosine specified by a double-precision real number. Page 791 ACOSD(P) ACOSDP ■Calculating the arc tangent of double-precision real number Instruction symbol Processing details Reference ATAND...
  • Page 105 ■Calculating the arc cosine of BCD data Instruction symbol Processing details Reference BACOS Calculates the arc cosine of the angle specified by a BCD value. Page 803 BACOS(P) BACOSP (d)+1 (d)+2 (d): Sign (d)+1: Integral part (d)+2: Decimal part ■Calculating the arc tangent of BCD data Instruction symbol Processing details Reference...
  • Page 106 ■Calculating the square root of single-precision real number Instruction symbol Processing details Reference ESQRT Calculates the square root of the value specified by a single-precision real number. Page 815 ESQRT(P) ESQRTP (s)+1, (s) (d)+1, (d) ■Calculating the square root of double-precision real number Instruction symbol Processing details Reference...
  • Page 107 ■Calculating the common logarithm of single-precision real number Instruction symbol Processing details Reference LOG10 Calculates the logarithm using the common logarithm (using 10 as the base) of the value specified Page 835 LOG10(P) by a single-precision real number. LOG10P ■Calculating the common logarithm of double-precision real number Instruction symbol Processing details Reference...
  • Page 108 Random number instructions ■Generating random number, changing random sequence Instruction symbol Processing details Reference Generates a random number between 0 and less than 32767, and stores the random number in Page 847 RND(P) the device specified by (d). RNDP SRND Changes the random number sequence according to the content of the 16-bit binary data stored in Page 848 SRND(P) the device specified by (s).
  • Page 109 ■Zone control of 16-bit/32-bit binary data Instruction symbol Processing details Reference ZONE Adds a bias value to the specified input value (16-bit binary). Page 865 ZONE(P)(_U) ZONEP ZONE_U ZONEP_U DZONE Adds a bias value to the specified input value (32-bit binary). Page 867 DZONE(P)(_U) DZONEP...
  • Page 110 Special timer instructions ■Teaching timer Instruction symbol Processing details Reference TTMR Measures the on time of the measurement command in seconds, multiplies it by a multiplier, and Page 883 TTMR stores the operation result. ×(s) (s)=0:1, (s)=1:10, (s)=2:100 : On time of TTMR ■Special function timer Instruction symbol Processing details...
  • Page 111 Check code instructions ■Check code Instruction symbol Processing details Reference Performs addition of the data stored in the devices specified by (s) to (s)+(n)-1 and calculate the Page 903 CCD(P) horizontal parity, and stores the added data in the device specified by (d) and the horizontal parity CCDP in the device specified by (d)+1.
  • Page 112 ■Checking the bit status in 16-bit/32-bit binary data Instruction symbol Processing details Reference Checks whether (n) bit(s) of the specified device are on or off, and stores the result in the device Page 918 BON(P) specified by (d). BONP DBON Checks whether (n) bit(s) of the specified device are on or off, and stores the result in the device Page 920 DBON(P) specified by (d).
  • Page 113 ■Calculating the mean value of 16-bit/32-bit binary data Instruction symbol Processing details Reference MEAN Calculates the average value of the (n) points of 16-bit data in the device starting from the one Page 938 specified by (s), and stores the average value in the device specified by (d). MEAN(P)(_U) MEANP MEAN_U...
  • Page 114 ■Importing data to the database Instruction symbol Processing details Reference DBIMPORT Imports the data set in the Unicode text file stored in the path specified by (s) to construct a Page 946 database. DBIMPORT(P) DBIMPORTP ■Exporting data from the database Instruction symbol Processing details Reference...
  • Page 115 Indirect address read instructions ■Reading the indirect address Instruction symbol Processing details Reference ADRSET Reads the indirect address of the specified device. Page 999 ADRSET(P) ADRSETP (1) Indirect address of specified device (2) Device name Clock instructions ■Reading clock data Instruction symbol Processing details Reference...
  • Page 116 ■Subtracting clock data Instruction symbol Processing details Reference DATE- Subtracts time data. Page 1007 DATE-(P) DATE-P (s1) (s2) hour hour hour minute minute minute second second second ■Converting time data from hour/minute/second to second Instruction symbol Processing details Reference TIME2SEC Converts time data from hour/minute/second to second.
  • Page 117 ■Reading expansion clock data Instruction symbol Processing details Reference S.DATERD Reads clock data including millisecond from the clock elements in the CPU module. Page 1025 S(P).DATERD SP.DATERD (d)+1 (d)+2 (d)+3 (d)+4 (d)+5 (d)+6 (d)+7 (d): Year (d)+1: Month (d)+2: Day (d)+3: Hour (d)+4: Minute (d)+5: Second...
  • Page 118 ■Hour meter Instruction symbol Processing details Reference HOURM Measures the period of time for which the start contact is ON in units of hour, and turns on the Page 1035 HOURM device specified by (d2) when the accumulated ON time reaches the time (16-bit binary data) specified in (s).
  • Page 119 ■Reading the module model name Instruction symbol Processing details Reference TYPERD Reads the module model name mounted on the slot specified by (H), and stores the model name in Page 1063 the device areas specified by (d) and later. TYPERD(P) TYPERDP ■Reading module specific information Instruction symbol...
  • Page 120: Built-In Ethernet Function Instructions

    Built-in Ethernet Function Instructions Open/close processing instructions ■Opening a connection Instruction symbol Processing details Reference SP.SOCOPEN Opens the connection specified by (s1). Page 1085 SP.SOCOPEN ■Closing a connection Instruction symbol Processing details Reference SP.SOCCLOSE Closes the connection specified by (s1). (Closing a connection) Page 1088 SP.SOCCLOSE Socket communications instructions...
  • Page 121 Predefined protocol support function instruction ■Executing the registered protocols Instruction symbol Processing details Reference SP.ECPRTCL Executes the protocol specified by the communication protocol support tool of the engineering tool. Page 1109 SP.ECPRTCL SLMP frame send instruction ■Sending an SLMP frame Instruction symbol Processing details Reference...
  • Page 122: Pid Operation Instruction

    PID Operation Instruction Performing PID operation Instruction symbol Processing details Reference Performs PID operation using the values set in (s1) to (s3), and stores the operation result in (d) at Page 1145 PID each cycle of sampling time. PID Control Instructions PID control instructions (inexact differential) ■Registering the PID control data to the CPU module Instruction symbol...
  • Page 123 ■Changing the parameters of specified loop number Instruction symbol Processing details Reference PIDPRMW Changes the operation parameter of the loop number in the device specified by (s1) to the PID Page 1179 control data stored in the device number specified by (s2) and later. PIDPRMW(P) PIDPRMWP 2 CPU MODULE INSTRUCTIONS...
  • Page 124: Process Control Instructions

    Process Control Instructions When a process control program is created, using process control function blocks is recommended. Process control function blocks have features as follows. • A process control program can be easily created by placing and connecting FB elements. •...
  • Page 125 Control operation instructions ■Basic PID control Instruction symbol Processing details Reference S.PID Performs process value derivative type (inexact differential) PID operation. Page 1232 S.PID The instruction performs the following processing steps: SV setting, tracking, gain (Kp) operation, PID operation, and deviation check. ■Two-degree-of-freedom PID control Instruction symbol Processing details...
  • Page 126 ■Derivative control Instruction symbol Processing details Reference Performs differential operation to the input data, and outputs the operation result. Page 1292 S.D ■Dead time Instruction symbol Processing details Reference S.DED Delays the output of the input data by the specified dead time. Page 1295 S.DED ■High selector Instruction symbol...
  • Page 127 ■Loop selector Instruction symbol Processing details Reference S.SEL Outputs the value selected by the selection signal from the input data in automatic mode, and Page 1338 S.SEL outputs the manipulated value (MV) in the loop tag memory in manual mode. ■Bumpless transfer Instruction symbol Processing details...
  • Page 128 ■Multiplication Instruction symbol Processing details Reference S.MUL Multiplies input data with a coefficient. Page 1372 S.MUL ■Division Instruction symbol Processing details Reference S.DIV Divides input data with a coefficient. Page 1374 S.DIV ■Square root Instruction symbol Processing details Reference S.SQR Outputs the square root () of input data.
  • Page 129: Multiple Cpu Dedicated Instructions

    Multiple CPU Dedicated Instructions Reading device data from another CPU module Instruction symbol Processing details Reference D.DDRD Reads the data in the device of another CPU module specified by (n), and stores the data to the Page 1405 read-source CPU module in a multiple CPU system. D(P).DDRD, DP.DDRD M(P).DDRD...
  • Page 130: Sfc Program Instructions

    SFC Program Instructions SFC control instructions ■Checking the status of a step Instruction symbol Processing details Reference LD [S/BL\S] Outputs the status (active or inactive) of the specified step as the operation result. (Normally open Page 1411 LD, LDI, contact instruction) AND, ANI, OR, ORI [S/BL\S] LDI [S/BL\S]...
  • Page 131 ■Pausing a block Instruction symbol Processing details Reference PAUSE [BL] Temporarily stops the step sequence in the specified block. Page 1429 PAUSE [BL] ■Restarting a block Instruction symbol Processing details Reference RSTART [BL] Releases the temporary stop, and restarts the sequence from the step where the sequence was Page 1431 RSTART stopped in the specified block.
  • Page 132: Redundant System Instructions

    2.10 Redundant System Instructions System switching Instruction symbol Processing details Reference SP.CONTSW Switches the systems (control system and standby system) during END processing of the scan Page 1440 where the instruction is executed. SP.CONTSW Disabling/enabling system switching Instruction symbol Processing details Reference DCONTSW Disables manual system switching.
  • Page 133: Chapter 3 Module Dedicated Instructions

    MODULE DEDICATED INSTRUCTIONS How to read the list is shown below. Item Description Instruction symbol Indicates the instruction name. Processing details Indicates the overview of an instruction. Reference Indicates the reference of detailed information. Network Common Instructions Link dedicated instructions ■Reading data from the programmable controller on another station Instruction symbol Processing details...
  • Page 134 ■Reading data from the programmable controller (Q series-compatible) Instruction symbol Processing details Reference J.ZNRD Reads data in units of words from a device in the programmable controller of another station. Page 1501 J(P).ZNRD JP.ZNRD ■Writing data to the programmable controller (Q series-compatible) Instruction symbol Processing details Reference...
  • Page 135: Ethernet Instructions

    Ethernet Instructions Open/close processing instructions ■Opening a connection Instruction symbol Processing details Reference GP.CONOPEN Establishes (opens) a connection with an external device for data communication. Page 1535 GP.CONOPEN ■Closing a connection Instruction symbol Processing details Reference GP.CONCLOSE Disconnects (closes) the connection from the external device during data communication. Page 1539 GP.CONCLOSE ■Opening a connection...
  • Page 136 ■Reading receive data (for interrupt programs) Instruction symbol Processing details Reference G.BUFRCVS Reads receive data from the external device through fixed buffer communications. This instruction Page 1557 is used in the interrupt program. G.BUFRCVS, Z.BUFRCVS Z.BUFRCVS ■Sending data Instruction symbol Processing details Reference GP.BUFSND...
  • Page 137: Cc-Link Ie Controller Network Instructions

    CC-Link IE Controller Network Instructions Remote RUN Instruction symbol Processing details Reference J.RRUN Sends a remote RUN request to the programmable controller of another station. Page 1576 J(P).RRUN, G(P).RRUN, JP.RRUN Z(P).RRUN G.RRUN GP.RRUN Z.RRUN ZP.RRUN Remote STOP Instruction symbol Processing details Reference J.RSTOP Sends a remote STOP request to the programmable controller of another station.
  • Page 138 Setting the station number to own station Instruction symbol Processing details Reference G.UINI Sets the station number of the own station. Page 1597 G(P).UINI, Z(P).UINI GP.UINI Z.UINI ZP.UINI • When the target station is QSCPU, the RRUN and RSTOP instructions cannot be used. •...
  • Page 139: Cc-Link Ie Field Network Instructions

    CC-Link IE Field Network Instructions Reading data from the intelligent device station/remote device station Instruction symbol Processing details Reference JP.REMFR Reads data from the buffer memory area of the intelligent device station or the remote device Page 1600 JP.REMFR, station in units of words (16-bit address specified). ZP.REMFR ZP.REMFR JP.REMFRD...
  • Page 140 Sending an SLMP frame Instruction symbol Processing details Reference J.SLMPREQ Sends an SLMP frame to the SLMP-compatible device in the same network. Data of the target Page 1638 station can be read/written and operated. J(P).SLMPREQ, JP.SLMPREQ G(P).SLMPREQ G.SLMPREQ GP.SLMPREQ The REMFR, REMTO, REMFRD, and REMTOD instructions cannot be executed in local stations. Execute them in the master station.
  • Page 141: Cc-Link Instructions

    CC-Link Instructions Reading data from the target station Instruction symbol Processing details Reference G.RIRD Reads data of the specified number of points from the buffer memory area of the target station or Page 1643 G(P).RIRD the device in the CPU module on the target station. GP.RIRD Writing data to the target station Instruction symbol...
  • Page 142: Serial Communication Instructions

    Serial Communication Instructions Sending data using the on-demand function Instruction symbol Processing details Reference G.ONDEMAND Sends data using the on-demand function of SLMP (MC protocol). Page 1673 G(P).ONDEMAND GP.ONDEMAND Executing the protocols registered for the predefined protocol support function Instruction symbol Processing details Reference G.CPRTCL...
  • Page 143 Sending data by using user frames Instruction symbol Processing details Reference G.PRR Sends data with user frames according to the specification in the user frame specification area for Page 1699 G(P).PRR sending, through communication with the nonprocedural protocol. GP.PRR Clearing receive data Instruction symbol Processing details Reference...
  • Page 144: A/D Conversion Instructions

    A/D Conversion Instructions Switching the mode Instruction symbol Processing details Reference G.OFFGAN Switches the analog module mode. Page 1724 • Normal mode to offset/gain setting mode G(P).OFFGAN GP.OFFGAN • Offset/gain setting mode to normal mode Reading the user range setting values Instruction symbol Processing details Reference...
  • Page 145: Positioning Instructions

    Positioning Instructions Restoring the absolute position Instruction symbol Processing details Reference G.ABRST1 Restores the absolute position of specified axis. Page 1765 G.ABRST, G.ABRST2 Z.ABRST G.ABRST3 G.ABRST4 Z.ABRST1 Z.ABRST2 Z.ABRST3 Z.ABRST4 Starting the positioning Instruction symbol Processing details Reference GP.PSTRT1 Starts positioning of the specified axis. Page 1769 GP.PSTRT, GP.PSTRT2...
  • Page 146: High Speed Data Logger Module Instructions

    High Speed Data Logger Module Instructions File access instructions ■Recipe write Instruction symbol Processing details Reference Z.RCPWRITE Writes device values of the CPU module to the specified recipe file in the SD memory card. Page 1781 Z(P).RCPWRITE ZP.RCPWRITE ■Recipe read Instruction symbol Processing details Reference...
  • Page 147: C Intelligent Function Module Instructions

    3.10 C Intelligent Function Module Instructions User function execution instruction Instruction symbol Processing details Reference G.CEXECUTE Instructs to execute a function for the pre-registered function. Page 1787 G(P).CEXECUTE GP.CEXECUTE 3 MODULE DEDICATED INSTRUCTIONS 3.10 C Intelligent Function Module Instructions...
  • Page 148: Chapter 4 Standard Functions/Function Blocks

    STANDARD FUNCTIONS/FUNCTION BLOCKS How to read the list is shown below. Item Description Function symbol and function block symbol A function and function block name are shown. Processing details An overview of the functions and function blocks is explained. Reference Indicates the reference of detailed information.
  • Page 149 ■Converting WORD to INT/DINT Function symbol Processing details Reference WORD_TO_INT Converts a value from WORD data type to INT data type. Page 1801 WORD_TO_INT(_E) WORD_TO_INT_E WORD_TO_DINT Converts a value from WORD data type to DINT data type. Page 1802 WORD_TO_DINT(_E) WORD_TO_DINT_E ■Converting WORD to TIME Function symbol...
  • Page 150 ■Converting INT to WORD/DWORD Function symbol Processing details Reference INT_TO_WORD Converts a value from INT data type to WORD data type. Page 1815 INT_TO_WORD(_E) INT_TO_WORD_E INT_TO_DWORD Converts a value from INT data type to DWORD data type. Page 1816 INT_TO_DWORD(_E) INT_TO_DWORD_E ■Converting INT to DINT Function symbol...
  • Page 151 ■Converting DINT to BCD Function symbol Processing details Reference DINT_TO_BCD Converts a value from DINT data type to BCD data type. Page 1831 DINT_TO_BCD(_E) DINT_TO_BCD_E ■Converting DINT to REAL/LREAL Function symbol Processing details Reference DINT_TO_REAL Converts a value from DINT data type to REAL data type. Page 1833 DINT_TO_REAL(_E) DINT_TO_REAL_E...
  • Page 152 ■Converting LREAL to INT/DINT Function symbol Processing details Reference LREAL_TO_INT Converts a value from LREAL data type to INT data type. Page 1854 LREAL_TO_INT(_E) LREAL_TO_INT_E LREAL_TO_DINT Converts a value from LREAL data type to DINT data type. Page 1856 LREAL_TO_DINT(_E) LREAL_TO_DINT_E ■Converting LREAL to REAL Function symbol...
  • Page 153 ■Converting STRING to INT/DINT Function symbol Processing details Reference STRING_TO_INT Converts a value from STRING data type to INT data type. Page 1870 STRING_TO_INT(_E) STRING_TO_INT_E STRING_TO_DINT Converts a value from STRING data type to DINT data type. Page 1872 STRING_TO_DINT(_E STRING_TO_DINT_E ■Converting STRING to BCD Function symbol...
  • Page 154 ■Getting the start data Function symbol Processing details Reference GET_BOOL_ADDR Outputs the top data of the specified data as the BOOL, INT, or WORD type data. Page 1892 GET_BOOL_ADDR, GET_INT_ADDR GET_INT_ADDR, GET_WORD_ADDR GET_WORD_ADDR Single variable functions ■Calculating the absolute value Function symbol Processing details Reference...
  • Page 155 Arithmetic operation functions ■Addition Function symbol Processing details Reference Outputs the sum of input values ((s1)+(s2)++(s28)). Page 1906 ADD(_E) ADD_E ■Multiplication Function symbol Processing details Reference Outputs the product of input values ((s1)(s2)(s28)). Page 1908 MUL(_E) MUL_E ■Subtraction Function symbol Processing details Reference Outputs the difference between input values ((s1)-(s2)).
  • Page 156 Boolean functions ■AND operation, OR operation, XOR operation Function symbol Processing details Reference Outputs the logical product of input values. Page 1927 AND(_E), OR(_E), XOR(_E) AND_E Outputs the logical sum of input values. OR_E Outputs the exclusive logical sum of input values. XOR_E ■NOT operation Function symbol...
  • Page 157 Comparison functions ■Comparing data Function symbol Processing details Reference Outputs the comparison result of input values. Page 1940 GT(_E), GE(_E), EQ(_E), GT_E LE(_E), LT(_E) GE_E EQ_E LE_E LT_E Page 1942 NE(_E) NE_E String functions ■Detecting a string length Function symbol Processing details Reference Detects and outputs the length of the string input.
  • Page 158 ■Replacing string data Function symbol Processing details Reference REPLACE Replaces the specified range in a character string, and outputs the operation result. Page 1957 REPLACE(_E) REPLACE_E ■Searching string data Function symbol Processing details Reference FIND Searches a character string, and outputs the operation result. Page 1960 FIND(_E) FIND_E Time data type functions...
  • Page 159: Standard Function Flocks

    Standard Function Flocks Bistable function blocks ■Bistable function block (set-dominant) Function block symbol Processing details Reference Discriminates between two input values, and outputs1 (TRUE) or 0 (FALSE). Page 1972 SR(_E) SR_E ■Bistable function block (reset-dominant) Function block symbol Processing details Reference Discriminates between two input values, and outputs1 (TRUE) or 0 (FALSE).
  • Page 160 ■Counter function block Function block symbol Processing details Reference COUNTER_FB_M Starts counting up when the execution condition is satisfied. Page 1987 COUNTER_FB_M Timer function blocks ■Pulse timer Function block symbol Processing details Reference Keeps the signal on for the specified period of time. Page 1989 TP(_E) TP_E ■On delay timer...
  • Page 161: Part 3 Cpu Module Instructions

    PART 3 CPU MODULE INSTRUCTIONS This part consists of the following chapters. 5 SEQUENCE INSTRUCTIONS 6 BASIC INSTRUCTIONS 7 APPLICATION INSTRUCTIONS 8 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS 9 PID OPERATION INSTRUCTION 10 PID CONTROL INSTRUCTIONS 11 PROCESS CONTROL INSTRUCTIONS 12 MULTIPLE CPU DEDICATED INSTRUCTIONS 13 SFC PROGRAM INSTRUCTIONS 14 REDUNDANT SYSTEM INSTRUCTIONS...
  • Page 162: Chapter 5 Sequence Instructions

    SEQUENCE INSTRUCTIONS Contact Instructions Operation start, series connection, parallel connection LD, LDI, AND, ANI, OR, ORI RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • LD: Normally open contact operation start, LDI: Normally closed contact operation start These instructions output the on/off information of the specified device as the operation result. •...
  • Page 163 Setting data ■Description, range, data type Operand Description Range Data type Data type (label)  Device used as a contact ANY_BOOL • In safety programs executed by the Safety CPU, only safety devices and safety labels of data types described in the table can be used.
  • Page 164: Pulse Operation Start, Pulse Series Connection, Pulse Parallel Connection

    Pulse operation start, pulse series connection, pulse parallel connection LDP, LDF, ANDP, ANDF, ORP, ORF RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • LDP: Rising edge pulse operation start This instruction turns on only at the rising edge (off to on) of the specified bit device. •...
  • Page 165 Setting data ■Description, range, data type Operand Description Range Data type Data type (label)  Device used as a contact ANY_BOOL  Execution condition BOOL Execution result  BOOL • In safety programs executed by the Safety CPU, only safety devices and safety labels of data types described in the table can be used.
  • Page 166 ■ANDP, ANDF • ANDP is a rising edge pulse series connection instruction and ANDF is a falling edge pulse series connection instruction. These instructions perform an AND operation with the previous operation result, and output the operation result. The following table lists the on/off information used by the ANDP and ANDF instructions. Device specified by ANDP or ANDF ANDP status ANDF status...
  • Page 167: Pulse Not Operation Start, Pulse Not Series Connection, Pulse Not Parallel Connection

    Pulse NOT operation start, pulse NOT series connection, pulse NOT parallel connection LDPI, LDFI, ANDPI, ANDFI, ORPI, ORFI RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • LDPI: Rising edge pulse NOT operation start This instruction turns on when the specified device is off, on, or at the falling edge (on to off). •...
  • Page 168 Setting data ■Description, range, data type Operand Description Range Data type Data type (label)  Device used as a contact ANY_BOOL  Execution condition BOOL  Execution result BOOL • In safety programs executed by the Safety CPU, only safety devices and safety labels of data types described in the table can be used.
  • Page 169 ■ANDPI, ANDFI • ANDPI is a rising edge pulse NOT series connection instruction and ANDFI is a falling edge pulse NOT series connection instruction. These instructions perform an AND operation with the previous operation result, and output the operation result. The following table lists the on/off information used by the ANDPI and ANDFI instructions.
  • Page 170: Association Instructions

    Association Instructions Ladder block series/parallel connection ANB, ORB RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • ANB: Ladder block series connection This instruction performs an AND operation between block A and block B. • ORB: Ladder block parallel connection This instruction performs an OR operation between block A and block B.
  • Page 171: Storing/Reading/Clearing The Operation Result

    Storing/reading/clearing the operation result MPS, MRD, MPP RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • MPS: Storing the operation result This instruction stores the operation result (on/off) immediately before the MPS instruction. • MRD: Reading the operation result This instruction reads the operation result stored by using the MPS instruction.
  • Page 172 Operation error There is no operation error. • The following are the ladder program examples. [Ladder program using the MPS, MRD, and MPP instructions] [Ladder program not using the MPS, MRD, or MPP instruction] • Use the same number of MPS instructions as that of MPP instructions. If the numbers of MPS and MPP instructions are different, the ladder is not displayed correctly on the engineering tool (ladder mode).
  • Page 173: Inverting The Operation Result

    Inverting the operation result RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction inverts the operation result up to just before the INV instruction. Ladder ENO:=INV(EN); FBD/LD ■Execution condition Instruction Execution condition Every scan Processing details • This instruction inverts the operation result up to just before the INV instruction. Operation result up to just before the INV instruction Operation result after execution of the INV instruction Operation error...
  • Page 174: Converting The Operation Result Into A Pulse

    Converting the operation result into a pulse MEP, MEF RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • MEP: Converting the operation result into a pulse (rising edge) This instruction turns on at the rising edge (off to on) of the operation result up to the MEP instruction. •...
  • Page 175: Converting The Edge Relay Operation Result Into A Pulse

    Converting the edge relay operation result into a pulse EGP, EGF RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • EGP: Converting the edge relay operation result into a pulse (rising edge) This instruction stores the operation result up to the EGP instruction in the edge relay (V). The instruction turns on at the rising edge (off to on) of the operation result.
  • Page 176 Processing details ■EGP • This instruction stores the operation result up to the EGP instruction in the edge relay (V). • The instruction turns on (continuity state) at the rising edge (off to on) of the operation result up to the EGP instruction. The instruction turns off (non-continuity state) when the operation result is in another state (staying on, falling edge (on to off), or staying off).
  • Page 177: Output Instructions

    Output Instructions Out (excluding the timer, counter, and annunciator) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction outputs the operation result to the specified device. Ladder ENO:=OUT(EN,d); FBD/LD ■Execution condition Instruction Execution condition Every scan Setting data ■Description, range, data type Operand Description...
  • Page 178 Processing details • This instruction outputs the operation result up to the OUT instruction to the specified device. Condition Operation result Coil/Specified bit When a bit device is used When a bit-specified word device is used • When indirect specification is used, specify the bit as shown below. @D0.0 (1) The operation result is output to bit 0 of the indirect address stored in D0.
  • Page 179: Timer

    Timer OUT T, OUTH T, OUT ST, OUTH ST RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, there are restrictions on their operation when the systems are switched.
  • Page 180 Setting data ■Description, range, data type Operand Description Range Data type Data type (label)  Timer device or timer type label ANY_BOOL Coil Value Value set for the timer 0 to 32767 16-bit unsigned ANY16 binary  Execution condition BOOL ...
  • Page 181 Processing details • These instructions start time measurement, triggered by the coil specified by (d) (in SD language or FBD/LD, displayed as Coil), when the operation result up to the OUT instruction is on. When time is up (current value  set value), the normally open contact turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 182 When timers T0 to T2 are programmed in order of measurement (1) Timer T0 starts measurement when X0 turns on. (2) When the contact of timer T0 turns on, the contacts of timers T1 and T2 also turn on. Operation error There is no operation error.
  • Page 183: Long Timer

    Long timer OUT LT, OUT LST RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, they do not operate in the standby system when the redundant system is in backup mode.
  • Page 184 Processing details • These instructions start time measurement, triggered by the coil specified by (d) (in SD language or FBD/LD, displayed as Coil), when the operation result up to the OUT instruction is on. When time is up (current value  set value), the normally open contact turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 185 When long timers LT0 to LT2 are programmed in order of measurement (1) Long timer LT0 starts measurement when X0 turns on. (2) When the contact of timer LT0 turns on, the contacts of timers LT1 and LT2 also turn on. Operation error There is no operation error.
  • Page 186: Counter

    Counter OUT C RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) When the safety counter is used in safety programs executed by the Safety CPU, unless otherwise specified, replace some words as follows: • "OUT C"  "OUT SA\C" This instruction increments the current counter value (count value) by one when the operation result up to the OUT instruction turns on.
  • Page 187 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD  ...
  • Page 188: Long Counter

    Long counter OUT LC RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction increments the current long counter value (count value) by one on the rising edge (off to on) of the operation result up to the OUT instruction. When the count value reaches the set value, the normally open contact of the long counter turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 189 Processing details • This instruction increments the current long counter value (count value) in the device specified by (d) (in SD language or FBD/LD, displayed as Coil) by one on the rising edge (off to on) of the operation result up to the OUT instruction. When the count value reaches the set value (current value ...
  • Page 190: Annunciator

    Annunciator OUT F RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction outputs the operation result up to the OUT F instruction to the specified annunciator. Ladder ENO:=OUT(EN,d); FBD/LD ( is to be replaced by OUT.) ■Execution condition Instruction Execution condition OUT F...
  • Page 191: Setting Devices (Excluding Annunciator)

    Setting devices (excluding annunciator) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction turns on the specified bit. Ladder ENO:=SET(EN,d); FBD/LD ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Data type (label) Set target bit device number or bit specification of word ...
  • Page 192 Processing details • This instruction changes the device status as follows when the execution command turns on. Device Status Bit device Turns on the coil or contact. Bit-specified word device Sets the specified bit to 1. • The device that has been turned on remains on even after the execution command turns off. The device that has been turned on can be turned off by using the RST instruction.
  • Page 193: Resetting Devices (Excluding Annunciator)

    Resetting devices (excluding annunciator) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction turns off the specified device. For the timer and counter, the instruction clears the current value to 0 and turns off the contact or coil. Ladder ENO:=RST(EN,d);...
  • Page 194 Processing details • This instruction changes the device status as follows when the execution command turns on. Device Status Bit device Turns off the coil or contact. Timer, counter Clears the current value to 0 and turns off the coil or contact. Bit-specified word device Sets the specified bit to 0.
  • Page 195: Setting Annunciator

    Setting annunciator SET F RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction turns on the specified annunciator. Ladder ENO:=SET(EN,d); FBD/LD ( is to be replaced by SET.) ■Execution condition Instruction Execution condition SET F Setting data ■Description, range, data type Operand Description...
  • Page 196 Processing details • This instruction turns on the annunciator specified by (d) when the execution command turns on. • When the annunciator (F) is turned on, the following are performed. • The USER LED turns on. • The annunciator number (F number) turned on is stored in the special register (SD64 to SD79). •...
  • Page 197: Resetting Annunciator

    Resetting annunciator RST F RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction turns off the specified annunciator. Ladder ENO:=RST(EN,d); FBD/LD ( is to be replaced by RST.) ■Execution condition Instruction Execution condition RST F Setting data ■Description, range, data type Operand Description...
  • Page 198 Processing details • This instruction turns off the annunciator specified by (d) when the execution command turns on. • The annunciator number (F number) turned off is deleted from the special register (SD64 to SD79), and the value in SD63 is decremented by one.
  • Page 199: Rising Edge Output

    Rising edge output RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) When this instruction is used in safety programs executed by the Safety CPU, unless otherwise specified, replace some words as follows: • "X0"  "SA\X0", "X5"  "SA\X5", "M0"  "SA\M0" •...
  • Page 200 Processing details • This instruction turns on the specified device on the rising edge (off to on) of the execution command. When the execution command is in another state (staying on, falling edge (on to off), or staying off), the instruction turns off the specified device. If only one PLS instruction in the device specified by (d) is executed in a single scan, the specified device turns on for one scan.
  • Page 201: Falling Edge Output

    Falling edge output RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) When this instruction is used in safety programs executed by the Safety CPU, unless otherwise specified, replace some words as follows: • "X5"  "SA\X5" • "Scan"  "Safety cycle processing" This instruction turns on the specified device for one scan on the falling edge (on to off) of the execution command.
  • Page 202 Processing details • This instruction turns on the specified device on the falling edge (on to off) of the execution command. When the execution command is in another state (staying off, rising edge (off to on), or staying on), the instruction turns off the specified device. If only one PLF instruction in the device specified by (d) is executed during one scan, the specified device turns on for one scan.
  • Page 203: Inverting The Bit Device Output

    Inverting the bit device output RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction inverts the status of the specified device. Ladder ENO:=FF(EN,d); FBD/LD ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Data type (label)
  • Page 204 Operation error There is no operation error. 5 SEQUENCE INSTRUCTIONS 5.3 Output Instructions...
  • Page 205: Converting The Direct Access Output Into A Pulse

    Converting the direct access output into a pulse DELTA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified direct access output (DY) into pulse output. Ladder ENO:=DELTA(EN,d); ENO:=DELTAP(EN,d); FBD/LD ■Execution condition Instruction Execution condition DELTA DELTAP Setting data...
  • Page 206 Processing details • These instructions convert the direct access output (DY) specified by (d) into pulse output. If DY0 is specified by (d), the program operates in the same way as the one that uses the SET and RST instructions. The following figure shows an example when a ladder using the DELTA instruction is replaced with a ladder using the SET/ RST instructions.
  • Page 207: Shift Instructions

    Shift Instructions Shifting bit devices SFT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the on/off state of the device area just before the one specified to the specified device area, and turn off the shift source device. Ladder ENO:=SFT(EN,d);...
  • Page 208 Processing details ■Bit device • These instructions shift the on/off state of the device area just before the one specified by (d) to the device area specified by (d). After the data is shifted, the data of the shift source device area is turned off. When the SFTP instruction that specifies M11 is executed, it shifts the on/off state of M10 to M11, and turns off M10.
  • Page 209: Master Control Instructions

    Master Control Instructions Setting/resetting a master control MC, MCR RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) When this instruction is used in safety programs executed by the Safety CPU, unless otherwise specified, replace some words as follows: •...
  • Page 210 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD  ...
  • Page 211 • When a ladder performing a master control includes an instruction which does not require a contact instruction (such as the FOR to NEXT instruction), the CPU module executes the instruction regardless of the execution command of the MC instruction. •...
  • Page 212 Precautions • Up to 15 nests (N0 to N14) are allowed. When nesting is performed, the MC instruction should use nesting (N) numbers in order from lower numbers and the MCR instruction should use them in order from higher numbers. •...
  • Page 213: Termination Instructions

    Termination Instructions Ending the main routine program FEND RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction is used to separate the main routine program from subroutine programs and interrupt programs in a program file. Ladder Not supported FBD/LD Not supported ■Execution condition...
  • Page 214 Operation error Error code Description (SD0) 3340H After execution of the FOR instruction, the FEND instruction is executed before the NEXT instruction. 3381H After execution of the CALL(P), FCALL(P), ECALL(P), or EFCALL(P) instruction, the FEND instruction is executed before the RET instruction.
  • Page 215: Ending The Sequence Program

    Ending the sequence program RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction indicates the end of a program. Ladder Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition Every scan Processing details • This instruction indicates the end of a program including a main routine program, subroutine programs, and interrupt programs.
  • Page 216 When a program is divided into multiple program blocks, the END instruction indicates the end of a program block. The END instruction within the program registered at the end of the program setting performs END processing. Operation error Error code Description (SD0) 3340H...
  • Page 217: Stop Instruction

    Stop Instruction Stopping the sequence program STOP RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction stops the operation of the CPU module. (The operation of this instruction is the same as setting the switch of the CPU module to the STOP position.) Ladder ENO:=STOP(EN);...
  • Page 218: No Operation Instruction

    No Operation Instruction No operation (NOP) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction is used to insert a space for debugging. Ladder  Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition Every scan Processing details •...
  • Page 219: No Operation (Noplf)

    No operation (NOPLF) NOPLF RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction is a no-operation instruction and has no impact on the previous operations. Ladder Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition NOPLF Every scan Processing details •...
  • Page 220: Chapter 6 Basic Instructions

    BASIC INSTRUCTIONS Comparison Operation Instructions Comparing 16-bit binary data LD(_U), AND(_U), OR(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions compare the two sets of 16-bit binary data specified. (Devices are used as normally open contacts.) Ladder ENO:=LD_(EN,s1,s2);...
  • Page 221 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 222: Comparing 32-Bit Binary Data

    Comparing 32-bit binary data LDD(_U), ANDD(_U), ORD(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions compare the two sets of 32-bit binary data specified. (Devices are used as normally open contacts.) Ladder ENO:=LDD_(EN,s1,s2); ENO:=LDD__U(EN,s1,s2); ENO:=ANDD_(EN,s1,s2); ENO:=ANDD__U(EN,s1,s2); (s1) (s2) ENO:=ORD_(EN,s1,s2);...
  • Page 223 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 224: Outputting A Comparison Result Of 16-Bit Binary Data

    Outputting a comparison result of 16-bit binary data CMP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions compare the 16-bit binary data specified by (s1) with the 16-bit binary data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on.
  • Page 225 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 226: Outputting A Comparison Result Of 32-Bit Binary Data

    Outputting a comparison result of 32-bit binary data DCMP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions compare the 32-bit binary data specified by (s1) with the 32-bit binary data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on.
  • Page 227 Processing details • These instructions compare the 32-bit binary data specified by (s1) with the 32-bit binary data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on. DCMP (s1) (s2) (s2) Turns on when [(s1), (s1)+1] >...
  • Page 228: Outputting A Band Comparison Result Of 16-Bit Binary Data

    Outputting a band comparison result of 16-bit binary data ZCP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions compare the band between the 16-bit binary data specified by lower limit value (s1) and the 16-bit binary data specified by upper limit value (s2) with the 16-bit binary data in the device specified by comparison data (s3).
  • Page 229 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 230: Outputting A Band Comparison Result Of 32-Bit Binary Data

    Outputting a band comparison result of 32-bit binary data DZCP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions compare the band between the 32-bit binary data specified by lower limit value (s1) and the 32-bit binary data specified by upper limit value (s2) with the 32-bit binary data in the device specified by comparison data (s3).
  • Page 231 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 232: Comparing 16-Bit Binary Block Data

    Comparing 16-bit binary block data BKCMP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions compare the two sets of 16-bit binary block data specified. Ladder ENO:=BKCMP_(EN,s1,s2,n,d); ENO:=BKCMP__U(EN,s1,s2,n,d); ENO:=BKCMP_P(EN,s1,s2,n,d); ENO:=BKCMP_P_U(EN,s1,s2,n,d) (s1) (s2) ( is replaced by any of the following: EQ, NE, GT, LE, LT, GE.) (...
  • Page 233 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 234: Comparing 32-Bit Binary Block Data

    Comparing 32-bit binary block data DBKCMP(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions compare the two sets of 32-bit binary block data specified. Ladder ENO:=DBKCMP_(EN,s1,s2,n,d); ENO:=DBKCMP__U(EN,s1,s2,n,d) ENO:=DBKCMP_P(EN,s1,s2,n,d); (s1) (s2) ENO:=DBKCMP_P_U(EN,s1,s2,n, ( is replaced by any of the following: DBKCMP=(P)(_U), (...
  • Page 235 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1)   ...
  • Page 236 Operation error Error code Description (SD0) 2821H The device ranges starting from the ones specified by (s1) and (d) are overlapping. The device ranges starting from the ones specified by (s2) and (d) are overlapping. When bits of a word device are specified, the bits other than the specified ones for storing the operation result do not change.
  • Page 237: Arithmetic Operation Instructions

    Arithmetic Operation Instructions Adding 16-bit binary data +(P)(_U) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of 16-bit binary data specified. Ladder Not supported ( Page 237 +(P)(_U) [when three operands are set]) FBD/LD Not supported (...
  • Page 238 Processing details • These instructions add the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the operation result in the device specified by (d). ··· ··· ···...
  • Page 239 +(P)(_U) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of 16-bit binary data specified. Ladder ENO:=PLUS(EN,s1,s2,d); ENO:=PLUSP(EN,s1,s2,d); (s1) (s2) ENO:=PLUS_U(EN,s1,s2,d); ENO:=PLUSP_U(EN,s1,s2,d); FBD/LD ( is to be replaced by any of the following: PLUS, PLUSP, PLUS_U, PLUSP_U.) ■Execution condition Instruction Execution condition...
  • Page 240 Processing details • These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) ···...
  • Page 241: Subtracting 16-Bit Binary Data

    Subtracting 16-bit binary data -(P)(_U) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of 16-bit binary data specified. Ladder Not supported ( Page 241 -(P)(_U) [when three operands are set]) FBD/LD Not supported (...
  • Page 242 Processing details • These instructions subtract the 16-bit binary data in the device specified by (s) from the 16-bit binary data in the device specified by (d), and store the operation result in the device specified by (d). ··· ··· ···...
  • Page 243 -(P)(_U) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of 16-bit binary data specified. Ladder ENO:=MINUS(EN,s1,s2,d); ENO:=MINUSP(EN,s1,s2,d); (s1) (s2) ENO:=MINUS_U(EN,s1,s2,d); ENO:=MINUSP_U(EN,s1,s2,d); FBD/LD ( is to be replaced by any of the following: MINUS, MINUSP, MINUS_U, MINUSP_U.) ■Execution condition Instruction Execution condition...
  • Page 244 Processing details • These instructions subtract the 16-bit binary data in the device specified by (s2) from the 16-bit binary data in the device specified by (s1), and store the operation result in the device specified by (d). (s1) (s2) ···...
  • Page 245: Adding 32-Bit Binary Data

    Adding 32-bit binary data D+(P)(_U) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of 32-bit binary data specified. Ladder Not supported ( Page 245 D+(P)(_U) [when three operands are set]) FBD/LD Not supported (...
  • Page 246 Processing details • These instructions add the 32-bit binary data in the device specified by (d) and the 32-bit binary data in the device specified by (s), and store the operation result in the device specified by (d). (d)+1 (s)+1 (d)+1 b16 b15 b16 b15...
  • Page 247 D+(P)(_U) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of 32-bit binary data specified. Ladder ENO:=DPLUS(EN,s1,s2,d); ENO:=DPLUSP(EN,s1,s2,d); (s1) (s2) ENO:=DPLUS_U(EN,s1,s2,d); ENO:=DPLUSP_U(EN,s1,s2,d); FBD/LD ( is to be replaced by any of the following: DPLUS, DPLUSP, DPLUS_U, DPLUSP_U.) ■Execution condition Instruction Execution condition...
  • Page 248 Processing details • These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 249: Subtracting 32-Bit Binary Data

    Subtracting 32-bit binary data D-(P)(_U) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of 32-bit binary data specified. Ladder Not supported ( Page 249 D-(P)(_U) [when three operands are set]) FBD/LD Not supported (...
  • Page 250 Processing details • These instructions subtract the 32-bit binary data in the device specified by (s) from the 32-bit binary data in the device specified by (d) and, and store the operation result in the device specified by (d). (d)+1 (s)+1 (d)+1 b16 b15...
  • Page 251 D-(P)(_U) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of 32-bit binary data specified. Ladder ENO:=DMINUS(EN,s1,s2,d); ENO:=DMINUSP(EN,s1,s2,d); (s1) (s2) ENO:=DMINUS_U(EN,s1,s2,d); ENO:=DMINUSP_U(EN,s1,s2,d); FBD/LD ( is to be replaced by any of the following: DMINUS, DMINUSP, DMINUS_U, DMINUSP_U.) ■Execution condition Instruction Execution condition...
  • Page 252 Processing details • These instructions subtracts the 32-bit binary data in the device specified by (s2) from the 32-bit binary data in the device specified by (s1), and store the operation result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 253: Multiplying 16-Bit Binary Data

    Multiplying 16-bit binary data *(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply the two sets of 16-bit binary data specified. Ladder ENO:=MULTI(EN,s1,s2,d); ENO:=MULTI_U(EN,s1,s2,d); ENO:=MULTIP(EN,s1,s2,d); ENO:=MULTIP_U(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: MULTI, MULTIP, MULTI_U, MULTIP_U.) *1 The engineering tool with version "1.035M"...
  • Page 254 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 255: Dividing 16-Bit Binary Data

    Dividing 16-bit binary data /(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between the two sets of 16-bit binary data specified. Ladder ENO:=DIVISION(EN,s1,s2,d); ENO:=DIVISION_U(EN,s1,s2,d); ENO:=DIVISIONP(EN,s1,s2,d); ENO:=DIVISIONP_U(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: DIVISION, DIVISIONP, DIVISION_U, DIVISIONP_U.) *1 The engineering tool with version "1.035M"...
  • Page 256 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1)   ...
  • Page 257: Multiplying 32-Bit Binary Data

    Multiplying 32-bit binary data D*(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply the two sets of 32-bit binary data specified. Ladder ENO:=DMULTI(EN,s1,s2,d); ENO:=DMULTI_U(EN,s1,s2,d); ENO:=DMULTIP(EN,s1,s2,d); ENO:=DMULTIP_U(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: DMULTI, DMULTIP, DMULTI_U, DMULTIP_U.) *1 The engineering tool with version "1.035M"...
  • Page 258 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 259: Dividing 32-Bit Binary Data

    Dividing 32-bit binary data D/(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between the two sets of 32-bit binary data specified. Ladder ENO:=DDIVISION(EN,s1,s2,d); ENO:=DDIVISION_U(EN,s1,s2,d); ENO:=DDIVISIONP(EN,s1,s2,d); ENO:=DDIVISIONP_U(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: DDIVISION, DDIVISIONP, DDIVISION_U, DDIVISIONP_U.) *1 The engineering tool with version "1.035M"...
  • Page 260 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 261: Adding Bcd 4-Digit Data

    Adding BCD 4-digit data B+(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of BCD 4-digit data specified. Ladder Not supported ( Page 260 B+(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 262 B+(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of BCD 4-digit data specified. Ladder ENO:=BPLUS(EN,s1,s2,d); ENO:=BPLUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by either of the following: BPLUS, BPLUSP.) ■Execution condition Instruction Execution condition...
  • Page 263 Processing details • These instructions add the BCD 4-digit data in the device specified by (s1) and the BCD 4-digit data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) •...
  • Page 264: Subtracting Bcd 4-Digit Data

    Subtracting BCD 4-digit data B-(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of BCD 4-digit data specified. Ladder Not supported ( Page 264 B-(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 265 Operation error Error code Description (SD0) 3405H The BCD data in the device specified by (s) is out of the range, 0 to 9999. The BCD data in the device specified by (d) is out of the range, 0 to 9999. 6 BASIC INSTRUCTIONS 6.2 Arithmetic Operation Instructions...
  • Page 266 B-(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of BCD 4-digit data specified. Ladder ENO:=BMINUS(EN,s1,s2,d); ENO:=BMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by either of the following: BMINUS, BMINUSP.) ■Execution condition Instruction Execution condition...
  • Page 267 Processing details • These instructions subtract the BCD 4-digit data in the device specified by (s2) from the BCD 4-digit data in the device specified by (s1), and store the operation result in the device specified by (d). (s1) (s2) Filled with 0s.
  • Page 268: Adding Bcd 8-Digit Data

    Adding BCD 8-digit data DB+(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of BCD 8-digit data specified. Ladder Not supported ( Page 268 DB+(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 269 Operation error Error code Description (SD0) 3405H The BCD data in the device specified by (s) is out of the range, 0 to 99999999. The BCD data in the device specified by (d) is out of the range, 0 to 99999999. 6 BASIC INSTRUCTIONS 6.2 Arithmetic Operation Instructions...
  • Page 270 DB+(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two sets of BCD 8-digit data specified. Ladder ENO:=DBPLUS(EN,s1,s2,d); ENO:=DBPLUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by either of the following: DBPLUS, DBPLUSP.) ■Execution condition Instruction Execution condition...
  • Page 271 Processing details • These instructions add the BCD 8-digit data in the device specified by (s1) and the BCD 8-digit data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1...
  • Page 272: Subtracting Bcd 8-Digit Data

    Subtracting BCD 8-digit data DB-(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of BCD 8-digit data specified. Ladder Not supported ( Page 272 DB-(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 273 Operation error Error code Description (SD0) 3405H The BCD data in the device specified by (s) is out of the range, 0 to 99999999. The BCD data in the device specified by (d) is out of the range, 0 to 99999999. 6 BASIC INSTRUCTIONS 6.2 Arithmetic Operation Instructions...
  • Page 274 DB-(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two sets of BCD 8-digit data specified. Ladder ENO:=DBMINUS(EN,s1,s2,d); ENO:=DBMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is to be replaced by either of the following: DBMINUS, DBMINUSP.) ■Execution condition Instruction Execution condition...
  • Page 275 Processing details • These instructions subtract the BCD 8-digit data in the device specified by (s2) from the BCD 8-digit data in the device specified by (s1), and store the operation result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1...
  • Page 276: Multiplying Bcd 4-Digit Data

    Multiplying BCD 4-digit data B*(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply the two sets of BCD 4-digit data specified. Ladder Not supported (s1) (s2) FBD/LD ( is to be replaced by either of the following: BMULTI, BMULTIP.) ■Execution condition Instruction Execution condition...
  • Page 277 Processing details • These instructions multiply the BCD 4-digit data in the device specified by (s1) by the BCD 4-digit data in the device specified by (s2), and store the operation result in the device specified by (d). ((d)+1: Upper 4 digits, (d): Lower 4 digits) (s1) (s2) (d)+1...
  • Page 278: Dividing Bcd 4-Digit Data

    Dividing BCD 4-digit data B/(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between the two sets of BCD 4-digit data specified. Ladder Not supported (s1) (s2) FBD/LD ( is to be replaced by either of the following: BDIVISION, BDIVISIONP.) ■Execution condition Instruction Execution condition...
  • Page 279 Processing details • These instructions divide the BCD 4-digit data in the device specified by (s1) by the BCD 4-digit data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) (d)+1 ÷...
  • Page 280: Multiplying Bcd 8-Digit Data

    Multiplying BCD 8-digit data DB*(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply the two sets of BCD 8-digit data specified. Ladder Not supported (s1) (s2) FBD/LD ( is to be replaced by either of the following: DBMULTI, DBMULTIP.) ■Execution condition Instruction Execution condition...
  • Page 281 Processing details • These instructions multiply the BCD 8-digit data in the device specified by (s1) by the BCD 8-digit data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) ×...
  • Page 282: Dividing Bcd 8-Digit Data

    Dividing BCD 8-digit data DB/(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between the two sets of BCD 8-digit data specified. Ladder Not supported (s1) (s2) FBD/LD ( is to be replaced by either of the following: DBDIVISION, DBDIVISIONP.) ■Execution condition Instruction Execution condition...
  • Page 283 Processing details • These instructions divide the BCD 8-digit data in the device specified by (s1) by the BCD 8-digit data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) ÷...
  • Page 284: Adding 16-Bit Binary Block Data

    Adding 16-bit binary block data BK+(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two 16-bit binary data blocks specified. Ladder ENO:=BKPLUS(EN,s1,s2,n,d); ENO:=BKPLUS_U(EN,s1,s2,n,d); ENO:=BKPLUSP(EN,s1,s2,n,d); ENO:=BKPLUSP_U(EN,s1,s2,n,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: DMINUS, DMINUSP, DMINUS_U, DMINUSP_U.) *1 The engineering tool with version "1.035M"...
  • Page 285 Processing details • These instructions add the (n) points of 16-bit binary data from the device specified by (s1) and the (n) points of 16-bit binary data from the device specified by (s2) or the constant, and store the operation result in the device specified by (d) and later.
  • Page 286: Subtracting 16-Bit Binary Block Data

    Subtracting 16-bit binary block data BK-(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two 16-bit binary data blocks specified. Ladder ENO:=BKMINUS(EN,s1,s2,n,d); ENO:=BKMINUS_U(EN,s1,s2,n,d); ENO:=BKMINUSP(EN,s1,s2,n,d); ENO:=BKMINUSP_U(EN,s1,s2,n,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: BKMINUS, BKMINUSP, BKMINUS_U, BKMINUSP_U.) *1 The engineering tool with version "1.035M"...
  • Page 287 Processing details • These instructions subtract the (n) points of 16-bit binary data from the device specified by (s2) or the constant from the (n) points of 16-bit binary data from the device specified by (s1), and store the operation result in the device specified by (d) and later.
  • Page 288: Adding 32-Bit Binary Block Data

    Adding 32-bit binary block data DBK+(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the two 32-bit binary data blocks specified. Ladder ENO:=DBKPLUS(EN,s1,s2,n,d); ENO:=DBKPLUS_U(EN,s1,s2,n,d); ENO:=DBKPLUSP(EN,s1,s2,n,d); ENO:=DBKPLUSP_U(EN,s1,s2,n,d); (s1) (s2) FBD/LD ( is to be replaced by any of the following: DBKPLUS, DBKPLUSP, DBKPLUS_U, DBKPLUSP_U.) *1 The engineering tool with version "1.035M"...
  • Page 289 Processing details • These instructions add the (n) points of 32-bit binary data from the device specified by (s1) and the (n) points of 32-bit binary data from the device specified by (s2) or the constant, and store the operation result in the device specified by (d) and later.
  • Page 290 Operation error Error code Description (SD0) 2821H The device ranges starting from the ones specified by (s1) and (d) are overlapping (except when the same device is specified for (s1) and (d)). The device ranges starting from the ones specified by (s2) and (d) are overlapping (except when the same device is specified for (s2) and (d)).
  • Page 291: Subtracting 32-Bit Binary Block Data

    Subtracting 32-bit binary block data DBK-(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between the two 32-bit binary data blocks specified. Ladder ENO:=DBKMINUS(EN,s1,s2,n,d); ENO:=DBKMINUS_U(EN,s1,s2,n,d); ENO:=DBKMINUSP(EN,s1,s2,n,d); ENO:=DBKMINUSP_U(EN,s1,s2,n,d (s1) (s2) FBD/LD ( is to be replaced by any of the following: DBKMINUS, DBKMINUSP, DBKMINUS_U, DBKMINUSP_U.) *1 The engineering tool with version "1.035M"...
  • Page 292 Processing details • These instructions subtract the (n) points of 32-bit binary data from the device specified by (s2) or the constant from the (n) points of 32-bit binary data from the device specified by (s1), and store the operation result in the device specified by (d) and later.
  • Page 293 Operation error Error code Description (SD0) 2821H The device ranges starting from the ones specified by (s1) and (d) are overlapping (except when the same device is specified for (s1) and (d)). The device ranges starting from the ones specified by (s2) and (d) are overlapping (except when the same device is specified for (s2) and (d)).
  • Page 294: Incrementing 16-Bit Binary Data

    Incrementing 16-bit binary data INC(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions increment the specified 16-bit binary data by one. Ladder ENO:=INC(EN,d); ENO:=INC_U(EN,d); ENO:=INCP(EN,d); ENO:=INCP_U(EN,d); FBD/LD ■Execution condition Instruction Execution condition INC_U INCP INCP_U Setting data ■Description, range, data type Operand Description...
  • Page 295 Processing details • These instructions increment the 16-bit binary data in the device specified by (d) by one. ··· ··· 5678 (BIN) 5679 (BIN) • When the INC(P) instruction is executed while the data in the device specified by (d) is 32767, -32768 is stored in the device specified by (d).
  • Page 296: Decrementing 16-Bit Binary Data

    Decrementing 16-bit binary data DEC(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions decrement the specified 16-bit binary data by one. Ladder ENO:=DEC(EN,d); ENO:=DEC_U(EN,d); ENO:=DECP(EN,d); ENO:=DECP_U(EN,d); FBD/LD ■Execution condition Instruction Execution condition DEC_U DECP DECP_U Setting data ■Description, range, data type Operand Description...
  • Page 297 Processing details • These instructions decrement the 16-bit binary data in the device specified by (d) by one. ··· ··· 5678 (BIN) 5677 (BIN) • When the DEC(P) instruction is executed while the data in the device specified by (d) is -32768, 32767 is stored in the device specified by (d).
  • Page 298: Incrementing 32-Bit Binary Data

    Incrementing 32-bit binary data DINC(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions increment the specified 32-bit binary data by one. Ladder ENO:=DINC(EN,d); ENO:=DINC_U(EN,d); ENO:=DINCP(EN,d); ENO:=DINCP_U(EN,d); FBD/LD ■Execution condition Instruction Execution condition DINC DINC_U DINCP DINCP_U Setting data ■Description, range, data type Operand...
  • Page 299 Processing details • These instructions increment the 32-bit binary data in the device specified by (d) by one. (d)+1 (d)+1 b16 b15 b16 b15 ··· ··· ··· ··· 73500 (BIN) 73501 (BIN) • When the DINC(P) instruction is executed while the data in the device specified by (d) is 2147483647, -2147483648 is stored in the device specified by (d).
  • Page 300: Decrementing 32-Bit Binary Data

    Decrementing 32-bit binary data DDEC(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions decrement the specified 32-bit binary data by one. Ladder ENO:=DDEC(EN,d); ENO:=DDEC_U(EN,d); ENO:=DDECP(EN,d); ENO:=DDECP_U(EN,d); FBD/LD ■Execution condition Instruction Execution condition DDEC DDEC_U DDECP DDECP_U Setting data ■Description, range, data type Operand...
  • Page 301 Processing details • These instructions decrement the 32-bit binary data in the device specified by (d) by one. (d)+1 (d)+1 b16 b15 b16 b15 ··· ··· ··· ··· 73500 (BIN) 73499 (BIN) • When the DDEC(P) instruction is executed while the data in the device specified by (d) is -2147483648, 2147483647 is stored in the device specified by (d).
  • Page 302: Logical Operation Instructions

    Logical Operation Instructions Performing an AND operation on 16-bit data WAND(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an AND operation on the two sets of 16-bit binary data specified. Ladder Not supported (...
  • Page 303 Processing details • These instructions perform an AND operation (bit-by-bit) on the 16-bit binary data in the device specified by (d) and the 16- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 304 WAND(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an AND operation on the two sets of 16-bit binary data specified. Ladder ENO:=WAND(EN,s1,s2,d); ENO:=WANDP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition WAND WANDP...
  • Page 305 Processing details • These instructions perform an AND operation (bit-by-bit) on the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 306: Performing An And Operation On 32-Bit Data

    Performing an AND operation on 32-bit data DAND(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an AND operation on the two sets of 32-bit binary data specified. Ladder Not supported (...
  • Page 307 Processing details • These instructions perform an AND operation (bit-by-bit) on the 32-bit binary data in the device specified by (d) and the 32- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). (d)+1 ∙∙∙...
  • Page 308 DAND(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an AND operation on the two sets of 32-bit binary data specified. Ladder ENO:=DAND(EN,s1,s2,d); ENO:=DANDP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition DAND DANDP...
  • Page 309 Processing details • These instructions perform an AND operation (bit-by-bit) on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) ∙∙∙...
  • Page 310: Performing An And Operation On 16-Bit Block Data

    Performing an AND operation on 16-bit block data BKAND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an AND operation on the two 16-bit binary data blocks specified. Ladder ENO:=BKAND(EN,s1,s2,n,d); ENO:=BKANDP(EN,s1,s2,n,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition BKAND...
  • Page 311 Processing details • These instructions perform an AND operation on the (n) points of data from the device specified by (s1) and the (n) points of data from the device specified by (s2), and store the operation result in the device specified by (d) and later. ∙∙∙...
  • Page 312: Performing An Or Operation On 16-Bit Data

    Performing an OR operation on 16-bit data WOR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an OR operation on the two sets of 16-bit binary data specified. Ladder Not supported (...
  • Page 313 Processing details • These instructions perform an OR operation (bit-by-bit) on the 16-bit binary data in the device specified by (d) and the 16- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 314 WOR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an OR operation on the two sets of 16-bit binary data specified. Ladder ENO:=WOR(EN,s1,s2,d); ENO:=WORP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition WORP Setting data...
  • Page 315 Processing details • These instructions perform an OR operation (bit-by-bit) on the 16-bit binary data in the device specified by (s1) and the 16- bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 316: Performing An Or Operation On 32-Bit Data

    Performing an OR operation on 32-bit data DOR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an OR operation on the two sets of 32-bit binary data specified. Ladder Not supported (...
  • Page 317 Processing details • These instructions perform an OR operation (bit-by-bit) on the 32-bit binary data in the device specified by (d) and the 32- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). (d)+1 ∙∙∙...
  • Page 318 DOR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an OR operation on the two sets of 32-bit binary data specified. Ladder ENO:=DOR(EN,s1,s2,d); ENO:=DORP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition DORP Setting data...
  • Page 319 Processing details • These instructions perform an OR operation (bit-by-bit) on the 32-bit binary data in the device specified by (s1) and the 32- bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) ∙∙∙...
  • Page 320: Performing An Or Operation On 16-Bit Block Data

    Performing an OR operation on 16-bit block data BKOR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an OR operation on the two 16-bit binary data blocks specified. Ladder ENO:=BKOR(EN,s1,s2,n,d); ENO:=BKORP(EN,s1,s2,n,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition BKOR...
  • Page 321 Processing details • These instructions perform an OR operation on the (n) points of data from the device specified by (s1) and the (n) points of data from the device specified by (s2), and store the operation result in the device specified by (d) and later. ∙∙∙...
  • Page 322: Performing An Xor Operation On 16-Bit Data

    Performing an XOR operation on 16-bit data WXOR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XOR operation on the two sets of 16-bit binary data specified. Ladder Not supported (...
  • Page 323 Processing details • These instructions perform an XOR operation (bit-by-bit) on the 16-bit binary data in the device specified by (d) and the 16- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 324 WXOR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XOR operation on the two sets of 16-bit binary data specified. Ladder ENO:=WXOR(EN,s1,s2,d); ENO:=WXORP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition WXOR WXORP...
  • Page 325 Processing details • These instructions perform an XOR operation (bit-by-bit) on the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 326: Performing An Xor Operation On 32-Bit Data

    Performing an XOR operation on 32-bit data DXOR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XOR operation on the two sets of 32-bit binary data specified. Ladder Not supported (...
  • Page 327 Processing details • These instructions perform an XOR operation (bit-by-bit) on the 32-bit binary data in the device specified by (d) and the 32- bit binary data in the device specified by (s), and store the operation result in the device specified by (d). (d)+1 ∙∙∙...
  • Page 328 DXOR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XOR operation on the two sets of 32-bit binary data specified. Ladder ENO:=DXOR(EN,s1,s2,d); ENO:=DXORP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition DXOR DXORP...
  • Page 329 Processing details • These instructions perform an XOR operation (bit-by-bit) on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) ∙∙∙...
  • Page 330: Performing An Xor Operation On 16-Bit Block Data

    Performing an XOR operation on 16-bit block data BKXOR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XOR operation on the two 16-bit binary data blocks specified. Ladder ENO:=BKXOR(EN,s1,s2,n,d); ENO:=BKXORP(EN,s1,s2,n,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition BKXOR...
  • Page 331 Processing details • These instructions perform an XOR operation on the (n) points of data from the device specified by (s1) and the (n) points of data from the device specified by (s2), and store the operation result in the device specified by (d) and later. ∙∙∙...
  • Page 332: Performing An Xnor Operation On 16-Bit Data

    Performing an XNOR operation on 16-bit data WXNR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XNOR operation on the two sets of 16-bit binary data specified. Ladder Not supported (...
  • Page 333 Processing details • These instructions perform an XNOR operation on the 16-bit binary data in the device specified by (d) and the 16-bit binary data in the device specified by (s), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 334 WXNR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XNOR operation on the two sets of 16-bit binary data specified. Ladder ENO:=WXNR(EN,s1,s2,d); ENO:=WXNRP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition WXNR WXNRP...
  • Page 335 Processing details • These instructions perform an exclusive NOR operation on the 16-bit binary data in the device specified by (s1) and the 16- bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). ∙∙∙...
  • Page 336: Performing An Xnor Operation On 32-Bit Data

    Performing an XNOR operation on 32-bit data DXNR(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XNOR operation on the two sets of 32-bit binary data specified. Ladder Not supported (...
  • Page 337 Processing details • These instructions perform an XNOR operation on the 32-bit binary data in the device specified by (d) and the 32-bit binary data in the device specified by (s), and store the operation result in the device specified by (d). (d)+1 ∙∙∙...
  • Page 338 DXNR(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XNOR operation on the two sets of 32-bit binary data specified. Ladder ENO:=DXNR(EN,s1,s2,d); ENO:=DXNRP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition DXNR DXNRP...
  • Page 339 Processing details • These instructions perform an XNOR operation on the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1)+1 (s1) ∙∙∙...
  • Page 340: Performing An Xnor Operation On 16-Bit Block Data

    Performing an XNOR operation on 16-bit block data BKXNR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform an XNOR operation on the two 16-bit binary data blocks specified. Ladder ENO:=BKXNR(EN,s1,s2,n,d); ENO:=BKXNRP(EN,s1,s2,n,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition BKXNR...
  • Page 341 Processing details • These instructions perform an exclusive NOR operation on the (n) points of data from the device specified by (s1) and the (n) points of data from the device specified by (s2), and store the operation result in the device specified by (d) and later. ∙∙∙...
  • Page 342: Bit Processing Instructions

    Bit Processing Instructions Setting a bit in the word device BSET(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions set the 'n'th bit in the specified word device to 1. Ladder ENO:=BSET(EN,n,d); ENO:=BSETP(EN,n,d); FBD/LD ■Execution condition Instruction Execution condition BSET...
  • Page 343 Processing details • These instructions set the 'n'th bit in the word device specified by (d) to 1. BSETP ∙∙∙ ∙∙∙ D10 1 1 0 0 1 1 0 1 1 0 1 1 ∙∙∙ ∙∙∙ D10 1 1 0 0 1 1 0 1 1 0 1 1 (1) Set b6 of D10 to 1.
  • Page 344: Resetting A Bit In The Word Device

    Resetting a bit in the word device BRST(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions reset the 'n'th bit in the specified word device to 0. Ladder ENO:=BRST(EN,n,d); ENO:=BRSTP(EN,n,d); FBD/LD ■Execution condition Instruction Execution condition BRST BRSTP Setting data...
  • Page 345 Processing details • These instructions reset the 'n'th bit in the word device specified by (d) to 0. BRSTP ∙∙∙ ∙∙∙ D10 1 1 0 0 1 1 0 1 1 0 1 1 ∙∙∙ ∙∙∙ D10 1 1 0 0 1 1 0 1 1 0 1 1 (1) Reset the b11 of D10 to 0.
  • Page 346: Performing A 16-Bit Test

    Performing a 16-bit test TEST(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions extract the 'n'th bit in the specified word device. Ladder ENO:=TEST(EN,s1,s2,d); ENO:=TESTP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition TEST TESTP Setting data ■Description, range, data type Operand Description...
  • Page 347 Processing details • These instructions extract the bit data at the position specified by (s2) of the word device specified by (s1), and write it to the bit device specified by (d). ∙∙∙ ∙∙∙ (s1) (1) (s2) bit (When (s2)=5) •...
  • Page 348: Performing A 32-Bit Test

    Performing a 32-bit test DTEST(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions extract the 'n'th bit in the specified double-word device. Ladder ENO:=DTEST(EN,s1,s2,d); ENO:=DTESTP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition DTEST DTESTP Setting data ■Description, range, data type Operand Description...
  • Page 349 Processing details • These instructions extract the bit data at the position specified by (s2) of the double-word device specified by (s1), and write it to the bit device specified by (d). ∙∙∙ ∙∙∙ ∙∙∙ (s1)+1 (s1) (1) (s2) bit (When (s2)=21) •...
  • Page 350: Batch-Resetting Bit Devices

    Batch-resetting bit devices BKRST(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions reset the (n) points of bit devices starting from the bit device specified. Ladder ENO:=BKRST(EN,n,d); ENO:=BKRSTP(EN,n,d); FBD/LD ■Execution condition Instruction Execution condition BKRST BKRSTP Setting data ■Description, range, data type Operand...
  • Page 351 Processing details • These instructions reset the (n) points of bit devices starting from the bit device specified by (d). • The following table lists the reset status of the bit devices. Device Status Annunciator (F) • The (n) points of data starting from the annunciator (F) number in the device specified by (d) turn off. •...
  • Page 352: Shift Instructions

    Shift Instructions Shifting 16-bit binary data to the right by n bit(s) SFR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the 16-bit binary data in the specified device to the right. Ladder ENO:=SFR(EN,n,d); ENO:=SFRP(EN,n,d); FBD/LD ■Execution condition Instruction...
  • Page 353 Processing details • These instructions shift the 16-bit binary data in the device specified by (d) to the right by (n) bit(s). The (n) bit(s) from the most significant bit is/are filled with 0(s). When (n)=6 b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1 (SM700) b14 b13 b12 b11 b10 b9...
  • Page 354: Shifting 16-Bit Binary Data To The Left By N Bit(S)

    Shifting 16-bit binary data to the left by n bit(s) SFL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the 16-bit binary data in the specified device to the left. Ladder ENO:=SFL(EN,n,d); ENO:=SFLP(EN,n,d); FBD/LD ■Execution condition Instruction Execution condition SFLP...
  • Page 355 Processing details • This instruction shifts the 16-bit binary data in the device specified by (d) to the left by (n) bit(s). The (n) bit(s) from the least significant bit is/are filled with 0(s). When (n)=8 b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1 (SM700) b14 b13 b12 b11 b10 b9...
  • Page 356: Shifting N-Bit Data To The Right By One Bit

    Shifting n-bit data to the right by one bit BSFR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n points of data starting from the specified device to the right by one bit. Ladder ENO:=BSFR(EN,n,d);...
  • Page 357 Processing details • These instructions shift the (n) points of data starting from the device specified by (d) to the right by one bit. (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (SM700) (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (1) Filled with 0. Operation error There is no operation error.
  • Page 358: Shifting N-Bit Data To The Left By One Bit

    Shifting n-bit data to the left by one bit BSFL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n points of data starting from the specified device to the left by one bit. Ladder ENO:=BSFL(EN,n,d);...
  • Page 359 Processing details • These instructions shift the (n) points of data starting from the device specified by (d) to the left by one bit. (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (SM700) (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (1) Filled with 0 Operation error There is no operation error.
  • Page 360: Shifting N-Word Data To The Right By One Word

    Shifting n-word data to the right by one word DSFR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n points of data starting from the specified device to the right by one word. Ladder ENO:=DSFR(EN,n,d);...
  • Page 361 Processing details • These instructions shift the (n) points of data starting from the device specified by (d) to the right by one word. (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 (d)+(n)-4 ∙∙∙ (d)+1 (1) Filled with 0. Operation error There is no operation error.
  • Page 362: Shifting N-Word Data To The Left By One Word

    Shifting n-word data to the left by one word DSFL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n points of data starting from the specified device to the left by one word. Ladder ENO:=DSFL(EN,n,d);...
  • Page 363 Processing details • These instructions shift the (n) points of data starting from the device specified by (d) to the left by one word. (d)+(n)-1 (d)+(n)-2 (d)+(n)-3 ∙∙∙ (d)+2 (d)+1 (d)+(n)-1 (d)+(n)-2 ∙∙∙ (d)+3 (d)+2 (d)+1 (1) Filled with 0. Operation error There is no operation error.
  • Page 364: Shifting N-Bit Data To The Right By N Bit(S)

    Shifting n-bit data to the right by n bit(s) SFTBR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n-bit data starting from the specified device to the right by n bit(s). Ladder ENO:=SFTBR(EN,n1,n2,d); ENO:=SFTBRP(EN,n1,n2,d); (n1) (n2) FBD/LD...
  • Page 365 Processing details • These instructions shift the (n1) bit(s) of data starting from the specified device to the right by (n2) bit(s). When (n1)=10 and (n2)=4 (n1) (n2) (d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (d)+4...
  • Page 366 SFTR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions shift the (n2) bit(s) of area to the right within the (n1) bits of data area starting from the specified device. Ladder ENO:=SFTR(EN,s,n1,n2,d);...
  • Page 367 Processing details • These instructions shift the (n2) bit(s) of area to the right within the (n1) bits of data area starting from the device specified by (d). After the shift, (n2) points of area from (s) are set into (n2) points of area from (d)+(n1-n2). •...
  • Page 368: Shifting N-Bit Data To The Left By N Bit(S)

    Shifting n-bit data to the left by n bit(s) SFTBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n-bit data starting from the specified device to the left by n bit(s). Ladder ENO:=SFTBL(EN,n1,n2,d); ENO:=SFTBLP(EN,n1,n2,d); (n1) (n2) FBD/LD...
  • Page 369 Processing details • These instructions shift the (n1) bit(s) of data starting from the specified device to the left by (n2) bit(s). When (n1)=10 and (n2)=4 (n1) (n2) (d)+9 (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 (SM700) (d)+9 (d)+8 (d)+7 (d)+6 (d)+5...
  • Page 370 SFTL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions shift the (n2) bit(s) of area to the left within the (n1) bits of data area starting from the specified device. Ladder ENO:=SFTL(EN,s,n1,n2,d);...
  • Page 371 Processing details • These instructions shift the (n2) bit(s) of area to the left within the (n1) bits of data area starting from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d). •...
  • Page 372: Shifting N-Word Data To The Right By N Word(S)

    Shifting n-word data to the right by n word(s) SFTWR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n-word data starting from the specified device to the right by n word(s). Ladder ENO:=SFTWR(EN,n1,n2,d); ENO:=SFTWRP(EN,n1,n2,d); (n1) (n2) FBD/LD...
  • Page 373 Processing details • These instructions shift the (n1) word(s) of data starting from the specified device to the right by (n2) word(s). When (n1)=9 and (n2)=4 (n1) (n2) (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 30FH 100H 1FFH 7FFH (d)+8 (d)+7 (d)+6...
  • Page 374 WSFR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions shift the (n2) word(s) of area to the right within the (n1) words of data area starting from the specified device.
  • Page 375 Processing details • These instructions shift the (n2) word(s) of area to the right within the (n1) words of data area starting from the device specified by (d). After the shift, (n2) points of area from (s) are set into (n2) points of area from (d)+(n1-n2). •...
  • Page 376: Shifting N-Word Data To The Left By N Word(S)

    Shifting n-word data to the left by n word(s) SFTWL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions shift the n-word data starting from the specified device to the left by n word(s). Ladder ENO:=SFTWL(EN,n1,n2,d); ENO:=SFTWLP(EN,n1,n2,d); (n1) (n2) FBD/LD...
  • Page 377 Processing details • These instructions shift the (n1) word(s) of data starting from the specified device to the left by (n2) word(s). When (n1)=9 and (n2)=4 (n1) (n2) (d)+8 (d)+7 (d)+6 (d)+5 (d)+4 (d)+3 (d)+2 (d)+1 1FFH 7FFH (d)+8 (d)+7 (d)+6 (d)+5 (d)+4...
  • Page 378 WSFL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions shift the (n2) word(s) of area to the left within the (n1) words of data area starting from the specified device. Ladder ENO:=WSFL(EN,s,n1,n2,d);...
  • Page 379 Processing details • These instructions shift the (n2) word(s) of area to the left within the (n1) words of data area starting from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d). •...
  • Page 380: Data Conversion Instructions

    Data Conversion Instructions Converting binary data to BCD 4-digit data BCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit binary data to BCD 4-digit data. Ladder ENO:=BCD(EN,s,d); ENO:=BCDP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BCDP Setting data...
  • Page 381 Processing details • These instructions convert the 16-bit binary data (0 to 9999) in the device specified by (s) to BCD 4-digit data, and store the converted data in the device specified by (d). BIN 9999 ×10 ×10 ×10 ×10 BCD 9999 (1) Set 0s.
  • Page 382: Converting Binary Data To Bcd 8-Digit Data

    Converting binary data to BCD 8-digit data DBCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit binary data to BCD 8-digit data. Ladder ENO:=DBCD(EN,s,d); ENO:=DBCDP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DBCD DBCDP Setting data ■Description, range, data type...
  • Page 383 Processing details • These instructions convert the 32-bit binary data (0 to 99999999) in the device specified by (s) to BCD 8-digit data, and store the converted data in the device specified by (d). (s)+1 (Upper 16 bits) (s) (Lower 16 bits) BIN 99999999 ×10 ×10...
  • Page 384: Converting Bcd 4-Digit Data To 16-Bit Binary Data

    Converting BCD 4-digit data to 16-bit binary data BIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified BCD 4-digit data to 16-bit binary data. Ladder ENO:=BIN(EN,s,d); ENO:=BINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BINP Setting data ■Description, range, data type...
  • Page 385 Operation error Error code Description (SD0) 3401H A value other than 0 to 9 exists at any digit of the value in the device specified by (s). *1 Turning on SM754 can prevent this error from being detected. If the specified value is out of the valid range, the BIN(P) instruction is not executed regardless of the status (on/off) of SM754. The BIN(P) instruction does not execute the next operation until the command (execution condition) is turned off and on regardless of the presence of an error.
  • Page 386: Converting Bcd 8-Digit Data To 32-Bit Binary Data

    Converting BCD 8-digit data to 32-bit binary data DBIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified BCD 8-digit data to 32-bit binary data. Ladder ENO:=DBIN(EN,s,d); ENO:=DBINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DBIN DBINP Setting data...
  • Page 387 Processing details • These instructions convert the BCD 8-digit data (0 to 99999999) in the device specified by (s) to 32-bit binary data, and store the converted data in the device specified by (d). (s)+1 ×10 ×10 ×10 ×10 ×10 ×10 ×10 ×10...
  • Page 388: Converting Single-Precision Real Number To 16-Bit Signed Binary Data

    Converting single-precision real number to 16-bit signed binary data FLT2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified single-precision real number to 16-bit signed binary data. Ladder ENO:=FLT2INT(EN,s,d); ENO:=FLT2INTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 389 Processing details • These instructions convert the single-precision real number in the device specified by (s) to 16-bit signed binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the single-precision real number is rounded off. •...
  • Page 390: Converting Single-Precision Real Number To 16-Bit Unsigned Binary Data

    Converting single-precision real number to 16-bit unsigned binary data FLT2UINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified single-precision real number to 16-bit unsigned binary data. Ladder ENO:=FLT2UINT(EN,s,d); ENO:=FLT2UINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 391 Processing details • These instructions convert the single-precision real number in the device specified by (s) to 16-bit unsigned binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the single-precision real number is rounded off. •...
  • Page 392: Converting Single-Precision Real Number To 32-Bit Signed Binary Data

    Converting single-precision real number to 32-bit signed binary data FLT2DINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified single-precision real number to 32-bit signed binary data. Ladder ENO:=FLT2DINT(EN,s,d); ENO:=FLT2DINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 393 Processing details • These instructions convert the single-precision real number in the device specified by (s) to 32-bit signed binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the single-precision real number is rounded off. •...
  • Page 394: Converting Single-Precision Real Number To 32-Bit Unsigned Binary Data

    Converting single-precision real number to 32-bit unsigned binary data FLT2UDINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified single-precision real number to 32-bit unsigned binary data. Ladder ENO:=FLT2UDINT(EN,s,d); ENO:=FLT2UDINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 395 Processing details • These instructions convert the single-precision real number in the device specified by (s) to 32-bit unsigned binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the single-precision real number is rounded off. •...
  • Page 396: Converting Double-Precision Real Number To 16-Bit Signed Binary Data

    Converting double-precision real number to 16-bit signed binary data DBL2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified double-precision real number to 16-bit signed binary data. Ladder ENO:=DBL2INT(EN,s,d); ENO:=DBL2INTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 397 Processing details • These instructions convert the double-precision real number in the device specified by (s) to 16-bit signed binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the double-precision real number is rounded off. •...
  • Page 398: Converting Double-Precision Real Number To 16-Bit Unsigned Binary Data

    Converting double-precision real number to 16-bit unsigned binary data DBL2UINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified double-precision real number to 16-bit unsigned binary data. Ladder ENO:=DBL2UINT(EN,s,d); ENO:=DBL2UINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 399 Processing details • These instructions convert the double-precision real number in the device specified by (s) to 16-bit unsigned binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the double-precision real number is rounded off. •...
  • Page 400: Converting Double-Precision Real Number To 32-Bit Signed Binary Data

    Converting double-precision real number to 32-bit signed binary data DBL2DINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified double-precision real number to 32-bit signed binary data. Ladder ENO:=DBL2DINT(EN,s,d); ENO:=DBL2DINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 401 Processing details • These instructions convert the double-precision real number in the device specified by (s) to 32-bit signed binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the double-precision real number is rounded off. •...
  • Page 402: Converting Double-Precision Real Number To 32-Bit Unsigned Binary Data

    Converting double-precision real number to 32-bit unsigned binary data DBL2UDINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified double-precision real number to 32-bit unsigned binary data. Ladder ENO:=DBL2UDINT(EN,s,d); ENO:=DBL2UDINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 403 Processing details • These instructions convert the double-precision real number in the device specified by (s) to 32-bit unsigned binary data, and store the converted data in the device specified by (d). • After conversion, the first digit after the decimal point of the double-precision real number is rounded off. •...
  • Page 404: Converting 16-Bit Signed Binary Data To 16-Bit Unsigned Binary Data

    Converting 16-bit signed binary data to 16-bit unsigned binary data INT2UINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit signed binary data to 16-bit unsigned binary data. Ladder ENO:=INT2UINT(EN,s,d); ENO:=INT2UINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 405 Processing details • These instructions convert the 16-bit signed binary data (ANY16_S) in the label specified by (s) to 16-bit unsigned binary data (ANY16_U), and store the converted data in the label specified by (d). • The following figure shows a program example using the INT2UINT(P) instruction. The +_U instruction requires ANY16_U to be specified by the operand, and therefore, before the +_U instruction is executed, the INT2UINT instruction is used to convert wLabel0 of ANY16_S to uLabel1 of ANY16_U.
  • Page 406: Converting 16-Bit Signed Binary Data To 32-Bit Signed Binary Data

    Converting 16-bit signed binary data to 32-bit signed binary data INT2DINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit signed binary data to 32-bit signed binary data. Ladder ENO:=INT2DINT(EN,s,d); ENO:=INT2DINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 407 Processing details • These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit signed binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 16-bit signed binary data stored in D0 to 32-bit signed binary data, and stores the converted data in D100 and D101.
  • Page 408: Converting 16-Bit Signed Binary Data To 32-Bit Unsigned Binary Data

    Converting 16-bit signed binary data to 32-bit unsigned binary data INT2UDINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit signed binary data to 32-bit unsigned binary data. Ladder ENO:=INT2UDINT(EN,s,d); ENO:=INT2UDINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 409 Processing details • These instructions convert the 16-bit signed binary data in the device specified by (s) to 32-bit unsigned binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 16-bit signed binary data stored in D0 to 32-bit unsigned binary data, and stores the converted data in D100 and D101.
  • Page 410: Converting 16-Bit Unsigned Binary Data To 16-Bit Signed Binary Data

    Converting 16-bit unsigned binary data to 16-bit signed binary data UINT2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit unsigned binary data to 16-bit signed binary data. Ladder ENO:=UINT2INT(EN,s,d); ENO:=UINT2INTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 411 Processing details • These instructions convert the 16-bit signed binary data (ANY16_U) in the label specified by (s) to 16-bit unsigned binary data (ANY16_S), and store the converted data in the label specified by (d). • The following figure shows a program example using the UINT2INT(P) instruction. The + instruction requires ANY16_S to be specified by the operand, and therefore, before the + instruction is executed, the UINT2INT instruction is used to convert uLabel0 of ANY16_U to wLabel1 of ANY16_S.
  • Page 412: Converting 16-Bit Unsigned Binary Data To 32-Bit Signed Binary Data

    Converting 16-bit unsigned binary data to 32-bit signed binary data UINT2DINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit unsigned binary data to 32-bit signed binary data. Ladder ENO:=UINT2DINT(EN,s,d); ENO:=UINT2DINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 413 Processing details • These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit signed binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 16-bit unsigned binary data stored in D0 to 32-bit signed binary data, and stores the converted data in D100 and D101.
  • Page 414: Converting 16-Bit Unsigned Binary Data To 32-Bit Unsigned Binary Data

    Converting 16-bit unsigned binary data to 32-bit unsigned binary data UINT2UDINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit unsigned binary data to 32-bit unsigned binary data. Ladder ENO:=UINT2UDINT(EN,s,d); ENO:=UINT2UDINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 415 Processing details • These instructions convert the 16-bit unsigned binary data in the device specified by (s) to 32-bit unsigned binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 16-bit unsigned binary data stored in D0 to 32-bit unsigned binary data, and stores the converted data in D100 and D101.
  • Page 416: Converting 32-Bit Signed Binary Data To 16-Bit Signed Binary Data

    Converting 32-bit signed binary data to 16-bit signed binary data DINT2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit signed binary data to 16-bit signed binary data. Ladder ENO:=DINT2INT(EN,s,d); ENO:=DINT2INTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 417 Processing details • These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit signed binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 32-bit signed binary data stored in D0 and D1 to 16-bit signed binary data, and stores the converted data in D100.
  • Page 418: Converting 32-Bit Signed Binary Data To 16-Bit Unsigned Binary Data

    Converting 32-bit signed binary data to 16-bit unsigned binary data DINT2UINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit signed binary data to 16-bit unsigned binary data. Ladder ENO:=DINT2UINT(EN,s,d); ENO:=DINT2UINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 419 Processing details • These instructions convert the 32-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 32-bit signed binary data stored in D0 and D1 to 16-bit unsigned binary data, and stores the converted data in D100.
  • Page 420: Converting 32-Bit Signed Binary Data To 32-Bit Unsigned Binary Data

    Converting 32-bit signed binary data to 32-bit unsigned binary data DINT2UDINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit signed binary data to 32-bit unsigned binary data. Ladder ENO:=DINT2UDINT(EN,s,d); ENO:=DINT2UDINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 421 Processing details • These instructions convert the 32-bit signed binary data (ANY32_S) in the label specified by (s) to 32-bit unsigned binary data (ANY32_U), and store the converted data in the label specified by (d). • The following figure shows a program example using the DINT2UDINT(P) instruction. The D+_U instruction requires ANY32_U to be specified by the operand, and therefore, before the D+_U instruction is executed, the DINT2UDINT instruction is used to convert dLabel0 of ANY32_S to udLabel1 of ANY32_U.
  • Page 422: Converting 32-Bit Unsigned Binary Data To 16-Bit Signed Binary Data

    Converting 32-bit unsigned binary data to 16-bit signed binary data UDINT2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit unsigned binary data to 16-bit signed binary data. Ladder ENO:=UDINT2INT(EN,s,d); ENO:=UDINT2INTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 423 Processing details • These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit signed binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 32-bit unsigned binary data stored in D0 and D1 to 16-bit signed binary data, and stores the converted data in D100.
  • Page 424: Converting 32-Bit Unsigned Binary Data To 16-Bit Unsigned Binary Data

    Converting 32-bit unsigned binary data to 16-bit unsigned binary data UDINT2UINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit unsigned binary data to 16-bit unsigned binary data. Ladder ENO:=UDINT2UINT(EN,s,d); ENO:=UDINT2UINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 425 Processing details • These instructions convert the 32-bit unsigned binary data in the device specified by (s) to 16-bit unsigned binary data, and store the converted data in the device specified by (d). The following program example converts, when M0 turns on, the 32-bit unsigned binary data stored in D0 and D1 to 16-bit unsigned binary data, and stores the converted data in D100.
  • Page 426: Converting 32-Bit Unsigned Binary Data To 32-Bit Signed Binary Data

    Converting 32-bit unsigned binary data to 32-bit signed binary data UDINT2DINT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit unsigned binary data to 32-bit signed binary data. Ladder ENO:=UDINT2DINT(EN,s,d); ENO:=UDINT2DINTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 427 Processing details • These instructions convert the 32-bit signed binary data (ANY32_U) in the label specified by (s) to 32-bit unsigned binary data (ANY32_S), and store the converted data in the label specified by (d). • The following figure shows a program example using the UDINT2DINT(P) instruction. The D+ instruction requires ANY32_S to be specified by the operand, and therefore, before the D+ instruction is executed, the UDINT2DINT instruction is used to convert udLabel0 of ANY32_U to dLabel1 of ANY32_S.
  • Page 428: Converting 16-Bit Binary Data To Gray Code Data

    Converting 16-bit binary data to Gray code data GRY(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit binary data to 16-bit binary Gray code data. Ladder ENO:=GRY(EN,s,d); ENO:=GRY_U(EN,s,d); ENO:=GRYP(EN,s,d); ENO:=GRYP_U(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition GRY_U...
  • Page 429 Operation error Error code Description (SD0) 3401H When the GRY(P) instruction is used, the value in the device specified by (s) is out of the range, 0 to 32767. 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 430: Converting 32-Bit Binary Data To Gray Code Data

    Converting 32-bit binary data to Gray code data DGRY(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit binary data to 32-bit binary Gray code data. Ladder ENO:=DGRY(EN,s,d); ENO:=DGRY_U(EN,s,d); ENO:=DGRYP(EN,s,d); ENO:=DGRYP_U(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DGRY...
  • Page 431 Processing details • These instructions convert the 32-bit binary data in the device specified by (s) to 32-bit binary Gray code data, and store the converted data in the device specified by (d). (s)+1 ∙∙∙ ∙∙∙ 305419896 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 (s) BIN (d)+1 ∙∙∙...
  • Page 432: Converting 16-Bit Binary Gray Code Data To 16-Bit Binary Data

    Converting 16-bit binary Gray code data to 16-bit binary data GBIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 16-bit binary Gray code data to 16-bit binary data. Ladder ENO:=GBIN(EN,s,d); ENO:=GBIN_U(EN,s,d); ENO:=GBINP(EN,s,d); ENO:=GBINP_U(EN,s,d); FBD/LD ■Execution condition Instruction...
  • Page 433 Operation error Error code Description (SD0) 3401H When the GBIN(P) instruction is used, the value in the device specified by (s) is out of the range, 0 to 32767. 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 434: Converting 32-Bit Binary Gray Code Data To 32-Bit Binary Data

    Converting 32-bit binary Gray code data to 32-bit binary data DGBIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the specified 32-bit binary Gray code data to 32-bit binary data. Ladder ENO:=DGBIN(EN,s,d); ENO:=DGBIN_U(EN,s,d); ENO:=DGBINP(EN,s,d); ENO:=DGBINP_U(EN,s,d); FBD/LD ■Execution condition Instruction...
  • Page 435 Processing details • These instructions convert the 32-bit binary Gray code data in the device specified by (s) to 32-bit binary data, and store the converted data in the device specified by (d). (s)+1 ∙∙∙ ∙∙∙ 305419896 0 0 1 1 0 1 1 0 0 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 (d)+1 ∙∙∙...
  • Page 436: Converting 16-Bit Binary Data Block To Bcd 4-Digit Data Block

    Converting 16-bit binary data block to BCD 4-digit data block BKBCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the n points of binary data (0 to 9999) starting from the specified device to BCD data. Ladder ENO:=BKBCD(EN,s,n,d);...
  • Page 437 Processing details • These instructions convert the (n) points of 16-bit binary data (0 to 9999) starting from the device specified by (s) to BCD data, and store the converted data in the device specified by (d) and later. BIN 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 (s)+1 BIN 5678...
  • Page 438: Converting Bcd 4-Digit Block Data To 16-Bit Binary Block Data

    Converting BCD 4-digit block data to 16-bit binary block data BKBIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the n points of BCD data (0 to 9999) starting from the specified device to binary data. Ladder ENO:=BKBIN(EN,s,n,d);...
  • Page 439 Processing details • These instructions convert the (n) points of BCD data (0 to 9999) starting from the device specified by (s) to 16-bit binary data, and store the converted data in the device specified by (d) and later. BCD 1234 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 (s)+1 BCD 5678...
  • Page 440: Converting Decimal Ascii Data To 16-Bit Binary Data

    Converting decimal ASCII data to 16-bit binary data DABIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert decimal ASCII data to 16-bit binary data. Ladder ENO:=DABIN(EN,s,d); ENO:=DABIN_U(EN,s,d); ENO:=DABINP(EN,s,d); ENO:=DABINP_U(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DABIN DABIN_U DABINP...
  • Page 441 Processing details • These instructions convert the decimal ASCII data in the device specified by (s) and later to 16-bit binary data, and store the converted data in the device specified by (d). • The setting method of the decimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 442 ■Setting method of (s) for when SM705 (Number of conversion digits selection) is on Set decimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not required to be set if the integral part has the maximum number of digits (5 digits). The following table lists the setting method of (s).
  • Page 443: Converting Decimal Ascii Data To 32-Bit Binary Data

    Converting decimal ASCII data to 32-bit binary data DDABIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert decimal ASCII data to 32-bit binary data. Ladder ENO:=DDABIN(EN,s,d); ENO:=DDABIN_U(EN,s,d); ENO:=DDABINP(EN,s,d); ENO:=DDABINP_U(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DDABIN DDABIN_U DDABINP...
  • Page 444 Processing details • These instructions convert the decimal ASCII data in the device areas specified by (s) and later to 32-bit binary data, and store the converted data in the device specified by (d). • The setting method of the decimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 445 ■Setting method of (s) for when SM705 (Number of conversion digits selection) is on Set decimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not required to be set if the integral part has the maximum number of digits (10 digits). The following table lists the setting method of (s).
  • Page 446 Operation error Error code Description (SD0) 3401H Invalid data that cannot be converted are input in (s) to (s)+5. • The ASCII code of the first character is other than 2DH, 30H to 39H, 20H, and 00H. • The ASCII code of the second character or later is other than 30H to 39H, 20H, and 00H. •...
  • Page 447: Converting Hexadecimal Ascii Data To 16-Bit Binary Data

    Converting hexadecimal ASCII data to 16-bit binary data HABIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert hexadecimal ASCII data to 16-bit binary data. Ladder ENO:=HABIN(EN,s,d); ENO:=HABINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition HABIN HABINP Setting data ■Description, range, data type Operand...
  • Page 448 Processing details • These instructions convert the hexadecimal ASCII data stored in the device areas specified by (s) and later to 16-bit binary data, and store the converted data in the device specified by (d). • The setting method of the hexadecimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 449 Operation error Error code Description (SD0) 3401H Invalid data that cannot be converted are input in (s) to (s)+1. • A value in each place of ASCII code is other than "30H" to "39H" and "41H" to "46H". 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 450: Converting Hexadecimal Ascii Data To 32-Bit Binary Data

    Converting hexadecimal ASCII data to 32-bit binary data DHABIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert hexadecimal ASCII data to 32-bit binary data. Ladder ENO:=DHABIN(EN,s,d); ENO:=DHABINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DHABIN DHABINP Setting data ■Description, range, data type Operand...
  • Page 451 Processing details • These instructions convert the hexadecimal ASCII data stored in the device specified by (s) and later to 32-bit binary data, and store the converted data in the device specified by (d). • The setting method of the hexadecimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 452 ■Setting method of (s) for when SM705 (Number of conversion digits selection) is on Set hexadecimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not required to be set for the maximum number of digits (8 digits). The following table lists the setting method of (s).
  • Page 453: Converting Decimal Ascii Data To Bcd 4-Digit Data

    Converting decimal ASCII data to BCD 4-digit data DABCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert decimal ASCII data to BCD 4-digit data. Ladder ENO:=DABCD(EN,s,d); ENO:=DABCDP(EN,s,d) FBD/LD ■Execution condition Instruction Execution condition DABCD DABCDP Setting data ■Description, range, data type Operand...
  • Page 454 Processing details • These instructions convert the decimal ASCII data stored in the device areas specified by (s) and later to BCD 4-digit data, and store the converted data in the device specified by (d). • The setting method of the decimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 455 ■Setting method of (s) for when SM705 (Number of conversion digits selection) is on Set decimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not required to be set for the maximum number of digits (4 digits). The following table lists the setting method of (s).
  • Page 456: Converting Decimal Ascii Data To Bcd 8-Digit Data

    Converting decimal ASCII data to BCD 8-digit data DDABCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert decimal ASCII data to BCD 8-digit data. Ladder ENO:=DDABCD(EN,s,d); ENO:=DDABCDP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DDABCD DDABCDP Setting data ■Description, range, data type Operand...
  • Page 457 Processing details • These instructions convert the decimal ASCII data stored in the device areas specified by (s) and later to BCD 8-digit data, and store the converted data in the device number specified by (d). • The setting method of the decimal ASCII data to be set in (s) depends on the status of SM705 (Number of conversion digits selection).
  • Page 458 ■Setting method of (s) for when SM705 (Number of conversion digits selection) is on Set decimal ASCII data with a desired number of digits (including 00H (NULL code)) in (s). Note that 00H (NULL code) is not required to be set for the maximum number of digits (8 digits). The following table lists the setting method of (s).
  • Page 459: Converting Decimal String Data To 16-Bit Binary Data

    Converting decimal string data to 16-bit binary data VAL(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert character strings to 16-bit binary data. Ladder ENO:=VAL(EN,s,d1,d2); ENO:=VAL_U(EN,s,d1,d2); ENO:=VALP(EN,s,d1,d2); ENO:=VALP_U(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition VAL_U VALP VALP_U...
  • Page 460 Processing details • These instructions convert the character strings stored in the device numbers specified by (s) and later to 16-bit binary data, and store the number of digits in (d1) and converted binary data in the device specified by (d2). For conversion of character strings to binary data, the data from the device number specified by (s) to the device number containing "00H"...
  • Page 461 When "30H" exists between the sign and the first numerical value other than 0 Total number of digits Number of digits in 0 . 0 0 1 2 the decimal part BIN16 Sign Ignored. Operation error Error code Description (SD0) 2820H 00H is not set between the device number specified by (s) and the last device number of the relevant device.
  • Page 462: Converting Decimal String Data To 32-Bit Binary Data

    Converting decimal string data to 32-bit binary data DVAL(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert character strings to 32-bit binary data. Ladder ENO:=DVAL(EN,s,d1,d2); ENO:=DVAL_U(EN,s,d1,d2); ENO:=DVALP(EN,s,d1,d2); ENO:=DVALP_U(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DVAL DVAL_U DVALP...
  • Page 463 Processing details • These instructions convert the character strings stored in the device numbers specified by (s) and later to 32-bit binary data, and store the number of digits in (d1) and converted binary data in the device specified by (d2). For conversion of character strings to binary data, the data from the device number specified by (s) to the device number containing "00H"...
  • Page 464 • If "20H" (space) or "30H" (0) exists between the sign and the first numerical value other than 0 in the character string in the device specified by (s), the instruction performs conversion to binary data by ignoring "20H" and "30H". When "20H"...
  • Page 465: Converting Hexadecimal Ascii To Hexadecimal Binary Data

    Converting hexadecimal ASCII to hexadecimal binary data ASC2INT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert hexadecimal ASCII data to binary data. Ladder ENO:=ASC2INT(EN,s,n,d); ENO:=ASC2INTP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition ASC2INT ASC2INTP Setting data ■Description, range, data type Operand Description...
  • Page 466 Processing details • These instructions convert the hexadecimal ASCII data stored in the device by the number of characters specified by (n) after the device number specified by (s) and later to binary data, and store the converted data in the device number specified by (d) and later.
  • Page 467: Converting Single-Precision Real Number To Bcd Format Data

    Converting single-precision real number to BCD format data EMOD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert single-precision real number data to the BCD floating point format data. Ladder ENO:=EMOD(EN,s1,s2,d); ENO:=EMODP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition EMOD...
  • Page 468 Processing details • These instructions convert the single-precision real number data stored in the device specified by (s1) to the BCD floating point format based on the number of decimal part digits stored in the device specified by (s2), and store the converted data in the device number specified by (d) and later.
  • Page 469: Two's Complement Of 16-Bit Binary Data (Sign Inversion)

    Two's complement of 16-bit binary data (sign inversion) NEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) Invert the sign of 16-bit binary device. Ladder ENO:=NEG(EN,d); ENO:=NEGP(EN,d); FBD/LD ■Execution condition Instruction Execution condition NEGP Setting data ■Description, range, data type Operand Description Range...
  • Page 470 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 471: Two's Complement Of 32-Bit Binary Data (Sign Inversion)

    Two's complement of 32-bit binary data (sign inversion) DNEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the sign of 32-bit binary device. Ladder ENO:=DNEG(EN,d); ENO:=DNEGP(EN,d); FBD/LD ■Execution condition Instruction Execution condition DNEG DNEGP Setting data ■Description, range, data type Operand Description...
  • Page 472 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 473: Decoding 8-Bit Data To 256-Bit Data

    Decoding 8-bit data to 256-bit data DECO(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions decode the lower (n) bits of the specified device. Ladder ENO:=DECO(EN,s,n,d); ENO:=DECOP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition DECO DECOP Setting data ■Description, range, data type Operand Description...
  • Page 474 Processing details • These instructions turn on the bit, corresponding to the binary value specified by the lower (n) bits in the device specified by (s), in the device specified by (d) 1 1 0 6 5 4 3 2 1 0 0 0 0 0 0 0 •...
  • Page 475: Encoding 256-Bit Data To 8-Bit Data

    Encoding 256-bit data to 8-bit data ENCO(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions encode the bit data of 'n'th power of 2. Ladder ENO:=ENCO(EN,s,n,d); ENO:=ENCOP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition ENCO ENCOP Setting data ■Description, range, data type Operand Description...
  • Page 476 Processing details • These instructions store the binary value, corresponding to the bit which is set to 1 in the 2 bit data in the device specified by (s), in the device specified by (d). 6 5 4 3 2 1 0 1 0 0 0 0 0 0 1 1 0 •...
  • Page 477: Decoding Data To Seven-Segment Display Data

    Decoding data to seven-segment display data SEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions decode the data consisting of 0 to F specified by the lower 4 bits of the device to seven-segment display data. Ladder ENO:=SEG(EN,s,d);...
  • Page 478 Processing details • These instructions decode the data consisting of 0 to F specified by the lower 4 bits in the device specified by (s) to seven- segment display data, and store the decoded data in the device specified by (d). •...
  • Page 479 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.6 Data Conversion Instructions...
  • Page 480: Separating Data In Units Of 4 Bits

    Separating data in units of 4 bits DIS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the lower (n) nibble(s) of 16-bit binary data in another device range specified. Ladder ENO:=DIS(EN,s,n,d); ENO:=DISP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition DISP...
  • Page 481 Processing details • These instructions separate the lower (n) nibble(s) (4 bits/nibble) from the 16-bit binary data in the device specified by (s), and store each of the separated data in the lower 4 bits of the (n) points of data in the device specified by (d). b15 b12 ∙∙∙...
  • Page 482: Combining Data In Units Of 4 Bits

    Combining data in units of 4 bits UNI(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the lower 4 bits of the (n) points of 16-bit binary data in another 16-bit device. Ladder ENO:=UNI(EN,s,n,d); ENO:=UNIP(EN,s,n,d); FBD/LD ■Execution condition Instruction...
  • Page 483 Processing details • These instructions store the lower 4 bits of the (n) points of 16-bit binary data in the device specified by (s) in the 16-bit device specified by (d). ∙∙∙ ∙∙∙ (s)+1 (s)+2 b15 b12 ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙...
  • Page 484: Separating Data In Units Of Bits

    Separating data in units of bits NDIS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions separate the data in units of bits. (The number of bits can be specified as desired.) Ladder ENO:=NDIS(EN,s1,s2,d); ENO:=NDISP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction...
  • Page 485 Processing details • These instructions separate the bits of data in the device specified by (s1) and later in units of bits specified by (s2), and store the separated data in the device range specified by (d) and later. (s2) (s2)+1 (s2)+2 (s2)+3...
  • Page 486: Combining Data In Units Of Bits

    Combining data in units of bits NUNI(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions combine the data in units of bits. (The number of bits can be specified as desired.) Ladder ENO:=NUNI(EN,s1,s2,d); ENO:=NUNIP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction...
  • Page 487 Processing details • These instructions combine the bits of data in the device specified by (s1) and later in units of bits specified by (s2), and store the combined data in the device specified by (d) and later. (s2) (s2)+1 (s2)+2 (s2)+3 (s2)+4...
  • Page 488: Separating Data In Units Of Bytes

    Separating data in units of bytes WTOB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions separate 16-bit binary data into (n) bytes. Ladder ENO:=WTOB(EN,s,n,d); ENO:=WTOBP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition WTOB WTOBP Setting data ■Description, range, data type Operand Description Range...
  • Page 489 Processing details • These instructions separate the 16-bit binary data in the device specified by (s) and later into (n) bytes, and store the separated data in the device specified by (d) and later. ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ (s)+1 (d)+1 (d)+2 (s)+( (d)+3...
  • Page 490: Combining Data In Units Of Bytes

    Combining data in units of bytes BTOW(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions combine the lower 8 bits of 16-bit binary data in units of words. Ladder ENO:=BTOW(EN,s,n,d); ENO:=BTOWP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition BTOW BTOWP Setting data...
  • Page 491 Processing details • These instructions combine the (n) bytes of lower 8 bits of 16-bit binary data in the device specified by (s) and later in units of words, and store the combined data in the device specified by (d) and later. •...
  • Page 492: Data Transfer Instructions

    Data Transfer Instructions Transferring 16-bit binary data MOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer the 16-bit binary data in the device specified. Ladder ENO:=MOV(EN,s,d); ENO:=MOVP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition MOVP Setting data ■Description, range, data type Operand Description...
  • Page 493 Processing details • These instructions transfer the 16-bit binary data in the device specified by (s) to the device specified by (d). • If (s) is a digit-specified bit device, the digit-specified bits are targeted. If data specified by (s) is less than 16 bits, 0s are added and transferred.
  • Page 494: Transferring 32-Bit Binary Data

    Transferring 32-bit binary data DMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer the 32-bit binary data in the device specified. Ladder ENO:=DMOV(EN,s,d); ENO:=DMOVP(EN,s,d) FBD/LD ■Execution condition Instruction Execution condition DMOV DMOVP Setting data ■Description, range, data type Operand Description Range...
  • Page 495 Processing details • These instructions transfer the 32-bit binary data in the device specified by (s) to the device specified by (d). • If (s) is a digit-specified bit device, the digit-specified bits are targeted. If data specified by (s) is less than 16 bits, 0s are added and transferred.
  • Page 496: Inverting And Transferring 16-Bit Binary Data

    Inverting and transferring 16-bit binary data CML(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the specified 16-bit binary data bit by bit, and transfer the inverted data. Ladder ENO:=CML(EN,s,d); ENO:=CMLP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition CMLP Setting data...
  • Page 497 Processing details • These instructions invert the 16-bit binary data in the device specified by (s) bit by bit, and transfer the inverted data to the device specified by (d). • If (s) is a digit-specified bit device, the digit-specified bits are targeted. If data specified by (s) is less than 16 bits, 0s are added and inverted.
  • Page 498: Inverting And Transferring 32-Bit Binary Data

    Inverting and transferring 32-bit binary data DCML(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the specified 32-bit binary data bit by bit, and transfer the inverted data. Ladder ENO:=DCML(EN,s,d); ENO:=DCMLP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DCML DCMLP...
  • Page 499 Processing details • These instructions invert the 32-bit binary data in the device specified by (s) bit by bit, and transfer the inverted data to the device specified by (d). • If (s) is a digit-specified bit device, the digit-specified bits are targeted. If data specified by (s) is less than 16 bits, 0s are added and inverted.
  • Page 500: Shifting Data In Units Of 4 Bits

    Shifting data in units of 4 bits SMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions distribute and combine data in units of 4 bits.
  • Page 501 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD ...
  • Page 502 Operation error Error code Description (SD0) 3405H Any one of (n1), (n2), or (n3) is other than 1 to 4. Either (s) or (d) is other than 0 to 9999 when SM773 is OFF. (n2) is greater than (n1) or (n3). 6 BASIC INSTRUCTIONS 6.7 Data Transfer Instructions...
  • Page 503: Inverting And Transferring 1-Bit Data

    Inverting and transferring 1-bit data CMLB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the specified bit data, and transfer the inverted data. Ladder ENO:=CMLB(EN,s,d); ENO:=CMLBP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition CMLB CMLBP Setting data ■Description, range, data type Operand Description...
  • Page 504 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.7 Data Transfer Instructions...
  • Page 505: Transferring 16-Bit Binary Data Block (16 Bits)

    Transferring 16-bit binary data block (16 bits) BMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions batch-transfer the (n) points (0 to 65535) of 16-bit binary data starting from the device specified. Ladder ENO:=BMOV(EN,s,n,d); ENO:=BMOVP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition...
  • Page 506 • In safety programs executed by the Safety CPU, only the following safety devices and constants can be used. Operand Word Constant SA\X, SA\Y, SA\M, SA\SM, SA\B SA\T, SA\ST, SA\C, SA\D, SA\W, SA\SD K, H      ...
  • Page 507: Transferring 16-Bit Binary Data Block (32 Bits)

    Transferring 16-bit binary data block (32 bits) BMOVL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions batch-transfer the (n) points (1 to 4294967295) of 16-bit binary data starting from the device specified. Ladder ENO:=BMOVL(EN,s,n,d); ENO:=BMOVLP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition...
  • Page 508 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD ...
  • Page 509: Transferring The Same 16-Bit Binary Data Block (16 Bits)

    Transferring the same 16-bit binary data block (16 bits) FMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer 16-bit binary data to the (n) points (0 to 65535) starting from the device specified. Ladder ENO:=FMOV(EN,s,n,d); ENO:=FMOVP(EN,s,n,d);...
  • Page 510 Processing details • These instructions transfer the 16-bit binary data in the device specified by (s) to the (n) points of the device specified by (d). ∙∙∙ 3456H ∙∙∙ 3456H 3456H (d)+1 (d)+2 3456H (d)+(n)-2 3456H (d)+(n)-1 3456H • When (s) is a word device and (d) is a bit device, the number of digit-specified bits in the word device is transferred. When K1Y30 is specified in (d), the lower 4 bits of the word device specified by (s) are transferred.
  • Page 511: Transferring The Same 16-Bit Binary Data Block (32 Bits)

    Transferring the same 16-bit binary data block (32 bits) FMOVL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer 16-bit binary data to the (n) points (1 to 4294967295) starting from the device specified. Ladder ENO:=FMOVL(EN,s,n,d); ENO:=FMOVLP(EN,s,n,d);...
  • Page 512 Processing details • These instructions transfer the 16-bit binary data in the device specified by (s) to the (n) points of the device specified by (d). ∙∙∙ 3456H ∙∙∙ 3456H 3456H (d)+1 (d)+2 3456H (d)+(n)-2 3456H (d)+(n)-1 3456H • When (s) is a word device and (d) is a bit device, the number of digit-specified bits in the word device is transferred. When K1Y30 is specified in (d), the lower 4 bits of the word device specified by (s) are transferred.
  • Page 513: Transferring The Same 32-Bit Binary Data Block (16 Bits)

    Transferring the same 32-bit binary data block (16 bits) DFMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer 32-bit binary data to the (n) points (1 to 65535) starting from the device specified. Ladder ENO:=DFMOV(EN,s,n,d); ENO:=DFMOVP(EN,s,n,d);...
  • Page 514 Processing details • These instructions transfer the 32-bit binary data in the device specified by (s) to the (n) points of the device specified by (d). ∙∙∙ (d)+1, 1234567H (d)+3, (d)+2 1234567H ∙∙∙ (d)+5, (d)+4 1234567H (s)+1, (s) 1234567H (d)+2(n)-1, (d)+2(n)-2 1234567H •...
  • Page 515: Transferring The Same 32-Bit Binary Data Block (32 Bits)

    Transferring the same 32-bit binary data block (32 bits) DFMOVL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer 32-bit binary data to the (n) points (1 to 4294967295) starting from the device specified. Ladder ENO:=DFMOVL(EN,s,n,d); ENO:=DFMOVLP(EN,s,n,d);...
  • Page 516 Processing details • These instructions transfer the 32-bit binary data in the device specified by (s) to the (n) points of the device specified by (d). ∙∙∙ (d)+1, 1234567H (d)+3, (d)+2 1234567H ∙∙∙ (d)+5, (d)+4 1234567H (s)+1, (s) 1234567H (d)+2(n)-1, (d)+2(n)-2 1234567H •...
  • Page 517: Exchanging 16-Bit Binary Data

    Exchanging 16-bit binary data XCH(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions exchange the 16-bit binary data specified. Ladder ENO:=XCH(EN,d1,d2); ENO:=XCHP(EN,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition XCHP Setting data ■Description, range, data type Operand Description Range...
  • Page 518 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.7 Data Transfer Instructions...
  • Page 519: Exchanging 32-Bit Binary Data

    Exchanging 32-bit binary data DXCH(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions exchange the 32-bit binary data specified. Ladder ENO:=DXCH(EN,d1,d2); ENO:=DXCHP(EN,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DXCH DXCHP Setting data ■Description, range, data type Operand Description Range...
  • Page 520 Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.7 Data Transfer Instructions...
  • Page 521: Exchanging 16-Bit Binary Block Data

    Exchanging 16-bit binary block data BXCH(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions exchange the (n) points of 16-bit binary data starting from the devices specified. Ladder ENO:=BXCH(EN,n,d1,d2); ENO:=BXCHP(EN,n,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition BXCH BXCHP...
  • Page 522 Processing details • These instructions exchange the (n) points of 16-bit binary data starting from the device specified by (d1) with the (n) points of 16-bit binary data starting from the device specified by (d2). ∙∙∙ b8b7 ∙∙∙ ∙∙∙ b8b7 ∙∙∙...
  • Page 523: Exchanging The Upper And Lower Bytes Of 16-Bit Binary Data

    Exchanging the upper and lower bytes of 16-bit binary data SWAP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions exchange upper and lower 8-bit data in the specified device. Ladder ENO:=SWAP(EN,d); ENO:=SWAPP(EN,d); FBD/LD ■Execution condition Instruction Execution condition SWAP SWAPP...
  • Page 524: Exchanging The Upper And Lower Bytes Of 32-Bit Binary Data

    Exchanging the upper and lower bytes of 32-bit binary data DSWAP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support this instruction. (Use an engineering tool with version "1.020W" or later.) These instructions exchange upper and lower 8-bit data in the specified device.
  • Page 525: Transferring 1-Bit Data

    Transferring 1-bit data MOVB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer the specified 1-bit data. Ladder ENO:=MOVB(EN,s,d); ENO:=MOVBP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition MOVB MOVBP Setting data ■Description, range, data type Operand Description Range Data type Data type (label)
  • Page 526 Processing details • These instructions transfer the bit data in the device specified by (s) to the device specified by (d). Before ∙∙∙ transfer The bit is transferred. After ∙∙∙ transfer Operation error There is no operation error. 6 BASIC INSTRUCTIONS 6.7 Data Transfer Instructions...
  • Page 527: Transferring N-Bit Data

    Transferring n-bit data BLKMOVB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions batch-transfer the (n) points of bit data. Ladder ENO:=BLKMOVB(EN,s,n,d); ENO:=BLKMOVBP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition BLKMOVB BLKMOVBP Setting data ■Description, range, data type Operand Description Range...
  • Page 528 Processing details • These instructions batch-transfer the (n) points of bit data starting from the device specified by (s) to the (n) points of bits starting from the device specified by (d). • Data can be transferred even when the transfer source device and destination device overlap. (s)+(n)-1 (s)+2 (s)+1...
  • Page 529: Chapter 7 Application Instructions

    APPLICATION INSTRUCTIONS Rotation Instructions Rotating 16-bit binary data to the right ROR(P), RCR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • ROR(P): These instructions rotate the 16-bit binary data to the right by (n) bit(s), excluding the carry flag. •...
  • Page 530 Processing details ■ROR(P) • These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s), excluding the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the ROR(P) instruction. SM700 b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1...
  • Page 531 ■RCR(P) • These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s), including the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the RCR(P) instruction. (SM700) b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1...
  • Page 532: Rotating 16-Bit Binary Data To The Left

    Rotating 16-bit binary data to the left ROL(P), RCL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • ROL(P): These instructions rotate the 16-bit binary data to the left by (n) bit(s), excluding the carry flag. • RCL(P): These instructions rotate the 16-bit binary data to the left by (n) bit(s), including the carry flag. Ladder ENO:=ROLP(EN,n,d);...
  • Page 533 Processing details ■ROL(P) • These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s), excluding the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the ROL(P) instruction. (SM700) b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1...
  • Page 534 ■RCL(P) • These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s), including the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the RCL(P) instruction. (SM700) b14 b13 b12 b11 b10 b9 b6 b5 b4 b3 b2 b1...
  • Page 535: Rotating 32-Bit Binary Data To The Right

    Rotating 32-bit binary data to the right DROR(P), DRCR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • DROR(P): These instructions rotate the 32-bit binary data to the right by (n) bit(s), excluding the carry flag. • DRCR(P): These instructions rotate the 32-bit binary data to the right by (n) bit(s), including the carry flag. Ladder ENO:=DRORP(EN,n,d);...
  • Page 536 Processing details ■DROR(P) • These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s), excluding the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the DROR(P) instruction. (d)+1 (SM700) b30 b29 b28 b27...
  • Page 537: Rotating 32-Bit Binary Data To The Left

    Rotating 32-bit binary data to the left DROL(P), DRCL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • DROL(P): These instructions rotate the 32-bit binary data to the left by (n) bit(s), excluding the carry flag. • DRCL(P): These instructions rotate the 32-bit binary data to the left by (n) bit(s), including the carry flag. Ladder ENO:=DROLP(EN,n,d);...
  • Page 538 Processing details ■DROL(P) • These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s), excluding the carry flag (SM700). The carry flag (SM700) is on or off depending on the status prior to the execution of the DROL(P) instruction. (d)+1 (SM700) b30 b29 b28 b27...
  • Page 539: Program Branch Instructions

    Program Branch Instructions Pointer branch CJ, SCJ, JMP RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • CJ: This instruction executes the program specified by the pointer number within the same program file. • SCJ: This instruction executes the program specified by the pointer number within the same program file starting with the next scan.
  • Page 540 ■SCJ • This instruction executes the program specified by the pointer number within the same program file starting with the scan immediately after the execution command turns on. • When the execution command is off or turned off, the program in the next step is executed. (1) Execution command (2) One scan (3) Executed in each scan...
  • Page 541 Operation error Error code Description (SD0) 3380H The pointer number specified by (P) is not set before the END instruction. The pointer number specified by (P) is not used as a label in the same program. The pointer number specified by (P) is a global pointer in another program. 7 APPLICATION INSTRUCTIONS 7.2 Program Branch Instructions...
  • Page 542: Jumping To End

    Jumping to END GOEND RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction jumps the program to the FEND or END instruction within the same program file. Ladder Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition GOEND Processing details •...
  • Page 543: Program Execution Control Instructions

    Program Execution Control Instructions Disabling/enabling interrupt programs DI, EI RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • DI: This instruction disables execution of interrupt programs. • EI: This instruction clears the interrupt disabled state. Ladder ENO:=DI(EN); ENO:=EI(EN); FBD/LD ■Execution condition Instruction...
  • Page 544 ■EI • This instruction clears the interrupt disabled state that has been set by the DI (Disabling interrupt programs) instruction, and enables execution of interrupt programs with the interrupt pointer numbers permitted by the IMASK instruction. When the IMASK instruction is not executed, I32 to I43 are disabled. •...
  • Page 545 • An interrupt pointer occupies one step. (At the program (1) below, for example, I10 is step 50, X1C is step 51, and Y10 is step 52.) (50) (53) (55) IRET • If the EI and DI instructions are provided in the master control, these instructions are executed regardless of the execution status of the MC instruction.
  • Page 546: Disabling Interrupt Programs With Specified Priority Or Lower

    Disabling interrupt programs with specified priority or lower RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction disables execution of interrupt programs with the specified priority or lower. Ladder ENO:=DI_1(EN,s); FBD/LD ( is replaced by DI_1.) ■Execution condition Instruction Execution condition Every scan...
  • Page 547 Processing details • This instruction disables execution of interrupt programs with the interrupt pointer numbers specified by (s) or lower. Interrupt priority setting I No. Priority FEND IRET IRET A: Sequence program B: Interrupt program (1) Interrupt disabled section for priority 6 to 8 (Interrupt enabled section for priority 1 to 5) (2) The interrupt program can be executed because its priority is 5.
  • Page 548 • The execution of the EI instruction enables the interrupt that has been disabled by a single DI (Disabling interrupt programs with specified priority or lower) instruction. Note that if interrupts have been disabled only by the DI (Disabling interrupt programs) instruction, executing the EI instruction only once enables interrupts in all priorities.
  • Page 549 • When the DI (Disabling interrupt programs) instruction, DI (Disabling interrupt programs with specified priority or lower) instruction, and EI instruction are executed, the interrupt disabled sections will be as follows. • When another DI (Disabling interrupt programs with specified priority or lower) instruction with a wider priority range is executed during execution of the DI (Disabling interrupt programs with specified priority or lower) instruction DI K3 DI K2...
  • Page 550 • When the DI (Disabling interrupt programs with specified priority or lower) instruction and the DI (Disabling interrupt programs) instruction are executed in this order DI K2 A: Scan execution type program (1) Interrupt enabled section for all priorities (2) Interrupt disabled section for priority 2 to 8 (Interrupt enabled section for priority 1) (3) Interrupt disabled section for priority 1 to 8 (Interrupt disabled section for all priorities) •...
  • Page 551: Interrupt Program Mask

    Interrupt program mask IMASK RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number. Ladder ENO:=IMASK(EN,s); FBD/LD ■Execution condition Instruction Execution condition IMASK Every scan Setting data ■Description, range, data type...
  • Page 552 Processing details • This instruction enables or disables the execution of the interrupt program with the interrupt pointer number specified by the 16 points of bit pattern starting from the device specified by (s). • 1 (on): Enables the execution of the interrupt program. •...
  • Page 553: Disabling/Enabling The Specified Interrupt Pointer

    Disabling/enabling the specified interrupt pointer SIMASK RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number. Ladder ENO:=SIMASK(EN,I,s); FBD/LD ■Execution condition Instruction Execution condition SIMASK Every scan Setting data...
  • Page 554 Processing details • This instruction, according to the data specified by (s), enables or disables the execution of the interrupt program with the interrupt pointer number specified by (I). • When (s) is 1: The execution of the interrupt program is enabled. •...
  • Page 555: Returning From The Interrupt Program

    Returning from the interrupt program IRET RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction indicates the end of the processing of an interrupt program. Ladder Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition IRET Every scan Processing details •...
  • Page 556: Resetting The Watchdog Timer

    Resetting the watchdog timer WDT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions reset the watchdog timer. Ladder ENO:=WDT(EN); ENO:=WDTP(EN); FBD/LD ■Execution condition Instruction Execution condition WDTP Processing details • These instructions reset the watchdog timer in a program. •...
  • Page 557: Structure Creation Instructions

    Structure Creation Instructions Performing the FOR to NEXT instruction loop FOR, NEXT RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions execute the processing between the FOR instruction and the NEXT instruction (n) times. Ladder Not supported NEXT A: Repeat program FBD/LD...
  • Page 558 Processing details • After the FOR to NEXT instruction loop is executed unconditionally (n) times, the step following the NEXT instruction is executed. • Specify a value 1 to 32767 for (n). If a value -32768 to 0 is specified, the processing is performed regarding (n) as 1. •...
  • Page 559: Forcibly Terminating The For To Next Instruction Loop

    Forcibly terminating the FOR to NEXT instruction loop BREAK(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions forcibly terminate the loop processing between the FOR and NEXT instructions, and pass the control to the specified pointer. Ladder Not supported FBD/LD...
  • Page 560 Processing details • These instructions forcibly terminate the loop processing between the FOR and NEXT instructions, and pass the control to the pointer specified by (P). Only a pointer in the same program file can be specified for (P). An operation error occurs if a pointer in another program file is specified.
  • Page 561: Calling A Subroutine Program

    Calling a subroutine program CALL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, there are restrictions on their operation in the standby system when the redundant system is in backup mode.
  • Page 562 Processing details • These instructions execute the subroutine program of the pointer specified by (P). The instructions can execute the subroutine program specified by a pointer in the same program file or the subroutine program specified by a global pointer. CALL (P) A: Main routine program B: Subroutine program...
  • Page 563 • Do not use any device used in the argument of the CALL(P) instruction in the subroutine program. If used, normal operation cannot be performed. Wrong operation: While D0 is specified for FD0 in the subroutine program, D1 is used in the subroutine program. CALL FEND K100...
  • Page 564 Correct operation: While D0 is specified for FD0 in the subroutine program, D4 is used in the subroutine program. CALL FEND K100 K100 Before the execution of Immediately after the execution At the execution of After the execution of the subroutine program of the CALL instruction the subroutine program the RET instruction...
  • Page 565: Returning From The Subroutine Program Called

    Returning from the subroutine program called RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction indicates the end of a subroutine program. Ladder Not supported FBD/LD Not supported ■Execution condition Instruction Execution condition Every scan Processing details •...
  • Page 566: Calling A Subroutine Program And Turning The Output Off

    Calling a subroutine program and turning the output off FCALL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, there are restrictions on their operation in the standby system when the redundant system is in backup mode.
  • Page 567 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD    ...
  • Page 568 • When the execution command is turned off, non-execution processing of the subroutine program is performed, enabling the OUT instruction and PLS instruction (including pulse conversion instructions) to be forcibly turned off. When the FCALL(P) instruction is used CALL FCALL FEND (1) Forced off by the FCALL instruction When the FCALL(P) instruction is not used...
  • Page 569 • The following table lists the data sizes of individual types of function devices. Function device Device Data size FX, FY Bit device 1 point When a bit-specified word device is used 1 bit When the bit device digit is specified 4 words Word device 4 words...
  • Page 570: Calling A Subroutine Program In The Specified Program File

    Calling a subroutine program in the specified program file ECALL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, there are restrictions on their operation in the standby system when the redundant system is in backup mode.
  • Page 571 Processing details • When the ECALL(P) instruction is executed, these instructions execute the subroutine program corresponding to the pointer specified by (P) of the specified program file name. The ECALL(P) instructions can also call the subroutine program using the local pointer of another program file. [File name: MAIN] [File name: ABC] Main routine program...
  • Page 572 • Any device used in the argument of the ECALL(P) instruction must not used in the subroutine program. Otherwise, normal operation cannot be performed. Wrong operation: While D0 is specified for FD0 in the subroutine program, D1 is used in the subroutine program. [MAIN] ECALL "ABC"...
  • Page 573 Correct operation: While D0 is specified for FD0 in the subroutine program, D4 is used in the subroutine program. [MAIN] ECALL "ABC" [ABC] FEND K100 K100 Before the execution of Immediately after the execution of At the execution of After the execution of the subroutine program the ECALL instruction the subroutine program...
  • Page 574 Operation error Error code Description (SD0) 2820H The device specified in an argument from (s1) to (s5) cannot be secured for the data size. 2840H The file specified by (file name) does not exist. 2841H The file specified by (file name) cannot be executed. 2842H The type of the program with the file name specified by (file name) is not supported.
  • Page 575: Calling A Subroutine Program In The Specified Program File And Turning The Output Off

    Calling a subroutine program in the specified program file and turning the output off EFCALL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If these instructions are used in a program executed in both systems, there are restrictions on their operation in the standby system when the redundant system is in backup mode.
  • Page 576 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (File name) ...
  • Page 577 • The EFCALL(P) instruction is used in combination with the ECALL(P) instruction. If the EFCALL(P) instruction is not used in combination with the ECALL(P) instruction, non-execution processing of the subroutine program is not performed even if the execution command is turned off, and therefore the output status of each coil instruction is retained. •...
  • Page 578 • Only a program file stored in program memory can be specified for the file name. • Extension ".PRG" need not be specified for the file name. (Only .PRG files can be processed by these instructions.) • When the subroutine program uses function devices (FX, FY, FD), specify the devices corresponding to the function devices in (s1) to (s5).
  • Page 579 Precautions • An FBD/LD program cannot be created as a subroutine program. • FBD/LD does not support the execution of a subroutine program with an argument. Operation error Error code Description (SD0) 2820H The device specified in an argument from (s1) to (s5) cannot be secured for the data size. 2840H The file specified by (file name) does not exist.
  • Page 580: Calling A Subroutine Program

    Calling a subroutine program XCALL RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • [RnPCPU (redundant)] If the instruction is used in a program executed in both systems, there are restrictions on its operation in the standby system when the redundant system is in backup mode.
  • Page 581 Processing details • This instruction performs execution or non-execution processing of a subroutine program. • For execution of the subroutine program, it operates each coil instruction according to the on/off status of condition contacts. • For non-execution processing of the subroutine program, it operates each coil instruction in the same way as when condition contacts are off. •...
  • Page 582 • When the subroutine program uses function devices (FX, FY, FD), specify the devices corresponding to the function devices in (s1) to (s5). The following figure the contents of the devices specified by (s1) to (s5). XCALL D100 FEND K100 •...
  • Page 583 • Any device used in the argument of the XCALL instruction must not used in the subroutine program. Otherwise, normal operation cannot be performed. Wrong operation: While D0 is specified for FD0 in the subroutine program, D1 is used in the subroutine program. XCALL FEND K100...
  • Page 584 Correct operation: While D0 is specified for FD0 in the subroutine program, D4 is used in the subroutine program. XCALL FEND K100 K100 Before the execution of Immediately after the execution of At the execution of After the execution of the subroutine program the XCALL instruction the subroutine program...
  • Page 585: Data Table Operation Instructions

    Data Table Operation Instructions Reading the oldest data from the data table FIFR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the data first stored in the table in the specified device. Ladder ENO:=FIFR(EN,s,d); ENO:=FIFRP(EN,s,d); FBD/LD ■Execution condition Instruction...
  • Page 586 Processing details • These instructions store the first-in data in the device specified by (d)+1 in the table specified by (d) in the device specified by (s). After execution of the FIFR(P) instruction, the data in the data table is moved forward one by one. (d)+1 5432 (d)+1...
  • Page 587: Reading The Newest Data From The Data Table

    Reading the newest data from the data table FPOP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the data last stored in the table in the specified device. Ladder ENO:=FPOP(EN,s,d); ENO:=FPOPP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition FPOP FPOPP...
  • Page 588 Processing details • These instructions store the data last stored in the table in the device specified by (d) in the device specified by (s). After execution of the FPOP(P) instruction, the device in which the data read by the instruction has been stored is cleared to 0. 1234 (d)+1 (d)+1...
  • Page 589: Writing Data To The Data Table

    Writing data to the data table FIFW(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer 16-bit binary data to the specified data table. Ladder ENO:=FIFW(EN,s,d); ENO:=FIFWP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition FIFW FIFWP Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 590 Processing details • These instructions store the 16-bit binary data in the device specified by (s) in the data table in the device specified by (d). The number of data stored in the table is stored in (d), and the data in the device specified by (s) is stored in order in the device specified by (d)+1 and later.
  • Page 591: Inserting Data To The Data Table

    Inserting data to the data table FINS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions insert 16-bit binary data to the (n)th position in the specified data table. Ladder ENO:=FINS(EN,s,n,d); ENO:=FINSP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition FINS FINSP Setting data...
  • Page 592 Processing details • These instructions store the 16-bit binary data in the device specified by (s) in the (n)th position in the data table in the device specified by (d). After execution of the FINS(P) instruction, the data after the (n)th position in the data table is moved down one by one.
  • Page 593: Deleting Data From Data Table

    Deleting data from data table FDEL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions delete the data at the (n)th position in the data table. Ladder ENO:=FDEL(EN,s,n,d); ENO:=FDELP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition FDEL FDELP Setting data ■Descriptions, ranges, and data types Operand...
  • Page 594 Processing details • These instructions delete the (n)th data in the data table in the device specified by (d) and store it in the device specified by (s). After execution of the FDEL(P) instruction, the data at the (n)+1th position and later in the data table is moved forward one by one.
  • Page 595: Reading/Writing Data Instructions

    Reading/Writing Data Instructions Reading/Writing data to data memory The data write instruction is an instruction to write arbitrary device data to data memory. Writing the fixed values used for operation and operation results to data memory can prevent data loss when the battery is low.
  • Page 596: Reading Data From The Data Memory

    Reading data from the data memory S(P).DEVLD RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions read data from the device data storage file in data memory. Ladder ENO:=S_DEVLD(EN,s,n,d); ENO:=SP_DEVLD(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition S.DEVLD SP.DEVLD Setting data ■Descriptions, ranges, and data types...
  • Page 597 Processing details • These instructions read device data by the number of points specified by (n) from the read offset specified by (s) in the device data storage file in data memory, and store it in the device specified by (d). (s) indicates the offset from the start of the device data storage file and can be specified by word offsets (incremented by 1 every 16 bits).
  • Page 598: Writing Data To The Data Memory

    Writing data to the data memory SP.DEVST RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction writes the specified number of points of data to the device data storage file in data memory. Ladder ENO:=SP_DEVST(EN,s1,s2,n,d); (s1) (s2) FBD/LD ■Execution condition Instruction...
  • Page 599 Processing details • These instructions retrieves the specified number of points of data specified by (n) from the device specified by (s2) and write it to the write offset in the device specified by (s1) in the device data storage file in data memory. (s1) indicates the offset from the start of the device data storage file and can be specified by word offsets (incremented by 1 every 16 bits).
  • Page 600 Operation error Error code Description (SD0) 2840H The device data storage file is not set in parameter. 3405H The value specified by (n) is 0. 3421H When the SP.DEVST instruction is executed, the write count of the day exceeds the value specified in SD771. When the SP.DEVST instruction is executed, a value out of the range (1 to 32767) is set in SD771.
  • Page 601: Reading Data From The Specified File

    Reading data from the specified file SP.FREAD RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction reads device data from the specified file on the SD memory card. Ladder ENO:=SP_FREAD(EN,U,s1,s2,d1,d2,d3); (s1) (d1) (s2) (d2) (d3) FBD/LD ■Execution condition Instruction Execution condition SP.FREAD...
  • Page 602 ■For RnCPU (firmware version "28" or later) and RnENCPU (firmware version "28" or later) • Control data (d1) Operand: (d1) Device Item Description Setting range Set by Execution/completion Specify the execution type. 0000H User type ■00**H: Reading binary data 0001H •...
  • Page 603 • File name (s2) Operand: (s2) Device Item Description Setting range Set by +0 to + File name character Specify the folder path where the files are stored and the file name. Unicode string User string • The folder path and file name (including an extension) must be within 253 characters in total.
  • Page 604 ■For RnCPU (firmware version "27" or earlier), RnENCPU (firmware version "27" or earlier), RnPCPU, and RnSFCPU • Control data (d1) Operand: (d1) Device Item Description Setting range Set by Execution/completion Specify the execution type. 0000H User type • 0000H: Reading binary data 0100H •...
  • Page 605 Processing details • This instruction reads data from the specified file. Set the execution/completion type in the control data to specify the file read-target format. Page 600 For RnCPU (firmware version "28" or later) and RnENCPU (firmware version "28" or later) Page 602 For RnCPU (firmware version "27"...
  • Page 606 Execution/completion type Data type Processing unit and setting range (d1)+0 specification Number of read- File position Number of data (d1)+7 target data (d1)+4, (d1)+5 actually read (d1)+2 (d2)+0 Reading data after 0100H: Decimal (16- 0: Word Number of elements (1 to Number of lines Word converted to CSV...
  • Page 607 ■When reading binary data • If the extension of the target file is omitted, the extension will be ".BIN". • If the specified file does not exist, an error occurs. • If the position is specified exceeding the existing file size, 0 point of data is read and the processing completes successfully. The following figure shows an example of reading binary data.
  • Page 608 ■When reading data after converted to CSV format  • Elements in the CSV format file (cells in Excel ) are read by each row and stored in the device. • If the extension of the target file is omitted, the extension will be ".CSV". •...
  • Page 609 Execution/completion type Data (one element) in the CSV Value stored in the device Remarks file 0140H: Floating point real Values within the range of: -2 < data As given on the left The value is converted in either decimal point -126 ...
  • Page 610 When "Reading data after converted to CSV format" (String (ASCII data)) is specified [Data stored in CSV format] Enclosed values as shown to the left are read. PARTS.CSV (Total of six elements, three columns from two lines of PARTS.CSV, are read.) Name Value1 Value2...
  • Page 611 When "Reading data after converted to CSV format" (Decimal (16-bit data)) is specified and the number of columns is set to 0 [Data created in Excel] [Data saved in CSV format] Main/sub item Measured value CR LF Length 3 CR LF Temperature , CR LF (1) Loaded data...
  • Page 612 • When the number of columns differs in each row, the data are also read by ignoring the rows. When the number of columns differs in each row [Data saved in CSV format] Main/sub item Measured value Excess CR LF Length CR LF Temperature...
  • Page 613 • When the specified number of columns is set to a value other than 0, a CSV format file is read as the table with the specified number of columns. The elements outside the specified number of columns are ignored. When "Reading data after converted to CSV format"...
  • Page 614 • When the number of columns differs in each row, the elements outside the specified number of columns are ignored and 0 is added to the cells where no element exists. When the number of columns differs in each row (1) Columns out of the specified range are ignored.
  • Page 615 • When "Reading data after converted to CSV format" is specified, data can be divided and read. [Specify row to start reading] • Execution/completion type: Reading data after converted to CSV format (Decimal (16-bit data)) • Number of columns specification: 4H •...
  • Page 616 [Reading data from the position where the previous reading ends] • Execution/completion type: Reading data after converted to CSV format (Decimal (16-bit data)) • Number of columns specification: 4H • Data type specification: Words • File position: FFFFFFFFH (continuing from the position where the previous reading ends) •...
  • Page 617 • When reading data from the position where the previous reading ends, specify the same values for "Execution/End type", "Number of columns", and "Data type specification". If not, data cannot be added correctly from the position where the previous reading ends. •...
  • Page 618: Writing Data To The Specified File

    Writing data to the specified file SP.FWRITE RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction writes device data to the specified file on the SD memory card. Ladder ENO:=SP_FWRITE(EN,U,s1,s2,s3,d1,d2); (s1) (d1) (s2) (s3) (d2) FBD/LD ■Execution condition Instruction Execution condition SP.FWRITE...
  • Page 619 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD ...
  • Page 620 • File name (s2) Operand: (s2) Device Item Description Setting range Set by +0 to + File name character Specify the folder path where the files are stored and the file name. Unicode string User string • The folder path and file name (including an extension) must be within 253 characters in total.
  • Page 621 ■For RnCPU (firmware version "27" or earlier), RnENCPU (firmware version "27" or earlier), RnPCPU, and RnSFCPU • Control data (d1) Operand: (d1) Device Item Description Setting range Set by Execution/completion Specify the execution type. 0000H User type • 0000H: Writing binary data 0100H •...
  • Page 622 Processing details • This instruction writes the specified number of data to the specified file. Set the execution/completion type in the control data to specify the file write-target format. Page 617 For RnCPU (firmware version "28" or later) and RnENCPU (firmware version "28" or later) Page 619 For RnCPU (firmware version "27"...
  • Page 623 Execution/completion type Data type Processing unit and setting range (d1)+0 specification Number of request File position Number of data (d1)+7 write data (d1)+4, (d1)+5 actually written (s3)+0 (d1)+2 Writing 0100H: Decimal (signed 16- 0: Word Word (1 to 65535) Head/end Word data after bit data)
  • Page 624 ■Writing binary data • If the extension of the target file is omitted, the extension will be ".BIN". • If a file that does not exist is specified, it will be created and data will be saved to the beginning of the file. The newly created file has the archive attribute.
  • Page 625 ■Converting and writing data in CSV format • If the extension is omitted, the extension will be ".CSV". • When an existing file is specified, the following occurs. • When a value other than FFFFFFFFH is specified in (d1)+4 or (d1)+5, data is saved to the file after deleting the existing data in the file. •...
  • Page 626 • When the specified number of columns is set to a value other than 0, a CSV format file is stored as the table with the specified number of columns. The number of columns is set to a value other than 0 when writing data after conversion to the CSV format. "ABCDE"...
  • Page 627 • The following figure shows how data is added. [Specify the file to which data will be written.] (Even if the file exists, it is deleted and re-created.) • Execution/completion type: Writing data after converted to CSV format (Decimal (signed 16-bit data)) •...
  • Page 628 • An integral multiple of "Number of columns" should be specified for "Number of request write data". Otherwise, numbers of columns will be apart. • The last data is always followed by a line feed code. In addition mode, therefore, data is added starting from the beginning of a new line.
  • Page 629 • The following table lists values to set in (s3)+1 and later and data to be written in a CSV file when "0140H: Floating point real number (single-precision real number)" or "0141H: Floating point real number (double-precision real number)" is set to (d1)+0.
  • Page 630: Debugging And Failure Diagnostic Instructions

    Debugging and Failure Diagnostic Instructions Resetting the error display and the annunciator display LEDR RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction resets the self-diagnostic error (continuation error) display and the annunciator display of the CPU module. Ladder ENO:=LEDR(EN);...
  • Page 631: Generating A Continuation Error

    Generating a continuation error PALERT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction generates a continuation error in the CPU module. Ladder ENO:=PALERT(EN,s); ENO:=PALERTP(EN,s); FBD/LD ■Execution condition Instruction Execution condition PALERT PALERTP Setting data ■Description, range, data type Operand Description Range...
  • Page 632: Generating A Stop Error

    Generating a stop error PABORT RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction stops program execution and generates a stop error in the CPU module. Ladder ENO:=PABORT(EN,s); FBD/LD ■Execution condition Instruction Execution condition PABORT Setting data ■Description, range, data type Operand Description...
  • Page 633: String Processing Instructions

    String Processing Instructions Comparing string data LD$, AND$, OR$ RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions compare string data as normally open contacts. Ladder ENO:=LDSTRING_(EN,s1,s2); ENO:=ANDSTRING_(EN,s1,s2); (s1) (s2) ENO:=ORSTRING_(EN,s1,s2); ( is replaced by any of the following: EQ, NE, GT, LE, LT, GE.) (s1) (s2) (s1)
  • Page 634 Processing details • These instructions perform a comparison operation between the character string data in the device specified by (s1) and the character string data in the device specified by (s2). (Devices are used as normally open contacts). • In comparison operation, the ASCII code of character string is compared character by character from the beginning of the character string.
  • Page 635 • When the lengths of the character string data in the devices specified by (s1) and (s2) are different, the longer character string data is greater. ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ (s1) 32H (2) 31H (1) (s2) 32H (2) 31H (1) (s1)+1 34H (4) 33H (3)
  • Page 636: Concatenating String Data

    Concatenating string data $+(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions concatenate string data. Ladder Not supported ( Page 636 $+(P) [when three operands are set]) FBD/LD Not supported ( Page 636 $+(P) [when three operands are set]) ■Execution condition Instruction Execution condition...
  • Page 637 Operation error Error code Description (SD0) 2820H There is no NULL code (00H) in the setting area specified by (s) and later in the device/label memory. There is no NULL code (00H) in the setting area specified by (d) and later in the device/label memory. 2821H The device numbers for storing the strings in the devices specified by (s) and (d) are overlapping.
  • Page 638 $+(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions concatenate string data. Ladder ENO:=STRINGPLUS(EN,s1,s2,d); ENO:=STRINGPLUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by STRINGPLUS or STRINGPLUSP.) ■Execution condition Instruction Execution condition Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 639 Processing details • This instruction connects the character string stored in the device number specified by (s2) and later to the end of the character string data stored in the device number specified by (s1) and later, and stores the connected data in the device number specified by (d) and later.
  • Page 640: Transferring String Data

    Transferring string data $MOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer string data to the specified device number and later. Ladder ENO:=STRINGMOV(EN,s,d); ENO:=STRINGMOVP(EN,s,d); FBD/LD ( is replaced by STRINGMOV or STRINGMOVP.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 641 Processing details • These instructions transfer the character string data in the device specified by (s) to the device number specified by (d) and later. The character strings from the one enclosed by double quotes (") or the device number specified by (s) to the device number containing 00H are transferred all at once.
  • Page 642: Transferring Unicode String Data

    Transferring Unicode string data $MOV(P)_WS RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer Unicode string data to the specified device number and later. Ladder ENO:=STRINGMOV_WS(EN,s,d); ENO:=STRINGMOVP_WS(EN,s,d); FBD/LD ( is replaced by STRINGMOV_WS or STRINGMOVP_WS.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 643 Processing details • These instructions transfer the Unicode character string data in the device specified by (s) to the device number specified by (d) and later. The Unicode character strings from the one enclosed by double quotes (") or the device number specified by (s) to the device number containing 0000H are transferred all at once.
  • Page 644: Converting 16-Bit Binary Data To Decimal Ascii

    Converting 16-bit binary data to decimal ASCII BINDA(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit binary data to the decimal ASCII code. Ladder ENO:=BINDA(EN,s,d); ENO:=BINDA_U(EN,s,d); ENO:=BINDAP(EN,s,d) ENO:=BINDAP_U(EN,s,d) FBD/LD ■Execution condition Instruction Execution condition BINDA BINDA_U BINDAP...
  • Page 645 Processing details • These instructions convert the digit in decimal notation of the 16-bit binary data in the device specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 646 ■Operation of when SM705 (Number of conversion digits selection) is off Decimal ASCII data is stored in a fixed number of digits in (d) to (d)+2. ∙∙∙ ∙∙∙ ASCII 10 ∙∙∙ ASCII S (d)+1 ASCII 10 ASCII 10 (d)+2 ASCII 10 ASCII 10 BIN 16bit (d)+3...
  • Page 647 • When the number of operation digits is less than the maximum number of digits (sign + 5 digits), 00H is stored in the end of the string regardless of the status (on/off) of SM701 (Number of output characters selection). If the end of the string is the lower byte, 00H is also stored in the upper byte.
  • Page 648: Converting 32-Bit Binary Data To Decimal Ascii

    Converting 32-bit binary data to decimal ASCII DBINDA(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit binary data to the decimal ASCII code. Ladder ENO:=DBINDA(EN,s,d); ENO:=DBINDA_U(EN,s,d); ENO:=DBINDAP(EN,s,d); ENO:=DBINDAP_U(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DBINDA DBINDA_U DBINDAP...
  • Page 649 Processing details • These instructions convert the digit in decimal notation of the 32-bit binary data in the device specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 650 ■Operation of when SM705 (Number of conversion digits selection) is off Decimal ASCII data is stored in a fixed number of digits in (d) to (d)+5. ∙∙∙ ∙∙∙ ASCII 10 ASCII S (s)+1 (d)+1 ASCII 10 ASCII 10 ∙∙∙ b16 b15 ∙∙∙...
  • Page 651 ■Operation of when SM705 (Number of conversion digits selection) is on Decimal ASCII data is stored right-justified in (d). The following figures show an example of a value of (s) and a value stored in (d). Value of (s) Data of (d) to (d)+2 Value of (s) Data of (d) to (d)+2 •...
  • Page 652 Precautions When SM705 (Number of conversion digits selection) is on, the operation result is stored in (d) for the effective number of digits. Therefore, when the DBINDA(P)(_U) instruction is executed successively and the operation result for each execution is stored in the same device, a part of the previous operation result may not be overwritten by the succeeding result and can remain in (d).
  • Page 653: Converting 16-Bit Binary Data To Hexadecimal Ascii

    Converting 16-bit binary data to hexadecimal ASCII BINHA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit binary data to the hexadecimal ASCII code. Ladder ENO:=BINHA(EN,s,d); ENO:=BINHAP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BINHA BINHAP Setting data ■Description, range, data type Operand...
  • Page 654 Processing details • These instructions convert the digit in hexadecimal notation of the 16-bit binary data in the device specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 655 ■Operation of when SM705 (Number of conversion digits selection) is off Hexadecimal ASCII data is stored in a fixed number of digits (4 digits) in (d). ∙∙∙ ∙∙∙ ASCII 3 ASCII 4 ∙∙∙ (d)+1 ASCII 1 ASCII 2 (d)+2 BIN 16bit ASCII : ASCII code (th digit) (1): 00H is stored in (d)+2 when SM701 (Number of output characters selection) is off.
  • Page 656 Precautions When SM705 (Number of conversion digits selection) is on, the operation result is stored in (d) for the effective number of digits. Therefore, when the BINHA(P) instruction is executed successively and the operation result for each execution is stored in the same device, a part of the previous operation result may not be overwritten by the succeeding result and can remain in (d).
  • Page 657: Converting 32-Bit Binary Data To Hexadecimal Ascii

    Converting 32-bit binary data to hexadecimal ASCII DBINHA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit binary data to the hexadecimal ASCII code. Ladder ENO:=DBINHA(EN,s,d); ENO:=DBINHAP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DBINHA DBINHAP Setting data ■Description, range, data type Operand...
  • Page 658 Processing details • These instructions convert the digit at each place in hexadecimal notation of the 32-bit binary data specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 659 ■Operation of when SM705 (Number of conversion digits selection) is off Hexadecimal ASCII data is stored in a fixed number of digits (8 digits) in (d) to (d)+3. ∙∙∙ ∙∙∙ ASCII 7 ASCII 8 (s)+1 (d)+1 ∙∙∙ ∙∙∙ ASCII 5 ASCII 6 (d)+2 ASCII 3...
  • Page 660 Operation error There is no operation error. Precautions When SM705 (Number of conversion digits selection) is on, the operation result is stored in (d) for the effective number of digits. Therefore, when the DBINHA(P) instruction is executed successively and the operation result for each execution is stored in the same device, a part of the previous operation result may not be overwritten by the succeeding result and can remain in (d).
  • Page 661: Converting 16-Bit Binary Data To String Data

    Converting 16-bit binary data to string data STR(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit binary data to a string by adding a decimal point to the specified place of the data. Ladder ENO:=STR(EN,s1,s2,d);...
  • Page 662 Processing details • These instructions add a decimal point to the 16-bit binary data in the device specified by (s2) at the location specified by (s1), convert the data to character string data, and store the converted data in the device areas specified by (d) and later. (s1) Total number of digits b8 b7...
  • Page 663 • The converted character string data are stored in the device areas specified by (d) and later as shown below. • As sign data, "20H" (space) is stored if the 16-bit binary data is positive, and "2DH" (-) is stored if the data is negative. •...
  • Page 664: Converting 32-Bit Binary Data To String Data

    Converting 32-bit binary data to string data DSTR(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit binary data to a string by adding a decimal point to the specified place of the data. Ladder ENO:=DSTR(EN,s1,s2,d);...
  • Page 665 Processing details • These instructions add a decimal point to the 32-bit binary data in the device specified by (s2) at the location specified by (s1), convert the data to character string data, and store the converted data in the device areas specified by (d) and later. (s1) Total number of digits b8 b7...
  • Page 666 • The converted character string data are stored in the device areas specified by (d) and later as shown below. • As sign data, 20H (space) is stored if the 32-bit binary data is positive, and 2DH (-) is stored if the data is negative. •...
  • Page 667: Converting Bcd 4-Digit Data To Decimal Ascii Code

    Converting BCD 4-digit data to decimal ASCII code BCDDA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert BCD 4-digit data to the ASCII code. Ladder ENO:=BCDDA(EN,s,d); ENO:=BCDDAP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BCDDA BCDDAP Setting data ■Description, range, data type Operand...
  • Page 668 Processing details • These instructions convert the numerical value of each digit of the BCD 4-digit data in the device specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 669 ■Operation of when SM705 (Number of conversion digits selection) is off Decimal ASCII data is stored in a fixed number of digits (4 digits) in (d) to (d)+1. ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ ASCII 10 ASCII 10 (d)+1 ASCII 10 ASCII 10 (d)+2 ×...
  • Page 670 Operation error Error code Description (SD0) 3401H Data in the device specified by (s) is out of the range, 0 to 9999. Precautions When SM705 (Number of conversion digits selection) is on, the operation result is stored in (d) for the effective number of digits.
  • Page 671: Converting Bcd 8-Digit Data To Decimal Ascii Code

    Converting BCD 8-digit data to decimal ASCII code DBCDDA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert BCD 8-digit data to the ASCII code. Ladder ENO:=DBCDDA(EN,s,d); ENO:=DBCDDAP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DBCDDA DBCDDAP Setting data ■Description, range, data type Operand...
  • Page 672 Processing details • These instructions convert the numerical value of each digit of the BCD 8-digit data in the device specified by (s) to the ASCII code, and store the converted data in the device number specified by (d) and later. •...
  • Page 673 ■Operation of when SM705 (Number of conversion digits selection) is off Decimal ASCII data is stored in a fixed number of digits (8 digits) in (d) to (d)+3. ∙∙∙ ∙∙∙ (s)+1 ASCII 10 ASCII 10 (d)+1 ASCII 10 ASCII 10 ∙∙∙...
  • Page 674 ■Operation of when SM705 (Number of conversion digits selection) is on Decimal ASCII data for the number of digits (up to 8 digits) without the leftmost "0" in the effective digits is stored in (d). The following figures show an example of a value of (s) and a value stored in (d). Value of (s) Data of (d) to (d)+3 Value of (s)
  • Page 675 Operation error Error code Description (SD0) 3401H Data in the device specified by (s) is out of the range, 0 to 99999999. Precautions When SM705 (Number of conversion digits selection) is on, the operation result is stored in (d) for the effective number of digits.
  • Page 676: Converting Single-Precision Real Number To String Data

    Converting single-precision real number to string data ESTR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert single-precision real number data to a string according to the display specification. Ladder ENO:=ESTR(EN,s1,s2,d); ENO:=ESTRP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition ESTR...
  • Page 677 Processing details • These instructions convert the single-precision real number data stored in the device specified by (s1) to a character string according to the display specification stored in the device number specified by (s2) and later, and store the converted data in the device number specified by (d) and later.
  • Page 678 • If the number of digits excluding the sign, decimal point, and decimal part from the total number of digits is greater than the number of digits in the integral part of single-precision real number data, 20H (space) is stored between the sign and integral part. (s2) (s2)+1 (s2)+2...
  • Page 679 • If the decimal part of the single-precision real number data is not stored within the range of the number of digits in the decimal part, the lower decimal digits are rounded off. (s2) (s2)+1 (s2)+2 2 3 4 6 6 7 E + (s1)+1 (s1) 2 .
  • Page 680 Operation error Error code Description (SD0) 3401H The value in the device specified by (s1) is not in the following range. -126 |(s1)|<2 0, 2 Invalid data that cannot be converted is set to (s2). • The format specification in the device specified by (s2) is a value other than 0 and 1. •...
  • Page 681: Converting Hexadecimal Binary Data To Hexadecimal Ascii Code

    Converting hexadecimal binary data to hexadecimal ASCII code INT2ASC(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit binary data to the hexadecimal ASCII code and store it in any specified range. Ladder ENO:=INT2ASC(EN,s,n,d); ENO:=INT2ASCP(EN,s,n,d) FBD/LD ■Execution condition Instruction...
  • Page 682 Processing details • Converts the 16-bit binary data in the device number specified by (s) and later to hexadecimal ASCII, and stores the converted data by the number of characters in the device specified by (n) in the device number specified by (d) and later. ∙∙∙...
  • Page 683: Converting Unicode Character String To Shift Jis Character String

    Converting Unicode character string to Shift JIS character string WS2SJIS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a Unicode character string to a Shift JIS character string. Ladder ENO:=WS2SJIS(EN,s,d); ENO:=WS2SJISP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition WS2SJIS WS2SJISP...
  • Page 684 Processing details • These instruction convert the Unicode character string in the device specified by (s) to the shift JIS character string, and stores the converted data in the device specified by (d). • The Unicode character string in the device specified by (s) should be specified in little endian. •...
  • Page 685: Converting Shift Jis Character String To Unicode Character String (Without Byte Order Mark)

    Converting shift JIS character string to Unicode character string (without byte order mark) SJIS2WS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a Shift JIS character string to a Unicode character string. Ladder ENO:=SJIS2WS(EN,s,d); ENO:=SJIS2WSP(EN,s,d); FBD/LD ■Execution condition Instruction...
  • Page 686 Processing details • These instructions convert the shift JIS character string in the device specified by (s) to a Unicode character string, and store the converted data in the device specified by (d). • The shift JIS character string in the device specified by (s) should be specified in little endian. •...
  • Page 687: Converting Shift Jis Character String To Unicode (With Byte Order Mark)

    Converting shift JIS character string to Unicode (with byte order mark) SJIS2WSB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a shift JIS character string to a Unicode character string, and adds a byte order mark to the start of the converted data.
  • Page 688 Processing details • These instructions convert the shift JIS character string in the device specified by (s) to the Unicode character string, add a byte order mark to the start of the converted data, and store it in the device specified by (d). •...
  • Page 689: Detecting A String Length

    Detecting a string length LEN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions detect the length of the specified string. Ladder ENO:=LENP(EN,s,d); FBD/LD *1 The LEN instruction does not support the ST and FBD/LD. Use the standard function, LEN. Page 1944 LEN(_E) ■Execution condition Instruction...
  • Page 690 Processing details • These instructions detect the length of the character string in the device specified by (s) and store it in the device number specified by (d) and later. The data stored in device numbers starting from the one specified by (s) to the one containing 00H is processed as a character string.
  • Page 691: Extracting String Data From The Right

    Extracting string data from the right RIGHT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions extract (n) characters of data from the right of string data. Ladder ENO:=RIGHTP(EN,s,n,d); FBD/LD *1 The RIGHT instruction does not support the ST and FBD/LD. Use the standard function, RIGHT. Page 1946 LEFT(_E), RIGHT(_E) ■Execution condition Instruction...
  • Page 692 Processing details • These instructions extract (n) characters of data from the right of the character string data (the end of the character string) stored in the device number specified by (s) and later, and store the extracted data in the device number specified by (d) and later.
  • Page 693: Extracting String Data From The Left

    Extracting string data from the left LEFT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions extract (n) characters of data from the left of the string data, and store the extracted data in the device number specified by (d) and later. Ladder ENO:=LEFTP(EN,s,n,d);...
  • Page 694 Processing details • These instructions extract (n) characters of data from the left of the character string data (the start of the character string) stored in the device number specified by (s) and later, and store the extracted data in the device number specified by (d) and later.
  • Page 695: Extracting The Specified String Data

    Extracting the specified string data MIDR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions extract data at any position in string data, and store the extracted data in the device number specified by (d) and later. Ladder ENO:=MIDR(EN,s1,s2,d);...
  • Page 696 Processing details • These instructions extract the data by the number of characters specify by (s2)+1 from the location specified by (s2) in the character string data stored in the device number specified by (s1) and later, and store the extracted data in the device number specified by (d) and later.
  • Page 697: Replacing The Specified String Data

    Replacing the specified string data MIDW(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions replace the data at the specified location in the string data with the specified string. Ladder ENO:=MIDW(EN,s1,s2,d); ENO:=MIDWP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition MIDW...
  • Page 698 Processing details • These instructions read data by the number of characters stored in the device specified by (s2)+1 from the character string data stored in the device number specified by (s1) and later, and store the read data at the location in the device specified by (s2) and later in the character string stored in the device number specified by (d) and later.
  • Page 699 • When the number of characters of the data in the device specified by (s2)+1 is -1, the data till the last character data in the device specified by (s1) is stored in the device specified by (d) and later. Before execution ∙∙∙...
  • Page 700: Searching String Data

    Searching string data INSTR(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search string data for the specified string. Ladder ENO:=INSTR(EN,s1,s2,s3,d); ENO:=INSTRP(EN,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD ■Execution condition Instruction Execution condition INSTR INSTRP Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 701 Processing details • These instructions search the character string data stored in the device number specified by (s2) and later starting from the (s3)th character from the left for the character string data stored in the device number specified by (s1) and later, and store the search result in the device specified by (d).
  • Page 702: Inserting String Data

    Inserting string data STRINS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions insert the specified string data into the specified position of the string data. Ladder ENO:=STRINS(EN,s1,s2,d); ENO:=STRINSP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition STRINS STRINSP Setting data...
  • Page 703 Processing details • These instructions insert the character string data in the device specified by (s1) to the (s2)th character (insertion position) from the start of the character string data in the device specified by (d). ∙∙∙ ∙∙∙ (s1) 31H (1) 30H (0) ∙∙∙...
  • Page 704: Deleting String Data

    Deleting string data STRDEL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions delete (n) characters starting from the specified position of string data. Ladder ENO:=STRDEL(EN,s,n,d); ENO:=STRDELP(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition STRDEL STRDELP Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 705 Processing details • These instructions delete (n) characters starting from the position (deletion start position) specified by the (s)th character from the start of the character string data in the device specified by (d). The string data after the deleted data are After the string data are shifted, 00Hs are shifted to the right.
  • Page 706: Real Number Instructions

    Real Number Instructions Comparing single-precision real numbers LDE, ANDE, ORE RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform a comparison operation of a single-precision real number. (Devices are used as a normally open contact.) Ladder ENO:=LDE_(EN,s1,s2);...
  • Page 707 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 708: Comparing Double-Precision Real Numbers

    Comparing double-precision real numbers LDED, ANDED, ORED RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform a comparison operation of a double-precision real number. (Devices are used as a normally open contact.) Ladder ENO:=LDED_(EN,s1,s2); ENO:=ANDED_(EN,s1,s2); (s1) (s2) ENO:=ORED_(EN,s1,s2);...
  • Page 709 Processing details • These instructions perform a comparison operation between the double-precision real number in the device specified by (s1) and the double-precision real number in the device specified by (s2). (Devices are used as a normally open contact.) • The following table lists the comparison operation results of each instruction. Instruction symbol (ladder, FBD/LD) Condition Result...
  • Page 710 Precautions The maximum number of digits of a real number which can be input using the engineering tool is 15, and therefore these instructions cannot perform comparison with a real number consisting of 16 or more effective digits. When these instructions are used to determine the match or mismatch with a real number consisting of 16 or more effective digits, the instructions need to compare the size with the approximate values before and after the real number to be compared.
  • Page 711: Outputting A Comparison Result Of Single-Precision Real Numbers

    Outputting a comparison result of single-precision real numbers ECMP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions compare the single-precision real number data specified by (s1) with the single-precision real number data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on.
  • Page 712 Processing details • These instructions compare the single-precision real number data specified by (s1) with the single-precision real number data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on. ECMP (s1) (s2) Turns on when [(s1), (s1)+1] >...
  • Page 713: Outputting A Comparison Result Of Double-Precision Real Numbers

    Outputting a comparison result of double-precision real numbers EDCMP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions compare the double-precision real number data specified by (s1) with the double-precision real number data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on.
  • Page 714 Processing details • These instructions compare the double-precision real number data specified by (s1) with the double-precision real number data specified by (s2), and according to the result (small, equal, or large), (d), (d)+1, or (d)+2 is turned on. EDCMP (s1) (s2) Turns on when [(s1) to (s1)+3] >...
  • Page 715: Outputting A Band Comparison Result Of Single-Precision Real Number

    Outputting a band comparison result of single-precision real number EZCP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions compare the band between the single-precision real number specified by lower limit value (s1) and the single-precision real number specified by upper limit value (s2) with the single-precision real number in the device specified by comparison data (s3).
  • Page 716 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 717: Outputting A Band Comparison Result Of Double-Precision Real Number

    Outputting a band comparison result of double-precision real number EDZCP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions compare the band between the double-precision real number specified by lower limit value (s1) and the double-precision real number specified by upper limit value (s2) with the double-precision real number in the device specified by comparison data (s3).
  • Page 718 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 719: Adding Single-Precision Real Numbers

    Adding single-precision real numbers E+(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add single-precision real numbers. Ladder Not supported ( Page 719 E+(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 720 Operation error Error code Description (SD0) The value input to (s) is -0, a subnormal number, NaN (not a number), or . 3402H The value input to (d) is -0, a subnormal number, NaN (not a number), or . 3403H The data in the device specified by (d) exceeds the following range.
  • Page 721 E+(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add single-precision real numbers. Ladder ENO:=EPLUS(EN,s1,s2,d); ENO:=EPLUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: BPLUS, BPLUSP.) ■Execution condition Instruction Execution condition Setting data...
  • Page 722 Processing details • These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1 Single-precision real number Single-precision real number...
  • Page 723: Subtracting Single-Precision Real Numbers

    Subtracting single-precision real numbers E-(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between single-precision real numbers. Ladder Not supported ( Page 723 E-(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 724 Operation error Error code Description (SD0) The value input to (s) is -0, a subnormal number, NaN (not a number), or . 3402H The value input to (d) is -0, a subnormal number, NaN (not a number), or . 3403H The data in the device specified by (d) exceeds the following range.
  • Page 725 E-(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between single-precision real numbers. Ladder ENO:=EMINUS(EN,s1,s2,d); ENO:=EMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: BMINUS, BMINUSP.) ■Execution condition Instruction Execution condition...
  • Page 726 Processing details • These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1 Single-precision real number Single-precision real number...
  • Page 727: Adding Double-Precision Real Numbers

    Adding double-precision real numbers ED+(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add double-precision real numbers. Ladder Not supported ( Page 727 ED+(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 728 Operation error Error code Description (SD0) The value input to (s) is -0, a subnormal number, NaN (not a number), or . 3402H The value input to (d) is -0, a subnormal number, NaN (not a number), or . 3403H The data in the device specified by (d) exceeds the following range.
  • Page 729 ED+(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add double-precision real numbers. Ladder ENO:=EDPLUS(EN,s1,s2,d); ENO:=EDPLUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EDPLUS, EDPLUSP.) ■Execution condition Instruction Execution condition ED+P...
  • Page 730 Processing details • These instructions add the double-precision real number in the device specified by (s1) to the double-precision real number in the device specified by (s2), and store the result in the device specified by (d). (s1)+3 (s1)+2 (s1)+1 (s1) (s2)+3 (s2)+2...
  • Page 731: Subtracting Double-Precision Real Numbers

    Subtracting double-precision real numbers ED-(P) [when two operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between double-precision real numbers. Ladder Not supported ( Page 731 ED-(P) [when three operands are set]) FBD/LD Not supported (...
  • Page 732 Operation error Error code Description (SD0) The value input to (s) is -0, a subnormal number, NaN (not a number), or . 3402H The value input to (d) is -0, a subnormal number, NaN (not a number), or . 3403H The data in the device specified by (d) exceeds the following range.
  • Page 733 ED-(P) [when three operands are set] RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform subtraction between double-precision real numbers. Ladder ENO:=EDMINUS(EN,s1,s2,d); ENO:=EDMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EDMINUS, EDMINUSP.) ■Execution condition Instruction Execution condition...
  • Page 734 Processing details • These instructions subtract the double-precision real number in the device specified by (s2) from the double-precision real number in the device specified by (s1), and store the result in the device specified by (d). (s1)+3 (s1)+2 (s1)+1 (s1) (s2)+3 (s2)+2...
  • Page 735: Multiplying Single-Precision Real Numbers

    Multiplying single-precision real numbers E*(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply single-precision real numbers. Ladder ENO:=EMULTI(EN,s1,s2,d); ENO:=EMULTIP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EMULTI, EMULTIP.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 736 Processing details • These instructions multiply the single-precision real number in the device specified by (s1) by the single-precision real number in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1...
  • Page 737: Dividing Single-Precision Real Numbers

    Dividing single-precision real numbers E/(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between single-precision real numbers. Ladder ENO:=EDIVISION(EN,s1,s2,d); ENO:=EDIVISIONP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EDIVISION, EDIVISIONP.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 738 Processing details • These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real number in the device specified by (s2), and store the division result in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) (d)+1...
  • Page 739: Multiplying Double-Precision Real Numbers

    Multiplying double-precision real numbers ED*(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions multiply double-precision real numbers. Ladder ENO:=EDMULTI(EN,s1,s2,d); ENO:=EDMULTIP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EDMULTI, EDMULTIP.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 740 Processing details • These instructions multiply the double-precision real number in the device specified by (s1) by the double-precision real number in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1)+3 (s1)+2 (s1)+1 (s1) (s2)+3...
  • Page 741: Dividing Double-Precision Real Numbers

    Dividing double-precision real numbers ED/(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions perform division between double-precision real numbers. Ladder ENO:=EDDIVISION(EN,s1,s2,d); ENO:=EDDIVISIONP(EN,s1,s2,d); (s1) (s2) FBD/LD ( is replaced by either of the following: EDDIVISION, EDDIVISIONP.) *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 742 Processing details • These instructions divide the double-precision real number in the device specified by (s1) by the double-precision real number in the device specified by (s2), and store the division result in the device specified by (d). (s1)+3 (s1)+2 (s1)+1 (s1) (s2)+3...
  • Page 743: Converting 16-Bit Signed Binary Data To Single-Precision Real Number

    Converting 16-bit signed binary data to single-precision real number INT2FLT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit signed binary data to a single-precision real number. Ladder ENO:=INT2FLT(EN,s,d); ENO:=INT2FLTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 744 Processing details • These instructions convert the 16-bit signed binary data in the device specified by (s) to a single-precision real number, and store the converted data in the device specified by (d). SM402 ∙∙∙ ∙∙∙ ∙∙∙ MOVP K-1234 D101, D100 C49AH 4000H FB2EH...
  • Page 745: Converting 16-Bit Unsigned Binary Data To Single-Precision Real Number

    Converting 16-bit unsigned binary data to single-precision real number UINT2FLT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit unsigned binary data to a single-precision real number. Ladder ENO:=UINT2FLT(EN,s,d); ENO:=UINT2FLTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 746 Processing details • These instructions convert the 16-bit unsigned binary data in the device specified by (s) to a single-precision real number, and store the real number in the device specified by (d). SM402 ∙∙∙ ∙∙∙ ∙∙∙ MOVP K1234 04D2H D101, D100 449AH 4000H...
  • Page 747: Converting 32-Bit Signed Binary Data To Single-Precision Real Number

    Converting 32-bit signed binary data to single-precision real number DINT2FLT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit signed binary data to a single-precision real number. Ladder ENO:=DINT2FLT(EN,s,d); ENO:=DINT2FLTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 748 Processing details • These instructions convert the 32-bit signed binary data in the device specified by (s) to a single-precision real number, and stores the real number in the device specified by (d). SM402 DMOVP K-123456 ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ D1, D0 FFFEH 1DC0H...
  • Page 749: Converting 32-Bit Unsigned Binary Data To Single-Precision Real Number

    Converting 32-bit unsigned binary data to single-precision real number UDINT2FLT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit unsigned binary data to a single-precision real number. Ladder ENO:=UDINT2FLT(EN,s,d); ENO:=UDINT2FLTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 750 Processing details • These instructions convert the 32-bit unsigned binary data in the device specified by (s) to a single-precision real number, and stores the real number in the device specified by (d). SM402 DMOVP K123456 D1, D0 0001H E240H D101, D100 47F1H 2000H...
  • Page 751: Converting Double-Precision Real Number To Single-Precision Real Number

    Converting double-precision real number to single-precision real number DBL2FLT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a double-precision real number to a single-precision real number. Ladder ENO:=DBL2FLT(EN,s,d); ENO:=DBL2FLTP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 752 Processing details • These instructions convert the double-precision real number in the device specified by (s) to a single-precision real number, and store the real number in the device specified by (d). SM402 ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ EDMOVP E-123456.7 D3, D2, D1, D0 C0FEH 240BH...
  • Page 753: Converting 16-Bit Signed Binary Data To Double-Precision Real Number

    Converting 16-bit signed binary data to double-precision real number INT2DBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit signed binary data to a double-precision real number. Ladder ENO:=INT2DBL(EN,s,d); ENO:=INT2DBLP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 754 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 755: Converting 16-Bit Unsigned Binary Data To Double-Precision Real Number

    Converting 16-bit unsigned binary data to double-precision real number UINT2DBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 16-bit unsigned binary data to a double-precision real number. Ladder ENO:=UINT2DBL(EN,s,d); ENO:=UINT2DBLP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 756 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 757: Converting 32-Bit Signed Binary Data To Double-Precision Real Number

    Converting 32-bit signed binary data to double-precision real number DINT2DBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit signed binary data to a double-precision real number. Ladder ENO:=DINT2DBL(EN,s,d); ENO:=DINT2DBLP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 758 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 759: Converting 32-Bit Unsigned Binary Data To Double-Precision Real Number

    Converting 32-bit unsigned binary data to double-precision real number UDINT2DBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert 32-bit unsigned binary data to a double-precision real number. Ladder ENO:=UDINT2DBL(EN,s,d); ENO:=UDINT2DBLP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 760 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 761: Converting Single-Precision Real Number To Double-Precision Real Number

    Converting single-precision real number to double-precision real number FLT2DBL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a single-precision real number to a double-precision real number. Ladder ENO:=FLT2DBL(EN,s,d); ENO:=FLT2DBLP(EN,s,d); FBD/LD *1 The engineering tool with version "1.035M" or later supports the ST. ■Execution condition Instruction Execution condition...
  • Page 762 Operation error Error code Description (SD0) The value input to (s) is -0, a subnormal number, NaN (not a number), or . 3402H 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 763: Converting String Data To Single-Precision Real Number

    Converting string data to single-precision real number EVAL(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert a string to a single-precision real number. Ladder ENO:=EVAL(EN,s,d); ENO:=EVALP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition EVAL EVALP Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 764 Processing details • These instructions convert the character string stored in the device number specified by (s) and later to single-precision real number data, and store the converted real number in the device specified by (d). • The specified character string can be converted to a single-precision real number in either decimal point or exponential format.
  • Page 765 • If 2BH(+) is specified for the sign or the sign is omitted in decimal point format, the converted single-precision real number is treated as a positive value. If 2DH(-) is specified for the sign, it is treated as a negative value. •...
  • Page 766 • If 2BH(+) is specified for the sign or the sign is omitted in exponential format, the converted single-precision real number is treated as a positive value. If 2DH(-) is specified for the sign in the exponent, it is treated as a negative value. •...
  • Page 767: Converting Bcd Format Data To Single-Precision Real Number

    Converting BCD format data to single-precision real number EREXP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert BCD floating point format data to single-precision real number data in accordance with the specified number of digits in the decimal part. Ladder ENO:=EREXP(EN,s1,s2,d);...
  • Page 768 Processing details • These instructions convert the BCD floating-point format data stored in the device specified by (s1) and later to single- precision real number data in accordance with the number of decimal places stored in the device specified by (s2), and store the converted data in the device number specified by (d) and later.
  • Page 769: Inverting The Sign Of Single-Precision Real Number

    Inverting the sign of single-precision real number ENEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the sign of single-precision real number data. Ladder ENO:=ENEG(EN,d); ENO:=ENEGP(EN,d); FBD/LD ■Execution condition Instruction Execution condition ENEG ENEGP Setting data ■Description, range, data type Operand Description...
  • Page 770: Inverting The Sign Of Double-Precision Real Number

    Inverting the sign of double-precision real number EDNEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions invert the sign of double-precision real number data. Ladder ENO:=EDNEG(EN,d); ENO:=EDNEGP(EN,d); FBD/LD ■Execution condition Instruction Execution condition EDNEG EDNEGP Setting data ■Description, range, data type Operand Description...
  • Page 771: Transferring Single-Precision Real Number

    Transferring single-precision real number EMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer single-precision real number data to the specified device. Ladder ENO:=EMOV(EN,s,d); ENO:=EMOVP(EN,s,d) FBD/LD ■Execution condition Instruction Execution condition EMOV EMOVP Setting data ■Description, range, data type Operand Description Range...
  • Page 772: Transferring Double-Precision Real Number

    Transferring double-precision real number EDMOV(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions transfer double-precision real number data to the specified device. Ladder ENO:=EDMOV(EN,s,d); ENO:=EDMOVP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition EDMOV EDMOVP Setting data ■Description, range, data type Operand Description Range...
  • Page 773: Calculating The Sine Of Single-Precision Real Number

    Calculating the sine of single-precision real number SIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the sine of the angle specified by a single-precision real number. Ladder ENO:=SINP(EN,s,d); FBD/LD *1 The SIN instruction does not support the ST and FBD/LD. Use the standard function, SIN. Page 1900 SIN(_E) ■Execution condition Instruction...
  • Page 774 Processing details • These instructions calculate the sine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 SIN ( Single-precision real number Single-precision real number • Set the angle data in radians (angle180). •...
  • Page 775: Calculating The Cosine Of Single-Precision Real Number

    Calculating the cosine of single-precision real number COS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the cosine of the angle specified by a single-precision real number. Ladder ENO:=COSP(EN,s,d); FBD/LD *1 The COS instruction does not support the ST and FBD/LD. Use the standard function, COS. Page 1901 COS(_E) ■Execution condition Instruction...
  • Page 776 Processing details • These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 COS ( Single-precision real number Single-precision real number • Set the angle data in radians (angle180). •...
  • Page 777: Calculating The Tangent Of Single-Precision Real Number

    Calculating the tangent of single-precision real number TAN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the tangent of the angle specified by a single-precision real number. Ladder ENO:=TANP(EN,s,d); FBD/LD *1 The TAN instruction does not support the ST and FBD/LD. Use the standard function, TAN. Page 1902 TAN(_E) ■Execution condition Instruction...
  • Page 778 Processing details • These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 TAN ( Single-precision real number Single-precision real number • Set the angle data in radians (angle180). •...
  • Page 779: Calculating The Arc Sine Of Single-Precision Real Number

    Calculating the arc sine of single-precision real number ASIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the sine specified by a single-precision real number. Ladder ENO:=ASINP(EN,s,d); FBD/LD *1 The ASIN instruction does not support the ST and FBD/LD. Use the standard function, ASIN. Page 1903 ASIN(_E) ■Execution condition Instruction...
  • Page 780 Processing details • These instructions calculate the angle based on the sine data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The sine data in the device specified by (s) can be set in the range from -1.0 to 1.0. •...
  • Page 781: Calculating The Arc Cosine Of Single-Precision Real Number

    Calculating the arc cosine of single-precision real number ACOS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the cosine specified by a single-precision real number. Ladder ENO:=ACOSP(EN,s,d) FBD/LD *1 The ACOS instruction does not support the ST and FBD/LD. Use the standard function, ACOS. Page 1904 ACOS(_E) ■Execution condition Instruction...
  • Page 782 Processing details • These instructions calculate the angle based on the cosine data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The cosine data in the device specified by (s) can be set in the range from -1.0 to 1.0. •...
  • Page 783: Calculating The Arc Tangent Of Single-Precision Real Number

    Calculating the arc tangent of single-precision real number ATAN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the tangent specified by a single-precision real number. Ladder ENO:=ATANP(EN,s,d); FBD/LD *1 The ATAN instruction does not support the ST and FBD/LD. Use the standard function, ATAN. Page 1905 ATAN(_E) ■Execution condition Instruction...
  • Page 784 Processing details • These instructions calculate the angle based on the tangent data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The angle (operation result) is stored in radians in the device specified by (d). •...
  • Page 785: Calculating The Sine Of Double-Precision Real Number

    Calculating the sine of double-precision real number SIND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the sine of the angle specified by a double-precision real number. Ladder ENO:=SINDP(EN,s,d); FBD/LD *1 The SIND instruction does not support the ST and FBD/LD. Use the standard function, SIN. Page 1900 SIN(_E) ■Execution condition Instruction...
  • Page 786 Processing details • These instructions calculate the sine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 SIN ( Double-precision real number Double-precision real number • Set the angle data in radians (angle180). •...
  • Page 787: Calculating The Cosine Of Double-Precision Real Number

    Calculating the cosine of double-precision real number COSD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the cosine of the angle specified by a double-precision real number. Ladder ENO:=COSDP(EN,s,d); FBD/LD *1 The COSD instruction does not support the ST and FBD/LD. Use the standard function, COS. Page 1901 COS(_E) ■Execution condition Instruction...
  • Page 788 Processing details • These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 COS ( Double-precision real number Double-precision real number • Set the angle data in radians (angle180). •...
  • Page 789: Calculating The Tangent Of Double-Precision Real Number

    Calculating the tangent of double-precision real number TAND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the tangent of the angle specified by a double-precision real number. Ladder ENO:=TANDP(EN,s,d); FBD/LD *1 The TAND instruction does not support the ST and FBD/LD. Use the standard function, TAN. Page 1902 TAN(_E) ■Execution condition Instruction...
  • Page 790 Processing details • These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 TAN ( Double-precision real number Double-precision real number • Set the angle data in radians (angle180). •...
  • Page 791: Calculating The Arc Sine Of Double-Precision Real Number

    Calculating the arc sine of double-precision real number ASIND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the sine specified by a double-precision real number. Ladder ENO:=ASINDP(EN,s,d) FBD/LD *1 The ASIND instruction does not support the ST and FBD/LD. Use the standard function, ASIN. Page 1903 ASIN(_E) ■Execution condition Instruction...
  • Page 792 Processing details • These instructions calculate the angle based on the sine data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number •...
  • Page 793: Calculating The Arc Cosine Of Double-Precision Real Number

    Calculating the arc cosine of double-precision real number ACOSD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the cosine specified by a double-precision real number. Ladder ENO:=ACOSDP(EN,s,d); FBD/LD *1 The ACOSD instruction does not support the ST and FBD/LD. Use the standard function, ACOS. Page 1904 ACOS(_E) ■Execution condition Instruction...
  • Page 794 Processing details • These instructions calculate the angle based on the cosine data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number •...
  • Page 795: Calculating The Arc Tangent Of Double-Precision Real Number

    Calculating the arc tangent of double-precision real number ATAND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the angle from the tangent specified by a double-precision real number. Ladder ENO:=ATANDP(EN,s,d); FBD/LD *1 The ATAND instruction does not support the ST and FBD/LD. Use the standard function, ATAN. Page 1905 ATAN(_E) ■Execution condition Instruction...
  • Page 796 Processing details • These instructions calculate the angle based on the tangent data in the device specified by (s), and store the operation result in the device number specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number •...
  • Page 797: Calculating The Sine Of Bcd Data

    Calculating the sine of BCD data BSIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the sine of the angle specified by a BCD value. Ladder ENO:=BSIN(EN,s,d); ENO:=BSINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BSIN BSINP Setting data ■Descriptions, ranges, and data types...
  • Page 798 Processing details • These instructions calculate the sine of the angle specified by (s), and store the sign of the operation result in the device specified by (d) and the operation result in the devices specified by (d)+1 and (d)+2. (d)+1 (d)+2 SIN (s) =...
  • Page 799: Calculating The Cosine Of Bcd Data

    Calculating the cosine of BCD data BCOS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the cosine of the angle specified by a BCD value. Ladder ENO:=BCOS(EN,s,d); ENO:=BCOSP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BCOS BCOSP Setting data ■Descriptions, ranges, and data types...
  • Page 800 Processing details • These instructions calculate the cosine of the angle specified by (s), and store the sign of the operation result in the word device specified by (d) and the operation result in the word devices specified by (d)+1 and (d)+2. (d)+1 (d)+2 COS (s) =...
  • Page 801: Calculating The Tangent Of Bcd Data

    Calculating the tangent of BCD data BTAN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the tangent of the angle specified by a BCD value. Ladder ENO:=BTAN(EN,s,d); ENO:=BTANP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BTAN BTANP Setting data ■Descriptions, ranges, and data types...
  • Page 802 Processing details • These instructions calculate the tangent of the angle specified by (s), and store the sign of the operation result in the device specified by (d) and the operation result in the devices specified by (d)+1 and (d)+2. (d)+1 (d)+2 TAN (s) =...
  • Page 803: Calculating The Arc Sine Of Bcd Data

    Calculating the arc sine of BCD data BASIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the arc sine of the angle specified by a BCD value. Ladder ENO:=BASIN(EN,s,d); ENO:=BASINP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BASIN BASINP Setting data...
  • Page 804 Processing details • These instructions calculate the arc sine of the value specified by (s), and store the operation result (angle) in the device specified by (d). (s)+1 (s)+2 ) = (d) (s): Sign (s)+1: Integral part (s)+2: Decimal part •...
  • Page 805: Calculating The Arc Cosine Of Bcd Data

    Calculating the arc cosine of BCD data BACOS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the arc cosine of the angle specified by a BCD value. Ladder ENO:=BACOS(EN,s,d); ENO:=BACOSP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BACOS BACOSP Setting data...
  • Page 806 Processing details • These instructions calculate the arc cosine of the value specified by (s), and store the operation result (angle) in the device specified by (d). (s)+1 (s)+2 ) = (d) (s): Sign (s)+1: Integral part (s)+2: Decimal part •...
  • Page 807: Calculating The Arc Tangent Of Bcd Data

    Calculating the arc tangent of BCD data BATAN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the arc tangent of the angle specified by a BCD value. Ladder ENO:=BATAN(EN,s,d); ENO:=BATANP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BATAN BATANP Setting data...
  • Page 808 Processing details • These instructions calculate the arc tangent of the value specified by (s), and store the operation result (angle) in the device specified by (d). (s)+1 (s)+2 ) = (d) Sign Integral part Decimal part (s): Sign (s)+1: Integral part (s)+2: Decimal part •...
  • Page 809: Converting Single-Precision Real Number Angle To Radian

    Converting single-precision real number angle to radian RAD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the unit of the measure of angle from the degree specified by a single-precision real number to radian. Ladder ENO:=RAD(EN,s,d);...
  • Page 810 Processing details • These instructions convert the unit of the measure of angle from the degree specified by (s) to the radian, and store the angle in radians in the device number specified by (d). (s)+1 (d)+1 )° ) rad Single-precision real number Single-precision real number •...
  • Page 811: Converting Single-Precision Real Number Radian To Angle

    Converting single-precision real number radian to angle DEG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the unit of the measure of angle from the radian specified by a single-precision real number to the degree. Ladder ENO:=DEG(EN,s,d);...
  • Page 812 Processing details • These instructions convert the unit of the measure of angle from the radian specified by (s) to the degree, and store the angle in degrees in the device number specified by (d). (s)+1 (d)+1 ) rad )° Single-precision real number Single-precision real number •...
  • Page 813: Converting Double-Precision Real Number Angle To Radian

    Converting double-precision real number angle to radian RADD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the unit of the measure of angle from the degree specified by a single-precision real number to radian. Ladder ENO:=RADD(EN,s,d);...
  • Page 814 Processing details • These instructions convert the unit of the measure of angle from the degree specified by (s) to the radian, and store the angle in radians in the device number specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 )°...
  • Page 815: Converting Double-Precision Real Number Radian To Angle

    Converting double-precision real number radian to angle DEGD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions convert the unit of the measure of angle from the radian specified by a double-precision real number to the degree. Ladder ENO:=DEGD(EN,s,d);...
  • Page 816 Processing details • These instructions convert the unit of the measure of angle from the radian specified by (s) to the degree, and store the angle in degrees in the device number specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 ) rad )°...
  • Page 817: Calculating The Square Root Of Single-Precision Real Number

    Calculating the square root of single-precision real number ESQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the square root of the value specified by a single-precision real number. Ladder ENO:=ESQRT(EN,s,d); ENO:=ESQRTP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition ESQRT...
  • Page 818 Processing details • These instructions calculate the square root of the value specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The value specified by (s) must be positive. (No negative value can be calculated.) •...
  • Page 819: Calculating The Square Root Of Double-Precision Real Number

    Calculating the square root of double-precision real number EDSQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the square root of the value specified by a double-precision real number. Ladder ENO:=EDSQRT(EN,s,d); ENO:=EDSQRTP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition EDSQRT...
  • Page 820 Processing details • These instructions calculate the square root of the value specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number • The value specified by (s) must be positive. (No negative value can be calculated.) •...
  • Page 821: Calculating The Exponent Of Single-Precision Real Number

    Calculating the exponent of single-precision real number EXP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the exponent of the value specified by a single-precision real number. Ladder ENO:=EXPP(EN,s,d); FBD/LD *1 The EXP instruction does not support the ST and FBD/LD. Use the standard function, EXP. Page 1899 EXP(_E) ■Execution condition Instruction...
  • Page 822 Processing details • These instructions calculate the exponent of the value specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • Exponent operation is performed with the base (e) set to "2.71828". •...
  • Page 823: Calculating The Exponent Of Double-Precision Real Number

    Calculating the exponent of double-precision real number EXPD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the exponent of the value specified by a double-precision real number. Ladder ENO:=EXPDP(EN,s,d); FBD/LD *1 The EXPD instruction does not support the ST and FBD/LD. Use the standard function, EXP. Page 1899 EXP(_E) ■Execution condition Instruction...
  • Page 824 Processing details • These instructions calculate the exponent of the value specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number • Exponent operation is performed with the base (e) set to "2.71828". •...
  • Page 825: Calculating The Natural Logarithm Of Single-Precision Real Number

    Calculating the natural logarithm of single-precision real number LOG(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the logarithm using the natural logarithm (e) of the value specified by a single-precision real number as the base. Ladder ENO:=LOGP(EN,s,d);...
  • Page 826 Processing details • These instructions calculate the logarithm using natural logarithm (e) of the value specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 log ( Single-precision real number Single-precision real number • Input a positive value only. (No negative value can be calculated.) •...
  • Page 827: Calculating The Natural Logarithm Of Double-Precision Real Number

    Calculating the natural logarithm of double-precision real number LOGD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the logarithm using the natural logarithm (e) of the value specified by a double-precision real number as the base. Ladder ENO:=LOGDP(EN,s,d);...
  • Page 828 Processing details • These instructions calculate the logarithm using natural logarithm (e) of the value specified by (s), and store the operation result in the device specified by (d). (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 log ( Double-precision real number Double-precision real number •...
  • Page 829: Calculating The Square Root Of Bcd 4-Digit Data

    Calculating the square root of BCD 4-digit data BSQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the square root of the value specified by a BCD 4-digit data. Ladder ENO:=BSQRT(EN,s,d); ENO:=BSQRTP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BSQRT...
  • Page 830 Operation error Error code Description (SD0) 3405H The data in the device specified by (s) is not a BCD value. 7 APPLICATION INSTRUCTIONS 7.9 Real Number Instructions...
  • Page 831: Calculating The Square Root Of Bcd 8-Digit Data

    Calculating the square root of BCD 8-digit data BDSQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the square root of the value specified by a BCD 8-digit data. Ladder ENO:=BDSQRT(EN,s,d); ENO:=BDSQRTP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition BDSQRT...
  • Page 832 Processing details • These instructions calculate the square root of the BCD 8-digit data specified by (s), and store the operation result in the device specified by (d). (d)+1 (s)+1 (s)+1, (s): 2-word data (d): Integral part (d)+1: Decimal part •...
  • Page 833: Calculating The Exponentiation Of Single-Precision Real Number

    Calculating the exponentiation of single-precision real number POW(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the exponentiation of a single-precision real number. Ladder ENO:=POW(EN,s1,s2,d); ENO:=POWP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition POWP Setting data ■Description, range, data type Operand...
  • Page 834 Processing details • These instructions raises the single-precision real number specified by (s1) to the power of the single-precision real number specified by (s2), and store the operation result in the device specified by (d). Exponent (s2)+1 (s2) (s1)+1 (s1) (d)+1 Base number (s1)+1...
  • Page 835: Calculating The Exponentiation Of Double-Precision Real Number

    Calculating the exponentiation of double-precision real number POWD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the exponentiation of a double-precision real number. Ladder ENO:=POWD(EN,s1,s2,d); ENO:=POWDP(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition POWD POWDP Setting data ■Description, range, data type...
  • Page 836 Processing details • These instructions raises the double-precision real number specified by (s1) to the power of the double-precision real number specified by (s2), and store the operation result in the device specified by (d). Exponent (s2)+3 (s2)+2 (s2)+1 (s2) (s1)+3 (s1)+2 (s1)+1...
  • Page 837: Calculating The Common Logarithm Of Single-Precision Real Number

    Calculating the common logarithm of single-precision real number LOG10(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the logarithm using the common logarithm (using 10 as the base) of the value specified by a single-precision real number. Ladder ENO:=LOG10(EN,s,d);...
  • Page 838 Processing details • These instructions calculate the common logarithm (using 10 as the base) of the value specified by (s), and store the operation result in the device number specified by (d). log10 ( (s)+1 (d)+1 Single-precision real number Single-precision real number •...
  • Page 839: Calculating The Common Logarithm Of Double-Precision Real Number

    Calculating the common logarithm of double-precision real number LOG10D(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the logarithm using the common logarithm (using 10 as the base) of the value specified by a double-precision real number. Ladder ENO:=LOG10D(EN,s,d);...
  • Page 840 Processing details • These instructions calculate the common logarithm (using 10 as the base) of the value specified by (s), and store the operation result in the device number specified by (d). log10 ( (s)+3 (s)+2 (s)+1 (d)+3 (d)+2 (d)+1 Double-precision real number Double-precision real number •...
  • Page 841: Searching The Maximum Value Of Single-Precision Real Number

    Searching the maximum value of single-precision real number EMAX(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the block data of single-precision real numbers for the maximum value. Ladder ENO:=EMAXP(EN,s,n,d); FBD/LD *1 The EMAX instruction does not support the ST and FBD/LD. Use the standard function, MAX. Page 1933 MAX(_E), MIN(_E) ■Execution condition Instruction...
  • Page 842 Processing details • These instructions search for the maximum value in the (n) points of single-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). The instructions store the location of the first maximum value by the number of points from (s) in the device specified by (d)+2 and the number of maximum values in the device specified by (d)+3.
  • Page 843: Searching The Maximum Value Of Double-Precision Real Number

    Searching the maximum value of double-precision real number EDMAX(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the block data of double-precision real numbers for the maximum value. Ladder ENO:=EDMAXP(EN,s,n,d); FBD/LD *1 The EDMAX instruction does not support the ST and FBD/LD. Use the standard function, MAX. Page 1933 MAX(_E), MIN(_E) ■Execution condition Instruction...
  • Page 844 Processing details • These instructions search for the maximum value in the (n) points of double-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). The instructions store the location of the first maximum value by the number of points from (s) in the device specified by (d)+4 and the number of maximum values in the device specified by (d)+5.
  • Page 845: Searching The Minimum Value Of Single-Precision Real Number

    Searching the minimum value of single-precision real number EMIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the block data of single-precision real numbers for the minimum value. Ladder ENO:=EMINP(EN,s,n,d); FBD/LD *1 The EMIN instruction does not support the ST and FBD/LD. Use the standard function, MIN. Page 1933 MAX(_E), MIN(_E) ■Execution condition Instruction...
  • Page 846 Processing details • These instructions search for the minimum value in the (n) points of single-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). The instructions store the location of the first minimum value by the number of points from (s) in the device specified by (d)+2 and the number of minimum values in the device specified by (d)+3.
  • Page 847: Searching The Minimum Value Of Double-Precision Real Number

    Searching the minimum value of double-precision real number EDMIN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the block data of double-precision real numbers for the minimum value. Ladder ENO:=EDMINP(EN,s,n,d); FBD/LD *1 The EDMIN instruction does not support the ST and FBD/LD. Use the standard function, MIN. Page 1933 MAX(_E), MIN(_E) ■Execution condition Instruction...
  • Page 848 Processing details • These instructions search for the minimum value in the (n) points of double-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). The instructions store the location of the first minimum value by the number of points from (s) in the device specified by (d)+4 and the number of minimum values in the device specified by (d)+5.
  • Page 849: Random Number Instructions

    7.10 Random Number Instructions Generating random number RND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions generate a random number between 0 and less than 32767, and store the random number in the specified device. Ladder ENO:=RND(EN,d);...
  • Page 850: Changing Random Sequence

    Changing random sequence SRND(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions change the random number sequence according to the content of the 16-bit binary data stored in the specified device. Ladder ENO:=SRND(EN,s); ENO:=SRNDP(EN,s); FBD/LD ■Execution condition Instruction Execution condition SRND...
  • Page 851: Index Register Instructions

    7.11 Index Register Instructions Saving all data of the index register ZPUSH(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions save the content of the index register to the specified area. Ladder ENO:=ZPUSH(EN,d); ENO:=ZPUSHP(EN,d); FBD/LD ■Execution condition Instruction Execution condition ZPUSH...
  • Page 852 Processing details • These instructions save the content of the index register to the device specified by (d) or the array label element and later. • When the content of the index register is saved, the number of saves (d) is incremented by 1. •...
  • Page 853: Returning All Data Of The Index Register

    Returning all data of the index register ZPOP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions read the data, which has been saved to the specified area, into the index register. Ladder ENO:=ZPOP(EN,d); ENO:=ZPOPP(EN,d); FBD/LD ■Execution condition Instruction Execution condition ZPOP...
  • Page 854: Saving The Selected Data Of The Index Register And Long Index Register

    Saving the selected data of the index register and long index register ZPUSH(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instruction save the contents of the index register and long index register to the specified area. Ladder ENO:=ZPUSH_2(EN,s,d);...
  • Page 855 Processing details • These instructions save the contents of the index register and long index register in the device specified by (s) to the device specified by (d) or array label element and later. The instructions also save the type of the saved index register and long index register to the end of the saved data.
  • Page 856 Precautions (d)+1 and (d)+2 for the ZPUSH(P) instructions are used for the system. Do not change the values. The Z and LZ save types stored in the area specified by (d) and later are also used for the system. Do not change the values. Changing the values may cause malfunction of the module.
  • Page 857: Returning The Selected Data Of The Index Register And Long Index Register

    Returning the selected data of the index register and long index register ZPOP(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions read the data, which has been saved to the specified area, into the index register and long index register. Ladder ENO:=ZPOP_2(EN,s,d);...
  • Page 858 Precautions (d)+1 and (d)+2 are used for the system. Do not change the values. The Z and LZ save types stored in the area specified by (d) and later are also used for the system. Do not change the values. Changing the values may cause malfunction of the module.
  • Page 859: Data Control Instructions

    7.12 Data Control Instructions Upper and lower limit control of 16-bit binary data LIMIT(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions control the output value depending on whether the specified 16-bit binary bit value is within the upper and lower limits.
  • Page 860 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 861: Upper And Lower Limit Control Of 32-Bit Binary Data

    Upper and lower limit control of 32-bit binary data DLIMIT(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions control the output value depending on whether the specified 32-bit binary bit value is within the upper and lower limits.
  • Page 862 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). The output value is controlled as follows.
  • Page 863: Dead Band Control Of 16-Bit Binary Data

    Dead band control of 16-bit binary data BAND(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions control the output value depending on whether the specified 16-bit binary bit value is within the upper and lower limits of the dead band. Ladder ENO:=BAND(EN,s1,s2,s3,d);...
  • Page 864 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking whether the input value (16-bit binary data) in the device specified by (s3) is within range of the upper and lower limits of the dead band in the devices specified by (s1) and (s2).
  • Page 865: Dead Band Control Of 32-Bit Binary Data

    Dead band control of 32-bit binary data DBAND(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions control the output value depending on whether the specified 32-bit binary bit value is within the upper and lower limits of the dead band. Ladder ENO:=DBAND(EN,s1,s2,s3,d);...
  • Page 866 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking whether the input value (32-bit binary data) in the device specified by (s3) is within range of the upper and lower limits of the dead band in the devices specified by (s1) and (s2).
  • Page 867: Zone Control Of 16-Bit Binary Data

    Zone control of 16-bit binary data ZONE(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add a bias value to the specified input value (16-bit binary). Ladder ENO:=ZONE(EN,s1,s2,s3,d); ENO:=ZONE_U(EN,s1,s2,s3,d); ENO:=ZONEP(EN,s1,s2,s3,d); ENO:=ZONEP_U(EN,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD ■Execution condition Instruction Execution condition ZONE...
  • Page 868 Processing details • These instructions add the bias value specified by (s1) or (s2) to the input value (16-bit binary) specified by (s3), and store the result in the device number specified by (d). The bias value is controlled as follows. Condition Output value Input value (s3) <...
  • Page 869: Zone Control Of 32-Bit Binary Data

    Zone control of 32-bit binary data DZONE(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add a bias value to the specified input value (32-bit binary). Ladder ENO:=DZONE(EN,s1,s2,s3,d); ENO:=DZONE_U(EN,s1,s2,s3,d); ENO:=DZONEP(EN,s1,s2,s3,d); ENO:=DZONEP_U(EN,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD ■Execution condition Instruction Execution condition DZONE...
  • Page 870 Processing details • These instructions add the bias value specified by (s1) or (s2) to the input value (32-bit binary) specified by (s3), and store the result in the device number specified by (d). The bias value is controlled as follows. Condition Output value Input value ((s3), (s3)+1) <...
  • Page 871: Scaling 16-Bit Binary Data (Point Coordinates)

    Scaling 16-bit binary data (point coordinates) SCL(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions scale the scaling conversion data (16-bit data) on the basis of the specified input value (point coordinates). Ladder ENO:=SCL(EN,s1,s2,d); ENO:=SCL_U(EN,s1,s2,d); ENO:=SCLP(EN,s1,s2,d); ENO:=SCLP_U(EN,s1,s2,d);...
  • Page 872 Processing details • These instructions scale the scaling conversion data (16-bit data) in the device specified by (s2) on the basis of the input value in the device specified by (s1), and stores the operation result in the device specified by (d). Scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 873 Precautions • The search method and the number of searches vary depending on whether SM755 is on or off. SM755 Search method Number of searches Sequential search 1number of searches65535 Binary search 1number of searches16 • When the scaling conversion data is sorted in ascending order, the search method varies depending on the status of SM755 and therefore the processing speed also varies.
  • Page 874: Scaling 32-Bit Binary Data (Point Coordinates)

    Scaling 32-bit binary data (point coordinates) DSCL(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions scale the scaling conversion data (32-bit data) on the basis of the specified input value (point coordinates). Ladder ENO:=DSCL(EN,s1,s2,d); ENO:=DSCL_U(EN,s1,s2,d); ENO:=DSCLP(EN,s1,s2,d); ENO:=DSCLP_U(EN,s1,s2,d);...
  • Page 875 Processing details • These instructions scale the scaling conversion data (32-bit data) in the device specified by (s2) on the basis of the input value in the device specified by (s1), and stores the operation result in the device specified by (d). Scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 876 Precautions • The search method and the number of searches vary depending on whether SM755 is on or off. SM755 Search method Number of searches Sequential search 1number of searches4294967295 Binary search 1number of searches32 • When the scaling conversion data is sorted in ascending order, the search method varies depending on the status of SM755 and therefore the processing speed also varies.
  • Page 877: Scaling 16-Bit Binary Data (Xy Coordinates)

    Scaling 16-bit binary data (XY coordinates) SCL2(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions scale the scaling conversion data (16-bit data) on the basis of the specified input value (XY coordinates). Ladder ENO:=SCL2(EN,s1,s2,d); ENO:=SCL2_U(EN,s1,s2,d); ENO:=SCL2P(EN,s1,s2,d); ENO:=SCL2P_U(EN,s1,s2,d);...
  • Page 878 Processing details • These instructions scale the scaling conversion data (16-bit data) in the device specified by (s2) on the basis of the input value in the device specified by (s1), and stores the operation result in the device specified by (d). Scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 879: Scaling 32-Bit Binary Data (Xy Coordinates)

    Scaling 32-bit binary data (XY coordinates) DSCL2(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions scale the scaling conversion data (32-bit data) on the basis of the specified input value (XY coordinates). Ladder ENO:=DSCL2(EN,s1,s2,d); ENO:=DSCL2_U(EN,s1,s2,d); ENO:=DSCL2P(EN,s1,s2,d); ENO:=DSCL2P_U(EN,s1,s2,d);...
  • Page 880 Processing details • These instructions scale the scaling conversion data (32-bit data) in the device specified by (s2) on the basis of the input value in the device specified by (s1), and stores the operation result in the device specified by (d). Scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 881: Special Counter Instructions

    7.13 Special Counter Instructions Counting up or down the current value (1-phase input) UDCNT1 RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction updates the current value of the specified counter. Ladder ENO:=UDCNT1(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition UDCNT1...
  • Page 882 Processing details • When the input specified by (s1) is turned on, this instruction updates the current value of the counter specified by (d). • Counting up or down is determined by whether the input specified by (s1)+1 is on or off. •...
  • Page 883: Counting Up Or Down The Current Value (2-Phase Input)

    Counting up or down the current value (2-phase input) UDCNT2 RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction updates the current value of the counter depending on the status of phases A and B pulses. Ladder ENO:=UDCNT2(EN,s1,s2,d);...
  • Page 884 Processing details • This instruction updates the current value of the counter specified by (d) depending on the status of the input (phase A pulse) specified by (s1) and the status of the input (phase B pulse) specified by (s1)+1. •...
  • Page 885: Special Timer Instructions

    7.14 Special Timer Instructions Teaching timer TTMR RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction measures the on time of the measurement command in seconds, multiplies it by a multiplier, and stores the operation result. Ladder ENO:=TTMR(EN,s,d);...
  • Page 886 Processing details • This instruction measures the on time of the execution command in seconds, multiplies it by the multiplier specified by (s), and stores the resultant value in the device specified by (d). • When the execution command is turned on, the instruction clears the device specified by (d)+0, (d)+1. •...
  • Page 887: Special Function Timer

    Special function timer STMR RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction implements the following four types of timer output. • Off delay timer output • After-off one-shot timer output • After-on one-shot timer output • On delay + off delay timer output Ladder ENO:=STMR(EN,s1,s2,d);...
  • Page 888 Processing details • This instruction uses four points from the device specified by (d) to implement four types of timer output. Setting data Description Off delay timer output: Turns on on the rising edge of the command of the STMR instruction, and turns off after a lapse of the time specified by (s2) after the falling edge of the command.
  • Page 889 Precautions If there is an STMR instruction within the range for changing the ladder block online or writing data to the running programmable controller, the STMR instruction is executed. For details, refer to the following.  MELSEC iQ-R CPU Module User's Manual (Application) Operation error There is no operation error.
  • Page 890: Shortcut Control Instruction

    7.15 Shortcut Control Instruction Rotary table shortest direction control ROTC RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction controls shortcut rotation on the rotary table divided equally by the specified value. Ladder ENO:=ROTC(EN,s,n1,n2,d); (n1) (n2) FBD/LD ■Execution condition Instruction Execution condition...
  • Page 891 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD ...
  • Page 892 ■Program example When getting in and out at counters, the items placed on the rotary table divided into 10 sections, this program controls the rotary table so that the items rotate at short cut. The item number is specified by D2, and the counter number is specified by D1. The table is rotated at low speeds in two front and rear sections.
  • Page 893: Ramp Signal Instruction

    7.16 Ramp Signal Instruction Ramp signal RAMPQ RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction shifts from a specified value to another specified value in (n) times. Ladder ENO:=RAMPQ(EN,s1,s2,n,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition RAMPQ...
  • Page 894 Processing details • When the execution command is on, this instruction performs processing as follows. • Shifting from the value specified by (s1) to the value specified by (s2) in the number of times specified by (n). • For (n), specify the number of scans (number of shifts) to be performed to shift from (s1) to (s2). If the value specified in (n) is out of the range between 0 and 32768, no processing is performed.
  • Page 895 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.16 Ramp Signal Instruction...
  • Page 896: Pulse Related Instructions

    7.17 Pulse Related Instructions Measuring the density of pulses RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction counts the device input only for the specified time. Ladder ENO:=SPD(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition Setting data ■Descriptions, ranges, and data types Operand...
  • Page 897 Processing details • This instruction counts the number of times the input of the device specified by (s1) turns on for the duration specified by (s2), and stores the count result in the device specified by (d). Start of counting (s2)ms (s2)ms Execution...
  • Page 898: Outputting Pulses At Regular Intervals

    Outputting pulses at regular intervals PLSY RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction outputs the pulses of the specified frequency to the output module. Ladder ENO:=PLSY(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition PLSY Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 899 Processing details • This instruction outputs the pulses at the frequency specified by (s), by the number of times specified by (n), to the output module with the output number (Y) in the device specified by (d). • A frequency from 1Hz to 100Hz can be specified in (s). If the specified value in (s) is not in the range from 1 to 100, no processing is performed.
  • Page 900: Performing The Pulse Width Modulation

    Performing the pulse width modulation RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) When on continues for the specified time, this instruction outputs the pulse of the period to the output module. Ladder ENO:=PWM(EN,s1,s2,d); (s1) (s2) FBD/LD ■Execution condition Instruction Execution condition Setting data...
  • Page 901 Processing details • This instruction outputs the on time specified by (s1) and the pulse of the period specified by (s2) to the output module specified by (d). (s1) ms (s2) ms • A value in the range from 1 to 65535 (0001H to FFFFH) can be specified in (s1) and (s2). (The value specified in (s1) must be less than the value specified in (s2).) •...
  • Page 902: Matrix Input Instruction

    7.18 Matrix Input Instruction Matrix input RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) This instruction sequentially reads the input of 16 pointsn columns connected to the specified input number and after. Ladder ENO:=MTR(EN,s,n,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition Setting data...
  • Page 903 Processing details • This instruction sequentially reads the input of 16 pointsn columns connected to the (s) specified input number and after, and stores the input data that has been read in the device specified by (d2) and later. • One scan reads one column (16 points) of data. •...
  • Page 904 Precautions • Note that the MTR instruction directly operates the actual input/output. Even when the command of the MTR instruction turns off, the output that has been turned on by the MTR instruction is not turned off. Turn off the output specified by (d1) in the program.
  • Page 905: Check Code Instructions

    7.19 Check Code Instructions Check code CCD(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions perform addition of the data stored in the devices specified by (s) to (s)+(n)-1 and calculate the horizontal parity, and stores the added data in the device specified by (d) and the horizontal parity in the device specified by (d)+1.
  • Page 906 Processing details • These instructions perform addition of the data stored in the devices specified by (s) to (s)+(n)-1 and calculate the horizontal parity, and stores the added data in the device specified by (d) and the horizontal parity in the device specified by (d)+1.
  • Page 907 ■8-bit conversion mode (while SM772 is ON) With regard to (n) data points starting from (s), the addition data and horizontal parity data of only low-order 8 bits are stored to (d) and (d)+1 respectively. When (n)=6 <Calculation of addition data value> In 8-bit conversion mode, addition data is determined by adding 6 bytes in the following shaded portion.
  • Page 908: Data Processing Instructions

    7.20 Data Processing Instructions Searching 16-bit binary data SERDATA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points in the 16-bit binary data specified by (s2) for the 16-bit binary data specified by (s1). Ladder ENO:=SERDATA(EN,s1,s2,n,d);...
  • Page 909 Processing details • These instructions search the (n) points in units of 16-bit binary data from the device specified by (s2) using the 16-bit binary data in the device specified by (s1) as a keyword. Each instruction stores the number of data which matches the keyword in the device specified by (d)+1 and also stores the relative value of the first-matched device number from (s2) in the device specified by (d).
  • Page 910: Searching 32-Bit Binary Data

    Searching 32-bit binary data DSERDATA(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points in the 32-bit binary data specified by (s2) for the 32-bit binary data specified by (s1). Ladder ENO:=DSERDATA(EN,s1,s2,n,d); ENO:=DSERDATAP(EN,s1,s2,n,d); (s1) (s2) FBD/LD...
  • Page 911 Processing details • These instructions search the (n) points of data in units of 32-bit binary data (2  (n) points of data in units of 16 bits) from the device specified by (s2), using the 16-bit binary data in the device specified by (s1) as a keyword. Each instruction stores the number of data which matches the keyword in the device specified by (d)+1 and also stores the relative value of the first-matched device number from (s2) in the device specified by (d).
  • Page 912: Searching 16-Bit Binary Data (Minimum, Match, Maximum)

    Searching 16-bit binary data (minimum, match, maximum) SERMM(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions search the (n) points in the 16-bit binary data specified by (s1) for the same data as the 16-bit binary data specified by (s2), the minimum value, and the maximum value.
  • Page 913 Processing details • These instructions search the same data as the 16-bit binary data of (s2) in (n) data starting from (s1), and store the search result in (d) to (d)+4. • When the same data exists, five devices starting from (d) store the number of the same data, first and last positions of the same data, maximum value position, and minimum value position.
  • Page 914: Searching 32-Bit Binary Data (Minimum, Match, Maximum)

    Searching 32-bit binary data (minimum, match, maximum) DSERMM(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions search the (n) points in the 32-bit binary data specified by (s1) for the same data as the 32-bit binary data specified by (s2), the minimum value, and the maximum value.
  • Page 915 Processing details • These instructions search the same data as the 32-bit binary data of (s2)+1 and (s2) in (n) data starting from (s1)+1 and (s1), and store the search result in [(d)+1, (d)] to [(d)+9, (d)+8]. • When the same data exists, five devices starting from (d)+1 and (d) store the number of the same data, first and last positions of the same data, maximum value position, and minimum value position.
  • Page 916: Checking 16-Bit Binary Data

    Checking 16-bit binary data SUM(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the total number of "1" bits in the 16-bit binary data stored in the specified device. Ladder ENO:=SUM(EN,s,d); ENO:=SUMP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition SUMP...
  • Page 917 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.20 Data Processing Instructions...
  • Page 918: Checking 32-Bit Binary Data

    Checking 32-bit binary data DSUM(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions store the total number of "1" bits in the 32-bit binary data stored in the specified device. Ladder ENO:=DSUM(EN,s,d); ENO:=DSUMP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition DSUM...
  • Page 919 Operation error There is no operation error. 7 APPLICATION INSTRUCTIONS 7.20 Data Processing Instructions...
  • Page 920: Checking The Bit Status In 16-Bit Binary Data

    Checking the bit status in 16-bit binary data BON(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions check whether (n) bit(s) of the specified device are on or off, and stores the result in the device specified by (d).
  • Page 921 Processing details • These instructions check whether (n) bit(s) of the device specified by (s) are on or off, and stores the result in the device specified by (d). • When the result above is on, these instructions turn (d) on. When the result above is off, these instructions turn (d) off. (n)=5 0 (OFF) (n)=8...
  • Page 922: Checking The Bit Status In 32-Bit Binary Data

    Checking the bit status in 32-bit binary data DBON(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions check whether (n) bit(s) of the specified device are on or off, and stores the result in the device specified by (d).
  • Page 923 Processing details • These instructions check whether (n) bit(s) of the device specified by (s) are on or off, and stores the result in the device specified by (d). • When the result above is on, these instructions turn (d) on. When the result above is off, these instructions turn (d) off. (s)+1, (s) (n)=5 0 (OFF)
  • Page 924: Searching The Maximum Value Of 16-Bit Binary Data

    Searching the maximum value of 16-bit binary data MAX(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points of 16-bit binary data in the specified device for the maximum value. Ladder ENO:=MAXP(EN,s,n,d); ENO:=MAXP_U(EN,s,n,d); FBD/LD *1 The MAX and MAX_U instructions do not support the ST and FBD/LD.
  • Page 925 Processing details • These instructions search the (n) points of 16-bit binary data in the device specified by (s) for the maximum value, and store the maximum value in the device specified by (d). Each instruction searches data starting from the device specified by (s) and detects first the maximum value in the xth point from (s), and stores x in (d)+1 and the number of maximum values in (d)+2.
  • Page 926: Searching The Maximum Value Of 32-Bit Binary Data

    Searching the maximum value of 32-bit binary data DMAX(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points of 32-bit binary data in the specified device for the maximum value. Ladder ENO:=DMAXP(EN,s,n,d); ENO:=DMAXP_U(EN,s,n,d); FBD/LD *1 The DMAX and DMAX_U instructions do not support the ST and FBD/LD.
  • Page 927 Processing details • These instructions search the (n) points of 32-bit binary data in the device specified by (s) for the maximum value, and store the maximum value in the devices specified by (d) and (d)+1. Each instruction searches data starting from the device specified by (s) and detects first the maximum value in the xth point from (s), and stores x in (d)+2 and the number of maximum values in (d)+3.
  • Page 928: Searching The Minimum Value Of 16-Bit Binary Data

    Searching the minimum value of 16-bit binary data MIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points of 16-bit binary data in the specified device for the minimum value. Ladder ENO:=MINP(EN,s,n,d); ENO:=MINP_U(EN,s,n,d); FBD/LD *1 The MIN and MIN_U instructions do not support the ST and FBD/LD.
  • Page 929 Processing details • These instructions search the (n) points of 16-bit binary data in the device specified by (s) for the minimum value, and store the minimum value in the device specified by (d). Each instruction searches data starting from the device specified by (s) and detects first the minimum value in the xth point from (s), and stores x in (d)+1 and the number of minimum values in (d)+2.
  • Page 930: Searching The Minimum Value Of 32-Bit Binary Data

    Searching the minimum value of 32-bit binary data DMIN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the (n) points of 32-bit binary data in the specified device for the minimum value. Ladder ENO:=DMINP(EN,s,n,d); ENO:=DMINP_U(EN,s,n,d); FBD/LD *1 The DMIN and DMIN_U instructions do not support the ST and FBD/LD.
  • Page 931 Processing details • These instructions search the (n) points of 32-bit binary data in the device specified by (s) for the minimum value, and store the minimum value in the devices specified by (d) and (d)+1. Each instruction searches data starting from the device specified by (s) and detects first the minimum value in the xth point from (s), and stores x in (d)+2 and the number of minimum values in (d)+3.
  • Page 932: Sorting 16-Bit Binary Data

    Sorting 16-bit binary data SORTD(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions sort (n) points of 16-bit binary data in ascending or descending order. Ladder ENO:=SORTD(EN,s1,n,s2,d1,d2); ENO:=SORTD_U(EN,s1,n,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition SORTD SORTD_U...
  • Page 933 Processing details • These instructions sort (n) points of 16-bit binary data from (s1) in ascending or descending order. Data is sorted in ascending order when SM703 is off and in descending order when SM703 is on. (s1) -124 (s1)+1 SM703: OFF (s1) (s1)+2...
  • Page 934: Sorting 32-Bit Binary Data

    Sorting 32-bit binary data DSORTD(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions sort (n) points of 32-bit binary data in ascending or descending order. Ladder ENO:=DSORTD(EN,s1,n,s2,d1,d2); ENO:=DSORTD_U(EN,s1,n,s2,d1,d2 (s1) (s2) (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DSORTD DSORTD_U...
  • Page 935 Processing details • These instructions sort (n) points of 32-bit binary data from (s1) in ascending or descending order. Data is sorted in ascending order when SM703 is off and in descending order when SM703 is on. (s1)+1, (s1) -1000 (s1)+3, (s1)+2 -124 SM703: OFF...
  • Page 936: Adding 16-Bit Binary Data

    Adding 16-bit binary data WSUM(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the (n) points of 16-bit binary data from the specified device. Ladder ENO:=WSUM(EN,s,n,d); ENO:=WSUM_U(EN,s,n,d); ENO:=WSUMP(EN,s,n,d); ENO:=WSUMP_U(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition WSUM WSUM_U WSUMP...
  • Page 937 Processing details • These instructions add the (n) points of 16-bit binary data in the device starting from the one specified by (s), and store the result in the device specified by (d). 4444 (BIN) (s)+1 3333 (BIN) (s)+2 1234 (BIN) 13914 (BIN) (d)+1 (s)+3...
  • Page 938: Adding 32-Bit Binary Data

    Adding 32-bit binary data DWSUM(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add the (n) points of 32-bit binary data in the devices starting from the specified one. Ladder ENO:=DWSUM(EN,s,n,d); ENO:=DWSUM_U(EN,s,n,d); ENO:=DWSUMP(EN,s,n,d); ENO:=DWSUMP_U(EN,s,n,d); FBD/LD ■Execution condition Instruction Execution condition DWSUM...
  • Page 939 Processing details • These instructions add the (n) points of 32-bit binary data in the device starting from the one specified by (s), and store the result in the device specified by (d). (s)+1, (s) 32767000 (BIN) (s)+3, (s)+2 6000 (BIN) (d)+1 68640000 (BIN) (s)+5, (s)+4...
  • Page 940: Calculating The Mean Value Of 16-Bit Binary Data

    Calculating the mean value of 16-bit binary data MEAN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the average value of the (n) points of 16-bit data in the devices starting from the specified one. Ladder ENO:=MEAN(EN,s,n,d);...
  • Page 941 Processing details • These instructions calculate the average value of the (n) points of 16-bit binary data in the devices starting from the one specified by (s), and stores the average value in the device specified by (d). (s)+1 (s)+2 (s)+(n)-1 (1) Mean value •...
  • Page 942: Calculating The Mean Value Of 32-Bit Binary Data

    Calculating the mean value of 32-bit binary data DMEAN(P)(_U) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions calculate the average value of the (n) points of 32-bit data in the devices starting from the specified one. Ladder ENO:=DMEAN(EN,s,n,d);...
  • Page 943 Processing details • These instructions calculate the average value of the (n) points of 32-bit binary data in the devices starting from the one specified by (s), and stores the average value in the device specified by (d). (s)+1, (s) (d)+1, (d) (s)+3, (s)+2 (s)+2(n)-1, (s)+2(n)-2...
  • Page 944: Calculating The Square Root Of 16-Bit Binary Data

    Calculating the square root of 16-bit binary data SQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions perform a square root operation of the specified 16-bit binary data.
  • Page 945: Calculating The Square Root Of 32-Bit Binary Data

    Calculating the square root of 32-bit binary data DSQRT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions perform a square root operation of the specified 32-bit binary data.
  • Page 946: Crc Operation

    CRC operation CRC(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) • The RnCPU and RnENCPU with firmware version "17" or later support these instructions. (Use an engineering tool with version "1.020W" or later.) These instructions generate the CRC value for (n) 8-bit data (unit: byte) starting from the device specified by (s), and store the CRC value to the device specified by (d).
  • Page 947 Processing details • These instructions generate the CRC value for (n) 8-bit data (unit: byte) starting from the device specified by (s), and store the CRC value to the device specified by (d). "X +1" is used in the generator polynomial of the CRC value (CRC-16).
  • Page 948: Database Access Instructions

    7.21 Database Access Instructions The database access instructions add, update, obtain, or delete data with respect to the tabular data such as product and production information managed as databases in the programmable controller. These instructions construct a database from the Unicode text file that defines information such as a table configuration, and operates the database thus constructed.
  • Page 949 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD ...
  • Page 950 Precautions In the following cases, the error completion signal in (d1)+1 is turned on and an error code is stored as the completion status in the device (d2). • The DBIMPORT(P) instruction is executed during execution of the database access instruction. •...
  • Page 951: Exporting Data From The Data Base

    Exporting data from the data base DBEXPORT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions export the data stored in the specified database to the Unicode text file. Ladder ENO:=DBEXPORT(EN,s,d1,d2); ENO:=DBEXPORTP(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DBEXPORT...
  • Page 952 Processing details • These instructions export the data in the database stored in the database folder at the path specified by (s) to the Unicode text file. • The Unicode text file is created in the folder where the database folder is stored. The file name is "database_name.txt". If the same Unicode text file already exists, the file is overwritten with the exported data.
  • Page 953 Operation error Error code Description (SD0) 2840H A numerical value other than 2 is specified for the drive number in (s). For the error code stored in the completion status of the operand, refer to the following. Page 986 Error codes related to database access instructions 7 APPLICATION INSTRUCTIONS 7.21 Database Access Instructions...
  • Page 954: Opening The Data Base

    Opening the data base DBOPEN(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions connect to the database specified by (s) and make it available. Ladder ENO:=DBOPEN(EN,s,d1,d2,d3); ENO:=DBOPENP(EN,s,d1,d2,d3); (d1) (d2) (d3) FBD/LD ■Execution condition Instruction Execution condition DBOPEN DBOPENP Setting data...
  • Page 955 Processing details • These instructions connect to the database stored in the folder path specified by (s) and makes it available. • Specify "(drive number):(database folder path)" for the storage location. The drive number is fixed to 2 (SD memory card). •...
  • Page 956: Closing The Data Base

    Closing the data base DBCLOSE(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions clear the connection from the specified database. Ladder ENO:=DBCLOSE(EN,s,d1,d2); ENO:=DBCLOSEP(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DBCLOSE DBCLOSEP Setting data ■Description, range, data type Operand Description Range...
  • Page 957 Processing details • These instructions release the connection between the database identification number specified by (s) and the corresponding database. • Upon successful completion, the completion signal in the completion device (d1)+0 is turned on and 0 is stored as the completion status in the device (d2).
  • Page 958: Adding A Record To The Data Base

    Adding a record to the data base DBINSERT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions add a record to the table of the database corresponding to the specified identification number. Ladder ENO:=DBINSERT(EN,s1,s2,s3,s4,d1,d2); ENO:=DBINSERTP(EN,s1,s2,s3,s4,d1,d2); (s1) (s2) (s3) (s4) (d1)
  • Page 959 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 960 ■Insertion data Operand: (s4) Device Item Description Setting range Set by Number of records Specify the number of records to be added. 1 to m User The number of records to be added is a value which satisfies the following formula: Number of records (m) ...
  • Page 961 When registering a record with ID = 0003H to the product information table (proInfo) in the database using the DBINSERT(P) instruction [Product information table (proInfo)] Product Size(x) Size(y) Size(z) 0001H "AAA1" 0002H "BBB2" 0003H "CCC3" · WORD type WSTRING type (15 characters) Product Size(x) WORD type...
  • Page 962 Processing details • These instructions add a record to the table specified by (s2) in the database corresponding to the identification number specified by (s1). • Specify the number of fields of the record to be added and field names in (s3). For the field names to be added, not all fields making up the table need to be specified.
  • Page 963 Precautions In the following cases, the error completion signal in (d1)+1 is turned on and an error code is stored as the completion status in the device (d2). • The DBINSERT(P) instruction is executed during execution of the database access instruction. •...
  • Page 964: Updating The Record In The Data Base

    Updating the record in the data base DBUPDATE(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions update all records that meet the specified condition in the specified table corresponding to the specified identification number. Ladder ENO:=DBUPDATE(EN,s1,s2,s3,s4,s5,d1,d2); ENO:=DBUPDATEP(EN,s1,s2,s3,s4,s5,d1,d2);...
  • Page 965 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 966 ■Update condition Operand: (s5) Device Item Description Setting range Set by Data size of the first Set the data size of the first update condition. 1 to 125 User condition Data size of the second Set the data size of the second update condition. 0 to 125 User condition...
  • Page 967 When updating Output of a record with ID = 0002H to 35 using the DBUPDATE(P) instruction [Production result table (proReport)] Product Output 0001H "AAA1" 0002H "BBB2" 0003H "CCC3" · Database [Program] DBUPDATE "proReport" D100 D200 D300 D500 Table name The program updates the information of ID 0002H by using the DBUPDATE instruction.
  • Page 968 Processing details • Updates all record that meets the condition specified by (s5) in the table specified by (s2) in the database specified by the identification number specified by (s1). • Specify the field name of the record to be updated in (s3). Not all fields in the table need to be specified but at least one field needs to be specified.
  • Page 969 • The following figure shows the operation of the completion device at completion of the DBUPDATE(P) instruction. END processing END processing END processing Program DBUPDATE(P) instruction Completion device (d1) Error completion Completion device (d1)+1 Updating the database • SM753 (File being accessed) turns on while the DBUPDATE(P) instruction is executed. While SM753 is on, the DBUPDATE(P) instruction cannot be executed.
  • Page 970: Searching The Record In The Data Base

    Searching the record in the data base DBSELECT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions search the records in the table in the database corresponding to the specified identification number. Ladder ENO:=DBSELECT(EN,s1,s2,s3,s4,d1,d2,d3); ENO:=DBSELECTP(EN,s1,s2,s3,s4,d1,d2,d3); (s1) (s2) (s3) (s4) (d1)
  • Page 971 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 972 ■Search condition Operand: (s4) Device Item Description Setting Set by Data range type Data size of the first Set the data size of the first search condition in units of words in (s4)+4. If 0 is 0 to 125 User WORD condition set in (s4), all records in the table are to be output.
  • Page 973 The following figure shows the setting format of (s4). (In the case of data type WORD) Set as many field names, condition numbers, logical operator setting values, and determination values as there are update conditions. The data size of the determination value follows the size of the data type of each field. (Page 956 DBINSERT(P)) ∙∙∙...
  • Page 974 When retrieving "Size(z)" with ID = 0001H using the DBSELECT(P) instruction [Product information table (proInfo)] Product Size(x) Size(y) Size(z) 0001H "AAA1" 0002H "BBB2" · Database [Program] [Output result] D300 0001H 1 record DBSELECT D100 D200 D300 D500 [Searched value] D301 →(9) The program searches and outputs the Size(z) value of ID 0001H by using the...
  • Page 975 When retrieving the "Size(z)" value greater than ID = 0001H and less than ID = 00003H using the DBSELECT(P) instruction [Product information table (proInfo)] Product Size(x) Size(y) Size(z) 0001H "AAA1" 0002H "BBB2" 0003H "CCC3" · Database [Program] [Output result] D300 0001H 1 record DBSELECT...
  • Page 976 Processing details • These instructions search the records in the table specified by (s2) in the database corresponding to the identification number specified by (s1). The maximum number of outputs is 64. • Specify the field name of the record to be searched for in (s3). •...
  • Page 977 Precautions In the following cases, the error completion signal in (d2)+1 is turned on and an error code is stored as the completion status in the device (d3). • The DBSELECT(P) instruction is executed during execution of the database access instruction. •...
  • Page 978: Deleting The Record In The Data Base

    Deleting the record in the data base DBDELETE(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions delete the record that meets the specified condition in the specified table in the database corresponding to the specified identification number. Ladder ENO:=DBDELETE(EN,s1,s2,s3,d1,d2);...
  • Page 979 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, J\ T, ST, C, D, W, U\G, J\, LT, LST, K, H E SM, F, B, SB, SD, SW, FD, R, U3E\(H)G FX, FY ZR, RD (s1) ...
  • Page 980 Processing details • These instructions delete the record that meets the condition specified by (s3) in the table specified by (s2) in the database corresponding to the identification number specified by (s1). • Specify the deletion conditions in (s3). A maximum of two deletion conditions can be specified. •...
  • Page 981 Precautions In the following cases, the error completion signal in (d1)+1 is turned on and an error code is stored as the completion status in the device (d2). • This instruction is executed during execution of the database access instruction. •...
  • Page 982: Starting A Transaction

    Starting a transaction DBTRANS(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions declare the start of a transaction in relation to the database corresponding to the specified identification number. Ladder ENO:=DBTRANS(EN,s,d1,d2); ENO:=DBTRANSP(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DBTRANS...
  • Page 983 Processing details • These instructions declare the start of a transaction in relation to the database corresponding to the identification number specified by (s). However, if a data base other than the one specified by (s) is open, the DBTRANS instruction cannot start a transaction and is completed with an error.
  • Page 984: Committing A Transaction

    Committing a transaction DBCOMMIT(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions commit the transaction in relation to the database corresponding to the specified identification number. Ladder ENO:=DBCOMMIT(EN,s,d1,d2); ENO:=DBCOMMITP(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DBCOMMIT DBCOMMITP Setting data...
  • Page 985 Processing details • These instructions commit the transaction in relation to the database corresponding to the identification number specified by (s). • Upon normal completion, the completion signal in the completion device (d1) is turned on and 0 is stored as the completion status in the device (d2).
  • Page 986: Performing A Database Rollback

    Performing a database rollback DBROLBAK(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions execute the rollback of the database corresponding to the specified identification number. Ladder ENO:=DBROLBAK(EN,s,d1,d2); ENO:=DBROLBAKP(EN,s,d1,d2); (d1) (d2) FBD/LD ■Execution condition Instruction Execution condition DBROLBAK DBROLBAKP Setting data...
  • Page 987 Processing details • These instructions execute the rollback in relation to the database corresponding to the identification number specified by (s). • Upon normal completion, the completion signal in the completion device (d1) is turned on and 0 is stored as the completion status in the device (d2).
  • Page 988: Error Codes Related To Database Access Instructions

    Error codes related to database access instructions The following table lists the error codes that could be stored in the completion status of database access instructions. Error Error content Action code 0103H CPU internal error Turn power off and turn it on again or reset the system and check whether the instruction can be executed.
  • Page 989 Error Error content Action code 096EH The record cannot be deleted because it is referenced by another Check whether the setting values of the record to be deleted include table. the value of a table referenced by an external key. 0970H An attempt was made to add or delete a record but failed because no Check that a referenced table is available.
  • Page 990 Error Error content Action code 1000H The Unicode text file specified for importing does not exist. Check whether the file indicated by the folder path is a Unicode text file. If not, specify a correct folder path. 1002H There is no identification number that can be allocated. A maximum of four databases can be opened.
  • Page 991 Error Error content Action code 2000H The format of the Unicode text file is incorrect. • Check whether the format of the Unicode text file is correct. If not, correct it. • Check whether the number of characters in the comment line is within the range.
  • Page 992 Error Error content Action code 2025H The database cannot be recognized. Or recovery of the database • Check the status of the SD memory card. failed. • If the error database check file (2:\CPUDB\ErrorDB.txt) exists and it lists a database which resides under the CPUDB folder or its subfolder, delete the database with its folder and then create a new database.
  • Page 993: File Register Operation Instructions

    7.22 File Register Operation Instructions Switching the file register block number RSET(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions change the block number of the file register used in the program. Ladder ENO:=RSET(EN,s); ENO:=RSETP(EN,s); FBD/LD ■Execution condition Instruction Execution condition...
  • Page 994 Processing details • These instructions switch the block number of the file register used in the program to that stored in the device specified by (s). After the block number is changed, all file registers processed by the sequence program are those linked to the new block number.
  • Page 995: Changing The File Register File Name

    Changing the file register file name QDRSET(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions change the file name of the file register used in the program to that stored in the device specified by (file name).
  • Page 996 Processing details • These instructions change the file name of the file register used in the program to that stored in the device specified by (file name). After the file name is changed, all file registers processed by the program are those linked to block number 0 of the new file name.
  • Page 997: File Register Read/Write Instructions

    7.23 File Register Read/Write Instructions Reading 1-byte data from the file register ZRRDB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions read the data from the file register with the specified serial byte number. Ladder ENO:=ZRRDB(EN,s,d); ENO:=ZRRDBP(EN,s,d);...
  • Page 998 Processing details • Without recognizing block numbers, these instructions read the data from the file register with the serial byte number specified by (s), and store the data in the lower 8 bits of the device specified by (d). 00H is stored in the upper 8 bits of the device specified by (d).
  • Page 999: Writing 1-Byte Data To The File Register

    Writing 1-byte data to the file register ZRWRB(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions write the data in the lower bits of the specified device to the file register with the specified serial byte number.
  • Page 1000 Processing details • Without recognizing block numbers, these instructions write the lower 8-bit data stored in the device specified by (s2) to the file register with the serial byte number specified by (s1). The instructions ignore upper 8-bit data in the device specified by (s2).
  • Page 1001: Indirect Address Read Instructions

    7.24 Indirect Address Read Instructions Reading the indirect address ADRSET(P) RnPCPU RnPCPU RnSFCPU RnSFCPU RnCPU RnENCPU (Process) (Redundant) (Standard) (Safety) These instructions read the indirect address of the specified device. Ladder ENO:=ADRSET(EN,s,d); ENO:=ADRSETP(EN,s,d); FBD/LD ■Execution condition Instruction Execution condition ADRSET ADRSETP Setting data ■Descriptions, ranges, and data types...

Table of Contents