# Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Instructions, standard functions/function blocks

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

#### Summary of Contents for Mitsubishi Electric MELSEC iQ-F FX5

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

• Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference, please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples.

CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .

Standard arithmetic functions ............. . . 97 Standard bit shift functions .

Shifting n-bit data to the left by n bit(s) ............151 Shifting n-word data to the right by n word(s) .

Performing an OR operation on 16-bit data........... . 255 Performing an OR operation on 32-bit data.

Seven Segment With Latch ..............331 Separating 4 bits from 16-bit data .

Reading the oldest data from the data table ........... 406 Reading the newest data from the data table .

Calculating the sine of single-precision real number ..........515 Calculating the cosine of single-precision real number .

8.19 Initial State ................627 Initial State .

Reading 1-word/2-word data from another module ..........726 Writing 1-word/2-word data to another module (32-bit specification) .

14.2 High-speed Current Value Transfer Instruction ..........816 High-speed current value transfer of 16-bit data .

18.4 Converting BOOL to DINT ............. . . 903 18.5 Converting BOOL to TIME .

18.55 Writing the Specified Bit of Word Label ........... . 971 18.56 Copying the Specified Bit of Word Label .

25.4 Link Character Strings ..............1029 25.5 Inserting Character String .
• ### Page 18: Relevant Manuals

Functions and programming for the synchronous control of the Simple Motion Synchronous Control) module. <IB0300255> MELSEC iQ-F FX5 User's Manual (Analog Control - CPU module built- Describes the analog function of the CPU module built-in and the analog adapter. in, Expansion adapter) <JY997D60501>...
• ### Page 19: Terms

TERMS Unless otherwise specified, this manual uses the following terms. For details of the FX3 devices that can be connected with the FX5, refer to the User's Manual (Hardware) of the CPU module to be used. Terms Description ■Devices Generic term for FX5U and FX5UC PLCs Generic term for FX3S, FX3G, FX3GC, FX3U, and FX3UC PLCs FX5 CPU module Generic term for FX5U CPU module and FX5UC CPU module...
• Page 20 Different name for FX3U-32BL Peripheral device Generic term for engineering tools and GOTs Generic term for Mitsubishi Electric Graphic Operation Terminal GOT1000 and GOT2000 series ■Software packages Engineering tool The product name of the software package for the MELSEC programmable controllers...
• ### Page 21: How To Read This Manual

HOW TO READ THIS MANUAL The following describes the page layout and symbols used in this manual. How to read PART 3 and PART 4 The contents described in this section are provided only for explaining how to read this manual. Thus, the actual description may differ.
• Page 22 Indicates the description, setting range, data type, and data type (label) of each operand. • For the data type, refer to the following. MELSEC iQ-F FX5 Programming Manual (Program Design) Indicates the applicable devices for each operand. The following table describes the usage classification.
• Page 23 How to read PART 5 and PART 6 The contents described in this section are provided only for explaining how to read this manual. Thus, the actual description may differ. 18.28 Converting DINT to INT  DINT_TO_INT(_E) These functions convert DINT type data to INT type data. ...
• Page 24 MEMO...
• ### Page 25: Part 1 Overview

PART 1 OVERVIEW Part 1 consists of the following chapter. 1 OVERVIEW 2 PRECAUTIONS ON PROGRAMMING...
• ### Page 26: Chapter 1 Overview

OVERVIEW Instruction Configuration Many instructions available for CPU module 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 27: Data Specification Method

Be careful when a large numerical value is used such as for the number of transfers. It delays the scan time. Data Specification Method The following table lists the types of data that can be used for instructions in CPU modules. Data Classification Bit data...
• Page 28 Label data ■Primitive data type Data type (label) Specifiable label • Bit type label (BOOL) • Bit-specified word [unsigned]/bit string [16 bits] type label • Bit-specified word [signed] type label • Timer/retentive timer/long timer/long retentive timer type label contact/coil • Counter/ long counter type label contact/coil Word [unsigned]/bit string [16 bits] •...
• Page 29 ■Generic data type Data type (label) Specifiable label Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string, structure ANY_BITADDR ANY_BOOL ANY_ELEMENTARY Bit, word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits], single-precision real number, hour, character string ANY_WORDADDR Word [signed], double word [signed], word [unsigned]/bit string [16 bits], double word [unsigned]/bit string[32 bits],...
• ### Page 30: 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 31: 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 32 Nibble specification range The following table lists the range of 16-bit data for each nibble specification. Nibble 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 33: Bit Data (Double Word Data)

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. 32-bit data (double word data) Data size and data range 32-bit data includes signed and unsigned 32-bit data.
• Page 34 Nibble specification range The following table lists the range of 32-bit data for each nibble specification. Nibble 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 35 ■Specifying a bit device with nibble specification in the source (s) When a bit device with nibble specification is specified in the source of an instruction, 0 is stored in the bits, which follow the bit for which nibble specification is made in the source, in the word device of the destination. Ladder example Processing •...
• ### Page 36: 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. Real number data can be stored only in devices other than bit devices or in single-precision real data type labels. Data name Data size Value range -126...
• Page 37 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 The setting range of real number data is as follows.
• ### Page 38: Character String Data

Character 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 NULL(00H) Character string data is stored in devices or an array in ascending order of device numbers or array element numbers.
• ### Page 39: Execution Condition

Execution Condition Types of execution conditions The following are the five types of execution conditions of the instructions and functions of CPU module. ■On 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.
• ### Page 40: Chapter 2 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 (SD0/SD8067) An I/O number which corresponds to no module is specified. 2801H • An I/O number which is out of range (0 to 1777(Octal number)) is specified. 2820H •...
• ### Page 41: 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 If two or more OUT, SET/RST, and PLS/PLF instructions are executed using the same device during one scan, they operate as described in this section. For OUT instructions of the same device More than one OUT instruction of the same device must not be issued during one scan.
• Page 42 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 43 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 44 • 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 on. (3) Since X0 is other than turning on, M0 turns off. (4) Since X1 is other than turning on, M0 remains off.
• Page 45 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 PLF instructions of the same device are issued during one scan, the specified device is turned on when the execution command of each PLF instruction specifies an on-to-off change.
• ### Page 46: Standard Function/Function Block Return Values

• 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 47 PART 2 INSTRUCTION/ FUNCTION LIST This part consists of the following chapters. 3 CPU MODULE INSTRUCTION 4 MODULE SPECIFIC INSTRUCTION 5 STANDARD FUNCTIONS/FUNCTION BLOCKS...
• ### Page 48: Chapter 3 Cpu Module Instruction

CPU MODULE INSTRUCTION Sequence Instruction Contact instruction ■Operation start, series connection, parallel connection Instruction symbol Description Reference Starts logical operation (Starts NO contact logical operation) Page 104 Starts logical NOT operation (Starts NC contact logical operation) Logical AND (NO contact series connection) Logical NAND (NC contact series connection) Logical OR (NO contact parallel connection) Logical NOR (NC contact parallel connection)
• Page 49 ■Converting the operation result into a pulse Instruction symbol Description Reference Conversion of operation result to rising edge pulse Page 113 Conversion of operation result to falling edge pulse Output instruction ■Out (excluding the timer, counter and annunciator) Instruction symbol Description Reference Device output...
• Page 50 Shift instruction ■Shifting bit devices Instruction symbol Description Reference 1 bit shift of the device Page 139 SFTP ■Shifting 16-bit data to the right/left by n bit (s) Instruction symbol Description Reference Page 141 bn-1 (SM700, SM8022) SFRP 0∙∙∙0 Page 143 bn+1 bn (SM700, SM8022) SFLP...
• Page 51 ■Shifting n-bit data to the right/left by n bit (s) Instruction symbol Description Reference SFTR Page 149 (n1) (n2) (n2) SFTRP SFTL Page 151 (n1) (n2) (n2) SFTLP ■Shifting n-word data to the right/left by n word (s) Instruction symbol Description Reference WSFR...
• ### Page 52: Basic Instruction

Basic Instruction Comparison operation instruction ■Comparing 16-bit binary data Instruction symbol Description Reference LD=, AND=, OR= (s1)=(s2): Conductive Page 165 (s1)(s2): Non-Conductive LD=_U, AND=_U, OR=_U LD<>, AND<>, OR<> (s1)(s2): Conductive (s1)=(s2): Non-Conductive LD<>_U, AND<>_U, OR<>_U LD>, AND>, OR> (s1)>(s2): Conductive (s1)(s2): Non-Conductive LD>_U, AND>_U, OR>_U LD<=, AND<=, OR<=...
• Page 53 ■Comparing 16-bit binary data band Instruction symbol Description Reference (s1)>(s3): (d) is on Page 173 (s1)(s3)(s2): (d) + 1 is on ZCPP (s3)>(s2): (d) + 2 is on ZCP_U ZCPP_U ■Comparing 32-bit binary data band Instruction symbol Description Reference DZCP [(s1)+1, (s1)] >...
• Page 54 Arithmetic operation instruction ■Adding/subtracting 16-bit binary data Instruction symbol Description Reference (d)+(s)  (d) Page 182 +P_U (s1)+(s2)  (d) Page 184 +P_U (s1)+(s2)  (d) Page 186 ADDP ADD_U ADDP_U (d)-(s)  (d) Page 188 -P_U (s1)-(s2)  (d) Page 190 -P_U (s1)-(s2) ...
• Page 55 ■Adding/subtracting 32-bit binary data Instruction symbol Description Reference [(d)+1, (d)] + [(s)+1, (s)]  [(d)+1, (d)] Page 194 D+_U D+P_U [(s1)+1, (s1)] + [(s2)+1, (s2)]  [(d)+1, (d)] Page 195 D+_U D+P_U [(s1)+1, (s1)] + [(s2)+1, (s2)]  [(d)+1, (d)] DADD Page 197 DADDP...
• Page 56 ■Multiplying/dividing 32-bit binary data Instruction symbol Description Reference [(s1)+1, (s1)]  [(s2)+1, (s2)]  [(d)+3, (d)+2, (d)+1, (d)] Page 213 D*_U D*P_U [(s1)+1, (s1)]  [(s2)+1, (s2)]  [(d)+3, (d)+2, (d)+1, (d)] DMUL Page 215 DMULP DMUL_U DMULP_U [(s1)+1, (s1)]  [(s2)+1, (s2)]  quotient [(d)+1, (d)], remainder [(d)+3, (d)+2] Page 217 D/_U D/P_U...
• Page 57 ■Adding/subtracting 16-bit binary block data Instruction symbol Description Reference Adds the 16-bit binary bit data in the device area ((n) points) from (s1) and the data or constants in Page 236 the device area ((n) points) from (s2) at once, and stores the result in the device area ((n) points) BK+P from (d).
• Page 58 Logical operation instruction ■Performing an AND operation on 16-bit/32-bit data Instruction symbol Description Reference (d)(s)  (d) WAND Page 249 WANDP (s1) (s2)  (d) WAND Page 250 WANDP [(d)+1, (d)] [(s)+1, (s)]  [(d)+1, (d)] DAND Page 251 DANDP [(s1)+1, (s1)]...
• Page 59 ■Performing an XNOR operation on 16-bit/32-bit data Instruction symbol Description Reference WXNR Page 267 WXNRP WXNR Page 268 (s1) (s2) WXNRP DXNR Page 269 [(d)+1, (d)] [(s)+1, (s)] [(d)+1, (d)] DXNRP DXNR Page 270 [(s1)+1, (s1)] [(s2)+1, (s2)] [(d)+1, (d)] DXNRP ■Performing an XNOR operation on 16-bit block data Instruction symbol...
• Page 60 ■Batch-resetting devices Instruction symbol Description Reference ZRST Page 280 (d2) (d1)+2 (d1)+1 (d1) ZRSTP (d2) (d1)+2 (d1)+1 (d1) (1): (d1), (d2) are bit devices: Writes off (reset) from (d1) to (d2) (d1), (d2) are word devices: Writes K0 from (d1) to (d2) Data conversion instruction ■Converting binary data to BCD 4-digit/8-digit data Instruction symbol...
• Page 61 ■Converting 16-bit signed binary data to 16-bit/32-bit unsigned binary data Instruction symbol Description Reference INT2UINT Converts 16-bit signed data in the device specified by (s) to 16-bit unsigned data, and stores the Page 294 converted data in the device specified by (d). INT2UINTP INT2UDINT Converts 16-bit signed data in the device specified by (s) to 32-bit unsigned data, and stores the...
• Page 62 ■Converting 16-bit/32-bit binary data to Gray code Instruction symbol Description Reference Converts the specified 16-bit binary data (-32768 to 32767) to 16-bit binary Gray code data. Page 306 GRYP Gc: Gray code GRY_U Converts the specified 16-bit binary data (0 to 65535) to 16-bit binary Gray code data. GRYP_U Gc: Gray code DGRY...
• Page 63 ■Converting character string to 16-bit/32-bit binary data Instruction symbol Description Reference Converts a character string including decimal point in the device specified by (s) to a 1 word binary Page 318 value and number of decimal fraction digits, and stores the converted data in the devices specified VALP by (d1) and (d2).
• Page 64 ■Separating/connecting the specified number of bits Instruction symbol Description Reference NDIS Separates the data in the devices starting from the one specified by (s1) into bits specified by the Page 337 devices from (s2), and stores them to the devices starting from the one specified by (d). NDISP NUNI Connects the data in the devices starting from the one specified by (s1) with bits specified by the...
• Page 65 ■Transferring identical 16-bit block data (65535 points maximum) Instruction symbol Description Reference FMOV Page 356 FMOVP (n) = 1 to 65535 ■Transferring identical 32-bit block data (65535 points maximum) Instruction symbol Description Reference DFMOV Page 358 (d+1, d) (s+1, s) DFMOVP (n) = 1 to 65535 ■Exchanging 16-bit/32-bit data...
• ### Page 66: Application Instruction

