Download Print this page
Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Instructions, standard functions/function blocks
Hide thumbs Also See for MELSEC iQ-F FX5:

Advertisement

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

Advertisement

loading

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.
  • Page 4: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .
  • Page 5: Table Of Contents

    Standard arithmetic functions ............. . . 97 Standard bit shift functions .
  • Page 6: Table Of Contents

    Shifting n-bit data to the left by n bit(s) ............151 Shifting n-word data to the right by n word(s) .
  • Page 7: Table Of Contents

    Performing an OR operation on 16-bit data........... . 255 Performing an OR operation on 32-bit data.
  • Page 8: Table Of Contents

    Seven Segment With Latch ..............331 Separating 4 bits from 16-bit data .
  • Page 9: Table Of Contents

    Reading the oldest data from the data table ........... 406 Reading the newest data from the data table .
  • Page 10: Table Of Contents

    Calculating the sine of single-precision real number ..........515 Calculating the cosine of single-precision real number .
  • Page 11: Table Of Contents

    8.19 Initial State ................627 Initial State .
  • Page 12: Table Of Contents

    Reading 1-word/2-word data from another module ..........726 Writing 1-word/2-word data to another module (32-bit specification) .
  • Page 13: Table Of Contents

    14.2 High-speed Current Value Transfer Instruction ..........816 High-speed current value transfer of 16-bit data .
  • Page 14: Table Of Contents

    18.4 Converting BOOL to DINT ............. . . 903 18.5 Converting BOOL to TIME .
  • Page 15: Table Of Contents

    18.55 Writing the Specified Bit of Word Label ........... . 971 18.56 Copying the Specified Bit of Word Label .
  • Page 16: Table Of Contents

    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 number of digits in the decimal part is set to other than 0, "2EH" (.) is automatically stored at the position before the specified number of digits. If the number of digits in the decimal part is 0, "2EH" (.) is not stored. (s2) (s2)+1 (s2)+2...
  • Page 460: Detecting A Character String Length

    Detecting a character string length LEN(P) These instructions detect the length of the character string specified by (s), and store the length in the device specified by (d) and later. These instructions handle data stored in the device specified by (s) to the device storing 00H as a character string. Ladder diagram Structured text ENO:=LENP(EN,s,d);...
  • Page 461 When "ABCDEFGHI" is stored in (s) and later 42H (B) 41H (A) (s)+1 44H (D) 43H (C) "ABCDEFGHI" (s)+2 46H (F) 45H (E) (s)+3 48H (H) 47H (G) (s)+4 49H (I) Precautions The LEN(P) instructions can handle character codes other than ASCII codes, but the character string length is handled in byte units (8 bits).
  • Page 462: Extracting Character String Data From The Right

    Extracting character string data from the right RIGHT(P) These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the right end (from the end), and store the extracted characters in the device specified by (d) and later. Ladder diagram Structured text ENO:=RIGHTP(EN,s,n,d);...
  • Page 463 When 5 is specified in (n) 42H (B) 41H (A) 32H (2) 31H (1) (s)+1 44H (D) 43H (C) (d)+1 34H (4) 33H (3) (s)+2 46H (F) 45H (E) (d)+2 35H (5) (s)+3 32H (2) 31H (1) "12345" (s)+4 34H (4) 33H (3) (s)+5 35H (5)
  • Page 464: Extracting Character String Data From The Left

    Extracting character string data from the left LEFT(P) These instructions extract "n" characters of the character string data stored in the device specified by (s) and later from the left end (from the start), and store the extracted characters in the device specified by (d) and later. Ladder diagram Structured text ENO:=LEFTP(EN,s,n,d);...
  • Page 465 When 7 is specified in (n) 42H (B) 41H (A) 42H (B) 41H (A) (s)+1 44H (D) 43H (C) (d)+1 44H (D) 43H (C) (s)+2 46H (F) 45H (E) 46H (F) 45H (E) (d)+2 (s)+3 32H (2) 31H (1) (d)+3 31H (1) (s)+4 34H (4)
  • Page 466: Storing The Specified Number Of Character Strings

    Storing the specified number of character strings MIDR(P) These instructions extract the number of characters specified by (s2)+1 of the character string data stored in the device specified by (s1) and later from the position specified by (s2), and store the extracted characters in the device specified by (d) and later.
  • Page 467 Processing details • These instructions extract the number of characters specified by (s2)+1 of the character string data stored in the device specified by (s1) and later from the position specified by (s2), and store the extracted characters in the device specified by (d) and later.
  • Page 468 Operation error Error code Description (SD0/SD8067) 2820H In the corresponding device range of the device specified by (s1) and later, "00H" does not exist. 3405H The value stored in a device specified in (s2)+1 is -2 or lower. The value stored in a device specified in (s2) exceeds the number of characters of (s1). A negative value is specified in (s2).
  • Page 469: Replacing The Specified Number Of Character Strings

    Replacing the specified number of character strings MIDW(P) These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string data stored in the device specified by (d) and later.
  • Page 470 Processing details • These instructions extract the number of characters specified by (s2)+1 from the character string data stored in the device specified by (s1) and later, and store the extracted data in the position specified by (s2) and later of the character string data stored in the device specified by (d) and later.
  • Page 471 • When (s2)+1 (the number of characters to be extracted) is "-1", the entire character string stored in (s1) and later is stored to (d) and later. Before execution 42H (B) 41H (A) (d)+1 44H (D) 43H (C) (d)+2 46H (F) 45H (E) (s1) 31H (1)
  • Page 472: Searching Character String

    Searching character string INSTR(P) These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th character from the left, for the character string data stored in the device specified by (s1) and later and store the search result in the device specified by (d).
  • Page 473 Processing details • These instructions search the character string data stored in the device specified by (s2) and later starting from the (s3)th character from the left, for the character string data stored in the device specified by (s1) and later and store the search result in the device specified by (d).
  • Page 474: Inserting Character String

    Inserting character string STRINS(P) These instructions insert the character string specified by (s1) at the (s2)th character from the start of the character string specified by (d). Ladder diagram Structured text ENO:=STRINS(EN,s1,s2,d); ENO:=STRINSP(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 475 Processing details • These instructions insert the character string specified by (s1) at the (s2)th character from the start of the character string specified by (d). (s1) 31H (1) 30H (0) (s1)+1 33H (3) 32H (2) 42H (B) 41H (A) The character string data of the (s1)+2 34H (4)
  • Page 476: Deleting Character String

    Deleting character string STRDEL(P) These instructions delete (n) characters starting from the (s)th character (deletion start position) from the start of the character string data specified by (d). Ladder diagram Structured text ENO:=STRDEL(EN,s,n,d); ENO:=STRDELP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 477 Processing details • These instructions delete (n) characters starting from the (s)th character (deletion start position) from the start of the character string data specified by (d). The character string data of the deleted character After shifting, "00H" is stored and later is shifted rightward by 5 characters.
  • Page 478: Real Number Instruction

    Real Number Instruction Comparing single-precision real numbers LDE, ANDE, ORE These instructions perform a comparison operation between the single-precision real number in the device specified by (s1) and the single-precision real number in the device specified by (s2). (Devices are used as a normally open contact.) Ladder diagram Structured text ENO:=LDE_(EN,s1,s2);...
  • Page 479 Processing details • These instructions perform a comparison operation between the single-precision real number in the device specified by (s1) and the single-precision real number in the device specified by (s2). (Devices are used as a normally open contact.) • The following table lists the comparison operation results of each instruction. Instruction symbol Condition Result...
  • Page 480: Single-Precision Real Number Comparison

    Single-precision real number comparison DECMP(P) These instructions compare two data values (single-precision real number), and output the result (larger, same or smaller) to three consecutive bit devices. Ladder diagram Structured text ENO:=DECMP(EN,s1,s2,d); ENO:=DECMPP(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 481 Precautions • Three devices ((d), (d)+1, and (d)+2) specified by (d) are occupied. Note that these devices are not used for any other purpose. Operation error Error code Description (SD0/SD8067) 2820H The device range specified by (d) exceeds the corresponding device range. The specified device value is denormalized number, NaN (not a number), or .
  • Page 482: Single-Precision Real Number Data Band Comparison

    Single-precision real number data band comparison DEZCP(P) These instructions compare the comparison range of two points, upper and lower, with the binary floating point, and output the result to three consecutive bit devices in accordance with the larger, smaller, and band. Ladder diagram Structured text ENO:=DEZCP (EN, s1, s2, s3, d);...
  • Page 483 Processing details • These instructions compare the comparison values (s1) and (s2) with the comparison source (s3) as floating point data, and one of the bits among (d), (d)+1, and (d)+2 turns on according to the result (smaller, within the range or larger). DEZCP (s1) (s2)
  • Page 484: Adding Single-Precision Real Numbers

    Adding single-precision real numbers E+(P) [For 2 operands] These instructions add the single-precision real number in the device specified by (s) to the single-precision real number in the device specified by (d), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 485 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H The value stored in specified device is outside the following range -126 |Specified device value|<2 0, 2 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 486 E+(P) [For 3 operands] These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=EPLUS(EN, s1, s2, d);...
  • Page 487 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H The value stored in specified device is outside the following range -126 |specified device value|<2 0, 2 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 488: Subtracting Single-Precision Real Numbers

    Subtracting single-precision real numbers E-(P) [For 2 operands] These instructions subtract the single-precision real number in the device specified by (s) from the single-precision real number in the device specified by (d), and store the result in the device specified by (d). Ladder diagram Structured text Not supported...
  • Page 489 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H The value stored in specified device is outside the following range -126 |specified device value|<2 0, 2 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 490 E-(P) [For 3 operands] These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=EMINUS(EN, s1, s2, d);...
  • Page 491 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H The value stored in specified device is outside the following range -126 |specified device value|<2 0, 2 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 492 Adding single-precision real numbers DEADD(P) These instructions add the single-precision real number in the device specified by (s2) to the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DEADD(EN,s1,s2,d);...
  • Page 493 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 494 Subtracting single-precision real numbers DESUB(P) These instructions subtract the single-precision real number in the device specified by (s2) from the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DSUB(EN,s1,s2,d);...
  • Page 495 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 496: Multiplying Single-Precision Real Numbers

    Multiplying single-precision real numbers E*(P) These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=EMULTI(EN,s1,s2,d);...
  • Page 497 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 498: Dividing Single-Precision Real Numbers

    Dividing single-precision real numbers E/(P) These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real number in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=EDIVISION(EN,s1,s2,d);...
  • Page 499 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 500 Multiplying single-precision real numbers DEMUL(P) These instructions multiply the single-precision real number in the device specified by (s2) to the single-precision real number in the device specified by (s1), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DEMUL(EN,s1,s2,d);...
  • Page 501 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 502 Dividing single-precision real numbers DEDIV(P) These instructions divide the single-precision real number in the device specified by (s1) by the single-precision real number in the device specified by (s2), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DEDIV(EN,s1,s2,d);...
  • Page 503 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 504: Converting 16-Bit Signed Binary Data To Single-Precision Real Number

    Converting 16-bit signed binary data to single-precision real number INT2FLT(P) These instructions convert the 16-bit signed binary data in the device specified by (s) to single-precision real number, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=INT2FLT(EN,s,d);...
  • Page 505: Converting 16-Bit Unsigned Binary Data To Single-Precision Real Number

    Converting 16-bit unsigned binary data to single-precision real number UINT2FLT(P) These instructions convert the 16-bit unsigned binary data in the device specified by (s) to single-precision real number, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=UINT2FLT(EN,s,d);...
  • Page 506: Converting 32-Bit Signed Binary Data To Single-Precision Real Number

    Converting 32-bit signed binary data to single-precision real number DINT2FLT(P) These instructions convert the 32-bit signed binary data in the device specified by (s) to single-precision real number, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=DINT2FLT(EN,s,d);...
  • Page 507: Converting 32-Bit Unsigned Binary Data To Single-Precision Real Number

    Converting 32-bit unsigned binary data to single-precision real number UDINT2FLT(P) These instructions convert the 32-bit unsigned binary data in the device specified by (s) to single-precision real number, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=UDINT2FLT(EN,s,d);...
  • Page 508: Converting Character String To Single-Precision Real Number

    Converting character string to single-precision real number EVAL(P)/DEVAL(P) These instructions convert the character strings in the device areas specified by (s) and later to single-precision real number, and store the converted data in the device specified by (d). The EVAL(P) instructions can also be used as DEVAL(P). Ladder diagram Structured text ENO:=EVAL(EN,s,d);...
  • Page 509 ■Decimal point format • When the character string specified by (s) is decimal point format, the operation is executed as follows. 31H (1) 2DH (-) (s)+1 30H (0) 2EH (.) (d)+1 (s)+2 38H (8) 37H (7) (s)+3 32H (2) 31H (1) (s)+4 0 7 8 1 2 (1): Single-precision real number...
  • Page 510 • With regard to character string, six digits excluding the sign, decimal point and exponent part are valid, and the 7th and later digits are discarded during conversion. 2DH (-) 20H (SP) (s)+1 2EH (.) 31H (1) (d)+1 (s)+2 35H (5) 33H (3) - .
  • Page 511: Converting Binary Floating Point To Decimal Floating Point

    Converting binary floating point to decimal floating point DEBCD(P) These instructions convert the binary floating point specified by (s) to decimal floating point, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=DEBCD(EN,s,d); ENO:=DEBCDP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types...
  • Page 512 Precautions In floating point operations, all data is handled in binary floating point. Because binary floating point is difficult to understand (requiring a dedicated monitoring method), it is converted into scientific notation (decimal floating point) so that monitoring can be easily executed by peripheral equipment. Operation error Error code Description...
  • Page 513: Converting Decimal Floating Point To Binary Floating Point

    Converting decimal floating point to binary floating point DEBIN(P) These instructions convert the decimal floating point specified by (s) to the binary floating point, and store the converted data in the device specified by (d). Ladder diagram Structured text ENO:=DEBIN(EN,s,d); ENO:=DEBINP(EN,s,d);...
  • Page 514 • The table below shows the related devices. Device Name Description Condition Operation The absolute value of the operation result  2 SM700 Carry The value of (d) is the maximum value (2 ) of 32-bit real numbers and the carry flag SM700 turns on. SM8020 Zero The operation result is true "0".
  • Page 515: Inverting The Sign Of Single-Precision Real Number

    Inverting the sign of single-precision real number ENEG(P)/DENEG(P) These instructions invert the sign of the single-precision real number specified by (d), and store the data of the device specified by (d). The ENEG(P) instructions can also be used as DENEG(P). Ladder diagram Structured text ENO:=ENEG(EN,d);...
  • Page 516: Transferring Single-Precision Real Number Data

    Transferring single-precision real number data EMOV(P)/DEMOV(P) These instructions transfer the single-precision real number data stored in the device specified by (s) to the device specified by (d). The EMOV(P) instructions can also be used as DEMOV(P). Ladder diagram Structured text ENO:=EMOV(EN,s,d);...
  • Page 517: Calculating The Sine Of Single-Precision Real Number

    Calculating the sine of single-precision real number SIN(P)/DSIN(P) These instructions calculate the sine of the angle specified by (s), and store the operation result in the device specified by (d). The SIN(P) instructions can also be used as DSIN(P). Ladder diagram Structured text ENO:=SINP(EN,s,d);...
  • Page 518 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H For the angleradian conversion, refer to the DRAD(P) and DDEG(P) instructions. (Page 527 Converting single-precision real number angle to radian, Page 529 Converting single-precision real number radian to angle) 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 519: Calculating The Cosine Of Single-Precision Real Number

    Calculating the cosine of single-precision real number COS(P)/DCOS(P) These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified by (d). The COS(P) instructions can also be used as DCOS(P). Ladder diagram Structured text ENO:=COSP(EN,s,d);...
  • Page 520 Processing details • These instructions calculate the cosine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 COS ( Single-precision real number Single-precision real number • Set the angle data in radians (angle180). •...
  • Page 521: Calculating The Tangent Of Single-Precision Real Number

    Calculating the tangent of single-precision real number TAN(P)/DTAN(P) These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified by (d). The TAN(P) instructions can also be used as DTAN(P). Ladder diagram Structured text ENO:=TANP(EN,s,d);...
  • Page 522 Processing details • These instructions calculate the tangent of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 TAN ( Single-precision real number Single-precision real number • Set the angle data in radians (angle180). •...
  • Page 523: Calculating The Arc Sine Of Single-Precision Real Number

    Calculating the arc sine of single-precision real number ASIN(P)/DASIN(P) These instructions calculate the angle from the sine of the angle specified by (s), and store the operation result in the word device specified by (d). The ASIN(P) instructions can also be used as DASIN(P). Ladder diagram Structured text ENO:=ASINP(EN,s,d);...
  • Page 524 Processing details • These instructions calculate the angle from the sine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The sine value specified by (s) can be set ranging from -1.0 to 1.0. •...
  • Page 525: Calculating The Arc Cosine Of Single-Precision Real Number

    Calculating the arc cosine of single-precision real number ACOS(P)/DACOS(P) These instructions calculate the angle from the cosine of the angle specified by (s), and store the operation result in the word device specified by (d). The ACOS(P) instructions can also be used as DACOS(P). Ladder diagram Structured text ENO:=ACOSP(EN,s,d)
  • Page 526 Processing details • These instructions calculate the angle from the cosine of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The cosine value specified by (s) can be set ranging from -1.0 to 1.0 •...
  • Page 527: Calculating The Arc Tangent Of Single-Precision Real Number

    Calculating the arc tangent of single-precision real number ATAN(P)/DATAN(P) These instructions calculate the angle from the tangent of the angle specified by (s), and store the operation result in the word device specified by (d). The ATAN(P) instructions can also be used as DATAN(P). Ladder diagram Structured text ENO:=ATANP(EN,s,d);...
  • Page 528 Processing details • These instructions calculate the angle from the tangent of the angle specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 Single-precision real number Single-precision real number • The angle (operation result) stored in (d) is expressed in radians (from -/2 to /2). •...
  • Page 529: Converting Single-Precision Real Number Angle To Radian

    Converting single-precision real number angle to radian RAD(P)/DRAD(P) These instructions convert a unit of angle from degrees (DEG.) specified by (s) into radians, and store the converted angle in the device specified by (d). The RAD(P) instructions can also be used as DRAD(P). Ladder diagram Structured text ENO:=RAD(EN,s,d);...
  • Page 530 Processing details • These instructions convert a unit of angle from degrees (DEG.) specified by (s) into radians, and store the converted angle in the device specified by (d). (s)+1 (d)+1 ) ) rad Single-precision real number Single-precision real number •...
  • Page 531: Converting Single-Precision Real Number Radian To Angle

    Converting single-precision real number radian to angle DEG(P)/DDEG(P) These instructions convert a unit of angle from radians specified by (s) into degrees (DEG.), and store the converted angle in the device specified by (d). The DEG(P) instructions can also be used as DDEG(P). Ladder diagram Structured text ENO:=DEG(EN,s,d);...
  • Page 532 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 533: Calculating The Square Root Of Single-Precision Real Number

    Calculating the square root of single-precision real number DESQR(P)/ESQRT(P) These instructions calculate the square root of a value specified by (s), and store the operation result in the device specified by (d). The DESQR(P) instructions can also be used as ESQRT(P). Refer to Added and Changed Functions for details on the ESQRT(P) instruction.
  • Page 534 Operation error Error code Description (SD0/SD8067) 2822H Device that cannot be specified is specified. The specified device value is denormalized number, NaN (not a number), or . 3402H 3405H The value stored in a device specified in (s) is negative. 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 535: Calculating The Exponent Of Single-Precision Real Number

    Calculating the exponent of single-precision real number EXP(P)/DEXP(P) These instructions calculate the exponent of a value specified by (s), and store the operation result in the device specified by (d). The EXP(P) instructions can also be used as DEXP(P). Ladder diagram Structured text ENO:=EXPP(EN,s,d);...
  • Page 536 Operation error Error code Description (SD0/SD8067) The specified device value is -0, denormalized number, NaN (not a number), or . 3402H • The EXP(P) instructions execute operations in natural logarithm. For obtaining a value in common logarithm, specify a common logarithm value divided by 0.4342945 in (s). 0.4342945 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 537: Calculating The Natural Logarithm Of Single-Precision Real Number

    Calculating the natural logarithm of single-precision real number LOG(P)/DLOGE(P) These instructions calculate the logarithm whose base is natural logarithm e of a value specified by (s), and store the operation result in the device specified by (d). The LOG(P) instructions can also be used as DLOGE(P). Ladder diagram Structured text ENO:=LOGP(EN,s,d);...
  • Page 538 Processing details • These instructions calculate the logarithm whose base is natural logarithm e of a value specified by (s), and store the operation result in the device specified by (d). (s)+1 (d)+1 log ( Single-precision real number Single-precision real number •...
  • Page 539: Calculating The Exponentiation Of Single-Precision Real Number

    Calculating the exponentiation of single-precision real number POW(P) These instructions raise float (single precision) data stored in a device specified by (s1) by the single-precision real number specified by (s2), and store the operation result in a device specified by (d). Ladder diagram Structured text ENO:=POW(EN,s1,s2,d);...
  • Page 540 Processing details • These instructions raise float (single precision) data stored in a device specified by (s1) by the single-precision real number specified by (s2), and store the operation result in a device specified by (d). Power data (s2)+1 (s2) (s1)+1 (s1) (d)+1...
  • Page 541: Calculating The Common Logarithm Of Single-Precision Real Number

    Calculating the common logarithm of single-precision real number LOG10(P)/DLOG10(P) These instructions calculate the common logarithm (the logarithm whose base is 10) of a value specified by (s), and store the operation result in the device specified by (d). The LOG10(P) instructions can also be used as DLOG10(P). Ladder diagram Structured text ENO:=LOG10(EN,s,d);...
  • Page 542 Operation error Error code Description (SD0/SD8067) The specified device value is denormalized number, NaN (not a number), or . 3402H 3405H The value stored in a device specified in (s) is negative. The value stored in a device specified in (s) is 0. 8 APPLICATION INSTRUCTION 8.9 Real Number Instruction...
  • Page 543: Searching The Maximum Value Of Single-Precision Real Number

    Searching the maximum value of single-precision real number EMAX(P) These instructions search for the maximum value in the (n) point(s) of single-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device areas specified by (d) and (d)+1. These instructions also store the location of the first maximum value from (s) in the device specified by (d)+2 and the number of maximum values in the device specified by (d)+3.
  • Page 544 Processing details • These instructions search for the maximum value in the (n) point(s) of single-precision real number block data in the device starting from the one specified by (s), and store the maximum value in the device areas specified by (d). These instructions also store the location of the first maximum value from (s) in the device specified by (d)+2 and the number of maximum values in the device specified by (d)+3.
  • Page 545: Searching The Minimum Value Of Single-Precision Real Number

    Searching the minimum value of single-precision real number EMIN(P) These instructions search for the minimum value in the (n) point(s) of single-precision real number block data in the device starting from the one specified by (s), and store the minimum value in the device areas specified by (d) and (d)+1. These instructions also store the location of the first minimum value from (s) in the device specified by (d)+2 and the number of minimum values in the device specified by (d)+3.
  • Page 546 Processing details • These instructions search for the minimum value in the (n) point(s) of single-precision real number block data in the device starting from the one specified by (s), and store the minimum value in the device areas specified by (d) and (d)+1. These instructions also store the location of the first minimum value from (s) in the device specified by (d)+2 and the number of minimum values in the device specified by (d)+3.
  • Page 547: Random Number Instruction

    8.10 Random Number Instruction Generating random number RND(P) These instructions generate a pseudo-random number ranging from 0 to 32767, and store it as a random number to a device specified by (d). Ladder diagram Structured text ENO:=RND(EN,d); ENO:=RNDP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 548: Index Register Operation Instruction

    8.11 Index Register Operation Instruction Saving all data of the index register ZPUSH(P) These instructions save the contents of index registers and long index registers in the devices specified by (d) and later. Ladder diagram Structured text ENO:=ZPUSH(EN,d); ENO:=ZPUSHP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand...
  • Page 549 • The following shows the areas of (d) and later to be used. (d)+0 (1): Number of times of batch-storage (2): 1st nesting (24 words for one nesting) (3): 2nd nesting Precautions • When a nesting structure is not adopted, clear (d) before executing the ZPUSH(P) instructions. •...
  • Page 550: Returning All Data Of The Index Register

    Returning all data of the index register ZPOP(P) These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers. Ladder diagram Structured text ENO:=ZPOP(EN,d); ENO:=ZPOPP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 551: Saving The Selected Data Of The Index Register And Long Index Register

    Saving the selected data of the index register and long index register ZPUSH(P) These instructions save the contents of index registers and long index registers within the range specified by (s) in the devices specified by (d) and later. Ladder diagram Structured text ENO:=ZPUSH_2(EN,s,d);...
  • Page 552 • The following shows the areas of (d) and later used for the instructions (when Z0 to 13 and LZ0 to 4 are used). Number of times of batch-storage (d)+1 Reserved by the system (2 words) (d)+2 (d)+3 (d)+4 ZPUSH (Save the whole range (d)+16 of Z and LZ)
  • Page 553: Returning The Selected Data Of The Index Register And Long Index Register

    Returning the selected data of the index register and long index register ZPOP(P) These instructions read the data saved in the devices specified by (d) and later to index registers and long index registers. Ladder diagram Structured text ENO:=ZPOP_2(EN,s,d); ENO:=ZPOPP_2(EN,s,d); FBD/LD ("ZPOP_2, ZPOPP_2"...
  • Page 554: Data Control Instruction

    8.12 Data Control Instruction Upper and lower limit control of 16-bit binary data LIMIT(P)(_U) These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). Ladder diagram Structured text ENO:=LIMITP(EN,s1,s2,s3,d);...
  • Page 555 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). The output value is controlled as follows.
  • Page 556: Upper And Lower Limit Control Of 32-Bit Binary Data

    Upper and lower limit control of 32-bit binary data DLIMIT(P)(_U) These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). Ladder diagram Structured text ENO:=DLIMITP(EN,s1,s2,s3,d);...
  • Page 557 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary data) in the device specified by (s3) with the upper and lower limit values specified by (s1) and (s2). The output value is controlled as follows.
  • Page 558: Dead Band Control Of 16-Bit Binary Data

    Dead band control of 16-bit binary data BAND(P)(_U) These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2). Ladder diagram Structured text ENO:=BAND(EN,s1,s2,s3,d);...
  • Page 559 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking the input value (16-bit binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2). The output value is controlled as follows.
  • Page 560: Dead Band Control Of 32-Bit Binary Data

    Dead band control of 32-bit binary data DBAND(P)(_U) These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2). Ladder diagram Structured text ENO:=DBAND(EN,s1,s2,s3,d);...
  • Page 561 Processing details • These instructions control the output value to be stored in the device specified by (d) by checking the input value (32-bit binary data) in the device specified by (s3) with the upper and lower limit values of the dead band specified by (s1) and (s2). The output value is controlled as follows.
  • Page 562: Zone Control Of 16-Bit Binary Data

    Zone control of 16-bit binary data ZONE(P)(_U) These instructions add the bias value specified by (s1) or (s2) to the input value specified by (s3), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=ZONE(EN,s1,s2,s3,d);...
  • Page 563 Processing details • These instructions add the bias value specified by (s1) or (s2) to the input value (16-bit binary data) specified by (s3), and store the operation result in the device specified by (d). The bias value is controlled as follows. Condition Output value Input value (s3) <...
  • Page 564: Zone Control Of 32-Bit Binary Data

    Zone control of 32-bit binary data DZONE(P)(_U) These instructions add the bias value specified by (s1) or (s2) to the input value specified by (s3), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=DZONE(EN,s1,s2,s3,d);...
  • Page 565 Processing details • These instructions add the bias value specified by (s1) or (s2) to the input value (32-bit binary data) specified by (s3), and store the operation result in the device specified by (d). The bias value is controlled as follows. Condition Output value Input value ((s3), (s3)+1) <...
  • Page 566: Scaling 16-Bit Binary Data (Point Coordinates)

    Scaling 16-bit binary data (point coordinates) SCL(P)(_U) These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=SCL(EN,s1,s2,d);...
  • Page 567 Processing details • These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 568 Setting item Setting device and setting contents Remarks When R0 is specified in (s2) Setting details Point 3 X coordinate (s2)+5 Y coordinate (s2)+6 K100 Point 4 X coordinate (s2)+7 K200 When coordinates are specified using three points in this way, the output value can be set to an intermediate value.
  • Page 569: Scaling 32-Bit Binary Data (Point Coordinates)

    Scaling 32-bit binary data (point coordinates) DSCL(P)(_U) These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=DSCL(EN,s1,s2,d);...
  • Page 570 Processing details • These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 571 Setting item Setting device and setting contents Remarks When R0 is specified in (s2) Setting details Point 4 X coordinate (s2)+15, (s2)+14 R15, R14 K200 When coordinates are specified using three points in this way, the output value can be set to an intermediate value. Y coordinate (s2)+17, (s2)+16 R17, R16...
  • Page 572: Scaling 16-Bit Binary Data (Xy Coordinates)

    Scaling 16-bit binary data (XY coordinates) SCL2(P)(_U) These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=SCL2(EN,s1,s2,d);...
  • Page 573 Processing details • These instructions process the scaling conversion data (in 16-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 574 Setting item Setting device and setting contents Remarks When R0 is specified in (s2) Setting details Number of coordinate points (s2) X coordinate Point 1 (s2)+1 Point 2 (s2)+2 Point 3 (s2)+3 Point 4 (s2)+4 K200 Refer to Point 5 (s2)+5 K200 Point 6...
  • Page 575: Scaling 32-Bit Binary Data (Xy Coordinates)

    Scaling 32-bit binary data (XY coordinates) DSCL2(P)(_U) These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device specified by (d). Ladder diagram Structured text ENO:=DSCL2(EN,s1,s2,d);...
  • Page 576 Processing details • These instructions process the scaling conversion data (in 32-bit data units) specified by (s2) by scaling it based on the input value specified by (s1), and store the operation result in the device number specified by (d). The scaling conversion is performed based on the scaling conversion data stored in the device specified by (s2) and later.
  • Page 577 Setting item Setting device and setting contents Remarks When R0 is specified in (s2) Setting details Number of coordinate points (s2)+1, (s2) R1, R0 X coordinate Point 1 (s2)+3, (s2)+2 R3, R2 Point 2 (s2)+5, (s2)+4 R5, R4 Point 3 (s2)+7, (s2)+6 R7, R6 Point 4...
  • Page 578: Special Timer Instruction

    8.13 Special Timer Instruction Teaching timer TTMR This instruction measures the period of time in which TTMR instruction is ON. Use this instruction to adjust the set value of a timer by a pushbutton switch. Ladder diagram Structured text ENO:=TTMR(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types...
  • Page 579 Processing details • This instruction measures the period of time to press and hold the command input (pushbutton switch) in 1-second units, multiplies the measured value by the magnification (10 ) which is specified by (s), and stores it in the device specified by (d).
  • Page 580: Special Function Timer

    Special function timer STMR This instruction uses the four devices from the device specified by (d) to perform four types of timer output. Ladder diagram Structured text ENO:=STMR(EN,s1,s2,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
  • Page 581 Processing details • This instruction uses the four devices from the device specified by (d) to perform four types of timer output. (d)+1 (d)+2 (d)+3 (1): Command of the STMR instruction (2): Setting value specified by (s2) • The flickering effect is produced using (d)+1 and (d)+2 with the following program, which turns on/off at the normally closed contact of (d)+3 (T10 is assigned to (s1), K100 is assigned to (s2), and M0 is assigned to (d)).
  • Page 582: Special Counter Instruction

    NC contact becomes turns OFF. The high-speed pulse input/output module is not supported. When the long counter specified by (d) is a high-speed counter, up-counting and down-counting are enabled. For details on the high-speed counter, refer to MELSEC iQ-F FX5 User's Manual (Application). Ladder diagram Structured text ENO:= UDCNTF(EN, s, d);...
  • Page 583 • When unsigned (0 to 4294967295) is assigned to the LC, the OUT LC instruction is used. For the OUT LC instruction, refer to Page 118 OUT LC. • The current value operates as a ring counter.    ...
  • Page 584: Shortcut Control Instruction

    8.15 Shortcut Control Instruction Rotary table shortest direction control ROTC This instruction is suitable for efficient control of the rotary table for putting/taking a product on/off the rotary table. Ladder diagram Structured text ENO:=ROTC(EN,s,n1,n2,d); (n1) (n2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 585 Processing details • The table rotation is controlled by conditions of "n2", (s), and (d) so that a product can be efficiently put on or taken off the rotary table divided into "n1" (=10) sections as shown in the figure below. When the following conditions are specified, forward/backward rotation and high-speed/low-speed/stop are output to (d)+3 to (d)+7.
  • Page 586 Operation error Error code Description (SD0/SD8067) 1811H The number of the ROTC instructions which are used simultaneously exceeds four. 2820H The device range specified by (s) exceeds the corresponding device range. The device range specified by (d) exceeds the corresponding device range. 3405H The value specified by (n1) is outside the following range.
  • Page 587: Ramp Signal Instruction

    8.16 Ramp Signal Instruction Ramp signal RAMPF This instruction obtains the data which changes between the start value (initial value) and the end value (target value) over the specified "n" times. Ladder diagram Structured text ENO:=RAMPF(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 588 • The value used in the constant scan mode can be set in the parameter setting of an engineering tool (constant scan execution interval setting of CPU parameter). For details on the constant scan, refer to MELSEC iQ-F FX5 User's Manual (Application). For details on the engineering tool, refer to GX Works3 Operating Manual.
  • Page 589 • The contents of (d) are changed as follows depending on the ON/OFF status of the mode flag SM8026. When SM8026 is off When SM8026 is on Command Command (s2) (s2) (s1) (s1) (SM8029) (SM8029) Precautions To specify a latched (battery backed) type device as (d) when setting the CPU module to the RUN mode while the command input is ON, clear (d) in advance.
  • Page 590: Pulse Related Instruction

    8.17 Pulse Related Instruction Instruction correspondence table for CPU module built-in positioning and high-speed pulse input/output module The table for instructions corresponding to the CPU module and the high-speed pulse input/output module are shown below. : Supported, : Not supported Instruction CPU module High-speed pulse input/...
  • Page 591 ■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           ...
  • Page 592 General-purpose input assignment of the 1-phase 1-input counter (switching H/W up or down) C: Pulse input, D: Direction input, P: Preset input (reset), E: Enable input (start) C(A) D(B) C(A) D(B) C(A) D(B) C(A) D(B) C(A) D(B) C(A) D(B) C(A) D(B) C(A) D(B)
  • Page 593 • The table below shows the related devices. Function Monitor in operation SM4500 SM4501 SM4502 SM4503 SM4504 SM4505 SM4506 SM4507 High-speed counter pulse SD4507, SD4537, SD4567, SD4597, SD4627, SD4657, SD4687, SD4717, density SD4506 SD4536 SD4566 SD4596 SD4626 SD4656 SD4686 SD4716 Measurement unit time SD4517, SD4547,...
  • Page 594: Measuring The Density Of 32 Bit Binary Pulses

    Measuring the density of 32 bit binary pulses DSPD This instruction counts the number of times the device input specified by (s1) turns off  on only for the time (in 32-bit data units) specified by (s2)  1ms and stores the operation result in the device specified by (d). The high-speed pulse input/output module is not supported.
  • Page 595 Processing details • This instruction counts the number of times the device input specified by (s1) turns off  on only for the time (in 32-bit data units) specified by (s2)  1ms and stores the operation result in the device specified by (d). Counting start (s2)+1,(s2)ms (s2)+1,(s2)ms...
  • Page 596 General-purpose input assignment of the 1-phase 2-input counter U: UP pulse input, D: DOWN pulse input, P: Preset input (reset), E: Enable input (start) U(A) D(B) U(A) D(B) U(A) D(B) U(A) D(B) U(A) D(B) U(A) D(B) U(A) D(B) U(A) D(B) If one of X1, X3, X5, X7, X11, X13, X15, X17 is specified as a device, an error occurs.
  • Page 597 Precautions • The maximum input frequency of turning the inputs ON and OFF is shown below: FX5U-32M/FX5UC-32M CPU module Used input number Maximum input frequency X0 to X5 200 kHz X6, X7 10 kHz FX5U-64M/FX5U-80M/FX5UC-64M/FX5UC-96M CPU module Used input number Maximum input frequency X0 to X7 200 kHz...
  • Page 598: Bit Binary Pulse Output

    16 bit binary pulse output PLSY [For the FX3 compatible operand specification] This instruction outputs 16-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for the amount of 16-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not supported.
  • Page 599 • The following tables show the special relays and special registers related to the PLSY instruction. [Special relays] Axis number Name Descriptions SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated activation SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop SM5532 SM5533...
  • Page 600 For stopping method of the pulse output, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module). • If the positioning address is 0 when the PLSY instruction is activated, pulses are output without limitation.
  • Page 601 Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810H The axis number specified by (d) is used by another instruction. 2820H The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
  • Page 602 PLSY [For the FX5 operand specification] This instruction outputs 16-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for the amount of 16-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not supported.
  • Page 603 • The following tables show the special relays and special registers related to the PLSY instruction. [Special relays] Axis number Name Descriptions SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated activation SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop SM5532 SM5533...
  • Page 604 For stopping method of the pulse output, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module). • If the positioning address is 0 when the PLSY instruction is activated, pulses are output without limitation.
  • Page 605 Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810H The axis number specified by (d) is used by another instruction. 2820H The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
  • Page 606 32 bit binary pulse output DPLSY [For the FX3 compatible operand specification] This instruction outputs 32-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for the amount of 32-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not supported.
  • Page 607 • The following tables show the special relays and special registers related to the DPLSY instruction. [Special relays] Axis number Name Descriptions SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated activation SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop SM5532 SM5533...
  • Page 608 For stopping method of the pulse output, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module). • If the positioning address is 0 when the DPLSY instruction is activated, pulses are output without limitation.
  • Page 609 Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810H The axis number specified by (d) is used by another instruction. 2820H The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
  • Page 610 DPLSY [For the FX5 operand specification] This instruction outputs 32-bit pulse trains specified by the command speed (s) from the device specified by the output (d) for the amount of 32-bit pulses specified by the positioning address (n). The high-speed pulse input/output module is not supported.
  • Page 611 • The following tables show the special relays and special registers related to the DPLSY instruction. [Special relays] Axis number Name Descriptions SM5500 SM5501 SM5502 SM5503 Positioning instruction ON: During activation, OFF: Not activated activation SM5516 SM5517 SM5518 SM5519 Pulse output monitor ON: During output, OFF: During stop SM5532 SM5533...
  • Page 612 For stopping method of the pulse output, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module). • If the positioning address is 0 when the DPLSY instruction is activated, pulses are output without limitation.
  • Page 613 Operation error Error code Description (SD0/SD8067) Axis 1 Axis 2 Axis 3 Axis 4 SD5510 SD5550 SD5590 SD5630 1810H The axis number specified by (d) is used by another instruction. 2820H The value specified by (s) is outside the following range. 0 to 65535 The value specified by (n) is outside the following range.
  • Page 614: Bit Binary Pulse Width Modulation

    16 bit binary pulse width modulation This instruction outputs the pulse (in 16-bit data units) of the ON time (in 16-bit data units) specified by (s1) and the period specified by (s2) to the output destination specified by (d). Ladder diagram Structured text ENO:=PWM(EN,s1,s2,d);...
  • Page 615 • The pulse output destination channel number selected on the parameter setting screen can be specified by (d). • This instruction store the number of pulses, pulse width, and period output from each channel to an SD device. The pulse width and period are stored in the units set by the parameters.
  • Page 616 • After the pulse output is started from each channel, the pulse output monitor turns on. Pulse output Pulse output monitor Initial ON timing OFF timing destination channel value SM5300 • When the HIOEN instruction is • Power on executed •...
  • Page 617 Precautions • Specify the ON time by (s1) and the period by (s2) so that [(s2)-(s1)] is equal to or larger than 3 s. • For the ON time specified by (s1), specify 2 s or more in Y0 to Y3 of the CPU module and the output of the high-speed pulse input/output module, and 200 s or more in Y4 to Y7 of the CPU module.
  • Page 618 • Operations when the PWM output is stopped (while the output pulse is off) Output stop command Period If an output stop command is issued while the OFF time setting is 5 s or less, outputting pulses stops after the set OFF time elapses. OFF time setting OFF time setting is 5 s or less...
  • Page 619 Operation error Error code Description (SD0/SD8067) 1810H The output destination specified by (d) is already used by another instruction (positioning instruction). (The PWM output is not executed.) A Y device is specified as the output destination specified by (d), and there is no unused channel number in the parameter setting. 3405H Y10 or later is specified as the output destination specified by (d).
  • Page 620 32 bit binary pulse width modulation DPWM This instruction outputs the pulse (in 32-bit data units) of the ON time (in 32-bit data units) specified by (s1) and the period specified by (s2) to the output destination specified by (d). Ladder diagram Structured text ENO:=DPWM(EN,s1,s2,d);...
  • Page 621 • The pulse output destination channel number selected on the parameter setting screen can be specified by (d). • This instruction stores the number of pulses, pulse width, and period output from each channel to an SD device. The pulse width and period are stored in the units set by the parameters.
  • Page 622 • After the pulse output is started from each channel, the pulse output monitor turns on. Pulse output Pulse output monitor Initial ON timing OFF timing destination channel value SM5300 • When the HIOEN instruction is • Power on executed •...
  • Page 623 Precautions • Specify the ON time by (s1) and the period by (s2) so that [(s2)-(s1)] is equal to or larger than 3 s. • When a negative value is specified for the ON time by (s1) and the period by (s2), an operation error occurs. (In 16-bit instruction PWM, no error occurs.) •...
  • Page 624 • Operations when the PWM output is stopped (while the output pulse is off) Output stop command Period If an output stop command is issued while the OFF time setting is 5 s or less, outputting pulses stops after the set OFF time elapses. OFF time setting OFF time setting is 5 s or less...
  • Page 625 Operation error Error code Description (SD0/SD8067) 1810H The output destination specified by (d) is already used by another instruction (positioning instruction). (The PWM output is not executed.) A Y device is specified as the output destination specified by (d), and there is no unused channel number in the parameter setting 3405H Y10 or later is specified as the output destination specified by (d).
  • Page 626: Input Matrix Instruction

    8.18 Input Matrix Instruction Input matrix Reads matrix input as 8-point input × "n"-point output (transistor) in the time division method. Ladder diagram Structured text ENO:=MTR(EN, s, n, d1, d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 627 • For wiring details, refer to the hardware manual of each CPU module. Diode Command 0.1A(50V) contact column 1st column input is received. (d1) 2nd column input is received. column (d1)+1 20ms (S)+1 (S)+2 (S)+3 (S)+4 (S)+5 (S)+6 (S)+7 SM8029 (execution Input (X) [sink] complete) CPU module...
  • Page 628 • The MTR instruction can only be used once in a program. • One diode of 0.1 A/50 V is required for each switch. • Use the transistor output format. • If write during RUN is executed while the MTR instruction is being executed, the control right is released by the END processing.
  • Page 629: Initial State

    8.19 Initial State Initial State Automatically controls the initial state and special relays in a step ladder program. Ladder diagram Structured text ENO:=IST(EN, s, d1, d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 630 • The switch functions shown in the table below are assigned to each of the devices specified for selector switches in the operation mode. When X20 is assigned, it is necessary to set X20 to X24 as rotary switches so that they do not turn ON at the same time.
  • Page 631 Device number Descriptions ON/OFF condition Individual operation ON condition when a individual operation mode is selected. initial state OFF condition Except a individual operation mode. Zero return initial state ON condition when a zero return operation mode is selected. OFF condition Except a zero return operation mode.
  • Page 632 ■IST instruction equivalent circuit • The details on special relays (M) and initial state relays (S0 to S9) which are automatically controlled by the IST instruction is as shown in the equivalent circuit below. (Refer to the equivalent circuit below for reference.) This equivalent circuit cannot be programmed.
  • Page 633 ■Example of IST instruction introduction (example of workpiece transfer mechanism) • Operation mode Mechanism for transferring a workpiece from the Stepping point A to the point B using the robot hand operation Zero return Zero return Cycle operation mode operation mode Rightward Right limit X003 Leftward Left limit X4...
  • Page 634 Input device Assignment Cycle operation mode Continuous operation mode Zero return start Automatic mode start Stop When only the continuous When only the continuous When inputs do not have operation mode and zero return operation mode and individual consecutive device numbers operation mode are used operation mode are used Example:...
  • Page 635 • Special relay (SM) used in the IST instruction are classified into two types. Some special relays are automatically controlled by the IST instruction itself according to the situation. Other special relays should be controlled by a program for preparation of operation or for purpose of control. Special relay Description Remarks...
  • Page 636 • Programming is not required when the individual operation mode is not provided. Initial state for individual operation Clamping command Clamping Unclamping command Moving-up command Moving up Moving-down command Moving down Leftward travel command Leftward travel Rightward travel command Rightward travel Upper limit RETSTL •...
  • Page 637 • Automatic mode (stepping operation mode, cycle operation mode or continuous operation mode) Initial state for automatic mode SM8041 SM8044 Transfer Zero point start condition SM400 Moving down Down limit SM400 Clamping T0 K10 SM400 Moving up Upper limit SM400 Rightward travel Right limit SM400...
  • Page 638 Operation error Error code Description (SD0/SD8067) 1811H The number of times the IST instruction is simultaneously driven exceeds 1. 2820H The device numbers specified in (d1) and (d2) show the following relationship: (d1)  (d2) Eight points are not secured from the device specified in (s). An unavailable device is set in (s).
  • Page 639: Drum Sequence

    8.20 Drum Sequence 16-bit binary data absolute method ABSD This instruction creates many output patterns corresponding to the current value (16-bit binary data) of a counter. Ladder diagram Structured text ENO:=ABSD(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 640 • The current value (s2) of the counter is compared with the data table with "n" lines starting from (s1) (which occupies "n" lines  2 devices), and consecutive "n" outputs starting from (d) are controlled to on or off during one rotation. Command input ABSD...
  • Page 641: Bit Binary Data Absolute Method

    32-bit binary data absolute method DABSD This instruction creates many output patterns corresponding to the current value (32-bit binary data) of a counter. Ladder diagram Structured text ENO:=DABSD(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
  • Page 642 • Write the following data to (s1), (s1)+1 to (s1)+4(n)-2, and (s1)+4(n)-1 in advance by a transfer instruction: For example, store 32-bit rising point data in even-numbered devices and 32-bit falling point data in odd-numbered devices. Rising point Falling point Target output ...
  • Page 643: Relative Method

    Relative method INCD This instruction creates many output patterns using a pair of counters. Ladder diagram Structured text ENO:=INCD(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)  (s1) Head word device number storing the set value 16-bit signed binary ANY16 (s2)
  • Page 644 • Suppose that the following data is written in advance by a transfer instruction: Device storing data Output   Data value (example) Example (s1) D300=20 (s1)+1 D301=30 (d)+1 (s1)+2 D302=10 (d)+2 (s1)+3 D303=40 (d)+3      ...
  • Page 645: Check Code

    8.21 Check Code Check code CCD(P) These instructions calculate the horizontal parity value and sum check value in the error check methods used in communication. There is another check method, called CRC (cyclic redundancy check). For obtaining CRC value, use the CRC(P) instructions.
  • Page 646 Processing details • These instructions calculate the addition data and horizontal parity value of data stored in (s) to (s)+(n)-1. The addition data is stored to (d), and the horizontal parity value is stored to (d)+1. The 16-bit mode and 8-bit mode are available for these instructions.
  • Page 647 • 8-bit conversion mode (while SM8161 is ON) With regard to (n) data points starting from (s), the addition data and horizontal parity data of only low-order 8 bits are stored to (d) and (d)+1 respectively. SM8161 is shared with the RS2, ASCI(P), HEX(P), and CRC(P) instructions. SM8161 must always be on in the 8-bit mode. SM8161 is cleared when the CPU module mode is changed from RUN to STOP.
  • Page 648: Data Operation Instruction

    8.22 Data Operation Instruction Searching 16-bit data SERMM(P) These instructions search for the same data, maximum value and minimum value in a data table. Ladder diagram Structured text ENO:=SERMM(EN,s1,s2,n,d); ENO:=SERMMP(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 649 • The following table shows example of search result table configuration and data. (n=10) Searched device Searched data Comparison data Data position Search result (s1) (s1) value (example) (s2) value (example) Maximum Same (d) Minimum value (d)+4 value (d)+3 (s1) K100 K100 ...
  • Page 650: Searching 32-Bit Data

    Searching 32-bit data DSERMM(P) These instructions search for the same data, maximum value and minimum value in a data table. Ladder diagram Structured text ENO:=DSERMM(EN,s1,s2,n,d); ENO:=DSERMMP(EN,s1,s2,n,d); (s1) (s2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 651 • The following table shows example of search result table configuration and data. (n=10) Searched device Searched data Comparison data Data position Search result (s1) (s1) value (s2) value Maximum value Same (d) Minimum value (example) (example) (d)+9, (d)+8 (d)+7, (d)+6 (s1)+1, (s) K100000 K100000...
  • Page 652: Bit Check Of 16-Bit Data

    Bit check of 16-bit data SUM(P) These instructions store the total bits of 1 in the binary 16-bit data of the device specified by (s) to the device specified by (d). Ladder diagram Structured text ENO:=SUM(EN,s,d); ENO:=SUMP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 653: Bit Check Of 32-Bit Data

    Bit check of 32-bit data DSUM(P) These instructions store the total bits of 1 in the binary 32-bit data of the device specified by (s) to the device specified by (d). Ladder diagram Structured text ENO:=DSUM(EN,s,d); ENO:=DSUMP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 654: Bit Judgment Of 16-Bit Data

    Bit judgment of 16-bit data BON(P) These instructions check whether (n) bit(s) of binary 16-bit data of the device specified by (s) are on or off, and output the result to the device specified by (d). Ladder diagram Structured text ENO:=BON(EN,s,n,d);...
  • Page 655 Operation error Error code Description (SD0/SD8067) 3405H The value specified by (n) is outside the following range. 0 to 15 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 656: Bit Judgment Of 32-Bit Data

    Bit judgment of 32-bit data DBON(P) These instructions check whether (n) bit(s) of binary 32-bit data of the device specified by (s) are on or off, and output the result to the device specified by (d). Ladder diagram Structured text ENO:=DBON(EN,s,n,d);...
  • Page 657 Operation error Error code Description (SD0/SD8067) 3405H The value specified by (n) is outside the following range. 0 to 31 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 658: Searching The Maximum Value Of 16-Bit Data

    Searching the maximum value of 16-bit data MAX(P)(_U) These instructions search the maximum value from the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). Ladder diagram Structured text ENO:=MAXP(EN,s,n,d);...
  • Page 659 Processing details • These instructions search the maximum value from the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). These instructions start searching from the device specified by (s), and store the location from (s) of the first maximum value in (d)+1 and the number of maximum values in (d)+2.
  • Page 660: Searching The Maximum Value Of 32-Bit Data

    Searching the maximum value of 32-bit data DMAX(P)(_U) These instructions search the maximum value from the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d). Ladder diagram Structured text ENO:=DMAXP(EN,s,n,d);...
  • Page 661 Processing details • These instructions search the maximum value from the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the maximum value in the device specified by (d) and (d)+1. These instructions start searching from the device specified by (s), and store the location from (s) of the first minimum value in (d)+2 and the number of maximum values in (d)+3.
  • Page 662: Searching The Minimum Value Of 16-Bit Data

    Searching the minimum value of 16-bit data MIN(P)(_U) These instructions search the minimum value from the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the minimum value in the device specified by (d). Ladder diagram Structured text ENO:=MINP(EN,s,n,d);...
  • Page 663 Processing details • These instructions search the minimum value from the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the minimum value in the device specified by (d). These instructions start searching from the device specified by (s), and store the location from (s) of the first minimum value in (d)+1 and the number of minimum values in (d)+2.
  • Page 664: Searching The Minimum Value Of 32-Bit Data

    Searching the minimum value of 32-bit data DMIN(P)(_U) These instructions search the minimum value from the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the minimum value in the device specified by (d). Ladder diagram Structured text ENO:=DMINP(EN,s,n,d);...
  • Page 665 Operation error Error code Description (SD0/SD8067) 2820H The (n) point(s) of data in the device starting from the one specified by (s) exceed the corresponding device range. The device specified by (d) exceeds the setting area in the device/label memory. 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 666: Sorting 16-Bit Data

    Sorting 16-bit data SORTTBL(_U) These instructions sort data lines in the data table (sorting source) having ((n1)(n2)) points specified by (s) in the ascending order based on the group data in the column number (n3), and store the result in the data table (sorting result) having ((n1)(n2)) points specified by (d).
  • Page 667 • The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns (n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d). Number of groups (n2 = K4) Column No.
  • Page 668 • Sorting result when the instructions are executed with (n3) = K3 (column No. 3) Number of groups (n2 = K4) Column No. 1 Column No. 2 Column No. 3 Column No. 4 Control number Height Weight Number of data (n1) = 5 Line No.
  • Page 669: Sorting 16-Bit Data 2

    Sorting 16-bit data 2 SORTTBL2(_U) These instructions sort data lines in the data table (sorting source) of 16-bit binary data having (n1n2) points specified by (s) in the ascending order or descending order based on the group data in the column number (n3), and store the result in the data table (sorting result) of 16-bit binary data having ((n1)(n2)) points specified by (d).
  • Page 670 • The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns (n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d). Number of groups (n2 = K4) Column No.
  • Page 671 • Sorting result when the instructions are executed with (n3) = K3 (column No. 3) (in the case of descending order SM703=ON) Number of groups (n2 = K4) Column No. 1 Column No. 2 Column No. 3 Column No. 4 Control number Height Weight...
  • Page 672: Sorting 32-Bit Data 2

    Sorting 32-bit data 2 DSORTTBL2(_U) These instructions sort data lines in the data table (sorting source) of 32-bit binary data having (n1n2) points specified by (s) in the ascending order or descending order based on the group data in the column number (n3), and store the result in the data table (sorting result) of 32-bit binary data having ((n1)(n2)) points specified by (d).
  • Page 673 • The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4 columns (n1 = K3, n2 = K4). For the sorting result data table, understand (s) as (d). Number of groups (n2 = K4) Column No.
  • Page 674 • Sorting result when the instructions are executed with (n3) = K3 (column No. 3) (in the case of descending order SM703=ON) Number of groups (n2 = K4) Column No. 1 Column No. 2 Column No. 3 Column No. 4 Control number Height Weight...
  • Page 675: Adding 16-Bit Data

    Adding 16-bit data WSUM(P)(_U) These instructions add the (n) point(s) of 16-bit binary data in the device starting from the one specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=WSUM(EN,s,n,d); ENO:=WSUM_U(EN,s,n,d); ENO:=WSUMP(EN,s,n,d);...
  • Page 676: Adding 32-Bit Data

    Adding 32-bit data DWSUM(P)(_U) These instructions add the (n) point(s) of 32-bit binary data in the device starting from the one specified by (s), and store the result in the device specified by (d). Ladder diagram Structured text ENO:=DWSUM(EN,s,n,d); ENO:=DWSUM_U(EN,s,n,d); ENO:=DWSUMP(EN,s,n,d);...
  • Page 677 Operation error Error code Description (SD0/SD8067) 2820H The device range specified by (d) exceeds the corresponding device range. The (n) point(s) of data in the device starting from (s) exceed the corresponding device range. 3405H The data stored in a device specified by (n) is 0. 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 678: Calculating The Mean Value Of 16-Bit Data

    Calculating the mean value of 16-bit data MEAN(P)(_U) These instructions calculate the mean value of the (n) point(s) of 16-bit data units starting from the one specified by (s), and store the operation result in (d). Ladder diagram Structured text ENO:=MEAN(EN,s,n,d);...
  • Page 679 Operation error Error code Description (SD0/SD8067) 3405H The value stored in a device specified by (n) is 0. 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 680: Calculating The Mean Value Of 32-Bit Data

    Calculating the mean value of 32-bit data DMEAN(P)(_U) These instructions calculate the mean value of the (n) point(s) of 32-bit data units starting from the one specified by (s), and store the operation result in (d). Ladder diagram Structured text ENO:=DMEAN(EN,s,n,d);...
  • Page 681 Operation error Error code Description (SD0/SD8067) 3405H The value stored in a device specified by (n) is 0. 8 APPLICATION INSTRUCTION 8.22 Data Operation Instruction...
  • Page 682: Calculating The Square Root Of 16-Bit Data

    Calculating the square root of 16-bit data SQRT(P) These instructions calculate the square root of binary 16-bit data specified by (s1), and store the operation result in (d). Ladder diagram Structured text ENO:=SQRTP(EN,s,d); FBD/LD *1 The SQRT instruction is not supported by the ST language and the FBD/LD language. Use SQRT of the standard function. Page 976 SQRT(_E) Setting data ■Descriptions, ranges, and data types...
  • Page 683: Calculating The Square Root Of 32-Bit Data

    Calculating the square root of 32-bit data DSQRT(P) These instructions calculate the square root of binary 32-bit data specified by (s1), and store the operation result in (d). Ladder diagram Structured text ENO:=DSQRT(EN,s,d); ENO:=DSQRTP(EN,s,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 684: Crc Calculation

    CRC calculation CRC(P) These instructions calculate the CRC (cyclic redundancy check) value which is an error check method used in communication. In addition to CRC value, parity check and sum check are available. For obtaining the horizontal parity value and sum check value, the CCD(P) instruction is available. For the generation of CRC value (CRC-16), these instructions use "X + 1"...
  • Page 685 Example) (s) = D100, (d) = D0, (n) = 6 Device Contents of target data 8 bits 16 bits Device storing data Low-order byte Low-order bits of D100 0301H for which the CRC High-order byte High-order bits of D100 value is generated (s)+1 Low-order byte Low-order bits of D101...
  • Page 686: Indirect Address Read Instruction

    8.23 Indirect Address Read Instruction Reading the indirect address ADRSET(P) These instructions store the indirect address of the device specified by (s) to the device specified by (d). The addresses stored in the device specified by (d)+0 and (d)+1 are used by the program to execute the indirect address of the device.
  • Page 687 Processing details • These instructions store the indirect address of the device specified by (s) to the device specified by (d). The addresses stored in the device specified by (d)+0 and (d)+1 are used by the program to execute the indirect address of the device. (1) Stores the address of W100 to D100 ADRSET W100 D100...
  • Page 688: Clock Instruction

    8.24 Clock Instruction Reading clock data TRD(P) These instructions read the clock data from the built-in real time clock in the CPU module. Ladder diagram Structured text ENO:=TRD(EN,d); ENO:=TRDP(EN,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 689 • The table below shows the related devices. The clock data stored in these special registers is updated during the END processing. Device Name Description Binary code SD210 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code. SD211 Binary clock data (month) The month data in the clock data is stored as a binary code.
  • Page 690: Writing Clock Data

    Writing clock data TWR(P) This instruction writes the clock data to the built-in CPU module real time clock. Ladder diagram Structured text ENO:=TWR(EN,s); ENO:=TWRP(EN,s); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 691 • The table below shows the related devices. Device Name Description SM8019 Real time clock error This special data register turns on when the clock data value in the special register is exceeding the setting range. Binary code SD210 Binary clock data (year) The year data in the clock data is stored as a four-digit binary code.
  • Page 692: Adding Clock Data

    Adding clock data TADD(P) These instructions add the time data stored in the device number specified by (s2) and later to the clock data stored in the device number specified by (s1) and later, and store the result to the device number specified by (d) and later. Ladder diagram Structured text ENO:=TADD(EN,s1,s2,d);...
  • Page 693 When adding 7:48:10 to 6:32:40 (s1) (s2) (s1)+1 (s2)+1 (d)+1 (s1)+2 (s2)+2 (d)+2 • If the sum of two values exceeds 24:00:00, the carry flag turns on, and the result will be the sum minus 24:00:00. For example, if a time value of 20:20:20 is added to another time value of 14:30:30, the sum is 34:40:50. However, the actual addition result will be 10:40:50.
  • Page 694: Subtracting Clock Data

    Subtracting clock data TSUB(P) These instructions subtract the time data stored in the device numbers starting from (s2) from the clock data stored in the device numbers starting from (s1), and store the result to the device numbers starting from (d). Ladder diagram Structured text ENO:=TSUB(EN, s1, s2,d);...
  • Page 695 When subtracting 3:50:10 from 10:40:20 (s1) (s2) (s1)+1 (s2)+1 (d)+1 (s1)+2 (s2)+2 (d)+2 • If the remainder is a negative time value, the borrow flag turns on. The actual result will be the remainder plus 24:00:00. For example, if a time value of 10:42:12 is subtracted from another time value of 4:50:32, the remainder is -6:08:20. However, the actual subtraction result will be 18:08:20.
  • Page 696: Converting Time Data From Hour/Minute/Second To Seconds In 16 Bits

    Converting time data from hour/minute/second to seconds in 16 bits HTOS(P) These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and store the converted data in the device numbers starting from (d) as 16-bit binary. Ladder diagram Structured text ENO:=HTOS(EN,s,d);...
  • Page 697 Operation error Error code Description (SD0/SD8067) 2820H Any of the device area ranges specified in (s) and (d) exceed the corresponding device range. 3403H The result is outside the following range. 0 to 32767 3405H A value specified by (s) is outside the following range. 0 to 9 Any of values specified by (s)+1 and (s)+2 is outside the following range.
  • Page 698: Converting Time Data From Hour/Minute/Second To Seconds In 32 Bits

    Converting time data from hour/minute/second to seconds in 32 bits DHTOS(P) These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and store the converted data in the device numbers starting from (d) as 32-bit binary. Ladder diagram Structured text ENO:=DHTOS(EN,s,d);...
  • Page 699 Operation error Error code Description (SD0/SD8067) 2820H Any of the device area ranges specified in (s) and (d) exceed the corresponding device range. 3405H A value specified by (s) is outside the following range. 0 to 32767 Any of values specified by (s)+1 and (s)+2 is outside the following range. 0 to 59 8 APPLICATION INSTRUCTION 8.24 Clock Instruction...
  • Page 700: Converting Time Data From Seconds To Hour/Minute/Second In 16 Bits

    Converting time data from seconds to hour/minute/second in 16 bits STOH(P) These instructions convert the 16-bit time value in seconds stored in the device numbers starting from (s) to the time value in the HHMMDD format, and store the converted data in the device numbers starting from (d). Ladder diagram Structured text ENO:=STOH(EN,s,d);...
  • Page 701 Operation error Error code Description (SD0/SD8067) 2820H The specified device area exceeds the corresponding device range. 3405H The value specified by (s) is outside the range. 8 APPLICATION INSTRUCTION 8.24 Clock Instruction...
  • Page 702: Converting Time Data From Seconds To Hour/Minute/Second In 32 Bits

    Converting time data from seconds to hour/minute/second in 32 bits DSTOH(P) These instructions convert the 32-bit time value in seconds stored in the device numbers starting from (s) to the time value in the HHMMDD format, and store the converted data in the device numbers starting from (d). Ladder diagram Structured text ENO:=DSTOH(EN,s,d);...
  • Page 703 Operation error Error code Description (SD0/SD8067) 2820H The specified device area exceeds the corresponding device range. 3405H The value specified by (s) is outside the range. 8 APPLICATION INSTRUCTION 8.24 Clock Instruction...
  • Page 704: Comparing Date Data

    Comparing date data LDDT, ANDDT, ORDT These instructions compare the date data in the devices specified by (s1) and (s2). Or, these instructions compare the date data in the device specified by (s1) with the current date. Set the comparison target by (s3). Ladder diagram Structured text ENO:=LDDT_(EN,s1,s2,s3);...
  • Page 705 Processing details • These instructions compare the date data in the devices specified by (s1) and (s2), or compare the date data in the device specified by (s1) with the current date. Set the comparison target by (s3). • Comparing two specified date data These instructions compare the date data in the device specified by (s1) with the date data in the device specified by (s2) in accordance with the conditions set by (s3).
  • Page 706 • If the comparison target data in the device are not recognized as date data, SM709 turns on after the instruction is executed and the operation result will be non-continuity. Even if the data are not recognized as date data, SM709 does not turn on if the data are within the setting range.
  • Page 707: Comparing Time Data

    Comparing time data LDTM, ANDTM, ORTM These instructions compare the time data in the devices specified by (s1) and (s2). Or, these instructions compare the time data in the device specified by (s1) with the current time. Set the comparison target by (s3). Ladder diagram Structured text ENO:=LDTM_(EN,s1,s2,s3);...
  • Page 708 Processing details • These instructions compare the time data in the devices specified by (s1) and (s2), or compare the time data in the device specified by (s1) with the current time. Set the comparison target by (s3). • Comparing two specified time data These instructions compare the time data in the device specified by (s1) with the time data in the device specified by (s2) in accordance with the conditions set by (s3).
  • Page 709 • If the comparison target data in the device are not recognized as time data, SM709 turns on after the instruction is executed and the operation result will be non-continuity. If the device areas specified by (s1) to (s1)+2 or (s2) to (s2)+2 exceed the corresponding device range, SM709 turns on after the instruction is executed and the operation result will be non-continuity as well.
  • Page 710: Comparing Clock Data

    Comparing clock data TCMP(P) These instructions compare the time specified by (s1), (s2), and (s3) with the time data specified by (s4), and turn on/off the bit device specified by (d) depending on the size match. Ladder diagram Structured text ENO:=TCMP(EN,s1,s2,s3,s4,d);...
  • Page 711 Processing details • These instructions compare the time specified by (s1), (s2), and (s3) with the time data specified by (s4), and turn on/off the bit device specified by (d) depending on the size match.  hour hour (0 to 23) (s1) (0 to 23) (s4)
  • Page 712: Comparing Clock Data Zones

    Comparing clock data zones TZCP(P) This instruction compares two comparison time (comparison time zone) specified by (s1) and (s2) with the time data specified by (s3), and turns on or off the specified bit devices (d) according to the comparison results. Ladder diagram Structured text ENO:=TZCP(EN,s1,s2,s3,d);...
  • Page 713 Processing details • This instruction compares two comparison time (comparison time zone) specified by (s1) and (s2) with the time data specified by (s3), and turns on or off the specified bit devices (d) according to the comparison results.  hour hour (0 to 23)
  • Page 714: Timing Check Instruction

    8.25 Timing Check Instruction Generating timing pulses DUTY This instruction sets user timing clock output destinations (SM420 to SM424 and SM8330 to SM8334) specified by (d) to on for the number of scans specified by (n1) and to off for the number of scans specified by (n2). Ladder diagram Structured text ENO:=DUTY(EN,n1,n2,d);...
  • Page 715 • The counted number of scans is stored among SD8330 to SD8334 in accordance with the special relay of the timing clock output destination specified by (d). • The counted number of scans stored among SD8330 to SD8334 is reset when the counted value reaches "(n1)+(n2)" or when the command input (instruction) is set to on.
  • Page 716: Hour Meter

    Hour meter HOURM This instruction measures the on time of the input contact in units of hour. Ladder diagram Structured text ENO:=HOURM(EN,s,d1,d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 717 Operation error Error code Description (SD0/SD8067) 2820H The device areas specified by (d1) exceed the corresponding device range. 3405H The value of (s) is negative. 8 APPLICATION INSTRUCTION 8.25 Timing Check Instruction...
  • Page 718 DHOURM This instruction measures the on time of the input contact in units of hour. Ladder diagram Structured text ENO:=DHOURM(EN,s,d1,d2); (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)  Time after which the alarm (d2) is set to on (unit: hour) 32-bit signed binary ANY32 ...
  • Page 719 Operation error Error code Description (SD0/SD8067) 2820H The device areas specified by (d1) exceed the corresponding device range. 3405H The value of (s) is negative. 8 APPLICATION INSTRUCTION 8.25 Timing Check Instruction...
  • Page 720: Module Access Instruction

    8.26 Module Access Instruction I/O refresh REF(P)/RFS(P) These instructions refresh the (n) points of devices starting from the device specified by (s), and receive an external input or generate an output. The REF(P) instructions can also be used as RFS(P). Ladder diagram Structured text ENO:=REF(EN,s,n);...
  • Page 721 • To refresh an input (X) or an output (Y) in 1 point units, use the direct access input (DX) or the direct access output (DY). When a program using the RFS instruction is changed to a program using direct access input/output Command Command DY20...
  • Page 722: Reading 1-Word/2-Word Data From Another Module

    Reading 1-word/2-word data from another module FROM(P), DFROM(P) • FROM(P) These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by (U/H), and store the data to the device specified by (d) and later (d). •...
  • Page 723 Processing details ■FROM(P) • These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by (U/H), and store the data to the device specified by (d) and later. Buffer memory CPU module (n) points (n) words ■DFROM(P)
  • Page 724 Common items among the FROM(P), DFROM(P), TO(P), and DTO(P) (details) • Use the module number to specify which Intelligent function module the instruction works for. The setting range is from H1 to H10 (K1 to K16). Module Module Module Module Module No.
  • Page 725: Writing 1-Word/2-Word Data To Another Module

    Writing 1-word/2-word data to another module TO(P), DTO(P) • TO(P) These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory address specified by (s1) in intelligent function module specified by (U/H). •...
  • Page 726 Processing details ■TO(P) • These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory address specified by (s1) in intelligent function module specified by (U/H). CPU module Buffer memory (s2) (s1) (n) points...
  • Page 727 Precautions • For the nibble of a bit device specified by (s2), specify K1 to K4 in the TO(P) instruction and K1 to K8 in the DTO(P) instruction. • When a number greater than 65535 is specified as the buffer memory specified by (s1), use the TOD(P) instruction or use U\G in the MOV(P) instruction.
  • Page 728 Reading 1-word/2-word data from another module FROMD(P), DFROMD(P) • FROMD(P) These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by (U/H), and store the data to the device specified by (d) and later. •...
  • Page 729 Processing details ■FROMD(P) • These instructions read (n) words of data from the buffer memory specified by (s) in intelligent function module specified by (U/H), and store the data to the device specified by (d) and later. Buffer memory CPU module (n) points (n) words ■DFROMD(P)
  • Page 730 Common items among the FROMD(P), DFROMD(P), TOD(P), and DTOD(P) (details) • Use the module number to specify which intelligent function module the instruction works for. The setting range is from H1 to H10 (K1 to K16). Module Module Module Module Module No.
  • Page 731: Writing 1-Word/2-Word Data To Another Module (32-Bit Specification)

    Writing 1-word/2-word data to another module (32-bit specification) TOD(P), DTOD(P) • TOD(P) These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory address specified by (s1) in intelligent function module specified by (U/H). •...
  • Page 732 Processing details ■TOD(P) • These instructions write the (n) points of data in the device starting from the one specified by (s2) to the buffer memory address specified by (s1) in intelligent function module specified by (U/H). CPU module Buffer memory (s2) (s1) (n) points...
  • Page 733 Precautions • For the nibble of a bit device specified by (s2), specify K1 to K4 in the TOD(P) instruction and K1 to K8 in the DTOD(P) instruction. Operation error Error code Description (SD0/SD8067) 2441H Updating procedure with the unit was not properly completed during the execution of the instruction. 2801H The unit number specified by (U/H) does not exist.
  • Page 734: Logging Instructions

    8.27 Logging Instructions Setting trigger logging LOGTRG This instruction generates a trigger condition for the specified logging setting number in trigger logging. Ladder diagram Structured text ENO:=LOGTRG(EN,s); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Logging setting number 1 to 4...
  • Page 735: Resetting Trigger Logging

    Resetting trigger logging LOGTRGR This instruction resets the trigger condition of the specified logging setting number. Ladder diagram Structured text ENO:=LOGTRGR(EN,s); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Logging setting number 1 to 4 16-bit signed binary ANY16...
  • Page 736: Real-Time Monitor Function Instruction

    8.28 Real-time Monitor Function Instruction Starts the real-time monitor. Ladder diagram Structured text ENO:=RTM(EN); FBD/LD Processing details When the instruction input turns on, real-time monitor can be started at any timing. ■Related devices Device Name Description SD1484 Real-time monitor The amount of free space of the internal buffer is stored in K bytes. internal buffer free space Precautions •...
  • Page 737: Chapter 9 Step Ladder Instructions

    STEP LADDER INSTRUCTIONS Starts/Ends Step Ladder STL, RETSTL STL: This instruction starts step ladder. RETSTL: This instruction ends step ladder. Ladder diagram Structured text Not supported. RETSTL (1): Step ladder program FBD/LD Not supported. Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 738 The actual step ladder program is as follows. SM402 This range divided by the STL instruction is called State. Process of S0 start Moving Process of S20 forward Moving Process of S21 backward RETSTL • A step ladder program is expressed as a relay ladder, but it can be created according to the machine control flow using state relays.
  • Page 739 ■Operation of program The step ladder program operates as follows. SM402 SM402 SM400 SM400 Process of S31 SM400 SM400 When X1 turns ON, S32 Y31 programmed in the turns ON and S31 is SET instruction remains automatically reset. ON even if S31 is reset. SM400 SM400 Process of S32...
  • Page 740: Chapter 10 Built-In Ethernet Function Instructions

    BUILT-IN ETHERNET FUNCTION INSTRUCTIONS 10.1 Open/Close Processing Instructions Opening a connection SP.SOCOPEN This instruction opens a connection. Ladder diagram Structured text ENO:=SP_SOCOPEN(EN,U0,s1,s2,d); (s1) (s2) FBD/LD ("SP_SOCOPEN" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) ...
  • Page 741 The status at the completion of the instruction is stored. System 0000H: Completed successfully Other than 0000H: Completed with an error (error code) For error codes, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). (s2)+2 Application setting area As shown on the left...
  • Page 742 • The connection in which no protocol is set with the parameter can be opened and used. In this case, specify 8000H in (s2)+0 and the contents of the open processing in (s2)+2 to (s2)+9. For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Operation error...
  • Page 743: Closing A Connection

    System 0000H: Completed successfully Other than 0000H: Completed with an error (error code) For error codes, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). *1 System: The CPU module stores the execution result of the instruction. 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS...
  • Page 744 When failed Completion device (d)+1 1 scan when normally Connection completed closed For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Operation error Error code Description (SD0/SD8067) 3405H The connection number specified by (s1) is other than 1 to 8.
  • Page 745: Socket Communications Function Instructions

    10.2 Socket Communications Function Instructions Reading receive data during the END processing SP.SOCRCV This instruction reads the receive data. (Reading during END processing) Ladder diagram Structured text ENO:=SP_SOCRCV(EN,U0,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ("SP_SOCRCV" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 746  System 0000H: Completed successfully Other than 0000H: Completed with an error (error code) For error codes, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). (d1)+0 Receive data length The data length of the data read from the socket communication...
  • Page 747 Completion device (d2)+1 Data reading processing Data reception (Only TCP) For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Operation error Error code Description (SD0/SD8067) 3405H The connection number specified by (s1) is other than 1 to 8.
  • Page 748: Sending Data

    Sending data SP.SOCSND This instruction sends data. Ladder diagram Structured text ENO:=SP_SOCSND(EN,U0,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD ("SP_SOCSND" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)  Dummy (Input the character string ['U0'].) Character string ANYSTRING_SINGLE (s1)
  • Page 749 The status at the completion of the instruction is stored.  System 0000H: Completed successfully Other than 0000H: Completed with an error (error code) For error codes, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). (s3)+0 Send data length Specifies the send data length. (Number of bytes)
  • Page 750 Data transmission Even after completion device (send) turns ON, data transmission may continue. For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Operation error Error code Description (SD0/SD8067) 3405H The connection number specified by (s1) is other than 1 to 8.
  • Page 751: Reading Connection Information

    Reading connection information SP.SOCCINF This instruction reads the connection information. Ladder diagram Structured text ENO:=SP_SOCCINF(EN,U0,s1,s2,d); (s1) (s2) FBD/LD ("SP_SOCCINF" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Dummy (Input the character string ['U0'].) ...
  • Page 752 EFFFH) as the port numbers is recommended. Do not specify 5549 to 5569 (15ADH to 15C1H) since they are used by the system. Processing details This instruction reads the connection information of the connection specified by (s1). For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Operation error Error code...
  • Page 753: Reading Socket Communications Receive Data

    System 0000H: Completed successfully Other than 0000H: Completed with an error (error code) For error codes, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). *1 System: The CPU module stores the execution result of the instruction. 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS...
  • Page 754 • When (n) is 1, the receive data length can be read. By doing this, the device for storing the receive data can be changed when the SP.SOCRCV instruction is executed. For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Precautions •...
  • Page 755: Predefined Protocol Support Function Instruction

    10.3 Predefined Protocol Support Function Instruction Executing the registered protocols SP.ECPRTCL This instruction executes the communication protocol registered using the engineering tool. Ladder diagram Structured text ENO:=SP_ECPRTCL(EN,U0,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD ("SP_ECPRTCL" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 756 Device Item Description Setting range Set by  (s3)+1 Completion status The completion status is stored upon completion of the instruction. System When two or more protocols are executed, the execution result of the protocol executed last is stored. • 0: Normal completion •...
  • Page 757 1 scan For details, refer to MELSEC iQ-F FX5 User's Manual (Ethernet Communication). Precautions • If an error occurs in the mth protocol while multiple protocols are being executed, the instruction does not execute the "m+1"th protocol and after and is completed with an error.
  • Page 758 Operation error Error code Description (SD0/SD8067) 2820H The device used exceeded the specified range. 2821H The device used to store data are overlapping. 2822H Device that cannot be specified is specified. 3405H The input data was out of range. 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS 10.3 Predefined Protocol Support Function Instruction...
  • Page 759: Slmp Frame Send Instruction

    10.4 SLMP Frame Send Instruction Sending the SLMP frame SP.SLMPSND This instruction sends SLMP messages to an SLMP-compatible device. Ladder diagram Structured text ENO:=SP_SLMPSND(EN,Un,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ("SP_SLMPSND" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 760 ■Control data Device Item Description Setting range Set by  (s1)+0 Execution/error User completion type (1) Execution type (b0) • 0: Without arrival check (The instruction is regarded as completed when a request message is sent from own station.) • 1: With arrival check (The instruction is regarded as completed when a response message is received from the target device.) (2) Error completion type (b7) Specify whether to set data at completion with an error.
  • Page 761 (Some commands do not return response data.) *1 For the set error code and the corresponding error description, check the specifications of the target device. *2 For details of the response data, refer to the MELSEC iQ-F FX5 User's Manual (SLMP). 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS...
  • Page 762 Processing details • This instruction sends the request frame in the device specified by (s2) and later to the target device specified by the target device IP address in the control data. When a response message is received from the target device, it is stored in the device specified by (d1).
  • Page 763 Upon completion with an error, the completion status indication device (d2)+1 is turned on and an error code is stored in the completion status (s1)+1. For the error code stored in the completion status (s1)+1, refer to the following.  MELSEC iQ-F FX5 User's Manual (Ethernet Communication) 10 BUILT-IN ETHERNET FUNCTION INSTRUCTIONS...
  • Page 764: Chapter 11 Pid Control Instruction

    PID CONTROL INSTRUCTION 11.1 PID Control Loop This instruction executes PID control which changes the output value according to the input variation. Ladder diagram Structured text ENO:=PID(EN,s1,s2,s3,d); (s1) (s2) (s3) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
  • Page 765 Precautions • When auto tuning is not used, twenty-five devices are occupied from the head device specified in (s3). • When auto tuning (limit cycle method) is used, twenty-nine devices are occupied from the head device specified in (s3). • When auto tuning (step response method) is used, the number of devices occupied from the devices specified in (s3) differs depending on the ON/OFF status of b8 of (s3)+1.
  • Page 766 Operation error Error code Description (SD0/SD8067) 2820H The connection number specified by (s1) is other than 1 to 8. 2822H The device number specified by (s2), (d), or (n) is outside the range of the number of device points. Incorrect sampling time (TS) (TS  0) 3500H Incompatible input filter constant (α) (α...
  • Page 767 PART 4 MODULE DEDICATED INSTRUCTION This part consists of the following chapters. 12 NETWORK COMMON INSTRUCTION 13 CC-LINK IE FIELD NETWORK INSTRUCTION 14 HIGH-SPEED COUNTER INSTRUCTION 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 16 POSITIONING INSTRUCTION 17 DIVIDED DATA READ/WRITE FROM/TO BFM INSTRUCTION...
  • Page 768: Chapter 12 Network Common Instruction

    NETWORK COMMON INSTRUCTION Target networks and target station types Each link dedicated instruction allows access to a station on a network other than the own station network. The following table lists the target stations of each instruction. Instruction symbol Target station (another station) Target network Target station type GP.READ...
  • Page 769 Specifications of character string data specified by link dedicated instructions Some operands specified in link dedicated instructions are specified in character strings. The following table summarizes the specifications of character string data specified. Instructio Applicable Specifications of character string data n symbol operand GP.READ...
  • Page 770: Link Dedicated Instructions

    12.1 Link Dedicated Instructions Reading data from another station programmable controller GP.READ This instruction reads data from a device in another station programmable controller. (In units of words) Ladder diagram Structured text ENO:=GP_READ(EN,Un,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ("GP_READ" enters .) Setting data ■Descriptions, ranges, and data types Operand...
  • Page 771 ■Control data Device Item Description Setting range Set by (s1)+0 Error completion type 0000H User … … 0080H (1) Error completion type (bit 7) Specify whether to set data at completion with an error. • 0: Do not set data in (s1)+11 and later at completion with an error. •...
  • Page 772 The number of resends (s1)+7 must be set every time the instruction is executed. Processing details • The instruction reads data by the specified number of words ((s1)+9) from the target station head device (s2) into the own station head device (after (d1)). Specify the target stations in control data ((s1)+4) and ((s1)+5). Upon completion of reading the device data specified by (s2), the completion device specified by (d2) turns on.
  • Page 773 (d2)+1 1 scan Completion status Error code (s1)+1 FX5-CCLIEF Channel 1 Target station error Operation error Error code Description ((s1)+1) Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). D000H to DFFFH 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 774: Reading Data From Another Station Programmable Controller (With Notification)

    Reading data from another station programmable controller (with notification) GP.SREAD This instruction reads data from a device in another station programmable controller. (In units of words) After the data reading is completed by the GP.SREAD instruction, the device of the other station is turned on. The other station can recognize that data has been read by the GP.SREAD instruction.
  • Page 775 ■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           ...
  • Page 776 Device Item Description Setting range Set by (s1)+12 Clock data Upper 8 bits: Month (01H to 12H)  System (Set only in an Lower 8 bits: Lower 2 digits of year (00H to 99H) abnormal state)  (s1)+13 Upper 8 bits: Hour (00H to 23H) System Lower 8 bits: Day (01H to 31H) ...
  • Page 777 (d2)+1 1 scan Completion status Error code (s1)+1 FX5-CCLIEF Channel 1 Target station error Operation error Error code Description ((s1)+1) D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 778: Writing Data To Another Station Programmable Controller

    Writing data to another station programmable controller GP.WRITE This instruction writes data to the device in another station programmable controller. (In units of words) Ladder diagram Structured text ENO:=GP_WRITE(EN,Un,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD ("GP_WRITE" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 779 ■Control data Device Item Description Setting range Set by (s1)+0 Execution/error 0000H User … … completion type 0001H 0080H 0081H (1) Execution type (bit 0) • 0: No arrival acknowledgment When the target station is in the own network: Completed when data has been sent from the own station.
  • Page 780 Device Item Description Setting range Set by (s1)+5 Target station number Specify the station number of the target station. Station No.: 1 to User (1) Station number specification 120, 125, 126 • 125: Master station Group number • 126: Master operating station specification: •...
  • Page 781 • When a number from 1 to 120 is specified for the target station number, the GP.WRITE instruction should be executed with the execution type set to "Arrival acknowledgment used" to improve data reliability. When a number from 81H to A0H or FFH is specified for the target station number, the GP.WRITE instruction should be executed with the execution type set to "No arrival acknowledgment".
  • Page 782 • Write processing is performed only once on the rising edge when the write command turns on. Operation error Error code Description ((s1)+1) Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). D000H to DFFFH 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 783: Writing Data To Another Station Programmable Controller (With Notification)

    Writing data to another station programmable controller (with notification) GP.SWRITE This instruction writes data to the device in another station programmable controller. (In units of words) After the data writing is completed by the GP.SWRITE instruction, the device of the other station is turned on. The other station can recognize that data has been written by the GP.SWRITE instruction.
  • Page 784 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            (d1) ...
  • Page 785 Device Item Description Setting range Set by (s1)+5 Target station number Specify the station number of the target station. Station No.: 1 to User (1) Station number specification 120, 125, 126 • 125: Master station Group number • 126: Master operating station specification: •...
  • Page 786 • When a number from 1 to 120 is specified for the target station number, the GP.SWRITE instruction should be executed with the execution type set to "Arrival acknowledgment used" to improve data reliability. When a number from 81H to A0H or FFH is specified for the target station number, the GP.SWRITE instruction should be executed with the execution type set to "No arrival acknowledgment".
  • Page 787 • The following figure shows the execution timing of the GP.SWRITE instruction. ■When completed normally SWRITE Sequence scan Start contact CPU module on Completion device the own station (d2) Completion status 1 scan indication device (d2)+1 Write data storage device (s2) 3000 FX5-CCLIEF Channel 1...
  • Page 788 Operation error Error code Description ((s1)+1) Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). D000H to DFFFH 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 789: Sending Data To Another Station Programmable Controller

    Sending data to another station programmable controller GP.SEND This instruction sends data to another station programmable controller. Ladder diagram Structured text ENO:=GP_SEND(EN,Un,s1,s2,d); (s1) (s2) FBD/LD ("GP_SEND" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) Position number of the module connected 1H to 10H...
  • Page 790 ■Control data Device Item Description Setting range Set by (s1)+0 Execution/error 0000H User … … completion type 0001H 0080H 0081H (1) Execution type (bit 0) • 0: No arrival acknowledgment When the target station is in the same network: Completed when data has been sent from the own station.
  • Page 791 Device Item Description Setting range Set by (s1)+7 Number of resends Effective when the execution type specified by (s1)+0 is "1: Arrival acknowledgment 0 to 15 User/ (retries) used". system ■Before instruction execution Specify the number of resends to be performed if the instruction is not completed within the monitoring time specified by (s1)+8.
  • Page 792 • When a number from 1 to 120 is specified for the target station number, the instruction should be executed with the execution type set to "Arrival acknowledgment used" to improve data reliability. When a group number or all stations are specified, the instruction should be executed with the execution type set to "No arrival acknowledgment".
  • Page 793 Processing details • The instruction sends data by the specified number of words ((s1)+9) from the own station head device (s2) into the specified channel of a target station. The data that has been sent is stored in the channel specified by (s2) in the target station.
  • Page 794 • The following figure shows the execution timing of the SEND instruction. ■When completed normally (With arrival acknowledgment) SEND Sequence scan Start contact CPU module on Completion device the own station Completion status 1 scan indication device (d)+1 Send data storage device (s2) 3000 FX5-CCLIEF...
  • Page 795 • Send processing is performed only once on the rising edge when the send command turns on. Operation error Error code Description ((s1)+1) D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 796: Receiving Data From Another Station Programmable Controller

    Receiving data from another station programmable controller GP.RECV This instruction reads data received from another station programmable controller. (For the main routine program) Ladder diagram Structured text ENO:=GP_RECV(EN,Un,s,d1,d2); (d1) (d2) FBD/LD ("GP_RECV" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 797 ■Control data Device Item Description Setting range Set by (s)+0 Error completion type 0000H User … … 0080H (1) Error completion type (bit 7) Specify whether to set data at completion with an error. • 0: Clock data at error occurrence is not stored in (s1)+11 and later. •...
  • Page 798 Processing details • This instruction reads data, which were sent from another station by the SEND instruction, from the specified channel of the own station to the own station word device (after (d1)). When the data reading from the specified channel of the own station is completed, the completion device (d2) turns on.
  • Page 799 • Read processing is performed only once on the rising edge when the read command turns on. Operation error Error code Description ((s)+1) D000H to DFFFH Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). 12 NETWORK COMMON INSTRUCTION 12.1 Link Dedicated Instructions...
  • Page 800: Chapter 13 Cc-Link Ie Field Network Instruction

    CC-LINK IE FIELD NETWORK INSTRUCTION 13.1 Setting parameters G(P).CCPASET Set the parameters to the FX5-CCLIEF. Ladder diagram Structured text ENO:=G_CCPASET(EN,Un,s1,s2,s3,s4,d); ENO:=GP_CCPASET(EN,Un,s1,s2,s3,s4,d); (s1) (s2) (s3) (s4) FBD/LD ("G_CCPASET", "GP_CCPASET" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (U)9...
  • Page 801 ■Control data Device Item Description Setting range Set by  (s1)+0 Completion status The instruction completion status is stored. System • 0: Normal • Other than 0: Error (error code) (s1)+1 Setting flag Shown on left side User … … b13 b12 b11 b10 b9 b8 b7 (2) (1) (1) Input setting for data link error (bit 8)
  • Page 802 (d)+1 1 scan Completion status Error code (s1) FX5-CCLIEF Parameter setting error Operation error Error code Description ((s1)+0) Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). D000H to DFFFH 13 CC-LINK IE FIELD NETWORK INSTRUCTION 13.1 Setting parameters...
  • Page 803: Setting The Station Number To Own Station

    13.2 Setting the station number to own station G(P).UINI This instruction sets the station number to the intelligent device station (own station) whose station number has not yet been set. Ladder diagram Structured text ENO:=G_UINI(EN,Un,s,d); ENO:=GP_UINI(EN,Un,s,d); FBD/LD ("G_UINI", "GP_UINI" enters .) Setting data ■Descriptions, ranges, and data types Operand...
  • Page 804 Processing details • Set the station number to the intelligent device station. [Own station] Intelligent device station FX5 CPU module (station No. ■) UINI Setting a station number • The execution of the G(P).UINI instruction and whether it has been completed normally or completed with an error can be checked with the completion device (d) or completion status indication device (d)+1.
  • Page 805 Set a unique station number. Note that such error cannot be detected before data link start (e.g. absence of the master station). Operation error Error code Description ((s)+1) Refer to MELSEC iQ-F FX5 User's Manual (CC-Link IE). D000H to DFFFH 13 CC-LINK IE FIELD NETWORK INSTRUCTION 13.2 Setting the station number to own station...
  • Page 806: Chapter 14 High-Speed Counter Instruction

    *1 Enable the FX3 compatible function, and specify a device between LC35 and 55 that is designated as an FX3 compatible high-speed counter. For FX3 compatible function, refer to MELSEC iQ-F FX5 User's Manual (Application). *2 I16 to I23 can be used.
  • Page 807 "199" to "200" or from "201" to "200" if the comparison value is K200), the bit device (d) is set to ON regardless of the scan time. In this instruction, the comparison processing is executed after the count processing in the high-speed counter. For details, refer to MELSEC iQ-F FX5 User's Manual (Application). Command...
  • Page 808: Reset 32-Bit Data Comparison

    "199" to "200" or from "201" to "200" if the comparison value is K200), the bit device (d) is reset to OFF regardless of the scan time. For details, refer to MELSEC iQ-F FX5 User's Manual (Application).
  • Page 809 • When a channel which is not set by the parameter or a value other than K1 to 8 is specified • When an LC device number which is not set by the parameter is specified For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Application). Operation error...
  • Page 810: Comparison Of 32-Bit Data Band

     *1 Enable the FX3 compatible function, and specify a device between LC35 and 55 that is designated as an FX3 compatible high-speed counter. For FX3 compatible function, refer to MELSEC iQ-F FX5 User's Manual (Application). Processing details • The current value of a high-speed counter specified in (s3) is compared with two comparison points (comparison value 1 and comparison value 2).
  • Page 811 When designating a Y device, do not set a device that crosses over a module or a device No. that is a multiple of 16 Example: Designating Y36 or Y37 when using FX5U-64M. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Application). Operation error...
  • Page 812: Start/Stop Of The 16-Bit Data High-Speed I/O Function

    Start/stop of the 16-bit data high-speed I/O function HIOEN(P) These instructions control the start and stop operations of a high-speed I/O function. Ladder diagram Structured text ENO:=HIOEN(EN,s1,s2,s3); ENO:=HIOENP(EN,s1,s2,s3); (s1) (s2) (s3) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 813 Function Function name number *1 When high-speed counter (function number: K0) is stopped during function operation, the function continues to operate, but nothing will be processed. *2 When multi-output high-speed comparison table (function number: K30) is stopped, high-speed counter of the same ch is also stopped. The following table shows the values which can be specified in (s2) and (s3) for each function number.
  • Page 814 Precautions • Do not specify channel numbers of the high-speed pulse input/output module in a program with interrupt priority set to "1". • When values that turn on the same channel are set for start and stop, the stop operation is prioritized. •...
  • Page 815: Start/Stop Of The 32-Bit Data High-Speed I/O Function

    Start/stop of the 32-bit data high-speed I/O function DHIOEN(P) These instructions control the start and stop operations of a high-speed I/O function. Ladder diagram Structured text ENO:=DHIOEN(EN,s1,s2,s3); ENO:=DHIOENP(EN,s1,s2,s3); (s1) (s2) (s3) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 816 Function Function name number *1*2 Multi-output high-speed comparison table Pulse width measurement *1 When high-speed counter (function number: K0) is stopped during function operation, the function continues to operate, but nothing will be processed. *2 When multi-output high-speed comparison table (function number: K30) is stopped, high-speed counter of the same ch is also stopped. The following table shows the values which can be specified in (s2) and (s3) for each function number.
  • Page 817 Precautions • Do not specify channel numbers of the high-speed pulse input/output module in a program with interrupt priority set to "1". • When values that turn on the same channel are set for start and stop, the stop operation is prioritized. •...
  • Page 818: High-Speed Current Value Transfer Instruction

    14.2 High-speed Current Value Transfer Instruction High-speed current value transfer of 16-bit data HCMOV(P) These instructions read and write (updates) special register for high-speed counter, pulse width measurement, PWM, and positioning. Ladder diagram Structured text ENO:=HCMOV(EN,s,n,d); ENO:=HCMOVP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 819 ■Effect of HCMOV instruction • By using both input interrupt and HCMOV instruction, the current value of a high-speed counter can be received at the rising edge or falling edge of an external input. • When HCMOV instruction is used just before a comparison instruction (CMP, ZCP or comparison contact instruction), the latest value of the high-speed counter is used in comparison.
  • Page 820: High-Speed Current Value Transfer Of 32-Bit Data

    High-speed current value transfer of 32-bit data DHCMOV(P) These instructions read and write (updates) special register for high-speed counter, pulse width measurement, PWM, and positioning. Ladder diagram Structured text ENO:=DHCMOV(EN,s,n,d); ENO:=DHCMOVP(EN,s,n,d); FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 821 SD device will be updated. Thus, there may be cases when the high-speed counter's SD device does not satisfy the relation of minimum value  current value  maximum value temporarily. Refer to the MELSEC iQ-F FX5 User's Manual (Application) for details on the timing that the high-speed counter's SD device is updated.
  • Page 822: Chapter 15 External Device Communication Instruction

    RS-485 serial ports installed in the CPU module. This instruction specifies the head device storing the sent data from the CPU module, the number of data bytes, the head device storing the received data, and the maximum number of bytes that can be received. For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION...
  • Page 823 • When using the header and terminator, set them before driving this instruction. Do not change the values of the header and terminator while this instruction is being driven. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). Operation error...
  • Page 824: Inverter Communication Instruction

    ANYBIT_ARRAY (Number of elements: 3) Execution condition  BOOL  Execution result BOOL *1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication) or respective inverter manual. ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, SM, T, ST, C, D, W, U\G...
  • Page 825 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 826: Inverter Operations Control (Drive)

    The control value specified in (s3) is written to the instruction code specified in (s2) of an inverter connected to the communication channel (n) whose station number is specified in (s1). For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the instruction codes, refer to the each inverter manual.) Precautions Three devices are occupied from the device specified in (d).
  • Page 827 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 828: Inverter Parameter Read

    The value of the parameter (s2) is read from an inverter connected to the communication channel (n) whose station number is (s1), and output to (d1). For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the parameter numbers, refer to the each inverter manual.) Precautions Three devices are occupied from the device specified in (d2).
  • Page 829 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 830: Inverter Parameter Write

    A value specified in (s3) is written to a parameter (s2) in an inverter connected to the communication channel (n) whose station number is (s1). For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the parameter numbers, refer to the each inverter manual.) Precautions Three devices are occupied from the device specified in (d).
  • Page 831 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 832: Inverter Parameter Block Write

    A data table specified in (s2) and (s3) is written to an inverter connected to the communication channel (n) whose station number is (s1) in batch. For details, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). (For the parameter numbers, refer to the each inverter manual.) Precautions Three devices are occupied from the device specified in (d).
  • Page 833 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 834: Inverter Multi Command

     ANYBIT_ARRAY (Number of elements: 3) Execution condition  BOOL  Execution result BOOL *1 Refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). ■Applicable devices Operand Word Double word Indirect Constant Others specification X, Y, M, L, SM, T, ST, C, D, W, U\G...
  • Page 835 The value specified by (n) is other than any of K1 to 4. 3600H Channel number specified by (d) is not set by parameters. For communication errors, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.2 Inverter Communication Instruction...
  • Page 836: Modbus Communication Instruction

    15.3 MODBUS Communication Instruction ADPRW This instruction allows the MODBUS Master to communicate (read/write data) with the Slaves. Ladder diagram Structured text ENO:=ADPRW(EN,s1,s2,s3,s4,s5d1,d2); (s1) (s2) (s3) (s4) (s5)/(d1) (d2) FBD/LD s5d1 Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
  • Page 837 Processing details • Function code (s2) is operated on Slave station No. (s1) according to Parameters (s3), (s4), and (s5)/(d1). Use 0 as the Slave station No. for Broadcast commands. For details, refer to MELSEC iQ-F FX5 User's Manual (MODBUS Communication).
  • Page 838 15.4 Predefined Protocol Support Function Instruction S(P).CPRTCL This instruction executes the communication protocol registered using the engineering tool. Ladder diagram Structured text ENO:=S_CPRTCL(EN,U0,s,n1,n2,d); ENO:=SP_CPRTCL(EN,U0,s,n1,n2,d); (n1) (n2) FBD/LD ("S_CPRTCL", "SP_CPRTCL" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label)
  • Page 839 ■Control data Device Item Description Setting range Set by  (s)+0 Completion status The completion status is stored upon completion of the instruction. System When two or more protocols are executed, the execution result of the protocol executed last is stored. •...
  • Page 840 • If same instructions are executed for the same CH, the subsequent instruction is ignored and is not executed until the preceding instruction is completed. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Serial Communication). 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION...
  • Page 841 Operation error Error code Description (SD0/SD8067) 2820H The device used exceeded the specified range. 2821H The device used to store data are overlapping. 2822H Device that cannot be specified is specified. 3405H The input data was out of range. 15 EXTERNAL DEVICE COMMUNICATION INSTRUCTION 15.4 Predefined Protocol Support Function Instruction...
  • Page 842: Chapter 16 Positioning Instruction

    POSITIONING INSTRUCTION 16.1 Dedicated Instruction (Positioning Function) Instruction correspondence table for CPU module built-in positioning and high-speed pulse input/output module The table for instructions corresponding to the CPU module and the high-speed pulse input/output module are shown below. : Supported, : Not supported Instruction CPU module High-speed pulse input/...
  • Page 843: Zero Return(Opr) With 16-Bit Data Dog Search

    Zero return(OPR) with 16-bit data DOG search DSZR [For the FX3 compatible operand specification] This instruction executes mechanical zero return. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DSZR(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 844 PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 845 • For (d2), specify the bit device of the zero return complete flag or abnormal end flag. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 846 Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 847: Zero Return(Opr) With 32-Bit Data Dog Search

    • For (d2), specify the bit device of the zero return complete flag or abnormal end flag. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 848 Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 849: Bit Data Interrupt Positioning

    16-bit data interrupt positioning DVIT [For the FX3 compatible operand specification] This instruction executes interrupt 1-speed constant quantity feed. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 850 PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 851 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DVIT instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 852 32-bit data interrupt positioning DDVIT [For the FX3 compatible operand specification] This instruction executes interrupt 1-speed constant quantity feed. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DDVIT(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 853 PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 854 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDVIT instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 855: Positioning By One Table Operation

    • For (n), specify the table number to be executed according to the output specified in (d). For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 856 • For (n), specify the table number to be executed according to the output specified in (d). For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 857: Positioning By Multiple Table Operation

    Positioning by multiple table operation DRVTBL This instruction executes positioning operation set in multiple data tables with the engineering tool in continuous operation or stepping operation. To execute such operation, this instruction needs to be executed only once. Ladder diagram Structured text ENO:=DRVTBL(EN,n1,n2,n3,d1,d2);...
  • Page 858 • For (d2), specify the bit device of the normal complete flag or abnormal end flag. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 859: Multiple Axes Concurrent Drive Positioning

    Multiple axes concurrent drive positioning DRVMUL This instruction executes tables of multiple axes of one module simultaneously. Ladder diagram Structured text ENO:=DRVMUL(EN,n1,n2,n3,n4,n5,d); (n1) (n2) (n3) (n4) (n5) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (n1) Start axis number...
  • Page 860 Instruction execution complete flag for the axis (n1)+3 (d)+7 Instruction execution abnormal end flag for the axis (n1)+3 For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module). Precautions Eight devices are occupied from the device specified in (d).
  • Page 861: Bit Data Abs Current Value Read

    • For (d2), specify the device that stores the absolute position (ABS) data read from the servo amplifier. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 862 Three devices are occupied from the device specified in (s) and (d1). Make sure that these devices are not used in other controls. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 863: Bit Data Variable Speed Pulse

    PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 864 • For (d2), specify the bit device of the abnormal end flag for the PLSV instruction. (This device does not have the normal complete status, and only has the abnormal end status ((d2)+1). For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 865 PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 866 • For (d2), specify the bit device of the abnormal end flag for the DPLSV instruction. (This device does not have the normal complete status, and only has the abnormal end status ((d2)+1). For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 867: Bit Data Relative Positioning

    16-bit data relative positioning DRVI [For the FX3 compatible operand specification] This instruction executes one-speed positioning by incremental drive. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 868 (PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 869 DRVI [For the FX5 operand specification] This instruction executes one-speed positioning by incremental drive. Ladder diagram Structured text ENO:=DRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Data type (label) (s1) Positioning address -32768 to +32767 16-bit signed binary...
  • Page 870 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DRVI instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 871 32-bit data relative positioning DDRVI [For the FX3 compatible operand specification] This instruction executes one-speed positioning by incremental drive. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DDRVI(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 872 PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 873 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDRVI instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 874 Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 875: Bit Data Absolute Positioning

    16-bit data absolute positioning DRVA [For the FX3 compatible operand specification] This instruction executes one-speed positioning by absolute drive. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 876 (PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 877 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DRVA instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 878 32-bit data absolute positioning DDRVA [For the FX3 compatible operand specification] This instruction executes one-speed positioning by absolute drive. The high-speed pulse input/output module is not supported. Ladder diagram Structured text ENO:=DDRVA(EN,s1,s2,d1,d2); (s1) (s2) (d1) (d2) FBD/LD Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 879 (PWM, positioning PULSE axis, or CW/CCW axis etc.), the device does not function and causes an error. For details on the function, precautions, and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 880 • For (d2), specify the bit device of the normal complete flag or abnormal end flag for the DDRVA instruction. For details on the function and error code, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 881 Two devices are occupied from the device specified in (d2). Make sure that these devices are not used in other controls. For other precautions, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - CPU module built-in, High-speed pulse input/output module).
  • Page 882: Positioning Module

    16.2 Positioning Module Restoring the absolute position G.ABRST These instructions restore the absolute position of the specified axis. Ladder diagram Structured text ENO:=G_ABRST1(EN,Un,s,d); ENO:=G_ABRST2(EN,Un,s,d); ("G.ABRST1", "G.ABRST2" enters .) FBD/LD ("G_ABRST1", "G_ABRST2" enters .) Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 883 ■Control data Device Item Description Setting range Set by    (s)+0 System area (s)+1 Completion status The instruction completion status is stored.  System • 0: Normal • Other than 0: Error (error code) (s)+2 Signal received from Write the signal status, below, input from the servo amplifier to the CPU module or I/ 0, 1 User...
  • Page 884 When the value is other than 0, the processing returns to step 1. When the value is 0, the processing ends. • For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module). Precautions •...
  • Page 885: Starting The Positioning

    Starting the positioning GP.PSTRT This instruction starts positioning of the specified axis. Ladder diagram Structured text ENO:=GP_PSTRT1(EN,Un,s,d); ENO:=GP_PSTRT2(EN,Un,s,d); ("GP.PSTRT1", "GP.PSTRT2" enters .) FBD/LD ("GP_PSTRT1", "GP_PSTRT2" enters .) Setting data ■Description, range, data type Operand Description Range Data type Data type (label) Position number of the module connected 1H to 10H 16-bit unsigned binary...
  • Page 886 When completed with an error Completion status indication device (d1)+1 When completed normally 1 scan • For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module). 16 POSITIONING INSTRUCTION 16.2 Positioning Module...
  • Page 887 Precautions • If the positioning is started by using the GP.PSTRT instruction, the [Cd.184] Positioning start signal will not turn on. In this case, although the start completion signals ([Md.31] Status: b14) turn on, the ON time is short; the program may fail to detect the ON state.
  • Page 888: Teaching

    Teaching GP.TEACH This instruction teaches the specified axis. Ladder diagram Structured text ENO:=GP_TEACH1(EN,Un,s,d); ENO:=GP_TEACH2(EN,Un,s,d); ("GP.TEACH1", "GP.TEACH2" enters .) FBD/LD ("GP_TEACH1", "GP_TEACH2" enters .) Setting data ■Description, range, data type Operand Description Range Data type Data type (label) Position number of the module connected 1H to 10H 16-bit unsigned binary ANY16...
  • Page 889 When completed with an error Completion status indication device (d1)+1 When completed normally 1 scan • For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module). 16 POSITIONING INSTRUCTION 16.2 Positioning Module...
  • Page 890 Precautions • The following instructions cannot be executed simultaneously to a single axis. For different axes, any of the following can be executed concurrently with a GP.TEACH instruction. • Positioning start instruction (GP.PSTRT) • Absolute position restoration instruction (G.ABRST) • Teaching instruction (GP.TEACH) •...
  • Page 891: Backing Up Module Data (Writing Data To The Flash Rom)

    Backing up Module Data (Writing Data to the Flash ROM) GP.PFWRT This instruction writes the module extension parameter (the positioning data and block start data) in the buffer memory to the module extension parameter file. Ladder diagram Structured text ENO:=GP_PFWRT(EN,Un,s,d); FBD/LD ("GP_PFWRT"...
  • Page 892 1 scan • For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module). Precautions • While the module extension parameters are being written by using the GP.PFWRT instruction, do not power off the system or reset the CPU module.
  • Page 893 Operation error Error code Description ((s)+1) 1080H Flash ROM write count error 1931H Flash ROM write error 16 POSITIONING INSTRUCTION 16.2 Positioning Module...
  • Page 894: Initializing The Module

    Initializing the Module GP.PINIT This instruction resets the module parameter and module extension parameter (the positioning data and block start data) in the buffer memory, and the module extension parameter file setting values to the factory default settings (initial values). Ladder diagram Structured text ENO:=GP_PINIT(EN,Un,s,d);...
  • Page 895 1 scan • For details of the function, refer to MELSEC iQ-F FX5 User's Manual (Positioning Control - Intelligent function module). Precautions • The GP.PINIT instruction can be executed when the READY signal ([Md.140] module status: b0) is OFF. While the READY signal ([Md.140] module status: b0) is ON, if the GP.PINIT instruction is executed, "Writing during PLC READY ON...
  • Page 896: Chapter 17 Divided Data Read/Write From/To Bfm Instruction

    DIVIDED DATA READ/WRITE FROM/TO BFM INSTRUCTION 17.1 Divided BFM Read RBFM This instruction reads data from continuous buffer memory areas in an FX3 intelligent function module Ladder diagram Structured text ENO:=RBFM(EN,UnHn,s,n1,n2,d); (U/H) (n1) (n2) FBD/LD UnHn Setting data ■Descriptions, ranges, and data types Operand Description Range...
  • Page 897 Processing details • This instruction reads (n1) points of buffer memory starting from (s) inside the intelligent function module number (U/H) to (d) in the CPU module. When (n1) exceeds 64 points, it divides and reads by several scans. (64 points are read in one scan) Command input...
  • Page 898 Operation error Error code Description (SD0/SD8067) 2441H Communication procedure with module is not completed correctly when this instruction is executed. 2801H Module with the module number specified by (U/H) does not exist. 2823H The number of transfer points specified by (n1) and the buffer memory number specified by (s) is beyond the buffer memory area range. 2820H The number of transfer points specified by (n1) and the device number specified by (d) is beyond the specified device range.
  • Page 899: Divided Bfm Write

    17.2 Divided BFM Write WBFM This instruction writes data to continuous buffer memory areas in an FX3 intelligent function module. Ladder diagram Structured text ENO:=WBFM(EN,UnHn,s1,s2,n1,n2); (U/H) (s1) (s2) (n1) (n2) FBD/LD UnHn Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 900 Processing details • This instruction writes (n1) points of buffer memory starting from (s1) inside the intelligent function module number (U/H) to (s2) in the CPU module. When (n1) exceeds 64 points, it divides and writes by several scans. (64 points are read in one scan) Command input...
  • Page 901: Part 5 Standard Functions

    PART 5 STANDARD FUNCTIONS This part consists of the following chapters. 18 TYPE CONVERSION FUNCTIONS 19 SINGLE NUMBER VARIABLE FUNCTIONS 20 ARITHMETIC OPERATION FUNCTIONS 21 BIT SHIFT FUNCTIONS 22 STANDARD BITWISE BOOLEAN FUNCTIONS 23 SELECTION FUNCTIONS 24 COMPARISON FUNCTIONS 25 CHARACTER STRING FUNCTIONS 26 TIME DATA FUNCTIONS...
  • Page 902: Chapter 18 Type Conversion Functions

    TYPE CONVERSION FUNCTIONS 18.1 Converting BOOL to WORD BOOL_TO_WORD(_E) These functions convert BOOL type data to WORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_WORD(s); [With EN/ENO] d:=BOOL_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 903: Converting Bool To Dword

    18.2 Converting BOOL to DWORD BOOL_TO_DWORD(_E) These functions convert BOOL type data to DWORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_DWORD(s); [With EN/ENO] d:=BOOL_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 904: Converting Bool To Int

    18.3 Converting BOOL to INT BOOL_TO_INT(_E) These functions convert BOOL type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_INT(s); [With EN/ENO] d:=BOOL_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 905: Converting Bool To Dint

    18.4 Converting BOOL to DINT BOOL_TO_DINT(_E) These functions convert BOOL type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_DINT(s); [With EN/ENO] d:=BOOL_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 906: Converting Bool To Time

    18.5 Converting BOOL to TIME BOOL_TO_TIME(_E) These functions convert BOOL type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_TIME(s); [With EN/ENO] d:=BOOL_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 907: Converting Bool To String

    18.6 Converting BOOL to STRING BOOL_TO_STRING(_E) These functions convert BOOL type data to STRING type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BOOL_TO_STRING(s); [With EN/ENO] d:=BOOL_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 908: Converting Word To Bool

    18.7 Converting WORD to BOOL WORD_TO_BOOL(_E) These functions convert WORD type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_BOOL(s); [With EN/ENO] d:=WORD_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 909: Converting Word To Dword

    18.8 Converting WORD to DWORD WORD_TO_DWORD(_E) These functions convert WORD type data to DWORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_DWORD(s); [With EN/ENO] d:=WORD_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 910: Converting Word To Int

    18.9 Converting WORD to INT WORD_TO_INT(_E) These functions convert WORD type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_INT(s); [With EN/ENO] d:=WORD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 911: Converting Word To Dint

    18.10 Converting WORD to DINT WORD_TO_DINT(_E) These functions convert WORD type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_DINT(s); [With EN/ENO] d:=WORD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 912: Converting Word To Time

    18.11 Converting WORD to TIME WORD_TO_TIME(_E) These functions convert WORD type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=WORD_TO_TIME(s); [With EN/ENO] d:=WORD_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 913: Converting Dword To Bool

    18.12 Converting DWORD to BOOL DWORD_TO_BOOL(_E) These functions convert DWORD type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_BOOL(s); [With EN/ENO] d:=DWORD_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 914: Converting Dword To Word

    18.13 Converting DWORD to WORD DWORD_TO_WORD(_E) These functions convert DWORD type data to WORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_WORD(s); [With EN/ENO] d:=DWORD_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 915 Operation error There is no operation error. 18 TYPE CONVERSION FUNCTIONS 18.13 Converting DWORD to WORD...
  • Page 916: Converting Dword To Int

    18.14 Converting DWORD to INT DWORD_TO_INT(_E) These functions convert DWORD type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_INT(s); [With EN/ENO] d:=DWORD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 917 Operation error There is no operation error. 18 TYPE CONVERSION FUNCTIONS 18.14 Converting DWORD to INT...
  • Page 918: Converting Dword To Dint

    18.15 Converting DWORD to DINT DWORD_TO_DINT(_E) These functions convert DWORD type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_DINT(s); [With EN/ENO] d:=DWORD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 919: Converting Dword To Time

    18.16 Converting DWORD to TIME DWORD_TO_TIME(_E) These functions convert DWORD type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DWORD_TO_TIME(s); [With EN/ENO] d:=DWORD_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 920: Converting Int To Bool

    18.17 Converting INT to BOOL INT_TO_BOOL(_E) These functions convert INT type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BOOL(s); [With EN/ENO] d:=INT_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 921: Converting Int To Word

    18.18 Converting INT to WORD INT_TO_WORD(_E) These functions convert INT type data to WORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_WORD(s); [With EN/ENO] d:=INT_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 922: Converting Int To Dword

    18.19 Converting INT to DWORD INT_TO_DWORD(_E) These functions convert INT type data to DWORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_DWORD(s); [With EN/ENO] d:=INT_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 923: Converting Int To Dint

    18.20 Converting INT to DINT INT_TO_DINT(_E) These functions convert INT type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_DINT(s); [With EN/ENO] d:=INT_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 924: Converting Int To Bcd

    18.21 Converting INT to BCD INT_TO_BCD(_E) These functions convert INT type data to BCD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BCD(s); [With EN/ENO] d:=INT_TO_BCD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 925 Operation error Error code Description (SD0/SD8067) 3401H Data in the device specified by (s) is out of the valid range (0 to 9999). 18 TYPE CONVERSION FUNCTIONS 18.21 Converting INT to BCD...
  • Page 926: Converting Int To Real

    18.22 Converting INT to REAL INT_TO_REAL(_E) These functions convert INT type data to REAL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_REAL(s); [With EN/ENO] d:=INT_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 927: Converting Int To Time

    18.23 Converting INT to TIME INT_TO_TIME(_E) These functions convert INT type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_TIME(s); [With EN/ENO] d:=INT_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 928: Converting Int To String

    18.24 Converting INT to STRING INT_TO_STRING(_E) These functions convert INT type data to STRING type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_STRING(s); [With EN/ENO] d:=INT_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 929 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 930: Converting Dint To Bool

    18.25 Converting DINT to BOOL DINT_TO_BOOL(_E) These functions convert DINT type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BOOL(s); [With EN/ENO] d:=DINT_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 931: Converting Dint To Word

    18.26 Converting DINT to WORD DINT_TO_WORD(_E) These functions convert DINT type data to WORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_WORD(s); [With EN/ENO] d:=DINT_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 932 Operation error There is no operation error. 18 TYPE CONVERSION FUNCTIONS 18.26 Converting DINT to WORD...
  • Page 933: Converting Dint To Dword

    18.27 Converting DINT to DWORD DINT_TO_DWORD(_E) These functions convert DINT type data to DWORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_DWORD(s); [With EN/ENO] d:=DINT_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 934: Converting Dint To Int

    18.28 Converting DINT to INT DINT_TO_INT(_E) These functions convert DINT type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_INT(s); [With EN/ENO] d:=DINT_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 935: Converting Dint To Bcd

    18.29 Converting DINT to BCD DINT_TO_BCD(_E) These functions convert DINT type data to BCD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BCD(s); [With EN/ENO] d:=DINT_TO_BCD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 936 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 937: Converting Dint To Real

    18.30 Converting DINT to REAL DINT_TO_REAL(_E) These functions convert DINT type data to REAL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_REAL(s); [With EN/ENO] d:=DINT_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 938: Converting Dint To Time

    18.31 Converting DINT to TIME DINT_TO_TIME(_E) These functions convert DINT type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_TIME(s); [With EN/ENO] d:=DINT_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 939: Converting Dint To String

    18.32 Converting DINT to STRING DINT_TO_STRING(_E) These functions convert DINT type data to STRING type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_STRING(s); [With EN/ENO] d:=DINT_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 940 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 941: Converting Bcd To Int

    18.33 Converting BCD to INT BCD_TO_INT(_E) These functions convert BCD type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BCD_TO_INT(s); [With EN/ENO] d:=BCD_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 942 Operation error Error code Description (SD0/SD8067) 3401H A value other than 0 to 9 exists in each digit of (s). 18 TYPE CONVERSION FUNCTIONS 18.33 Converting BCD to INT...
  • Page 943: Converting Bcd To Dint

    18.34 Converting BCD to DINT BCD_TO_DINT(_E) These functions convert BCD type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BCD_TO_DINT(s); [With EN/ENO] d:=BCD_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 944 • A value input to (s) is within the range from 0H to 9999H (from 0 to 9 for each digit) for the WORD type data value and from 0H to 99999999H (from 0 to 9 for each digit) for the DWORD type data value. •...
  • Page 945: Converting Real To Int

    18.35 Converting REAL to INT REAL_TO_INT(_E) These functions convert REAL type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_INT(s); [With EN/ENO] d:=REAL_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 946 Operation error Error code Description (SD0/SD8067) 3401H The single-precision real number in the device specified by (s) is out of the valid range (-32768 to 32767). 3402H • A special number is set to (s). • The set single-precision real number is not located within the following range. -126 |(s)|<...
  • Page 947: Converting Real To Dint

    18.36 Converting REAL to DINT REAL_TO_DINT(_E) These functions convert REAL type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_DINT(s); [With EN/ENO] d:=REAL_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 948 Operation error Error code Description (SD0/SD8067) 3401H The single-precision real number in the device specified by (s) is out of the valid range (-2147483648 to 2147483647). 3402H A special number is set to (s). • The set single-precision real number is not located within the following range. -126 |(s)|<...
  • Page 949: Converting Real To String

    18.37 Converting REAL to STRING REAL_TO_STRING(_E) These functions convert REAL type data to STRING type data (exponent format). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=REAL_TO_STRING(s); [With EN/ENO] d:=REAL_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 950 • In "Sign data (integer part)", "20H (space)" is stored when the input value is positive, and "2DH (-)" is stored when the input value is negative. • The 6th and later digits of the decimal part are rounded. -12.345678 7 8 E + 0 1 REAL (1): Total number of digits (13 digits)
  • Page 951 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 952: Converting Time To Bool

    18.38 Converting TIME to BOOL TIME_TO_BOOL(_E) These functions convert TIME type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_BOOL(s); [With EN/ENO] d:=TIME_TO_BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 953: Converting Time To Word

    18.39 Converting TIME to WORD TIME_TO_WORD(_E) These functions convert TIME type data to WORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_WORD(s); [With EN/ENO] d:=TIME_TO_WORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 954: Converting Time To Dword

    18.40 Converting TIME to DWORD TIME_TO_DWORD(_E) These functions convert TIME type data to DWORD type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_DWORD(s); [With EN/ENO] d:=TIME_TO_DWORD_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 955: Converting Time To Int

    18.41 Converting TIME to INT TIME_TO_INT(_E) These functions convert TIME type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_INT(s); [With EN/ENO] d:=TIME_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 956: Converting Time To Dint

    18.42 Converting TIME to DINT TIME_TO_DINT(_E) These functions convert TIME type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_DINT(s); [With EN/ENO] d:=TIME_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 957: Converting Time To String

    18.43 Converting TIME to STRING TIME_TO_STRING(_E) These functions convert TIME type data to STRING type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TIME_TO_STRING(s); [With EN/ENO] d:=TIME_TO_STRING_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 958: Converting String To Bool

    18.44 Converting STRING to BOOL STRING_TO_BOOL(_E) These functions convert STRING type data to BOOL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_ BOOL(s); [With EN/ENO] d:=STRING_TO_ BOOL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 959: Converting String To Int

    18.45 Converting STRING to INT STRING_TO_INT(_E) These functions convert STRING type data to INT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_INT(s); [With EN/ENO] d:=STRING_TO_INT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 960 Operation error Error code Description (SD0/SD8067) 3401H Invalid data which cannot be converted to (s) are input. • Values for each place of the ASCII code are other than "30H" to "39H", "20H", and "00H". • Values for the ASCII data are other than "-32768" to "32767" when STRING_TO_INT(_E) is used. 18 TYPE CONVERSION FUNCTIONS 18.45 Converting STRING to INT...
  • Page 961: Converting String To Dint

    18.46 Converting STRING to DINT STRING_TO_DINT(_E) These functions convert STRING type data to DINT type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_DINT(s); [With EN/ENO] d:=STRING_TO_DINT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 962 Operation error Error code Description (SD0/SD8067) 3401H Invalid data which cannot be converted to (s) are input. • Values for each place of the ASCII code are other than "30H" to "39H", "20H", and "00H". • Values for the ASCII data are other than "-2147483648" to "2147483647" when STRING_TO_DINT(_E) is used. 18 TYPE CONVERSION FUNCTIONS 18.46 Converting STRING to DINT...
  • Page 963: Converting String To Real

    18.47 Converting STRING to REAL STRING_TO_REAL(_E) These functions convert STRING type data to REAL type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_REAL(s); [With EN/ENO] d:=STRING_TO_REAL_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 964 • Exponent format High-order byte Low-order byte 31H (1) 2DH (-) 33H (3) 2EH (.) 30H (0) 35H (5) -1.35034E-10 34H (4) 33H (3) 2DH (-) 45H (E) REAL 30H (0) 31H (1) - 1 0 • With regard to STRING type data, six digits excluding the sign, decimal point and exponent part are valid, and the 7th and later digits are discarded during conversion.
  • Page 965 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 966: Converting String To Time

    18.48 Converting STRING to TIME STRING_TO_TIME(_E) These functions convert STRING type data to TIME type data. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=STRING_TO_TIME(s); [With EN/ENO] d:=STRING_TO_TIME_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 967: Converting Bit Array To Int

    18.49 Converting Bit Array to INT BITARR_TO_INT(_E) These functions convert a bit array to INT type data for a specified number of bits. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BITARR_TO_INT(s,n); [With EN/ENO] d:=BITARR_TO_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description...
  • Page 968: Converting Bit Array To Dint

    18.50 Converting Bit Array to DINT BITARR_TO_DINT(_E) These functions convert a bit array to DINT type data for a specified number of bits. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=BITARR_TO_DINT(s,n) [With EN/ENO] d:=BITARR_TO_DINT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description...
  • Page 969: Converting Int To Bit Array

    18.51 Converting INT to Bit Array INT_TO_BITARR(_E) These functions output low-order (n) bits of INT type data to a bit array. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=INT_TO_BITARR(s,n); [With EN/ENO] d:=INT_TO_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 970: Converting Dint To Bit Array

    18.52 Converting DINT to Bit Array DINT_TO_BITARR(_E) These functions output low-order (n) bits of DINT type data to a bit array. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DINT_TO_BITARR(s,n); [With EN/ENO] d:=DINT_TO_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 971: Bit Array Copy

    18.53 Bit Array Copy CPY_BITARR(_E) These functions copy specified number of bits of a bit array. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=CPY_BITARR(s,n); [With EN/ENO] d:=CPY_BITARR_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 972: Reading The Specified Bit Of Word Label

    18.54 Reading the Specified Bit of Word Label GET_BIT_OF_INT(_E) These functions reads the specified bit of the word label Ladder diagram Structured text FBD/LD [Without EN/ENO] [With EN/ENO] [Without EN/ENO] Not supported d:=GET_BIT_OF_INT(s,n); [With EN/ENO] d:=GET_BIT_OF_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 973: Writing The Specified Bit Of Word Label

    18.55 Writing the Specified Bit of Word Label SET_BIT_OF_INT(_E) These functions writes the specified bit of the word label. Ladder diagram Structured text FBD/LD [Without EN/ENO] [With EN/ENO] [Without EN/ENO] Not supported d:=SET_BIT_OF_INT(s,n); [With EN/ENO] d:=SET_BIT_OF_INT_E(EN,ENO,s,n); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 974: Copying The Specified Bit Of Word Label

    18.56 Copying the Specified Bit of Word Label CPY_BIT_OF_INT(_E) These functions copy the specified bit of the word label to the one of another word label. Ladder diagram Structured text FBD/LD [Without EN/ENO] [With EN/ENO] [Without EN/ENO] Not supported d:=CPY_BIT_OF_INT(s,n1,n2); [With EN/ENO] d:=CPY_BIT_OF_INT_E(EN,ENO,s,n1,n2);...
  • Page 975: Unnecessary Of Type Conversion

    18.57 Unnecessary of Type Conversion GET_BOOL_ADDR, GET_INT_ADDR, GET_WORD_ADDR These functions output the input variable as the output variable type. Ladder diagram, FBD/LD Structured text d:=GET_BOOL_ADDR(s) d:=GET_INT_ADDR(s); d:=GET_WORD_ADDR(s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Input Input variable d(GET_BOOL_ADDR / GET_INT_ADDR / GET_WORD_ADDR) Output...
  • Page 976: Chapter 19 Single Number Variable Functions

    SINGLE NUMBER VARIABLE FUNCTIONS 19.1 Absolute Value ABS(_E) These functions output the absolute value of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ABS(s); [With EN/ENO] d:=ABS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type...
  • Page 977 Operation error • When (s) is REAL Error code Description (SD0/SD8067) The data specified by (s) is -0, denormalized number, NaN (not a number), or . 3402H 3403H (d) exceeds the following range. (An overflow has occurred.) |(d)|<2 19 SINGLE NUMBER VARIABLE FUNCTIONS 19.1 Absolute Value...
  • Page 978: Square Root

    19.2 Square Root SQRT(_E) These functions output the square root of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SQRT(s); [With EN/ENO] d:=SQRT_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
  • Page 979: Natural Logarithm Operation

    19.3 Natural Logarithm Operation LN(_E) These functions output the natural logarithm operation result of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LN(s); [With EN/ENO] d:=LN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type...
  • Page 980: Calculating The Common Logarithm

    19.4 Calculating the Common Logarithm LOG(_E) These functions output the operation result of the common logarithm (the logarithm whose base is 10) of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=LOG(s); [With EN/ENO] d:=LOG_E(EN,ENO,s);...
  • Page 981 Operation error • When (s) is REAL Error code Description (SD0/SD8067) The value specified in (s) is -0, denormalized number, NaN (not a number), or . 3402H 3403H The value of (d) exceeds the following range. (An overflow has occurred.) |(d)|<2 3405H Data outside the allowable range was set to (s).
  • Page 982: Exponential Operation

    19.5 Exponential Operation EXP(_E) These functions output the exponential operation result of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=EXP(s); [With EN/ENO] d:=EXP_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable...
  • Page 983: Sine Operation

    19.6 Sine Operation SIN(_E) These functions output the sine of the angle of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SIN(s); [With EN/ENO] d:=SIN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 984: Cosine Operation

    19.7 Cosine Operation COS(_E) These functions output the cosine of the angle of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=COS(s); [With EN/ENO] d:=COS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 985: Tangent Operation

    19.8 Tangent Operation TAN(_E) These functions output the tangent of the angle of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=TAN(s); [With EN/ENO] d:=TAN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 986: Arc Sine Operation

    19.9 Arc Sine Operation ASIN(_E) These functions output the arc sine value of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ASIN(s); [With EN/ENO] d:=ASIN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 987: Arc Cosine Operation

    19.10 Arc Cosine Operation ACOS(_E) These functions output the arc cosine value of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ACOS(s); [With EN/ENO] d:=ACOS_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 988: Arc Tangent Operation

    19.11 Arc Tangent Operation ATAN(_E) These functions output the arc tangent value of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ATAN(s); [With EN/ENO] d:=ATAN_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop)
  • Page 989: Chapter 20 Arithmetic Operation Functions

    ARITHMETIC OPERATION FUNCTIONS 20.1 Addition ADD(_E) These functions output the sum of input values ((s1) + (s2) + ... + (s28)). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=ADD(s1,s2); [With EN/ENO] d:=ADD_E(EN,ENO,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
  • Page 990 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 991: Multiplication

    20.2 Multiplication MUL(_E) These functions output the product input values ((s1)(s2) ... (s28)). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MUL(s1,s2); [With EN/ENO] d:=MUL_E(EN,ENO,s1,s2); *1 The input variable "s" can be changed in the range of 2 to 28. Setting data ■Descriptions, types, and data types Argument...
  • Page 992 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 993: Subtraction

    20.3 Subtraction SUB(_E) These functions output the difference of input values ((s1) - (s2)). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=SUB(s1,s2); [With EN/ENO] d:=SUB_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
  • Page 994 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 995: Division

    20.4 Division DIV(_E) These functions output the quotient of input values ((s1)  (s2)). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=DIV(s1,s2); [With EN/ENO] d:=DIV_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
  • Page 996 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)
  • Page 997: Remainder

    20.5 Remainder MOD(_E) These functions output the remainder of input values ((s1)  (s2)). Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MOD(s1,s2); [With EN/ENO] d:=MOD_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL...
  • Page 998 Operation error • (s1) and (s2) are INT Error code Description (SD0/SD8067) 3400H The value (divisor) specified by (s2) is 0. • (s1) and (s2) are DINT Error code Description (SD0/SD8067) 3400H The value (divisor) specified by (s2) is 0. 20 ARITHMETIC OPERATION FUNCTIONS 20.5 Remainder...
  • Page 999: Exponentiation

    20.6 Exponentiation EXPT(_E) These functions output the exponentiation of an input value. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=EXPT(s1,s2); [With EN/ENO] d:=EXPT_E(EN,ENO,s1,s2); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL s1(IN1)
  • Page 1000 Operation error • (s1) is the REAL type and (s2) is the INT type Error code Description (SD0/SD8067) 3402H The value of (s1) is outside the following range. -126 |(s1)|<2 0, 2 The data specified by (s1) is -0, denormalized number, NaN (not a number), or . 3403H The operation result is within the following range.
  • Page 1001: Move Operation

    20.7 Move Operation MOVE(_E) These functions output the assignment of input values. Ladder diagram, FBD/LD Structured text [Without EN/ENO] [With EN/ENO] [Without EN/ENO] d:=MOVE(s); [With EN/ENO] d:=MOVE_E(EN,ENO,s); Setting data ■Descriptions, types, and data types Argument Description Type Data type Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL s(IN)
  • Page 1002 ■Operation result Function without EN/ENO The following table lists the operation results. Operation result No operation error occurred Operation output value An operation error occurred Indefinite value Function with EN/ENO The following table lists the execution conditions and operation results. Execution condition Operation result TRUE (Executes operation)