Application Instruction Rotation instruction ■Rotating 16-bit data to the right Instruction symbol Description Reference Rotates the 16-bit binary data to the right by (n) bit(s) (not including the carry flag). Page 371 (SM700, SM8022) RORP (1): (n) bit right rotation Rotates the 16-bit binary data to the right by (n) bit(s) (including the carry flag).
• Page 67 ■Rotating 32-bit data to the left Instruction symbol Description Reference DROL Rotates the 32-bit binary data to the left by (n) bit(s) (not including the carry flag). Page 379 (d+1) (SM700, SM8022) ∙∙∙ b16 b15 ∙∙∙ DROLP (1): (n) bit left rotation DRCL Rotates the 32-bit binary data to the left by (n) bit(s) (including the carry flag).
• Page 68 Structuring instruction ■Performing the FOR to NEXT instruction loop Instruction symbol Description Reference Execute the instructions between FOR instruction and NEXT instruction (n) times Page 395 NEXT ■Forcibly terminating the FOR to NEXT instruction loop Instruction symbol Description Reference BREAK Forcibly end execution between FOR instruction and NEXT instruction, and jump to pointer (P) Page 397 BREAKP...
• Page 69 ■Writing data to the data table Instruction symbol Description Reference SFWR Page 410 SFWRP P: Pointer ■Deleting/inserting data from/to the data table Instruction symbol Description Reference FINS Page 412 FINSP N: Number of stored data FDEL Page 414 FDELP N: Number of stored data Reading/writing data instructions ■Reading data from the data memory Instruction symbol...
• Page 70 Character string operation instruction ■Comparing character strings Instruction symbol Description Reference LD\$=, AND\$=, OR\$= Compares the character string (s1) with the character string (s2) one character at a time. Page 431 [Character string (s1)] = [Character string (s2)]: Conductive state [Character string (s1)] ...
• Page 71 ■Converting 16-bit/32-bit binary data to character string Instruction symbol Description Reference Converts the 1 word binary value specified by (s2) to the decimal character string with total number Page 447 of digits and the number of digits in the decimal fraction part as specified in (s1), and stores this in STRP the device specified by (d).
• Page 72 Real number instruction ■Comparing single-precision real numbers Instruction symbol Description Reference LDE=, ANDE=, ORE= [(s1)+1, (s1)] = [(s2)+1, (s2)]: Conductive Page 476 [(s1)+1, (s1)]  [(s2)+1, (s2)]: Non-Conductive [(s1)+1, (s1)]  [(s2)+1, (s2)]: Conductive LDE<>, ANDE<>, ORE<> [(s1)+1, (s1)] = [(s2)+1, (s2)]: Non-Conductive LDE>, ANDE>, ORE>...
• Page 73 ■Converting 16-bit/32-bit unsigned binary data to single-precision real number Instruction symbol Description Reference UINT2FLT Converts the 16-bit unsigned binary data in the device specified by (s) to single-precision real Page 503 number, and stores the converted data in (d). UINT2FLTP UDINT2FLT Converts the 32-bit unsigned binary data in the device specified by (s) to single-precision real Page 505...
• Page 74 ■Calculating the tangent of single-precision real number Instruction symbol Description Reference Tan [(s)+1, (s)]  [(d)+1, (d)] Page 519 TANP DTAN DTANP ■Calculating the arc sine of single-precision real number Instruction symbol Description Reference [(s)+1, (s)]  [(d)+1, (d)] ASIN Page 521 ASINP DASIN...
• Page 75 ■Calculating the exponent of single-precision real number Instruction symbol Description Reference [(s)+1, (s)]  [(d)+1, (d)] Page 533 EXPP DEXP DEXPP ■Calculating the natural logarithm of single-precision real number Instruction symbol Description Reference Loge[(s)+1, (s)]  [(d)+1, (d)] Page 535 LOGP DLOGE DLOGEP...
• Page 76 Index register operation instruction ■Saving/returning all data of the index register Instruction symbol Description Reference ZPUSH Saves the contents of index registers to the devices specified by (d) onwards. Page 546 ZPUSHP ZPOP Reads the data in devices specified by (d) onwards to the index registers. Page 548 ZPOPP ■Saving/returning the selected data of the index register and long index register...
• Page 77 Instruction symbol Description Reference When [(s3)+1, (s3)] = 0: 0  [(d)+1, (d)] DZONE Page 562 When [(s3)+1, (s3)] > 0: [(s3)+1, (s3)] + [(s2)+1, (s2)]  [(d)+1, (d)] DZONEP When [(s3)+1, (s3)] < 0: [(s3)+1, (s3)] + [(s1)+1, (s1)]  [(d)+1, (d)] DZONE_U DZONEP_U ■Scaling 16-bit/32-bit binary data (point coordinates)
• Page 78 Special counter instruction ■Signed 32-bit bi-directional counters Instruction symbol Description Reference UDCNTF This instruction increments the current value of the counter specified by (d) by 1 when the Page 580 operation result up to UDCNTF instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes turns ON and NC contact becomes turns OFF.
• Page 79 Drum sequence ■16-bit binary data absolute method Instruction symbol Description Reference ABSD Creates many output patterns corresponding to the current value of a counter. Page 637 ■32-bit binary data absolute method Instruction symbol Description Reference DABSD Creates many output patterns corresponding to the current value of a counter. Page 639 ■Relative method Instruction symbol...
• Page 80 ■Bit judgment of 16-bit data/32-bit data Instruction symbol Description Reference Page 652 ······ BONP (1): b(n) ON  (d)=On b(n) OFF  (d)=Off DBON Page 654 ······ DBONP (1): b(n) ON  (d)=On b(n) OFF  (d)=Off ■Searching the maximum value of 16-bit/32-bit data Instruction symbol Description Reference...
• Page 81 ■Adding 16-bit data Instruction symbol Description Reference WSUM These instructions add the (n) points of 16-bit binary data in the device starting from the one Page 673 specified by (s), and store the result in the device specified by (d). WSUM_U WSUMP WSUMP_U...
• Page 82 Clock instruction ■Reading clock data Instruction symbol Description Reference (d)+0: Year Page 686 (d)+0 (d)+1: Month (d)+1 (d)+2: Day (d)+2 (d)+3 (d)+3: Hour TRDP (d)+4 (d)+4: Minute (d)+5 (d)+5: Seconds (d)+6 (d)+6: Day of week (1): Clock element ■Writing clock data Instruction symbol Description Reference...
• Page 83 ■Comparing date data Instruction symbol Description Reference LDDT=, ANDDT=, ORDT= Page 702 (s1) (s2) year year (s1)+1 (s2)+1 month month (s1)+2 (s2)+2 (1): Result LDDT<>, ANDDT<>, (s1) (s2) year year ORDT<> (s1)+1 (s2)+1 month < > month (s1)+2 (s2)+2 (1): Result LDDT>, ANDDT>, ORDT>...
• Page 84 ■Comparing clock data Instruction symbol Description Reference TCMP Page 708 (s1) (s4) hour hour TCMPP (s2) (s4)+1 minute > minute (d) = ON seconds seconds (s3) (s4)+2 (s1) (s4) hour hour (s2) (s4)+1 minute minute (d)+1 = ON seconds seconds (s3) (s4)+2 (s1)
• ### Page 85: Step Ladder Instructions

■Reading 1-word/2-word data from another module (16-bit specification) Instruction symbol Description Reference FROM These instructions read the (n) word data from the buffer memory of the intelligent function module. Page 720 FROMP DFROM These instructions read the (n)2 word data from the buffer memory of the intelligent function module.
• ### Page 86: Built-In Ethernet Function Instructions

Built-in Ethernet Function Instructions Open/Close Processing Instructions ■Opening a connection Instruction symbol Description Reference SP.SOCOPEN This instruction opens the connection specified by (s1). Page 738 ■Closing a connection Instruction symbol Description Reference SP.SOCCLOSE This instruction closes the connection specified by (s1). (Closing a connection) Page 741 Socket communication function instruction ■Reading receive data during the END processing...
• ### Page 87: Chapter 4 Module Specific Instruction

MODULE SPECIFIC INSTRUCTION Network Common Instruction Link dedicated instruction ■Reading data from another station programmable controller Instruction symbol Description Reference GP.READ Reads data from another station PLC device in units of words. Page 768 ■Reading data from another station programmable controller (with notification) Instruction symbol Description Reference...
• ### Page 88: High-Speed Counter Instruction

High-speed Counter Instruction High-speed processing instruction ■Setting 32-bit data comparison Instruction symbol Description Reference DHSCS Turns ON the bit device of (d) when the current value of the high-speed counter of CH specified by Page 804 (s2) is changed to the value specified by (s1). ■Reset 32-bit data comparison Instruction symbol Description...
• ### Page 89: External Device Communication Instruction

External Device Communication Instruction Serial communication 2 Instruction symbol Description Reference Sends/receives data by non-protocol communication. Page 820 Inverter Communication Instruction ■Inverter operation monitoring (Status check) Instruction symbol Description Reference IVCK Reads the contents of the corresponding instruction code from the specified inverter station Page 822 number.
• ### Page 90: Positioning Instruction

Positioning Instruction Positioning instruction ■Zero return(OPR) with 16-bit/32- bit data DOG search Instruction symbol Description Reference DSZR • When FX3 compatible operand is specified Page 841 Specifies the proximity dog signal, zero signal and device (Y). Outputs a pulse with the specified DDSZR Page 845 device (Y) to perform the zero return operation.
• ### Page 91: Bfm Device Read/ Write Instruction

■16-bit/32-bit data absolute positioning Instruction symbol Description Reference DRVA • When FX3 compatible operand is specified Page 873 Specifies the travel distance from the reference position, speed and performs pulse output with the DDRVA Page 876 specified device (Y). • When FX5 operand is specified Specifies the travel distance from the reference position, speed and performs pulse output with the specified axis number.
• ### Page 92: Chapter 5 Standard Functions/Function Blocks

STANDARD FUNCTIONS/FUNCTION BLOCKS Standard Functions Type conversion functions Converting BOOL to WORD/DWORD Function symbol Description Reference BOOL_TO_WORD Converts BOOL type data to WORD type data. Page 900 BOOL_TO_WORD_E BOOL_TO_DWORD Converts BOOL type data to DWORD type data. Page 901 BOOL_TO_DWORD_E Converting BOOL to INT/DINT Function symbol Description...
• Page 93 Converting WORD to INT/DINT Function symbol Description Reference WORD_TO_INT Converts WORD type data to INT type data. Page 908 WORD_TO_INT_E WORD_TO_DINT Converts WORD type data to DINT type data. Page 909 WORD_TO_DINT_E Converting WORD to TIME Function symbol Description Reference WORD_TO_TIME Converts WORD type data to TIME type data.
• Page 94 Converting INT to DINT Function symbol Description Reference INT_TO_DINT Converts INT type data to DINT type data. Page 921 INT_TO_DINT_E Converting INT to BCD Function symbol Description Reference INT_TO_BCD Converts INT type data to BCD type data. Page 922 INT_TO_BCD_E Converting INT to REAL Function symbol Description...
• Page 95 Converting DINT to BCD Function symbol Description Reference DINT_TO_BCD Converts DINT type data to BCD type data. Page 933 DINT_TO_BCD_E Converting DINT to REAL Function symbol Description Reference DINT_TO_REAL Converts DINT type data to REAL type data. Page 935 DINT_TO_REAL_E Converting DINT to TIME Function symbol Description...
• Page 96 Converting TIME to WORD/DWORD Function symbol Description Reference TIME_TO_WORD Converts TIME type data to WORD type data. Page 951 TIME_TO_WORD_E TIME_TO_DWORD Converts TIME type data to DWORD type data. Page 952 TIME_TO_DWORD_E Converting TIME to INT/DINT Function symbol Description Reference TIME_TO_INT Converts TIME type data to INT type data.
• Page 97 Converting INT/DINT to bit array Function symbol Description Reference INT_TO_BITARR Outputs low-order (n) bits of INT type data to a bit array. Page 967 INT_TO_BITARR_E DINT_TO_BITARR Outputs low-order (n) bits of DINT type data to a bit array. Page 968 DINT_TO_BITARR_E Bit array copy Function symbol...
• ### Page 98: Standard Functions Of One Numeric Variable

Standard functions of one numeric variable Absolute value Function symbol Description Reference Outputs the absolute value of an input value. Page 974 ABS_E Square root Function symbol Description Reference SQRT Outputs the square root of an input value. Page 976 SQRT_E Natural logarithm operation Function symbol...
• ### Page 99: Standard Arithmetic Functions

Arc cosine operation Function symbol Description Reference ACOS Outputs the arc cosine value of an input value. Page 985 ACOS_E Arc tangent operation Function symbol Description Reference ATAN Outputs the arc tangent value of an input value. Page 986 ATAN_E Standard arithmetic functions Addition Function symbol...
• ### Page 100: Standard Bit Shift Functions

Standard bit shift functions Shifting n-bit data to left/right Function symbol Description Reference Shifts an input value leftward by (n) bits and outputs the result. Page 1001 SHL_E Shifts an input value rightward by (n) bits and outputs the result. Page 1003 SHR_E Rotating n-bit data to left/right...
• ### Page 101: Standard Comparison Functions

Multiplexer Function symbol Description Reference Outputs one of multiple input values. Page 1018 MUX_E Standard comparison functions Compare Function symbol Description Reference Outputs the data comparison result of input values. Page 1020 GT_E GE_E EQ_E LE_E LT_E Page 1022 NE_E Standard character string functions Character string length detection Function symbol...
• ### Page 102: Time Data Functions

Inserting character string Function symbol Description Reference INSERT Inserts a character string into another character string and output the result. Page 1031 INSERT_E Deleting character string Function symbol Description Reference DELETE Deletes an arbitrary range of a character string and outputs the result. Page 1033 DELETE_E Replacing character string...
• ### Page 103: Standard Function Blocks

Standard Function Blocks Bistable function blocks Bistable function blocks (set priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE). (Set priority) Page 1050 SR_E Bistable function blocks (reset priority) Function block symbol Description Reference Judges two input values and outputs 1 (TRUE) or 0 (FALSE).
• ### Page 104: Timer Function Blocks

Timer function blocks Pulse timer Function block symbol Description Reference Keeps ON a signal for specified duration. Page 1067 TP_E TP_10 TP_10_E On-delay timer Function block symbol Description Reference Turns ON a signal after a specified time. Page 1069 TON_E TON_10 TON_10_E Off-delay timer...
• Page 105 PART 3 CPU MODULE INSTRUCTIONS This part consists of the following chapters. 6 SEQUENCE INSTRUCTIONS 7 BASIC INSTRUCTIONS 8 APPLICATION INSTRUCTION 9 STEP LADDER INSTRUCTIONS 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS 11 PID CONTROL INSTRUCTION...
• ### Page 106: Chapter 6 Sequence Instructions

SEQUENCE INSTRUCTIONS Contact Instructions Operation start, series connection, parallel connection LD, LDI, AND, ANI, OR, ORI • LD: NO contact operation start instruction/LDI: NC contact operation start instruction These instructions capture the ON/OFF information of the device specified by (s), and use that as the operation result. •...
• Page 107 Processing details ■LD, LDI • The LD instruction is the NO contact operation start instruction, and the LDI instruction is the NC contact operation start instruction. These instructions capture the ON/OFF information of the specified device, and use the result as the operation result.
• ### Page 108: Pulse Operation Start, Pulse Series Connection, Pulse Parallel Connection

Pulse operation start, pulse series connection, pulse parallel connection LDP, LDF, ANDP, ANDF, ORP, ORF • LDP: Rising edge pulse operation start instruction This becomes conductive (ON) only at the rising edge (OFF to ON) of the bit device specified by (s). •...
• Page 109 Processing details ■LDP, LDF • The LDP instruction is the rising edge pulse operation start instruction, and becomes conductive (ON) only at the rising edge (OFF to ON) of the specified bit device. When word devices are specified by bits, this instruction becomes conductive (ON) only when the status of the specified bit changes to 01.
• ### Page 110: 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 • LDPI: Rising edge pulse NOT operation start instruction This instruction becomes conductive (ON) at OFF, ON and the falling edge (ON to OFF) of the bit device specified by (s). •...
• Page 111 Processing details ■LDPI, LDFI • The LDPI instruction is the rising edge pulse NOT operation start instruction, and becomes conductive (ON) at OFF, ON and the falling edge (ON to OFF) of the specified bit device. When word devices are specified by bits, this instruction becomes conductive when the status of the specified bit is 0, 1, and when it changes 10.
• ### Page 112: Association Instruction

Association Instruction Ladder block series/parallel connection ANB, ORB These instructions AND or OR the A and B blocks, and use the result as the operation result. Ladder diagram Structured text Not supported. A: A block B: B block FBD/LD Not supported. Processing details ■ANB •...
• ### Page 113: Storing/Reading/Clearing The Operation Result

Storing/reading/clearing the operation result MPS, MRD, MPP • MPS: This instruction stores the preceding operation result (ON/OFF) to memory. • MRD, MPP: These instructions read the operation result stored by the MPS instruction, and executes operations from the next step using that operation result. Ladder diagram Structured text ENO:=MPS(EN);...
• ### Page 114: Inverting The Operation Result

Inverting the operation result This instruction inverts the operation result up to this instruction. Ladder diagram Structured text ENO:=INV(EN); FBD/LD Processing details • This instruction inverts the operation result up to this instruction. Operation result up to the INV Operation result after execution of instruction INV instruction Operation error...
• ### Page 115: Converting The Operation Result Into A Pulse

Converting the operation result into a pulse MEP, MEF • MEP: This instruction turns ON at the rising edge of the operation result up to the MEP instruction and turns OFF in other instances. • MEF: This instruction turns ON at the falling edge of the operation result up to the MEF instruction and turns OFF in other instances.
• ### Page 116: Output Instructions

Output Instructions Out (excluding the timer, counter and annunciator) This instruction outputs the operation result up to this instruction to the specified device. Ladder diagram Structured text ENO:=OUT(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) Number of the device that turns ON/OFF ...
• ### Page 117: Timer

Timer OUT T, OUTH T, OUTHS T, OUT ST, OUTH ST, OUTHS ST The timer counts up to the set value when the operation result up to the OUT instruction is ON and the coil of the timer/ retentive timer specified by (d) turns ON. When the timer times up, NO contact becomes conductive and NC contact becomes non conductive.
• Page 118 • OUTHS instruction: 0.001 to 32.767 seconds For the counting method, refer to the following. MELSEC iQ-F FX5 User's Manual (Application) Precautions When creating a program for measuring another timer at a timer contact, program in order starting with the timer to be measured later on.
• ### Page 119: Counter

Counter OUT C This instruction increments the current value of the counter specified by (d) by 1 when the operation result up to OUT instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes conductive and NC contact becomes non-conductive.
• ### Page 120: Long Counter

Long counter OUT LC This instruction increments the current value of the long counter specified by (d) by 1 when the operation result up to the OUT instruction changes from OFF to ON, and when the counter reaches the end of its count, NO contact becomes conductive and NC contact becomes non-conductive.
• Page 121 Operation error Error code Remarks (SD0/SD8067) 2821H When the high speed counter is assigned to the specification long counter. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
• ### Page 122: Annunciator

Annunciator OUT F This instruction outputs the operation result up to the OUT F instruction to the specified annunciator. Ladder diagram Structured text ENO:=OUT(EN,d); FBD/LD ("OUT" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
• ### Page 123: Setting Devices (Excluding Annunciator)

Setting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the execution command turns ON. • Bit device: Turns the coils and contacts ON. • Bit specification of word device: Set the specified bit to 1. Ladder diagram Structured text ENO:=SET(EN,d);...
• Page 124 Precautions When the SET and RST instructions are executed on the same output relay (Y), the result of the instruction nearer the END instruction (end of program) is output. Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
• ### Page 125: Resetting Devices (Excluding Annunciator)

Resetting devices (excluding annunciator) The status of the device specified by (d) changes as follows when the RST input turns ON. • Bit devices: Turns the coils and contacts OFF. • Timers, counters: Sets the current value to 0, and turns coils and contacts OFF. •...
• Page 126 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
• ### Page 127: Setting Annunciator

Setting annunciator SET F This instruction turns ON the specified annunciator. Ladder diagram Structured text ENO:=SET(EN,d); FBD/LD ("SET" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Annunciator number (F number) that is set ANY_BOOL ...
• Page 128 ■Related devices Device Name Remarks SD62 Annunciator (F) Detection No. This register stores the earliest detected annunciator (F) No.. SD63 Annunciator (F) Detection Number This register stores the number of annunciator (F) detections. SD64 to SD79 Annunciator (F) Detection No. table This register stores the annunciator (F) detection No.
• ### Page 129: Resetting Annunciator

Resetting annunciator RST F This instruction turns OFF the specified annunciator. Ladder diagram Structured text ENO:=RST(EN,d); FBD/LD ("RST" enters .) Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Annunciator number (F number) that is reset ANY_ELEMENTARY ...
• Page 130 Processing details • This instruction turns OFF the annunciator specified by (d) when the execution command turns ON. • An annunciator number (F number) that turns OFF is deleted from special registers (SD64 to SD79) and the content of SD63 is decremented by 1. •...
• ### Page 131: Setting Annunciator (With Check Time)

Setting annunciator (with check time) This instruction sets the annunciator (F device). Ladder diagram Structured text ENO:=ANS(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)  Timer number for evaluation time 16-bit signed binary ANY16 Evaluation time data 1 to 32767...
• Page 132 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
• ### Page 133: Resetting Annunciator (Smallest Number Reset)

Resetting annunciator (smallest number reset) ANR(P) This instruction resets the lowest number annunciator (F device) in the ON status. Ladder diagram Structured text ENO:=ANR(EN); ENO:=ANRP(EN); FBD/LD Processing details • Annunciator (F device) that is operating (in ON status) is reset when the command input turns ON. This instruction resets the annunciator with the smallest number when multiple annunciators are ON.
• ### Page 134: Rising Edge Output

Rising edge output This instruction turns ON the device specified by (d) for one scan when the PLS command turns from OFF to ON, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLS(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• Page 135 • If the RUN/STOP/RESET switch is changed from RUN to STOP after execution of the PLS instruction, the PLS instruction will not be executed even if the switch is set to RUN again. LD X0 LD X0 LD X0 PLS M0 PLS M0 PLS M0 X0 OFF...
• ### Page 136: Falling Edge Output

Falling edge output This instruction turns ON the device specified by (d) for one scan when the PLF command turns from ON to OFF, and turns OFF in other cases. Ladder diagram Structured text ENO:=PLF(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• Page 137 Precautions • When write during RUN is completed for a circuit including a falling edge instruction (LDF/ANDF/ORF instruction), the instruction is not executed regardless of the ON/OFF status of the target device of the falling edge instruction. Also, in the case of a falling edge instruction (PLF instruction), the instruction is not executed regardless of the ON/OFF status of the device that is set as the operation condition.
• ### Page 138: Inverting The Bit Device Output

Inverting the bit device output This instruction reverses the output status of the device specified by (d) when the execution command changes from OFF to Ladder diagram Structured text ENO:=FF(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label)
• Page 139 Inverting the bit device output ALT(P) These instructions reverse (ON  OFF) bit devices when input turns ON. Ladder diagram Structured text ENO:=ALT(EN,d); ENO:=ALTP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range Data type Data type (label) ...
• Page 140 Operation error There is no operation error. 6 SEQUENCE INSTRUCTIONS 6.3 Output Instructions...
• ### Page 141: Shift Instructions

Shift Instructions Shifting bit devices SFT(P) • In case of bit device: These instructions shift the ON/OFF status of the device before the device specified by (d) to the device specified by (d). • When bit of word device is specified: These instructions shift the 1/0 status of the bit before the bit specified by (d) to the bit specified by (d).
• Page 142 • When the SFT(P) instruction is used consecutively, create the program to start from the device with the largest number. M15 M14 SFTP SFTP SFTP SFTP (1): X2 ON (2): After the 1st shift input (3): After the 2nd shift input (4): X2 ON (5): After the 3rd shift input (6): After the 4th shift input...
• ### Page 143: Shifting 16-Bit Data To The Right By N Bit(S)

Shifting 16-bit data to the right by n bit(s) SFR(P) These instructions shift the 16-bit data in the device specified by (d) to the right by (n) bit(s). Ladder diagram Structured text ENO:=SFR(EN,n,d); ENO:=SFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• Page 144 • Specify any value between 0 and 15 for (n). If a value 16 or larger is specified for (n), bits are shifted to the right by the remainder value of (n)16. For example, when (n) is 18, data is shifted by 2 bits to the right because 18 divided by 16 equals 1 with a remainder of 2.
• ### Page 145: Shifting 16-Bit Data To The Left By N Bit(S)

Shifting 16-bit data to the left by n bit(s) SFL(P) These instructions shift the 16-bit data in the device specified by (d) to the left by (n) bit(s). Ladder diagram Structured text ENO:=SFL(EN,n,d); ENO:=SFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• Page 146 • Specify any value between 0 and 15 for (n). If a value 16 or larger is specified for (n), bit(s) are shifted to the left by the remainder value of (n)16. For example, when (n) is 18, data is shifted by 2 bits to the left because 18 divided by 16 equals 1 with a remainder of 2.
• ### Page 147: Shifting N-Bit Data To The Right By 1 Bit

Shifting n-bit data to the right by 1 bit BSFR(P) These instructions shift (n) point(s) of data to the right by 1 bit from the device specified by (d). Ladder diagram Structured text ENO:=BSFR(EN,n,d); ENO:=BSFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• ### Page 148: Shifting N-Bit Data To The Left By 1 Bit

Shifting n-bit data to the left by 1 bit BSFL(P) These instructions shift (n) point(s) of data to the left by 1 bit from the device specified by (d). Ladder diagram Structured text ENO:=BSFL(EN,n,d); ENO:=BSFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• ### Page 149: Shifting N-Word Data To The Right By 1 Word

Shifting n-word data to the right by 1 word DSFR(P) These instructions shift (n) point(s) of data to the right by 1 word from the device specified by (d). Ladder diagram Structured text ENO:=DSFR(EN,n,d); ENO:=DSFRP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• ### Page 150: Shifting N-Word Data To The Left By 1 Word

Shifting n-word data to the left by 1 word DSFL(P) These instructions shift (n) point(s) of data to the left by 1 word from the device specified by (d). Ladder diagram Structured text ENO:=DSFL(EN,n,d); ENO:=DSFLP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• ### Page 151: Shifting N-Bit(S) Data To The Right By (N) Bit(S)

Shifting n-bit(s) data to the right by (n) bit(s) SFTR(P) These instructions shift (n1) bits of data to the right by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTR(EN,s,n1,n2,d); ENO:=SFTRP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
• Page 152 Processing details • These instructions shift (n1) bits of data to the right by (n2) bit(s) from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d)+(n1-n2). • When K0 is specified for (s), set 0s for (n2) points of bits from (d)+(n1-n2) after the shift. •...
• ### Page 153: Shifting N-Bit Data To The Left By N Bit(S)

Shifting n-bit data to the left by n bit(s) SFTL(P) These instructions shift (n1) bits of data to the left by (n2) bit(s) from the device specified by (d). Ladder diagram Structured text ENO:=SFTL(EN,s,n1,n2,d); ENO:=SFTLP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
• Page 154 Processing details • These instructions shift (n1) bits of data to the left by (n2) bit(s) from the device specified by (d). After the shift, (n2) points from (s) are set into (n2) points from (d). • When K0 is specified for (s), set 0s for (n2) points of bits from (d) after the shift. •...
• ### Page 155: Shifting N-Word Data To The Right By N Word(S)

Shifting n-word data to the right by n word(s) WSFR(P) This instruction shifts (n1) words of data to the right by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFR(EN,s,n1,n2,d); ENO:=WSFRP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
• Page 156 Operation error Error code Remarks (SD0/SD8067) 2820H The (n2) points of data starting from the device specified by (s) exceed in the corresponding device. The (n1) points of data starting from the device specified by (d) exceed in the corresponding device. 2821H The transfer source data (s) overlaps with shift device (d).
• ### Page 157: Shifting N-Word Data To The Left By N Word(S)

Shifting n-word data to the left by n word(s) WSFL(P) This instruction shifts (n1) words of data to the left by (n2) word(s) from the device specified by (d). Ladder diagram Structured text ENO:=WSFL(EN,s,n1,n2,d); ENO:=WSFLP(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks...
• Page 158 Operation error Error code Remarks (SD0/SD8067) 2820H The (n2) points of data starting from the device specified by (s) exceed in the corresponding device. The (n1) points of data starting from the device specified by (d) exceed in the corresponding device. 2821H The transfer source data (s) overlaps with shift device (d).
• ### Page 159: Master Control Instruction

Master Control Instruction Setting/resetting the master control MC, MCR • MC: This instruction starts master control. • MCR: This instruction ends master control. Ladder diagram Structured text ENO:=MC(EN,n,d); ENO:=MCR(EN,n); (1): Master control ladder FBD/LD Setting data ■Descriptions, ranges, and data types Operand Remarks Range...
• Page 160 Processing details These instructions create program with efficient ladder switching by opening/closing common buses in ladders. Ladder using master control is illustrated below. (Left: Display on the engineering tool, Right: Actual operation) (1) Executed only when X0 is on ■MC •...
• Page 161 Master control instructions can be used in a nested fashion. Each master control section is distinguished by nesting (N). Nesting is available within the range N0 to N14. A nested structure allows you to create a ladder for successively restricting program execution conditions. A nested structure ladder is illustrated as follows: (Left: Display on the engineering tool, Right: Actual operation) N0 M15...
• Page 162 Precautions • If an instruction (e.g. LD, LDI) to be connected to the bus is not programmed following the MC instruction, a program structure error (error code: 33E0) occurs. • These instructions cannot be used in FOR to NEXT, STL to RETSTL, P to RET (SRET), and I to IRET. Also, do not block by I, IRET, FEND, END, RET (SRET), RETSTL, etc.
• ### Page 163: Termination Instructions

Termination Instructions Ending the main routine program FEND This instruction is used to branch operation of the sequence program by the CJ instruction or to divide the main routine program into a subroutine program or an interrupt program. Ladder diagram Structured text Not supported.
• ### Page 164: Ending The Sequence Program

Ending the sequence program This instruction indicates the end of a program. Ladder diagram Structured text Not supported. FBD/LD Not supported. Processing details • This instruction indicates the end of all programs including the main routine program, subroutine program, and interrupt program.
• Page 165 Operation error Error code Remarks (SD0/SD8067) 3340H The END instruction is executed before the NEXT instruction after the FOR instruction is executed. 3381H The END instruction is executed before the RET instruction after the CALL(P) instruction is executed. 33E3H The END instruction is programmed between FOR-NEXT. 33E4H The END instruction is programmed between MC-MCR.
• ### Page 166: Stop Instruction

Stop Instruction Stopping the sequence program STOP This instruction resets outputs (Y) and stops operation of the CPU module when the execution command turns ON. (This operation is the same as setting the switch to STOP.) Ladder diagram Structured text ENO:=STOP(EN);...
• ### Page 167: Chapter 7 Basic Instructions

BASIC INSTRUCTIONS Comparison Operation Instructions Comparing 16-bit binary data LD(_U), AND(_U), OR(_U) These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the 16- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text ENO:=LD_(EN,s1,s2);...
• Page 168 ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, SM, T, ST, C, D, W, U\G K, H F, B, SB, S SD, SW, R (s1)          ...
• ### Page 169: Comparing 32-Bit Binary Data

Comparing 32-bit binary data LDD(_U), ANDD(_U), ORD(_U) These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32- bit binary data in the device specified by (s2). (Devices are used as NO contacts.) Ladder diagram Structured text ENO:=LDD_(EN,s1,s2);...
• Page 170 Processing details • These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2). (Devices are used as NO contacts) • The following table lists the comparison operation results of each instruction. Instruction symbol Condition Result...
• ### Page 171: Comparison Output 16-Bit Binary Data

Comparison output 16-bit binary data CMP(P)(_U) These instructions perform a comparison operation between the 16-bit binary data in the devices specified by (s1) and (s2). Ladder diagram Structured text ENO:=CMP(EN,s1,s2,d); ENO:=CMP_U(EN,s1,s2,d); ENO:=CMPP(EN,s1,s2,d); ENO:=CMPP_U(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 172 Processing details • These instructions perform a comparison operation between the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is turned ON.
• ### Page 173: Comparison Output 32-Bit Binary Data

Comparison output 32-bit binary data DCMP(P)(_U) These instructions perform a comparison operation between the 32-bit binary data in the devices specified by (s1) and (s2). Ladder diagram Structured text ENO:=DCMP(EN,s1,s2,d); ENO:=DCMP_U(EN,s1,s2,d); ENO:=DCMPP(EN,s1,s2,d); ENO:=DCMPP_U(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 174 Processing details • These instructions perform a comparison operation between the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2) and according to the result (small, equal, large), (d), (d) + 1, or (d) + 2 is turned ON.
• ### Page 175: Comparing 16-Bit Binary Data Band

Comparing 16-bit binary data band ZCP(P)(_U) These instructions perform a comparison 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) with the 16-bit binary data in the device specified by comparison source (s3), and output the comparison result (below, within zone, above) to the device specified by (d) onwards.
• Page 176 Processing details • These instructions perform a comparison 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) with the 16-bit binary data in the device specified by comparison source (s3), and according to the comparison result (below, within zone, above), (d), (d) + 1, or (d) + 2 is turned ON.
• ### Page 177: Comparing 32-Bit Binary Data Band

Comparing 32-bit binary data band DZCP(P)(_U) These instructions perform a comparison 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) with the 32-bit binary data in the device specified by comparison source (s3), and output the comparison result (below, within zone, above) to the device specified by (d) onwards.
• Page 178 Processing details • These instructions perform a comparison 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) with the 32-bit binary data in the device specified by comparison source (s3), and according to the comparison result (below, within zone, above), (d), (d) + 1, or (d) + 2 is turned ON.
• ### Page 179: Comparing 16-Bit Binary Block Data

Comparing 16-bit binary block data BKCMP(P)(_U) These instructions perform a comparison operation between (n) point(s) of 16-bit binary data in the device starting from the one specified by (s1) and (n) point(s) of 16-bit binary data in the device starting from the one specified by (s2), and store the operation result in the device specified by (d).
• Page 180 Processing details • These instructions perform a comparison operation between (n) point(s) of 16-bit binary data in the device starting from the one specified by (s1) and (n) point(s) of 16-bit binary data in the device starting from the one specified by (s2), and store the comparison result in (n) point(s) of data starting from the device specified by (d).
• ### Page 181: Comparing 32-Bit Binary Block Data

Comparing 32-bit binary block data DBKCMP(P)(_U) These instructions perform a comparison operation between the (n) point(s) of 32-bit binary data starting from the device specified by (s1) and the (n) point(s) of 32-bit binary data starting from the device specified by (s2), and store the operation result in the device specified by (d).
• Page 182 Processing details • These instructions perform a comparison operation between (n) point(s) of 32-bit binary data starting from the device specified by (s1) and (n) point(s) of 32-bit binary data starting from the device specified by (s2), and store the comparison result in (n) point(s) of data starting from the device specified by (d).
• Page 183 Operation error Error code Description (SD0/SD8067) The (n)  2 points of data starting from the device specified by (s1) and (s2) or the (n) point(s) of data starting from the device specified by 2820H (d) exceeds said device. When (d) specifies "D.b", the (n) point(s) of data starting from the device specified by (d) and the device range of the (n)  2 points of 2821H data starting from the device specified by (s1) overlap.
• ### Page 184: Arithmetic Operation Instructions

Arithmetic Operation Instructions Adding 16-bit binary data +(P)(_U) instruction and ADD(P)(_U) instruction can be used for addition of 16-bit binary data. +(P)(_U) [using two operands] 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 result in the device specified by (d).
• Page 185 Processing details • These instructions add the 16-bit binary data in the device specified by (s) to the 16-bit binary data in the device specified by (d), and store the addition result in the device specified by (d). ··· ··· ···...
• Page 186 +(P)(_U) [using three operands] 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 result in the device specified by (d). Ladder diagram Structured text ENO:=PLUS(EN,s1,s2,d);...
• Page 187 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 addition result in the device specified by (d). (s1) (s2) ···...
• Page 188 ADD(P)(_U) 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 result in the device specified by (d). Ladder diagram Structured text ENO:=ADDP(EN,s1,s2,d); ENO:=ADD_U(EN,s1,s2,d);...
• Page 189 ■Relationship between the flag operation and the sign (positive or negative) of a numeric value Device Name Description SM700, SM8022 Carry When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON. SM8020 Zero When the operation result is 0, the zero flag is turned ON.
• ### Page 190: Subtracting 16-Bit Binary Data

Subtracting 16-bit binary data -(P)(_U) instruction and SUB(P)(_U) instruction can be used for subtraction of 16-bit binary data. -(P)(_U) [using two operands] These instructions subtract 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 result in the device specified by (d).
• Page 191 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
• Page 192 -(P)(_U) [using three operands] These instructions subtract 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 result in the device specified by (d). Ladder diagram Structured text ENO:=MINUS(EN,s1,s2,d);...
• Page 193 Processing details • These instructions subtract 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 subtraction result in the device specified by (d). (s1) (s2) ···...
• Page 194 SUB(P)(_U) These instructions subtract 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 result in the device specified by (d). Ladder diagram Structured text ENO:=SUBP(EN,s1,s2,d); ENO:=SUB_U(EN,s1,s2,d);...
• Page 195 ■Relationship between the flag operation and the sign (positive or negative) of a numeric value Device Name Description SM700, SM8022 Carry When the operation result exceeds the upper limit of the data setting range, the carry flag is turned ON. SM8020 Zero When the operation result is 0, the zero flag is turned ON.
• ### Page 196: Adding 32-Bit Binary Data

Adding 32-bit binary data D+(P)(_U) instruction and DADD(P)(_U) instruction can be used for addition of 32-bit binary data. D+(P)(_U) [using two operands] 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 result in the device specified by (d).
• Page 197 D+(P)(_U) [using three operands] 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DPLUS(EN,s1,s2,d);...
• Page 198 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 addition result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
• Page 199 DADD(P)(_U) 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DADD(EN,s1,s2,d); ENO:=DADD_U(EN,s1,s2,d);...
• Page 200 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 addition result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
• ### Page 201: Subtracting 32-Bit Binary Data

Subtracting 32-bit binary data D-(P)(_U) instruction and DSUB(P)(_U) instruction can be used for subtraction of 32-bit binary data. D-(P)(_U) [using two operands] These instructions subtract 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 result in the device specified by (d).
• Page 202 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
• Page 203 D-(P)(_U) [using three operands] These instructions subtract 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DMINUS(EN,s1,s2,d);...
• Page 204 Processing details • These instructions subtract 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 subtraction result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
• Page 205 DSUB(P)(_U) These instructions subtract 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DSUB(EN,s1,s2,d); ENO:=DSUB_U(EN,s1,s2,d);...
• Page 206 Processing details • These instructions subtract 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 subtraction result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
• ### Page 207: Multiplying 16-Bit Binary Data

Multiplying 16-bit binary data *(P)(_U) instruction and MUL(P)(_U) instruction can be used for multiplication of 16-bit binary data. *(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
• Page 208 Operation error Error code Description (SD0/SD8067) 2820H The range of the device specified by (d) exceeds said device range. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
• Page 209 MUL(P)(_U) These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=MULP(EN,s1,s2,d); ENO:=MUL_U(EN,s1,s2,d);...
• Page 210 Processing details • These instructions multiply the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+1 b16 b15 ···...
• ### Page 211: Dividing 16-Bit Binary Data

Dividing 16-bit binary data /(P)(_U) instruction and DIV(P)(_U) instruction can be used for division of 16-bit binary data. /(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
• Page 212 Processing details • These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the division result in the device specified by (d). (s1) (s2) (d)+1 b0 b15 ···...
• Page 213 DIV(P)(_U) These instructions divide the 16-bit binary data in the device specified by (s1) by the 16-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DIVP(EN,s1,s2,d); ENO:=DIV_U(EN,s1,s2,d);...
• Page 214 ■Related flag Device Name Description SM700 Carry When the operation result of the signed operation exceeds 32767, the carry flag is turned ON. SM8304 Zero When the operation result is 0, the zero flag is turned ON. SM8306 Carry When the operation result of the signed operation exceeds 32767, the carry flag is turned ON. Precautions ■Operation result •...
• ### Page 215: Multiplying 32-Bit Binary Data

Multiplying 32-bit binary data D*(P)(_U) instruction and DMUL(P)(_U) instruction can be used for multiplication of 32-bit binary data. D*(P)(_U) These instructions multiply 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 result in the device specified by (d).
• Page 216 Processing details • These instructions multiply the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+2 (s1)+1 (s2)+1...
• Page 217 DMUL(P)(_U) These instructions multiply 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DMUL(EN,s1,s2,d); ENO:=DMUL_U(EN,s1,s2,d);...
• Page 218 Processing details • These instructions multiply the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the multiplication result in the device specified by (d). (s1) (s2) (d)+2 (s1)+1 (s2)+1...
• ### Page 219: Dividing 32-Bit Binary Data

Dividing 32-bit binary data D/(P)(_U) instruction and DDIV(P)(_U) instruction can be used for division of 32-bit binary data. D/(P)(_U) These instructions divide the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d).
• Page 220 Operation error Error code Description (SD0/SD8067) 2820H The range of the device specified by (d) exceeds the range of said device. 3400H 0 is specified for (s2) value. 7 BASIC INSTRUCTIONS 7.2 Arithmetic Operation Instructions...
• Page 221 DDIV(P)(_U) These instructions divide the 32-bit binary data in the device specified by (s1) by the 32-bit binary data in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DDIV(EN,s1,s2,d); ENO:=DDIV_U(EN,s1,s2,d);...
• Page 222 Precautions ■Operation result • The most significant bit of the quotient and remainder indicates the sign (positive: 0, negative: 1), respectively. • The quotient is negative when either (s1) or (s2) is negative. The remainder is negative when the (s1) is negative. ■Device specified by (d) •...
• ### Page 223: Adding Bcd 4-Digit Data

Adding BCD 4-digit data B+(P) [using two operands] These instructions add the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 224 B+(P) [using three operands] 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 result in the device specified by (d). Ladder diagram Structured text ENO:=BPLUS(EN,s1,s2,d);...
• ### Page 225: Subtracting Bcd 4-Digit Data

Subtracting BCD 4-digit data B-(P) [using two operands] These instructions subtract the BCD 4-digit data in the device specified by (d) and the BCD 4-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 226 B-(P) [using three operands] These instructions subtract 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 result in the device specified by (d). Ladder diagram Structured text ENO:=BMINUS(EN,s1,s2,d);...
• ### Page 227: Adding Bcd 8-Digit Data

Adding BCD 8-digit data DB+(P) [using two operands] These instructions add the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 228 DB+(P) [using three operands] 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 result in the device specified by (d). Ladder diagram Structured text ENO:=DBPLUS(EN,s1,s2,d);...
• ### Page 229: Subtracting Bcd 8-Digit Data

Subtracting BCD 8-digit data DB-(P) [using two operands] These instructions subtract the BCD 8-digit data in the device specified by (d) and the BCD 8-digit data in the device specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 230 DB-(P) [using three operands] These instructions subtract the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DBMINUS(EN,s1,s2,d); ENO:=DBMINUSP(EN,s1,s2,d); (s1) (s2) FBD/LD ("DBMINUS", "DBMINUSP"...
• ### Page 231: Multiplying Bcd 4-Digit Data

Multiplying BCD 4-digit data B*(P) These instructions multiply the BCD 4-digit data specified by (s1) and the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("BMULTI", "BMULTIP"...
• ### Page 232: Dividing Bcd 4-Digit Data

Dividing BCD 4-digit data B/(P) These instructions divide the BCD 4-digit data specified by (s1) by the BCD 4-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("BDIVISION", "BDIVISIONP"...
• Page 233 Operation error Error code Description (SD0/SD8067) 2820H Device specified by (d) exceeds the allowable device range 3400H 0 is specified for (s2) value. 3405H BCD data in the device specified by (s1) is outside of the valid range (0 to 9999). BCD data in the device specified by (s2) is outside of the valid range (0 to 9999).
• ### Page 234: Multiplying Bcd 8-Digit Data

Multiplying BCD 8-digit data DB*(P) These instructions multiply the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("DBMULTI", "DBMULTIP"...
• Page 235 Processing details • These instructions multiply the BCD 8-digit data specified by (s1) and the BCD 8-digit data specified by (s2), and store the multiplication results in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) × (d)+3 (d)+2 (d)+1 •...
• ### Page 236: Dividing Bcd 8-Digit Data

Dividing BCD 8-digit data DB/(P) These instructions divide the BCD 8-digit data specified by (s1) by the BCD 8-digit data specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text Not supported (s1) (s2) FBD/LD ("DBDIVISION", "DBDIVISIONP"...
• Page 237 Processing details • These instructions divide the BCD 8-digit data specified by (s1) by the BCD 8-digit data specified by (s2), and store the results of division in the device specified by (d). (s1)+1 (s1) (s2)+1 (s2) ÷ 0 is entered. Quotient (d)+1 Remainder...
• ### Page 238: Adding 16-Bit Binary Block Data

Adding 16-bit binary block data BK+(P)(_U) These instructions add (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=BKPLUS(EN,s1,s2,n,d);...
• Page 239 Processing details • These instructions add (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). •...
• ### Page 240: Subtracting 16-Bit Binary Block Data

Subtracting 16-bit binary block data BK-(P)(_U) These instructions subtract (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=BKMINUS(EN,s1,s2,n,d);...
• Page 241 Processing details • These instructions subtract (n) point(s) of 16-bit binary data from the device specified by (s1) and the (n) point(s) of 16-bit binary data from the device specified by (s2), and store the subtraction results in the device specified by (d). •...
• ### Page 242: Adding 32-Bit Binary Block Data

Adding 32-bit binary block data DBK+(P)(_U) These instructions add (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). Ladder diagram Structured text ENO:=DBKPLUS(EN,s1,s2,n,d);...
• Page 243 Processing details • These instructions add (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of addition in the device specified by (d). •...
• Page 244 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821H The device range for (n) point(s) beginning from (s1) overlaps with that of (n) point(s) starting from (d). (Does not apply when same device has been specified for (s1) and (d).) The device range for (n) point(s) beginning from (s2) overlaps with that of (n) point(s) starting from (d).
• ### Page 245: Subtracting 32-Bit Binary Block Data

Subtracting 32-bit binary block data DBK-(P)(_U) These instructions subtract (n) point(s) of 32-bit binary data from the device specified by (s1) and the (n) point(s) of 32-bit binary data from the device specified by (s2), and store the results of subtraction in the device specified by (d). Ladder diagram Structured text ENO:=DBKMINUS(EN,s1,s2,n,d);...
• Page 246 If device is specified for (s2) (signed) ∙∙∙ ∙∙∙ ∙∙∙ (s2)+1, (s2) (s1)+1, (s1) 44445 (BIN) (BIN) -55555 (BIN) (d)+1, -1000000 (s2)+3, (s2)+2 (s1)+3, (s1)+2 3333 (BIN) (BIN) 33333 (BIN) (d)+3, (d)+2 30000 (s2)+5, (s2)+4 (s1)+5, (s1)+4 -10000 (BIN) (d)+4 (BIN) 44444 (BIN)
• ### Page 247: Incrementing 16-Bit Binary Data

Incrementing 16-bit binary data INC(P)(_U) These instructions add +1 to the device (16-bit binary data) specified by (d). Ladder diagram Structured text ENO:=INC(EN,d); ENO:=INC_U(EN,d); ENO:=INCP(EN,d); ENO:=INCP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) INC(P) Device to be incremented by +1 -32768 to +32767...
• ### Page 248: Decrementing 16-Bit Binary Data

Decrementing 16-bit binary data DEC(P)(_U) These instructions subtract 1 from the device (16-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DEC(EN,d); ENO:=DEC_U(EN,d); ENO:=DECP(EN,d); ENO:=DECP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DEC(P) Device to be decremented by -1 -32768 to +32767...
• ### Page 249: Incrementing 32-Bit Binary Data

Incrementing 32-bit binary data DINC(P)(_U) These instructions add +1 to the device (32-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DINC(EN,d); ENO:=DINC_U(EN,d); ENO:=DINCP(EN,d); ENO:=DINCP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DINC(P) Head device to be incremented by +1 -2147483648 to +2147483647...
• ### Page 250: Decrementing 32-Bit Binary Data

Decrementing 32-bit binary data DDEC(P)(_U) These instructions subtract 1 from the device (32-bit binary data) specified by (d). Ladder diagram Structured text ENO:=DDEC(EN,d); ENO:=DDEC_U(EN,d); ENO:=DDECP(EN,d); ENO:=DDECP_U(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) DDEC(P) Head device to be decremented by 1 -2147483648 to +2147483647...
• ### Page 251: Logical Operation Instructions

Logical Operation Instructions Performing an AND operation on 16-bit data WAND(P) [using two operands] These instructions AND each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 252 WAND(P) [using three operands] These instructions AND each bit of 16-bit binary data from the device specified by (s1) and each bit of 16-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=WAND(EN,s1,s2,d);...
• ### Page 253: Performing An And Operation On 32-Bit Data

Performing an AND operation on 32-bit data DAND(P) [using two operands] These instructions AND each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 254 DAND(P) [using three operands] These instructions AND each bit of 32-bit binary data from the device specified by (s1) and each bit of 32-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DAND(EN,s1,s2,d);...
• ### Page 255: Performing An And Operation On 16-Bit Block Data

Performing an AND operation on 16-bit block data BKAND(P) These instructions AND contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. Ladder diagram Structured text ENO:=BKAND(EN,s1,s2,n,d);...
• Page 256 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821H Device range of (n) point(s) from (s1) partially overlaps with device range of (n) point(s) from (d). (Does not apply when same device has been specified for (s1) and (d).) Device range of (n) point(s) from (s2) partially overlaps with device range of (n) point(s) from (d).
• ### Page 257: Performing An Or Operation On 16-Bit Data

Performing an OR operation on 16-bit data WOR(P) [using two operands] These instructions OR each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 258 WOR(P) [using three operands] These instructions OR each bit of 16-bit binary data from the device specified by (s1) and each bit of 16-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=WOR(EN,s1,s2,d);...
• ### Page 259: Performing An Or Operation On 32-Bit Data

Performing an OR operation on 32-bit data DOR(P) [using two operands] These instructions OR each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 260 DOR(P) [using three operands] These instructions OR each bit of 32-bit binary data from the device specified by (s1) and each bit of 32-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DOR(EN,s1,s2,d);...
• ### Page 261: Performing An Or Operation On 16-Bit Block Data

Performing an OR operation on 16-bit block data BKOR(P) These instructions OR contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. Ladder diagram Structured text ENO:=BKOR(EN,s1,s2,n,d);...
• Page 262 Processing details • These instructions seek OR of contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. (s1)+(n-1) (s1)+1 (s1) …...
• ### Page 263: Performing An Xor Operation On 16-Bit Data

Performing an XOR operation on 16-bit data WXOR(P) [using two operands] These instructions exclusive OR each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 264 WXOR(P) [using three operands] These instructions exclusive OR each bit of 16-bit binary data from the device specified by (s1) and each bit of 16-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=WXOR(EN,s1,s2,d);...
• ### Page 265: Performing An Xor Operation On 32-Bit Data

Performing an XOR operation on 32-bit data DXOR(P) [using two operands] These instructions exclusive OR each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 266 DXOR(P) [using three operands] These instructions exclusive OR each bit of 32-bit binary data from the device specified by (s1) and each bit of 32-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DXOR(EN,s1,s2,d);...
• ### Page 267: Performing An Xor Operation On 16-Bit Block Data

Performing an XOR operation on 16-bit block data BKXOR(P) These instructions seek exclusive OR of contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. Ladder diagram Structured text ENO:=BKXOR(EN,s1,s2,n,d);...
• Page 268 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) point(s) of data starting from the device specified by (s1), (s2), or (d) exceed the corresponding device range. 2821H Device range of (n) point(s) from (s1) partially overlaps with device range of (n) point(s) from (d). (Does not apply when same device has been specified for (s1) and (d).) Device range of (n) point(s) from (s2) partially overlaps with device range of (n) point(s) from (d).
• ### Page 269: Performing An Xnor Operation On 16-Bit Data

Performing an XNOR operation on 16-bit data WXNR(P) [using two operands] These instructions exclusive NOR each bit of 16-bit binary data from the device specified by (d) and each bit of 16-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 270 WXNR(P) [using three operands] These instructions exclusive NOR each bit of 16-bit binary data from the device specified by (s1) and each bit of 16-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=WXNR(EN,s1,s2,d);...
• ### Page 271: Performing An Xnor Operation On 32-Bit Data

Performing an XNOR operation on 32-bit data DXNR(P) [using two operands] These instructions exclusive NOR each bit of 32-bit binary data from the device specified by (d) and each bit of 32-bit binary data from device specified by (s), and store the results in the device specified by (d). Ladder diagram Structured text Not supported...
• Page 272 DXNR(P) [using three operands] These instructions exclusive NOR each bit of 32-bit binary data from the device specified by (s1) and each bit of 32-bit binary data from device specified by (s2), and store the results in the device specified by (d). Ladder diagram Structured text ENO:=DXNR(EN,s1,s2,d);...
• ### Page 273: Performing An Xnor Operation On 16-Bit Block Data

Performing an XNOR operation on 16-bit block data BKXNR(P) These instructions exclusive NOR contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onwards. Ladder diagram Structured text ENO:=BKXNR(EN,s1,s2,n,d);...
• Page 274 Processing details • These instructions exclusive NOR contents of (n) point(s) from the device specified by (s1) and (n) point(s) from the device specified by (s2), and store the results in the devices specified by (d) onward. (s1)+(n-1) (s1)+1 (s1) XNOR (s2)+(n-1) (s2)+1...
• ### Page 275: Bit Processing Instructions

Bit Processing Instructions Setting a bit in the word device BSET(P) These instructions set (to 1) (n)th bit of word device specified by (d). Ladder diagram Structured text ENO:=BSET(EN,n,d); ENO:=BSETP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
• ### Page 276: Resetting A Bit In The Word Device

Resetting a bit in the word device BRST(P) These instructions reset (to 0) (n)th bit of word device specified by (d). Ladder diagram Structured text ENO:=BRST(EN,n,d); ENO:=BRSTP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
• ### Page 277: Performing A 16-Bit Test

Performing a 16-bit test TEST(P) These instructions take bit data at position specified by (s2) from device specified by (s1) and write to bit device specified by (d). Ladder diagram Structured text ENO:=TEST(EN,s1,s2,d); ENO:=TESTP(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 278 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.4 Bit Processing Instructions...
• ### Page 279: Performing A 32-Bit Test

Performing a 32-bit test DTEST(P) These instructions take bit data at position specified by (s2) from device specified by (s1) and write to bit device specified by (d). Ladder diagram Structured text ENO:=DTEST(EN,s1,s2,d); ENO:=DTESTP(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 280 Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.4 Bit Processing Instructions...
• ### Page 281: Batch-Resetting Bit Devices

Batch-resetting bit devices BKRST(P) These instructions reset (n) point(s) bit devices from the bit device specified by (d). Ladder diagram Structured text ENO:=BKRST(EN,n,d); ENO:=BKRSTP(EN,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
• ### Page 282: Batch-Resetting Devices

Batch-resetting devices ZRST(P) These instructions reset all data among devices of same type specified by (d1) and (d2). Use these instructions for restarting operation from the beginning after pause or after resetting control data. Ladder diagram Structured text ENO:=ZRST(EN, d1, d2); ENO:=ZRSTP(EN, d1, d2);...
• Page 283 • As a reset instruction for individual devices, the RST instruction can be used for bit devices and word devices. (1): M0 is reset. (2): The current value of T0 is reset. (3): D0 is reset. • The FMOV(P) instruction is a batch write instruction for a constant (K0 for example) that can write "0" for word devices (including nibble specification of bit devices).
• ### Page 284: Data Conversion Instructions

Data Conversion Instructions Converting binary data to BCD 4-digit data BCD(P) These instructions convert the binary data in the device specified by (s) to BCD data, and store the converted data in the device specified by (d). Binary data is used in operations in CPU module. Use this instruction to display numeric values on seven-segment display unit equipped with BCD decoder.
• Page 285 • Data specified by (s) can be converted if it is within the range from K0 to K9999 BCD (decimal). • The table below shows nibble specification for the data in the device specified by (s) and (d). CPU module BCD Y14 to Y10 to Y4 to...
• ### Page 286: Converting Binary Data To Bcd 8-Digit Data

Converting binary data to BCD 8-digit data DBCD(P) These instructions convert the binary data in the device specified by (s) to BCD data, and store the converted data in the device specified by (d). Binary data is used in operations in CPU module. Use this instruction to display numeric values on seven-segment display unit equipped with BCD decoder.
• Page 287 • Data specified by (s) can be converted if it is within the range from K0 to K99999999 BDC (decimal). • The table below shows nibble specification for the data in the device specified by (s) and (d). CPU module DBCD DBCD Y34 to Y30 to...
• ### Page 288: Converting Bcd 4-Digit Data To Binary Data

Converting BCD 4-digit data to binary data BIN(P) These instructions convert the binary-coded decimal data in the device specified by (s) to binary data, and store the converted data in the device specified by (d). Use this instruction to convert a binary-coded decimal (BCD) value such as a value set by a digital switch into binary (BIN) data and to receive the converted binary data so that the data can be handled in operations in CPU module.
• Page 289 • The data in the device specified by (s) can be converted if it is in the range from 0 to 9999 (BCD). • The table below shows nibble specification for the data in the device specified by (s) and (d). In case of K4X0 X4 to X14 to...
• ### Page 290: Converting Bcd 8-Digit Data To Binary Data

Converting BCD 8-digit data to binary data DBIN(P) These instructions convert the binary-coded decimal data in the device specified by (s) to binary data, and store the converted data in the device specified by (d). Use this instruction to convert a binary-coded decimal (BCD) value such as a value set by a digital switch into binary (BIN) data and to receive the converted binary data so that the data can be handled in operations in CPU module.
• Page 291 • The data in the device specified by (s) can be converted if it is in the range from 0 to 99999999 (BCD). • The table below shows nibble specification for the data in the device specified by (s) and (d). DBIN In case of K8X0 X34 to...
• ### Page 292: Converting Single-Precision Real Number To 16-Bit Signed Binary Data

Converting single-precision real number to 16-bit signed binary data FLT2INT(P) 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 digits after the decimal point of the single- precision real number, specified with (s), are truncated.
• ### Page 293: Converting Single-Precision Real Number To 16-Bit Unsigned Binary Data

Converting single-precision real number to 16-bit unsigned binary data FLT2UINT(P) 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 digits after the decimal point of the single- precision real number, specified with (s), are truncated.
• ### Page 294: Converting Single-Precision Real Number To 32-Bit Signed Binary Data

Converting single-precision real number to 32-bit signed binary data FLT2DINT(P) 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 digits after the decimal point of the single- precision real number, specified with (s), are truncated.
• ### Page 295: Converting Single-Precision Real Number To 32-Bit Unsigned Binary Data

Converting single-precision real number to 32-bit unsigned binary data FLT2UDINT(P) 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 digits after the decimal point of the single- precision real number, specified with (s), are truncated.
• ### Page 296: 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) These instructions convert the 16-bit signed binary data in the device specified by (s) to 16-bit unsigned binary data, and store the result in the device specified by (d). Ladder diagram Structured text ENO:=INT2UINT(EN,s,d);...
• ### Page 297: 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) 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). Ladder diagram Structured text ENO:=INT2DINT(EN,s,d);...
• ### Page 298: 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) 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). Ladder diagram Structured text ENO:=INT2UDINT(EN,s,d);...
• ### Page 299: 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) These instructions convert the 16-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). Ladder diagram Structured text ENO:=UINT2INT(EN,s,d);...
• ### Page 300: 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) 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). Ladder diagram Structured text ENO:=UINT2DINT(EN,s,d);...
• ### Page 301: 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) 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). Ladder diagram Structured text ENO:=UINT2UDINT(EN,s,d);...
• ### Page 302: 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) 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). Ladder diagram Structured text ENO:=DINT2INT(EN,s,d);...
• ### Page 303: 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) 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). Ladder diagram Structured text ENO:=DINT2UINT(EN,s,d);...
• ### Page 304: 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) These instructions convert the 32-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). Ladder diagram Structured text ENO:=DINT2UDINT(EN,s,d);...
• ### Page 305: 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) 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). Ladder diagram Structured text ENO:=UDINT2INT(EN,s,d);...
• ### Page 306: 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) 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). Ladder diagram Structured text ENO:=UDINT2UINT(EN,s,d);...
• ### Page 307: 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) These instructions convert the 32-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). Ladder diagram Structured text ENO:=UDINT2DINT(EN,s,d);...
• ### Page 308: Converting 16-Bit Binary Data To Gray Code

Converting 16-bit binary data to Gray code GRY(P)(_U) These instructions convert the 16-bit binary data in the device specified by (s) to 16-bit binary gray code data, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=GRY(EN,s,d);...
• ### Page 309: Converting 32-Bit Binary Data To Gray Code

Converting 32-bit binary data to Gray code DGRY(P)(_U) 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). Ladder diagram Structured text ENO:=DGRY(EN,s,d);...
• ### Page 310: Converting Gray Code To 16-Bit Binary Data

Converting Gray code to 16-bit binary data GBIN(P)(_U) These instructions convert the 16-bit binary gray code data in the device specified by (s) to 16-bit binary data, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=GBIN(EN,s,d);...
• ### Page 311: Converting Gray Code To 32-Bit Binary Data

Converting Gray code to 32-bit binary data DGBIN(P)(_U) 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). Ladder diagram Structured text ENO:=DGBIN(EN,s,d);...
• ### Page 312: Converting Decimal Ascii To 16-Bit Binary Data

Converting decimal ASCII to 16-bit binary data DABIN(P)(_U) These instructions convert the decimal ASCII data 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). Ladder diagram Structured text ENO:=DABIN(EN,s,d);...
• Page 313 When the ASCII data, -25108 (signed), is specified by (s) ∙∙∙ ∙∙∙ 32H (2) 2DH (-) ∙∙∙ (s)+1 31H (1) 35H (5) (s)+2 38H (8) 30H (0) • The ASCII data that can be specified by (s) to (s)+2 is -32768 to +32767 for signed data, and 0 to 65535 for unsigned data. •...
• ### Page 314: Converting Decimal Ascii To 32-Bit Binary Data

Converting decimal ASCII to 32-bit binary data DDABIN(P)(_U) These instructions convert the decimal ASCII data in the device numbers specified by (s) and later to 32-bit binary data, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=DDABIN(EN,s,d);...
• Page 315 Processing details • These instructions convert the decimal ASCII data in the device numbers specified by (s) and later to 32-bit binary data, and store the converted data in the device specified by (d). ∙∙∙ ∙∙∙ ASCII 10 ASCII S (s)+1 (d)+1 ASCII 10...
• ### Page 316: Converting Ascii To Hex

Converting ASCII to HEX HEXA(P) These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers specified by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later. Ladder diagram Structured text ENO:=HEXA(EN,s,n,d);...
• Page 317 Processing details • These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers specified by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later. 16-bit conversion mode and 8-bit conversion mode options are available for these instructions.
• Page 318 SM400 16 bits SM8161 8-bit conversion mode Ignored Lower 8 bits HEXA D200 D100 Source data Conversion source data ASCII data Hexadecimal code D200 D201 D202 D203 D204 D205 D206 D207 D208 Number of specified characters and conversion result "." indicates "0". When (n)=K2 D200 D102...
• Page 319 Operation error Error code Description (SD0/SD8067) 2820H The (n) number of devices specified by (s) and (d) exceeds the corresponding device range. 2821H The range specified by (s) and (d) overlaps. 3401H An ASCII code other than 30H to 39H, and 41H to 46H is set in the device specified by (s). 3405H The value specified in (n) is outside the range specified below.
• ### Page 320: Converting Character String To 16-Bit Binary Data

Converting character string to 16-bit binary data VAL(P)(_U) These instructions convert the character string in the device numbers specified by (s) and later to 16-bit binary data, and store the number of digits in the device specified by (d1) and the binary data in the device specified by (d2). Ladder diagram Structured text ENO:=VAL(EN,s,d1,d2);...
• Page 321 • The total number of digits stored in (d1) is the total number of characters (including the sign and decimal point) representing the numeric value. The number of digits in the decimal part stored in (d1)+1 is the number of characters representing the decimal part after 2EH (.).
• Page 322 Operation error Error code Description (SD0/SD8067) 2820H The device specified by (d1) exceeds the corresponding device range. When "00H" is not set in the corresponding device range after the device specified in (s). 3401H The number of characters of the character string specified by (s) is other than 2 to 8 characters. The number of characters of the decimal part of the character string specified by (s) is other than 0 to 5 characters.
• ### Page 323: Converting Character String To 32-Bit Binary Data

Converting character string to 32-bit binary data DVAL(P)(_U) These instructions convert the character string in the device numbers specified by (s) and later to 32-bit binary data, and store the number of digits in the device specified by (d1) and the binary data in the device specified by (d2). Ladder diagram Structured text ENO:=DVAL(EN,s,d1,d2);...
• Page 324 Processing details • These instructions convert the character string in the device numbers specified by (s) and later to 32-bit binary data, and store the number of digits in the device specified by (d1) and the binary data in the device specified by (d2). When converting a character string into binary data, the data from the device number specified by (s) to a device number storing "00H"...
• Page 325 When "20H" exists between the sign and the first non-zero number (a signed value is specified) Total number of digits Number of digits of the decimal part 6 5 4 3 . BIN32 6 5 4 3 2 1 Ignore When "30H"...
• ### Page 326: Two's Complement Of 16-Bit Binary Data (Sign Inversion)

Two's complement of 16-bit binary data (sign inversion) NEG(P) These instructions invert the sign of the 16-bit binary data in the device specified by (d), and store the resultant data in the device specified by (d). Ladder diagram Structured text ENO:=NEG(EN,d);...
• ### Page 327: Two's Complement Of 32-Bit Binary Data (Sign Inversion)

Two's complement of 32-bit binary data (sign inversion) DNEG(P) These instructions invert the sign of the 32-bit binary data in the device specified by (d), and store the resultant data in the device specified by (d). Ladder diagram Structured text ENO:=DNEG(EN,d);...
• ### Page 328: Decoding From 8 To 256 Bits

Decoding from 8 to 256 bits DECO(P) These instructions decode the lower-order (n) bits of the device specified by (s), and store the result in the 2 (to the power (n)) bit from the device specified by (d). Ladder diagram Structured text ENO:=DECO(EN,s,n,d);...
• Page 329 Operation error Error code Description (SD0/SD8067) 2820H The device specified by (s) exceeds the corresponding device range. The device specified by (d) exceeds the corresponding device range. 3401H (d) is specified as a bit device and (n) is other than 0 to 8. (d) is specified as a word device and (n) is other than 0 to 4.
• ### Page 330: Encoding From 256 To 8 Bits

Encoding from 256 to 8 bits ENCO(P) These instructions encode the 2 bits of data from the device specified by (s), and store it in (d). Ladder diagram Structured text ENO:=ENCO(EN,s,n,d); ENO:=ENCOP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• ### Page 331: Seven-Segment Decoding

Seven-segment decoding SEGD(P) This instruction decodes data, and turns the seven-segment display unit (1 digit) ON. Ladder diagram Structured text ENO:=SEGD(EN,s,d); ENO:=SEGDP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Head device to be decoded -32768 to +32767 16-bit signed binary ANY16...
• Page 332 Processing details • "0" to "F" (hexadecimal numbers) in low-order 4 bits (1 digit) of (s) are decoded to data for the seven-segment display unit, and stored in the low-order 8 bits of (d). Low-order 8 bits of (d) are occupied, and high-order 8 bits do not change. •...
• ### Page 333: Seven Segment With Latch

Seven Segment With Latch SEGL This instruction controls one or two sets of 4-digit seven-segment display units having the latch function. Ladder diagram Structured text ENO:=SEGL(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Head device converted into the BCD format 0 to 9999 16-bit signed binary...
• Page 334 ■When using one set of 4 digits (n = K0 to K3) A 4-digit numeric value stored in (s) is converted from binary into BCD, and each digit is output in turn from (d) to (d)+3 by the time division method. The strobe signal is output in turn from (d)+4 to (d)+7 by the time division method also to latch one set of 4-digit seven-segment display unit.
• ### Page 335: Separating 4 Bits From 16-Bit Data

Separating 4 bits from 16-bit data DIS(P) These instructions store the data equivalent of the (n) nibbles (1-nibble/ 4-bits) of the 16-bit binary data specified by (s) in to the lower-order 4 bits of (n) number of devices starting from the one specified by (d). Ladder diagram Structured text ENO:=DIS(EN,s,n,d);...
• Page 336 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) number of points from (d) exceed the corresponding device range. 3401H (n) is other than 0 to 4. 7 BASIC INSTRUCTIONS 7.5 Data Conversion Instructions...
• ### Page 337: Connecting 4 Bits To 16-Bit Data

Connecting 4 bits to 16-bit data UNI(P) These instructions link the lower-order 4 bits of the 16-bit binary data of the (n) number of devices starting from the one specified by (s) to the device storing 16-bit binary data specified by (d). Ladder diagram Structured text ENO:=UNI(EN,s,n,d);...
• Page 338 Operation error Error code Description (SD0/SD8067) 2820H The range of (n) number of points from (d) exceed the corresponding device range. 3401H (n) is other than 0 to 4. 7 BASIC INSTRUCTIONS 7.5 Data Conversion Instructions...
• ### Page 339: Separating The Specified Number Of Bits

Separating the specified number of bits NDIS(P) These instructions separate each bit of the data in the device numbers specified by (s1) onwards into bit units specified by (s2), and store the separated data in the device number specified by (d) onwards. Ladder diagram Structured text ENO:=NDIS(EN,s1,s2,d);...
• Page 340 Processing details • These instructions separate each bit of the data in the device numbers specified by (s1) and later into bit units specified by (s2), and store the separated data in the device numbers starting from the one specified by (d). (s2) (s2)+1 (s2)+2...
• ### Page 341: Connecting The Specified Number Of Bits

Connecting the specified number of bits NUNI(P) These instructions link each bit of the data in the device numbers specified by (s1) onwards into bit units specified by (s2), and store the connected data in the device number specified by (d) onwards. Ladder diagram Structured text ENO:=NUNI(EN,s1,s2,d);...
• Page 342 Processing details • These instructions link each bit of the data in the device numbers specified by (s1) onwards into bit units specified by (s2), and store the linked data in the device number specified by (d). (s2) (s2)+1 (s2)+2 (s2)+3 (s2)+4 (s2)+5...
• ### Page 343: Separating Data In Byte Units

Separating data in byte units WTOB(P) These instructions separate the 16-bit binary data in the device numbers starting from the one specified by (s) onwards into (n) byte units, and store the separated data in the device number specified by (d) onwards. Ladder diagram Structured text ENO:=WTOB(EN,s,n,d);...
• Page 344 For example, when (n) is 5, data starting from (s) to the lower 8 bits of (s)+2 is stored into (d) through (d)+4. ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ (d)+1 (s)+1 (n)=5 (d)+2 (s)+2 (d)+3 (d)+4 (1): The data FEH is ignored when (n) is 5. •...
• ### Page 345: Connecting Data In Byte Units

Connecting data in byte units BTOW(P) These instructions link the lower-order 8 bits of the 16-bit binary data of (n) number of bytes stored in the device numbers starting from the one specified by (s) onwards into word units, and store the linked data in the device numbers starting from the one specified by (d) onwards.
• Page 346 For example, when (n) is 5, lower 8 bits of data from (s) through (s+4) is stored into (d) through (d)+2. ∙∙∙ ∙∙∙ ∙∙∙ ∙∙∙ (d)+1 (s)+1 (d)+2 (s)+2 (n)=5 (s)+3 (s)+4 (1): Filled with 00H. • Setting the number of bytes by (n) automatically determines the byte data range specified by (s) and the device range specified by (d) for storing the linked data.
• ### Page 347: Digital Switch (Thumbwheel Input)

Digital Switch (Thumbwheel Input) This instruction reads the set value of digital switches. This instruction can read a set of 4 digits (n = K1) or two sets of 4 digits (n = K2). Ladder diagram Structured text ENO:=DSW(EN,s,n,d1,d2); (d1) (d2) FBD/LD Setting data...
• Page 348 Processing details The value of each digital switch connected to (s) is input by the time division method (in which the value is input in turn from the 1st digit by 100 ms interval output signal), and stored to (d2). A numeric value from 0 to 9999 (up to 4 digits) can be read, the first set is stored to (d2), and the second set is stored to (d2)+1.
• ### Page 349: Data Transfer Instructions

Data Transfer Instructions Transferring 16-bit data MOV(P) These instructions transfer the 16-bit binary data in the device specified by (s) to the device specified by (d). Ladder diagram Structured text ENO:=MOV(EN,s,d); ENO:=MOVP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• ### Page 350: Transferring 32-Bit Data

Transferring 32-bit data DMOV(P) These instructions transfer the 32-bit binary data in the device specified by (s) to the device specified by (d). Ladder diagram Structured text ENO:=DMOV(EN,s,d); ENO:=DMOVP(EN,s,d) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Transfer source data or device number for storing data...
• ### Page 351: Inverting And Transferring 16-Bit Data

Inverting and transferring 16-bit data CML(P) These instructions invert each bit of the 16-bit binary data in the device specified by (s), and transfer the result to the device specified by (d). Ladder diagram Structured text ENO:=CML(EN,s,d); ENO:=CMLP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
• ### Page 352: Inverting And Transferring 32-Bit Data

Inverting and transferring 32-bit data DCML(P) These instructions invert each bit of the 32-bit binary data in the device specified by (s), and transfer the result to the device specified by (d). Ladder diagram Structured text ENO:=DCML(EN,s,d); ENO:=DCMLP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
• ### Page 353: Digit Move

Digit move SMOV(P) These instructions distribute and compose data in units of nibble (4 bits). Ladder diagram Structured text ENO:=SMOV(EN,s,n1,n2,n3,d); ENO:=SMOVP(EN,s,n1,n2,n3,d); (n1) (n2) (n3) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Word device number storing data whose nibbles will be ...
• Page 354 Processing details These instructions distribute and compose data in units of nibble (4 bits). The contents of the transfer source (s) and transfer destination (d) are converted into 4-digit BCD (0000 to 9999). (n2) nibbles starting from the (n1)th nibble are transferred to the transfer destination (d) starting from the (n3)th nibble, converted into binary, and then stored to the transfer destination (d).
• ### Page 355: Inverting And Transferring 1-Bit Data

Inverting and transferring 1-bit data CMLB(P) These instructions invert the bit data in the device specified by (s), and transfer the result into the device specified by (d). Ladder diagram Structured text ENO:=CMLB(EN,s,d); ENO:=CMLBP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• ### Page 356: Transferring 16-Bit Block Data (65535 Points Maximum)

Transferring 16-bit block data (65535 points maximum) BMOV(P) These instructions block transfer the 16-bit binary data of (n) number of devices starting from the one specified by (s) to the device specified by (d). Ladder diagram Structured text ENO:=BMOV(EN,s,n,d); ENO:=BMOVP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types...
• Page 357 Processing details • These instructions block transfer the 16-bit binary data of (n) number of devices starting from the one specified by (s) to the device specified by (d). ∙∙∙ ∙∙∙ 1234H 1234H (s)+1 5678H (d)+1 5678H (s)+2 7FF0H (d)+2 7FF0H (s)+(n-2) 6FFFH...
• ### Page 358: Transferring Identical 16-Bit Block Data (65535 Points Maximum)

Transferring identical 16-bit block data (65535 points maximum) FMOV(P) These instructions transfer (n) point(s) of data identical to the 16-bit binary data in the device specified by (s) to the devices specified by (d). Ladder diagram Structured text ENO:=FMOV(EN,s,n,d); ENO:=FMOVP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types...
• Page 359 Precautions When the value specified in (n) is 0, an operation error does not occur, but no processing is performed, Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.7 Data Transfer Instructions...
• ### Page 360: Transferring Identical 32-Bit Block Data (65535 Points Maximum)

Transferring identical 32-bit block data (65535 points maximum) DFMOV(P) These instructions transfer (n) point(s) of data identical to the 32-bit binary data in the device specified by (s) to the devices specified by (d). (65535 points maximum) Ladder diagram Structured text ENO:=DFMOV(EN,s,n,d);...
• Page 361 Precautions When the value specified in (n) is 0, an operation error does not occur, but no processing is performed. Operation error There is no operation error. 7 BASIC INSTRUCTIONS 7.7 Data Transfer Instructions...
• ### Page 362: Exchanging 16-Bit Data

Exchanging 16-bit data XCH(P) These instructions exchange 16-bit binary data of (d1) and (d2). Ladder diagram Structured text ENO:=XCH(EN,d1,d2); ENO:=XCHP(EN,d1,d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)  (d1) Head device for storing the data to be exchanged 16-bit signed binary ANY16...
• ### Page 363: Exchanging 32-Bit Data

Exchanging 32-bit data DXCH(P) These instructions exchange 32-bit binary data of (d1) and (d2). Ladder diagram Structured text ENO:=DXCH(EN,d1,d2); ENO:=DXCHP(EN,d1,d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (d1) Head device for storing the data to be exchanged ...
• ### Page 364: Exchanging The Upper And Lower Bytes Of 16-Bit Data

Exchanging the upper and lower bytes of 16-bit data SWAP(P) These instructions swap the value of 8 bits of the upper and lower bytes of the device specified by (d). Ladder diagram Structured text ENO:=SWAP(EN,d); ENO:=SWAPP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• ### Page 365: Exchanging The Upper And Lower Bytes Of 32-Bit Data

Exchanging the upper and lower bytes of 32-bit data DSWAP(P) These instructions swap the value of 8 bits of the upper and lower bytes of the word devices specified by (d). Ladder diagram Structured text ENO:=DSWAP(EN,d); ENO:=DSWAPP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
• ### Page 366: Transferring 1-Bit Data

Transferring 1-bit data MOVB(P) These instructions store bit data specified by (s) to (d). Ladder diagram Structured text ENO:=MOVB(EN,s,d); ENO:=MOVBP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)  Head device for storing the transfer-source data ANY_BOOL ...
• ### Page 367: Transferring Octal Bits (16-Bit Data)

Transferring octal bits (16-bit data) PRUN(P) These instructions handle the device number of (s) and (d) with nibble specification as octal numbers, and transfer data. Ladder diagram Structured text ENO:=PRUN(EN,s,d); ENO:=PRUNP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
• Page 368 • Decimal bit device  Octal bit device Command input M0 to M7, M10 to M17  Y0 to Y17 PRUN K4M0 K4Y0 Not transferred Decimal bit device (M) Octal bit device (X) Operation error Error code Description (SD0/SD8067) 2820H The devices specified by (s) and (d) exceed the range of the corresponding device.
• ### Page 369: Transferring Octal Bits (32-Bit Data)

Transferring octal bits (32-bit data) DPRUN(P) These instructions handle the device number of (s) and (d) with nibble specification as octal numbers, and transfer data. Ladder diagram Structured text ENO:=DPRUN(EN,s,d); ENO:=DPRUNP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
• Page 370 • Decimal bit device  Octal bit device Command input M0 to M7, M10 to M17,M20 to M27  Y0 to Y27 K6M0 K6Y0 DPRUN Decimal bit device (M) Not transferred Not transferred Octal bit device (X) Operation error Error code Description (SD0/SD8067) 2820H...
• ### Page 371: Transferring N-Bit Data

Transferring n-bit data BLKMOVB(P) These instructions block transfer the bit data of (n) point(s) from the device specified by (s) to the bit data of (n) point(s) from (d). Ladder diagram Structured text ENO:=BLKMOVB(EN,s,n,d); ENO:=BLKMOVBP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 372 Processing details • These instructions block transfer the bit data of (n) point(s) from the device specified by (s) to the bit data of (n) point(s) from the device specified by (d). • Data can be transferred even when the device range of the transfer-source device and transfer-destination device is overlapping.
• ### Page 373: Chapter 8 Application Instruction

APPLICATION INSTRUCTION Rotation Instruction Rotating 16-bit data to the right ROR(P), RCR(P) • ROR(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the right by (n) bit(s) (not including the carry flag). • 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).
• Page 374 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) (not including the carry flag). The carry flag is on or off depending on the status prior to the execution of the instruction. (SM700, SM8022) Rotating 1-bit data to the right (SM700, SM8022)
• Page 375 ■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). The carry flag is on or off depending on the status prior to the execution of the instruction. (SM700, SM8022) Rotating 1-bit data to the right (SM700, SM8022)
• ### Page 376: Rotating 16-Bit Data To The Left

Rotating 16-bit data to the left ROL(P), RCL(P) • ROL(P): These instructions rotate the 16-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including the carry flag). • 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).
• Page 377 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) (not including the carry flag). The carry flag is on or off depending on the status prior to the execution of the instruction. (SM700, SM8022) b14 b13 b12 b11 b10 Rotating 1-bit data to the left...
• Page 378 ■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). The carry flag is on or off depending on the status prior to the execution of the instruction. (SM700, SM8022) b14 b13 b12 b11 b10 Rotating 1-bit data to the left...
• ### Page 379: Rotating 32-Bit Data To The Right

Rotating 32-bit data to the right DROR(P), DRCR(P) • DROR(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (not including the carry flag). • DRCR(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (including the carry flag).
• Page 380 ■DRCR(P) • These instructions rotate the 32-bit binary data in the device specified by (d) to the right by (n) bit(s) (including the carry flag). The carry flag is on or off depending on the status prior to the execution of the instruction. (d)+1 (SM700, SM8022) b30 b29 b28 b27...
• ### Page 381: Rotating 32-Bit Data To The Left

Rotating 32-bit data to the left DROL(P), DRCL(P) • DROL(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (not including the carry flag). • DRCL(P): These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the carry flag).
• Page 382 ■DRCL(P) • These instructions rotate the 32-bit binary data in the device specified by (d) to the left by (n) bit(s) (including the carry flag). The carry flag is on or off depending on the status prior to the execution of the instruction. (d)+1 (SM700, SM8022) b30 b29 b28 b27...
• ### Page 383: Program Branch Instruction

Program Branch Instruction Pointer branch CJ(P) These instructions execute the program specified by the pointer number within the same program file when the jump command is on. Ladder diagram Structured text Not supported FBD/LD Not supported. Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 384 • These instructions can specify and jump from the current step to a smaller step number. In this case, consider a method to exit a loop so that the watchdog timer does not time out. (1) While X3 is on, the loop is repeated. (2) To exit the loop, turn on X7.
• Page 385 • When the pointer number in operands is same and there is one label, the following operation is caused: (1) When X20 turns ON, the program execution jumps from CJ instruction corresponding to X20 to the label P9. (2) When X20 turns OFF and X21 turns ON, the program execution jumps from CJ instruction corresponding to X21 to the label P9.
• Page 386 Jump to END GOEND This instruction moves the program execution to the FEND or END instruction in the same program file. Ladder diagram Structured text Not supported FBD/LD Not supported. Processing details • This instruction moves the program execution to the FEND or END instruction in the same program file. Precautions •...
• ### Page 387: Program Execution Control Instruction

Program Execution Control Instruction Disabling/enabling interrupt programs DI, EI Interrupts are usually disabled in CPU module. These instructions enable interrupts in CPU module (EI instruction) or disable interrupts again (DI instruction). • DI: Disables the execution of the interrupt program. •...
• Page 388 • An interrupt pointer occupies two steps. (In (1) below, I10 is the step 50, X2 is the step 52, and Y10 is the step 54.) IRET • If the master control contains the EI or DI instruction, such an instruction is executed regardless of the execution of the MC instruction.
• ### Page 389: Disabling The Interrupt Program With Specified Priority Or Lower

Disabling the interrupt program with specified priority or lower This instruction disables the execution of the interrupt program with a priority specified by (s) or lower until the EI instruction is executed, even if the interrupt cause occurs. Ladder diagram Structured text ENO:=DI_1(EN,s);...
• Page 390 • The DI instruction can be nested in up to 16 levels. • The interrupt priority of the interrupt pointer can be set with parameters. (MELSEC iQ-F FX5 User's Manual (Application)) • The interrupt-disabled priority can be checked with SD758 (interrupt-disabling priority setting value).
• Page 391 • When the DI instruction is executed in an interrupt program DI K2 IRET DI K3 A: Scan execution type program B: Interrupt Program (1): Interrupt-enabled section for all priority (2): Interrupt-disabled section for the priority 3 or lower (interrupt-enabled section for the priority 2 or higher) (3): Interrupt-disabled section for the priority 2 or lower (interrupt-enabled section for the priority 1 or higher) •...
• ### Page 392: Interrupt Program Mask

Interrupt program mask IMASK This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number according to the 16-point bit pattern starting from the device specified in (s). Ladder diagram Structured text ENO:=IMASK(EN,s); FBD/LD Setting data ■Descriptions, ranges, and data types Operand...
• Page 393 Processing details • This instruction enables or disables the execution of the interrupt program with the specified interrupt pointer number according to the 16-point bit pattern starting from the device specified in (s). • 1 (ON): The execution of interrupt programs is enabled. •...
• ### Page 394: Disabling/Enabling The Specified Interrupt Pointer

Disabling/enabling the specified interrupt pointer SIMASK This instruction enables or disables the interrupt pointer number specified by (I) according to the value of (s). Ladder diagram Structured text ENO:=SIMASK(EN,In,s); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Interrupt pointer number for which interrupts are enabled or disabled...
• ### Page 395: Returning From The Interrupt Program

Returning from the interrupt program IRET This instruction indicates an end of the processing of an interrupt program. Ladder diagram Structured text Not supported FBD/LD Not supported. Processing details When an interrupt (input or timer) is generated while the main program is executing, the program execution jumps to an interrupt (I) routine.
• ### Page 396: Resetting The Watchdog Timer

Resetting the watchdog timer WDT(P) These instructions reset the watchdog timer in a program. Ladder diagram Structured text ENO:=WDT(EN); ENO:=WDTP(EN); FBD/LD Processing details • These instructions reset the watchdog timer in a program. • These instructions are used when the scan time exceeds the value set for the watchdog timer depending on the condition. If the scan time exceeds the value set for the watchdog timer every scan, change the setting of the watchdog timer in the parameter setting of the engineering tool.
• ### Page 397: Structuring Instruction

Structuring Instruction FOR to NEXT FOR, NEXT When the processing between the FOR and NEXT instructions is executed (n) times without any condition, the processing of the step following the NEXT instruction is executed. Ladder diagram Structured text Not supported NEXT A: Repetition program FBD/LD...
• Page 398 Precautions • The FOR-NEXT loop can be nested up to 16 levels. 3rd level 2nd level 2nd level 1st level NEXT 1st level NEXT 1st level NEXT NEXT NEXT NEXT • The FOR-NEXT loop cannot be interrupted by the I, IRET, SRET, RET, FEND, or END instruction. •...
• ### Page 399: Forcibly Terminating The For To Next Instruction Loop

Forcibly terminating the FOR to NEXT instruction loop BREAK(P) This instruction forcibly terminates the FOR to NEXT instruction loop and shifts the program execution to the pointer specified by (P). Ladder diagram Structured text Not supported FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 400 Precautions • If the branch pointer number of the BREAK instruction outside two nesting levels or more is specified, an operation error occurs and the program execution stops when the BREAK instruction is executed. Operation error Error code Description (SD0/SD8067) 3340H The branch pointer number outside two nesting levels or more is specified.
• ### Page 401: Calling A Subroutine Program

Calling a subroutine program CALL(P) This instruction executes the subroutine program specified by (P). Ladder diagram Structured text Not supported FBD/LD Not supported. Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Start pointer number of the subroutine program ...
• Page 402 • While the command input is ON, the CALL instruction is executed and the program execution jumps to a step with a label (Pn). Then, a subroutine program with the label (Pn) is executed. When the RET (SRET) instruction is executed, the program execution returns to the step following the CALL instruction.
• Page 403 Example in which outputs are latched In the following program example, the counter C0 is provided to count X1. When X0 is input, the subroutine P0 is executed only in one scan, and then the counter is reset and Y7 is output. [Program example] CALLP FEND...
• Page 404 [Timing chart] A: Execution of subroutine P0 triggered by X0 Subroutine is executed. Current value of Counter is reset Counter reset instruction is (part in above deactivated (part program). above program). Resets Y7. Operation error Error code Description (SD0/SD8067) 3360H The 17th level of the nesting is executed.
• ### Page 405: Returning From The Subroutine Program

Returning from the subroutine program RET/SRET These instructions indicate an end of a subroutine program. The RET instruction can be used as SRET. Ladder diagram Structured text Not supported FBD/LD Not supported. Processing details • These instructions indicate an end of a subroutine program. •...
• Page 406 Calling a subroutine program XCALL This instruction executes CALL for (turns on and executes) the subroutine program specified by (P) when the execution condition is established. When the condition is turned off, this instruction executes turns off and terminates for the subroutine program.
• Page 407 • The XCALL instruction can be nested up to 16 levels. However, the 16 levels are the total of the CALL(P) and XCALL instructions. XCALL P0 X0 XCALL P10 X10 XCALL P20 X20 FEND Operation error Error code Description (SD0/SD8067) 3360H The 17th level of the nesting is executed.
• ### Page 408: Data Table Operation Instruction

Data Table Operation Instruction Reading the oldest data from the data table SFRD(P) These instructions read data for first-in first-out control. Ladder diagram Structured text ENO:=SFRD(EN,s,n,d); ENO:=SFRDP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
• Page 409 Processing details • These instructions transfer (read) (s)+1, which was sequentially written by the SFWR instruction, to (d), and shift the word data of (n)-1 points starting from (s)+1 upward by 1 word. Then, these instructions decrease the number of data points stored in (s) by 1.
• ### Page 410: Reading The Newest Data From The Data Table

Reading the newest data from the data table POP(P) These instructions read the latest data written by a shift write (SFWR) instruction for FIFO/FILO control. Ladder diagram Structured text ENO:=POP(EN,s,n,d); ENO:=POPP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
• Page 411 Processing details • Every time the instruction is executed for the word devices (s) to (s)+(n)-1, a device "(s) + Pointer data (s)" is read to (d). (The last data entry written by the shift write (SFWR) instruction for first-in first-out control is read to (d).) Specify any value between 2 and 32767 for (n).
• ### Page 412: Writing Data To The Data Table

Writing data to the data table SFWR(P) These instructions write data for first-in first-out (FIFO) and last-in first-out (LIFO) control. Ladder diagram Structured text ENO:=SFWR(EN,s,n,d); ENO:=SFWRP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
• Page 413 Processing details • The contents of (s) are written to "(n)-1" devices from (d)+1, and "1" is added to the number of data stored in (d). For example, for (d)=0, the contents are written to (d)+1, and for (d)=1, to (d)+2. Pointer Pointer (d)+1 ...
• ### Page 414: Inserting Data To The Data Table

Inserting data to the data table FINS(P) These instructions insert 16-bit data specified by (s) to the data table specified by (d) as the (n)th data. After these instructions are executed, the data after the (n)th data in the data table is moved down by one data point. Ladder diagram Structured text ENO:=FINS(EN,s,n,d);...
• Page 415 Operation error Error code Description (SD0/SD8067) 2820H When the FINS(P) instructions are executed, the data table range exceeds the corresponding device range. 3405H When the FINS(P) instructions are executed, the value (n) exceeds the corresponding device range of the table (d). When the FINS(P) instructions are executed, the table position (n) where the data is inserted exceeds "the number of stored data points + 1".
• ### Page 416: Deleting Data From The Data Table

Deleting data from the data table FDEL(P) These instructions remove the (n)th data in the data table specified by (d) and store the data in the device specified by (s). After these instructions are executed, the data after the (n)+1th data in the data table is moved up by one data point. Ladder diagram Structured text ENO:=FDEL(EN,s,n,d);...
• Page 417 Operation error Error code Description (SD0/SD8067) 2820H When the FDEL(P) instructions are executed, the data table range exceeds the corresponding device range. 3405H When the FDEL(P) instructions are executed, the value (n) exceeds the corresponding device range of the table (d). When 0 is set in (d), and the FDEL(P) instructions are executed.
• ### Page 418: 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 419: Reading Data From The Data Memory

Reading data from the data memory S(P).DEVLD Reads data from the device data storage file in data memory. Ladder diagram Structured text ENO:=S_DEVLD(EN,s,d,n); ENO:=SP_DEVLD(EN,s,d,n); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Read offset of device data storage file (specified in units of 0 to 63 32-bit unsigned binary...
• Page 420 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 421: Writing Data To The Data Memory

Writing data to the data memory SP.DEVST This instruction writes the specified number of points of data to the device data storage file in data memory. Ladder diagram Structured text ENO:=SP_DEVST(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 422 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 423 Operation error Error code Description (SD0/SD8067) 2820H • The value specified by (s1), and (s1)+(n) are out of range of the device data storage file. • Any of the device area ranges specified in (s2) and (d) exceed the corresponding device range. 2822H Device that cannot be specified is specified.
• ### Page 424: Extended File Register Operation Instruction

Extended File Register Operation Instruction Reading extended file register ERREAD Reads the current value of the extended file register (ER) to the file register (R) in the CPU built-in memory. Ladder diagram Structured text ENO:=ERREAD(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
• Page 425 Processing details The current value of the extended file register (ER) stored into the SD memory card is read for (n) points to the file register (R) in the CPU built-in memory specified with (s). The normal or abnormal completion of the ERREAD instruction can be confirmed with the instruction completion device (d) specified with the setting data.
• Page 426 Precautions • If the ERREAD instruction is executed, an access to the SD memory card occurs and the scan time is extended. • This instruction cannot be executed with the extended file register operation instruction simultaneously. • When executing the following extended file register operation instruction, detect the extended file register (ER) access flag: SM9366 switching from ON to OFF, and turn on the drive contact of the extended file register operation instruction.
• ### Page 427: Writing Extended File Register

Writing extended file register ERWRITE Writes the current value of the file register (R) in the CPU built-in memory to the extended file register (ER). Ladder diagram Structured text ENO:=ERWRITE(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
• Page 428 Processing details The current value of the file register (R) in the CPU built-in memory is written (transferred) for (n) points to the extended file register (ER) in the SD memory card specified with (s). The normal or abnormal completion of the ERWRITE instruction can be confirmed with the instruction completion device (d) specified with the setting data.
• Page 429 Precautions • If the ERWRITE instruction is executed, an access to the SD memory card occurs and the scan time is extended. • This instruction cannot be executed with the extended file register operation instruction simultaneously. • When executing the following extended file register operation instruction, detect the extended file register (ER) access flag: SM9366 switching from ON to OFF, and turn on the drive contact of the extended file register operation instruction.
• ### Page 430: Batch Initialization Function Of Extended File Register

Batch initialization function of extended file register ERINIT Initialize all the points of the extended file register (ER) in a batch. Ladder diagram Structured text ENO:=ERINIT(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
• Page 431 Processing details Initializes all the points of the extended file register (ER) in the SD memory card in a batch. The normal or abnormal completion of the ERINIT instruction can be confirmed with the instruction completion device (d) specified with the setting data. •...
• Page 432 Precautions • If the ERINIT instruction is executed, an access to the SD memory card occurs and the scan time is extended. • This instruction cannot be executed with the extended file register operation instruction simultaneously. • When executing the following extended file register operation instruction, detect the extended file register (ER) access flag: SM9366 switching from ON to OFF, and turn on the drive contact of the extended file register operation instruction.
• ### Page 433: Character String Operation Instruction

Character String Operation Instruction Comparing character strings LD\$, AND\$, OR\$ These instructions perform a comparison operation between the character string data in the device specified by (s1) and later and the character string data in the device specified by (s2) and later. (Devices are used as a normally open contact.) Ladder diagram Structured text ENO:=LDSTRING_(EN,s1,s2);...
• Page 434 Processing details • These instructions perform a comparison operation between the character string data specified by (s1) and the character string data specified by (s2). (Devices are used as a normally open contact.) • In the comparison operation, the ASCII codes of the character strings are compared one by one from the start of the strings.
• Page 435 Precautions • In character string comparison operation, if the target device range does not have "00H", the values until the last number of the device are retrieved. Thus, even if the target device range does not have "00H", a comparison operation result is output when a mismatch between the acquired character strings is detected.
• ### Page 436: Concatenating Character Strings

Concatenating character strings \$+(P) [For 2 operands] These instructions concatenate the character string data stored in the device specified by (s) and later to the end of the character string data stored in the device specified by (d) and later, and store the concatenated string in the device specified by (d) and later.
• Page 437 Operation error Error code Description (SD0/SD8067) 2820H In the corresponding device range after the device specified by (s), "00H" does not exist. In the corresponding device range after the device specified by (d), "00H" does not exist. 3406H The whole concatenated character string cannot be stored in the devices from the device specified by (d) to the last device in the corresponding device range.
• Page 438 \$+(P) [For 3 operands] These instructions concatenate the character string data stored in the device specified by (s2) and later to the end of the character string data stored in the device specified by (s1) and later, and store the concatenated string in the device specified by (d) and later.
• Page 439 Precautions • For direct specification, up to 32 characters can be specified (input). When word devices are specified in (s1) or (s2), this restriction (up to 32 characters) is not applicable. • When the values in both (s1) and (s2) start from "00H" (that is, when the number of characters is "0"), "0000H" is stored in (d).
• ### Page 440: Transferring Character Strings

Transferring character strings \$MOV(P) These instructions transfer the character string data specified by (s) to the device specified by (d) and later. Ladder diagram Structured text ENO:=STRINGMOV(EN,s,d); ENO:=STRINGMOVP(EN,s,d); FBD/LD ("STRINGMOV", "STRINGMOVP" enters .) *1 Supported by engineering tool version "1.035M" and later. Setting data ■Descriptions, ranges, and data types Operand...
• Page 441 • Even though the device range of the data to be transferred (s) to (s)+n and the device range for storing the transferred data (d) to (d)+n overlap, the processing is performed normally. For example, when a character string stored in D10 to D13 is transferred to D11 to D14, the transfer is executed as shown below: 32H (2) 31H (1)
• ### Page 442: Converting 16-Bit Binary Data To Decimal Ascii

Converting 16-bit binary data to decimal ASCII BINDA(P)(_U) These instructions convert 16-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the device specified by (d) and later. Ladder diagram Structured text ENO:=BINDA(EN,s,d); ENO:=BINDA_U(EN,s,d); ENO:=BINDAP(EN,s,d) ENO:=BINDAP_U(EN,s,d) FBD/LD...
• Page 443 Precautions • The number of occupied points of (d) is 3 when SM701 is on, and 4 when SM701 is off. Operation error Error code Description (SD0/SD8067) 2820H The device specified by (d) exceeds the corresponding device range. 8 APPLICATION INSTRUCTION 8.8 Character String Operation Instruction...
• ### Page 444: Converting 32-Bit Binary Data To Decimal Ascii

Converting 32-bit binary data to decimal ASCII DBINDA(P)(_U) These instructions convert 32-bit binary data specified by (s) into decimal ASCII codes, and store the converted data in the device specified by (d) and later. Ladder diagram Structured text ENO:=DBINDA(EN,s,d); ENO:=DBINDA_U(EN,s,d); ENO:=DBINDAP(EN,s,d);...
• Page 445 When -12345678 is specified in (s) (when signed data is specified) 20H (SP) 2DH (-) (d)+1 31H (1) 20H (SP) (s)+1 (d)+2 33H (3) 32H (2) 1 2 3 4 5 6 7 8 (d)+3 35H (5) 34H (4) (d)+4 37H (7) 36H (6) 00H or 20H...
• ### Page 446: Converting Hex Code Data To Ascii

Converting HEX code data to ASCII ASCI(P) These instructions convert the (n) characters (digits) within the hexadecimal code data specified by (s) to ASCII, and store the converted data in the device specified by (d) and later. Ladder diagram Structured text ENO:=ASCI(EN,s,n,d);...
• Page 447 Number of specified digits (characters) and conversion result D200 lowest-order byte "C" "B" "A" "0" "4" "3" "2" "1" "8" D200 highest-order byte "C" "B" "A" "0" "4" "3" "2" "1" D201 lowest-order byte "C" "B" "A" "0" "4" "3" "2"...
• Page 448 Number of specified digits (characters) and conversion result D200 "C" "B" "A" "0" "4" "3" "2" "1" "8" D201 "C" "B" "A" "0" "4" "3" "2" "1" D202 "C" "B" "A" "0" "4" "3" "2" D203 "C" "B" "A" "0" "4"...
• ### Page 449: Converting 16-Bit Binary Data To Character String

Converting 16-bit binary data to character string STR(P)(_U) 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. Ladder diagram Structured text ENO:=STR(EN,s1,s2,d);...
• Page 450 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) b8 b7 (s1)+1...
• Page 451 Operation error Error code Description (SD0/SD8067) 3401H The number of digits specified by (s1) is smaller than the number of digits plus 2 of the 16-bit binary data in the device specified by (s2). (The additional 2 digits indicate the sign (+/-) and the decimal point.) The total number of digits specified by (s1) is out of the valid range (2 to 8).
• ### Page 452: Converting 32-Bit Binary Data To Character String

Converting 32-bit binary data to character string DSTR(P)(_U) 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. Ladder diagram Structured text ENO:=DSTR(EN,s1,s2,d);...
• Page 453 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) b8 b7 (s1)+1...
• Page 454 • The value "00H" is automatically stored at the end of the converted character string. • When the number of all digits is even, "0000H" is stored in the device after the last character. When the number of all digits is odd, "00H" is stored in the upper byte (8 bits) of the device storing the final character.
• ### Page 455: Converting Single-Precision Real Number To Character String

Converting single-precision real number to character string ESTR(P)/DESTR(P) These instructions convert the single-precision real number data stored in the device specified by (s1) into a character string according to the display specification stored in the device specified by (s2) and later, and store the string in the device specified by (d) and later.
• Page 456 ■Decimal point format • When 0 is specified in (s2), the decimal point format is applied. (s2) (s2)+1 b8 b7 (s2)+2 ASCII code in "(Value specifying number ASCII code for sign of all digits - 1)"th digit ASCII code in "(Value specifying number ASCII code in "(Value specifying number (d)+1 of all digits - 3)"th digit...
• Page 457 • 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 single-precision real number is positive, and "2DH" (-) is stored if the data is negative. •...
• Page 458 • When the number of decimal part digits is 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24 at a maximum)  6". For other than 0, the number of digits that can be specified by (s2)+1 is "the number of digits (24 at a maximum) >...
• Page 459 • If the nu