Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Motion module instructions, standard functions/ function blocks
Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC iQ-R Series

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

    (Read these precautions before using this product.) Before using MELSEC iQ-R series programmable controllers, please read the manuals for the product and the relevant manuals introduced in those manuals carefully, and pay full attention to safety to handle the product correctly.
  • Page 4: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 INTRODUCTION .
  • Page 5 Out (excluding the timer and counter) ............48 Timer .
  • Page 6 Program Control Instructions ............. 95 Changing the program execution type to standby type .
  • Page 7 12.9 Converting WORD to DINT ............. . . 134 12.10 Converting WORD to TIME .
  • Page 8 14.4 Division................183 14.5 Remainder .
  • Page 9: Relevant Manuals

    GX Works3 For programs, refer to the following. MELSEC iQ-R Programming Manual (Program Design) e-Manual refers to the Mitsubishi Electric FA electronic book manuals that can be browsed using a dedicated tool. e-Manual has the following features: • Required information can be cross-searched in multiple manuals.
  • Page 10: Terms

    TERMS Unless otherwise specified, this manual uses the following terms. Term Description Intelligent function module A module that has functions other than input and output, such as the A/D and the D/A converter module. Control CPU A CPU module that controls connected I/O modules and intelligent function modules. In a multiple CPU system, there are multiple CPU modules and each connected module can be controlled by a different CPU module.
  • Page 11: Generic Terms And Abbreviations

    Unless otherwise specified, this manual uses the following generic terms and abbreviations. Generic term/abbreviation Description A/D converter module It indicates MELSEC iQ-R series analog-digital converter module, channel isolated analog-digital converter module, and high speed analog-digital converter module. CPU module It indicates MELSEC iQ-R series CPU module.
  • Page 12: Manual Page Organization

    MANUAL PAGE ORGANIZATION In this manual, pages are organized and the symbols are used as shown below. How to read Part 3 to Part 6 The following illustration is for explanation purpose only, and should not be referred to as an actual documentation. Ò...
  • Page 13  Instruction symbol • An instruction symbol followed by parentheses indicates multiple instructions. For example, "+(_U)" indicates two instructions: + and +_U. Instruction symbol Meaning Instruction symbol followed by "(P)" This instruction is executed only on the rising edge (off to on). Instruction symbol followed by "(_U)"...
  • Page 14 How to read Part 7 and Part 8 The following illustration is for explanation purpose only, and should not be referred to as an actual documentation. Ò Ó Ô Õ Ö  Function symbol  Description formats of structured text language For instances, refer to the following.
  • Page 15: Future Support Planned

    FUTURE SUPPORT PLANNED The following function is mentioned in this manual, but it is planned for a future support. The information in this page might be changed for improvement without prior notice. Function Description Link device • LB • LW •...
  • Page 16 MEMO...
  • Page 17: Part 1 Overview

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

    OVERVIEW Instruction Configuration Many instructions available for motion systems 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 19: Data Specification Method

    Data Specification Method The following table lists the types of data that can be used for instructions. Data Classification Bit data Bit data 16-bit data (word data) 16-bit signed binary data 16-bit unsigned binary data 32-bit data (double word data) 32-bit signed binary data 32-bit unsigned binary data Real number data (floating-point data)
  • Page 20 Label data The following table lists labels that can be used to specify the setting data of instructions. ■Primitive data type Data type (label) Specifiable label • Bit type label (BOOL) • Bit-specified word [unsigned]/bit string [16 bits] type label •...
  • Page 21 ■Generic data type The generic data type is the data type of the labels which summarize several primitive data types. Generic data types are used when multiple data types are allowed for arguments and return values of functions or function blocks.
  • Page 22: 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 One point of bit device/label can handle 1-bit data.
  • Page 23: 16-Bit Data (Word Data)

    16-bit data (word data) Data size and data range 16-bit data includes signed and unsigned 16-bit data. In signed 16-bit data, a negative number is represented in two's complement. Data name Data size Value range Decimal notation Hexadecimal notation Signed 16-bit data 16 bits (1 word) -32768 to 32767 0000H to FFFFH...
  • Page 24: 32-Bit Data (Double Word Data)

    ■Specifying a bit device with digit specification in the source (s) When a bit device is specified with digit specification in the source of an instruction, 0 is stored in the word device of the destination, in the upper bits than those specified in the source of the instruction. Ladder example Processing •...
  • Page 25 Precaution Digit specification cannot be made for a bit type array label. Digit specification range The following table lists the range of 32-bit data for each digit specification. Digit specification Decimal notation Hexadecimal notation 0 to 15 0H to FH 0 to 255 00H to FFH 0 to 4095...
  • Page 26 ■Specifying a bit device with digit specification in the source (s) When a bit device is specified with digit specification in the source of an instruction, 0 is stored in the word device of the destination, in the upper bits than those specified in the source of the instruction. Ladder example Processing •...
  • Page 27: Real Number Data (Floating-Point Data)

    Real number data (floating-point data) Data size and data range Real number data includes single-precision 32-bit real number data and double-precision 64-bit real number data. Real number data can be stored only in devices other than bit devices or in single-precision or double-precision real data type labels.
  • Page 28 Precautions ■When setting an input value of single-precision real number from the engineering tool The number of significant digits is about 7 because the engineering tool processes single precision real number data in 32-bit single precision. When the input value of single-precision real number data exceeds 7 digits, the 8th digit is rounded off. Therefore, if the rounded-off value goes out of the range from -2147483648 to 2147483647, it will not be an intended value.
  • Page 29: 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, Shift JIS code NULL(00H) Character string [Unicode]...
  • Page 30 Character string data storage location An image of the character string data storage location is shown below. ■Character strings In each character string storage image, "NULL" indicates a NULL code (00H). Character string Image of storing character string data from G0 Image of storing character string data from word type to be stored label array arrayA[0]...
  • Page 31: Execution Condition

    Execution Condition Types of execution conditions The following table lists the execution conditions of instructions. Execution condition Description An instruction is executed during on. It is executed only while the precondition of the instruction is on. When the precondition is off, the instruction is not executed. Rising edge An instruction is executed one time when turned on.
  • Page 32: 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 • The device or label specified by the instruction exceeds the available range. 3506H •...
  • Page 33: Lists Of Instructions And Fun/Fb

    PART 2 LISTS OF INSTRUCTIONS AND FUN/FB This part consists of the following chapters. 2 MOTION SYSTEM INSTRUCTIONS 3 MOTION DEDICATED INSTRUCTIONS 4 STANDARD FUNCTIONS/FUNCTION BLOCKS...
  • Page 34: Chapter 2 Motion System Instructions

    MOTION SYSTEM INSTRUCTIONS The following table summarizes how to read the instruction lists. Item Description Instruction symbol An instruction name Processing details An overview of the instruction Reference Section where detailed information is described Sequence Instructions Output instructions ■Out (excluding the timer and counter) Instruction symbol Processing details Reference...
  • Page 35: Basic Instructions

    Basic Instructions Arithmetic operation instructions ■Adding/subtracting 16-bit binary data Instruction symbol Processing details Reference Adds the two sets of 16-bit binary data specified. Page 60 +(_U) Performs subtraction between the two sets of 16-bit binary data specified. Page 62 -(_U) ■Adding/subtracting 32-bit binary data Instruction symbol Processing details...
  • Page 36 ■Performing an OR operation on 16-bit/32-bit data Instruction symbol Processing details Reference Performs an OR operation on the two sets of 16-bit binary data specified. Page 78 WOR Performs an OR operation on the two sets of 32-bit binary data specified. Page 79 DOR ■Performing an XOR operation on 16-bit/32-bit data Instruction symbol...
  • Page 37: Application Instructions

    Application Instructions Program control Program execution control instructions ■Disabling/enabling interrupt programs Instruction symbol Processing details Reference Disables the execution of fixed scan execution type programs. Page 94 DI, EI Clears the fixed scan execution type programs execution disabled state. Program control instructions ■Changing the program execution type to standby type Instruction symbol Processing details...
  • Page 38: String Processing

    String processing String processing instructions ■Transferring string data Instruction symbol Processing details Reference $MOV Transfers the character strings in the device specified by (s) to the device specified by (d) and later. Page 102 $MOV $MOV_WS Transfers the character strings [Unicode] in the device specified by (s) to the device specified by Page 104 $MOV_WS (d) and later.
  • Page 39 ■Transferring double-precision real number Instruction symbol Processing details Reference EDMOV Transfers double-precision real number data to the specified device. Page 116 EDMOV (s)+3, (s)+2, (s)+1, (s) (d)+3, (d)+2, (d)+1, (d) (1) Real number 2 MOTION SYSTEM INSTRUCTIONS 2.3 Application Instructions...
  • Page 40: Chapter 3 Motion Dedicated Instructions

    MOTION DEDICATED INSTRUCTIONS User Function Execution Instruction Instruction symbol Processing details Reference G(P).CEXECUTE Instructs the execution of processing in the Motion module. Page 119 G(P).CEXECUTE 3 MOTION DEDICATED INSTRUCTIONS...
  • Page 41 MEMO 3 MOTION DEDICATED INSTRUCTIONS...
  • Page 42: Chapter 4 Standard Functions/Function Blocks

    STANDARD FUNCTIONS/FUNCTION BLOCKS How to read the list is shown below. Item Description Function symbol and function block symbol A function and function block name are shown. Processing details An overview of the functions and function blocks is explained. Reference Indicates the reference of detailed information.
  • Page 43 ■Converting DWORD to BOOL Function symbol Processing details Reference DWORD_TO_BOOL Converts a value from DWORD data type to BOOL data type. Page 136 DWORD_TO_BOOL ■Converting DWORD to WORD Function symbol Processing details Reference DWORD_TO_WORD Converts a value from DWORD data type to WORD data type. Page 137 DWORD_TO_WORD ■Converting DWORD to INT/DINT...
  • Page 44 ■Converting DINT to WORD/DWORD Function symbol Processing details Reference DINT_TO_WORD Converts a value from DINT data type to WORD data type. Page 149 DINT_TO_WORD DINT_TO_DWORD Converts a value from DINT data type to DWORD data type. Page 150 DINT_TO_DWORD ■Converting DINT to INT Function symbol Processing details Reference...
  • Page 45 ■Converting TIME to INT/DINT Function symbol Processing details Reference TIME_TO_INT Converts a value from TIME data type to INT data type. Page 164 TIME_TO_INT TIME_TO_DINT Converts a value from TIME data type to DINT data type. Page 165 TIME_TO_DINT Single variable functions ■Calculating the absolute value Function symbol Processing details...
  • Page 46 ■Division Function symbol Processing details Reference Outputs the quotient of input values ((s1)÷(s2)). Page 183 DIV ■Remainder Function symbol Processing details Reference Outputs the remainder of input values ((s1)÷(s2)). Page 185 MOD ■Assignment (move operation) Function symbol Processing details Reference MOVE Outputs the assignment value of an input value.
  • Page 47: Standard Function Flocks

    Standard Function Flocks Bistable function blocks ■Bistable function block (set-dominant) Function block symbol Processing details Reference Discriminates between two input values, and outputs1 (TRUE) or 0 (FALSE). Page 192 SR ■Bistable function block (reset-dominant) Function block symbol Processing details Reference Discriminates between two input values, and outputs1 (TRUE) or 0 (FALSE).
  • Page 48 MEMO 4 STANDARD FUNCTIONS/FUNCTION BLOCKS 4.2 Standard Function Flocks...
  • Page 49: Part 3 Sequence Instructions

    PART 3 SEQUENCE INSTRUCTIONS This part consists of the following chapters. 5 SEQUENCE INSTRUCTIONS...
  • Page 50: Chapter 5 Sequence Instructions

    SEQUENCE INSTRUCTIONS Output Instructions Out (excluding the timer and counter) This instruction outputs the operation result to the specified device. ENO:=OUT(EN,d); ■Execution condition Instruction Execution condition Every scan Setting data ■Description, range, data type Operand Description Range Data type On/off target device number ANY_BOOL ...
  • Page 51: Timer

    Timer OUT_T, OUTH_T, OUT_ST, OUTH_ST • OUT_T: Low-speed timer instruction • OUTH_T: High-speed timer instruction • OUT_ST: Low-speed retentive timer instruction • OUTH_ST: High-speed retentive timer instruction These instructions start time measurement when the operation result up to the OUT instruction is on. When time is up, the normally open contact turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 52 Processing details • These instructions start time measurement, triggered by the coil specified by Coil, when the operation result up to the OUT instruction is on. When time is up (current value ≥ set value), the normally open contact turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 53 When timers Time_0 to Time_2 are programmed in order of measurement [Label definitions] Label name Data type Class Time_0 Timer Time_1 Timer Time_2 Timer Flag_Label ENO_Label [Program] ENO_Label := OUT_T(Flag_Label,Time_0,1); (1) Timer Time_0 starts measurement when Flag_Label turns on. ENO_Label := OUT_T(Time_0.S,Time_1,1); (2) When the contact of timer Time_0 turns on, the contacts of timers Time_1 ENO_Label := OUT_T(Time_1.S,Time_2,1);...
  • Page 54: Long Timer

    Long timer OUT_LT, OUT_LST • OUT_LT: Low-speed long timer instruction • OUT_LST: Low-speed long retentive timer instruction These instructions start time measurement when the operation result up to the OUT instruction is on. When time is up, the normally open contact turns on (continuity state) and the normally closed contact turns off (non-continuity state). ENO:=OUT_T(EN,Coil,Value);...
  • Page 55 • The timer limit value is set in parameter using the engineering tool. Long timer/long retentive timer: 1 to 1000000 μs (in increments of 1 μs) (Default: 500 μs) • For the counting method, refer to the following.  MELSEC iQ-R CPU Module User's Manual (Application) Precautions To create a program in which the operation of a long timer contact triggers the operation of another long timer, program the long timers in order from the one that operates last.
  • Page 56: Counter

    Counter OUT_C This instruction increments the current counter value (count value) by one when the operation result up to the OUT instruction turns on. When the count value reaches the set value, the normally open contact of the counter turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 57: Long Counter

    Long counter OUT_LC This instruction increments the current long counter value (count value) by one on the rising edge (off to on) of the operation result up to the OUT instruction. When the count value reaches the set value, the normally open contact of the long counter turns on (continuity state) and the normally closed contact turns off (non-continuity state).
  • Page 58: Setting Devices

    Setting devices This instruction turns on the specified bit. ENO:=SET(EN,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Set target bit device number or bit specification of word device ANY_BOOL  Execution condition BOOL ...
  • Page 59 Operation error There is no operation error. When RX is used, specify a device number that is not used in actual input. If the number that is used in actual input is specified, the data of actual input is written over the input device (RX) specified by the SET instruction. 5 SEQUENCE INSTRUCTIONS 5.1 Output Instructions...
  • Page 60: Resetting Devices

    Resetting devices This instruction turns off the specified device. ENO:=RST(EN,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Reset target bit device number, bit specification of word device ANY_BOOL  Execution condition BOOL ...
  • Page 61: Part 4 Basic Instructions

    PART 4 BASIC INSTRUCTIONS This part consists of the following chapters. 6 BASIC INSTRUCTIONS...
  • Page 62: Chapter 6 Basic Instructions

    BASIC INSTRUCTIONS Arithmetic Operation Instructions Adding 16-bit binary data +(_U) These instructions add the two sets of 16-bit binary data specified. ENO:=PLUS(EN,s1,s2,d); ENO:=PLUS_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) First addend data or the device where the first addend data is stored -32768 to 32767 ANY16_S...
  • Page 63 Processing details • These instructions add the 16-bit binary data in the device specified by (s1) and the 16-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) ···...
  • Page 64: Subtracting 16-Bit Binary Data

    Subtracting 16-bit binary data -(_U) These instructions perform subtraction between the two sets of 16-bit binary data specified. ENO:=MINUS(EN,s1,s2,d); ENO:=MINUS_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) Minuend data or the device where minuend data is stored -32768 to 32767 ANY16_S 0 to 65535...
  • Page 65 Processing details • These instructions subtract the 16-bit binary data in the device specified by (s2) from the 16-bit binary data in the device specified by (s1), and store the operation result in the device specified by (d). (s1) (s2) ···...
  • Page 66: Adding 32-Bit Binary Data

    Adding 32-bit binary data D+(_U) These instructions add the two sets of 32-bit binary data specified. ENO:=DPLUS(EN,s1,s2,d); ENO:=DPLUS_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition D+_U Setting data ■Description, range, data type Operand Description Range Data type (s1) First addend data or the start device where the first addend data is -2147483648 to 2147483647 ANY32_S stored...
  • Page 67 Processing details • These instructions add the 32-bit binary data in the device specified by (s1) and the 32-bit binary data in the device specified by (s2), and store the operation result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 68: Subtracting 32-Bit Binary Data

    Subtracting 32-bit binary data D-(_U) These instructions perform subtraction between the two sets of 32-bit binary data specified. ENO:=DMINUS(EN,s1,s2,d); ENO:=DMINUS_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition D-_U Setting data ■Description, range, data type Operand Description Range Data type (s1) Minuend data or the start device where minuend data is stored -2147483648 to 2147483647 ANY32_S D-_U...
  • Page 69 Processing details • These instructions subtracts the 32-bit binary data in the device specified by (s2) from the 32-bit binary data in the device specified by (s1), and store the operation result in the device specified by (d). (s1) (s2) (s1)+1 (s2)+1 (d)+1...
  • Page 70: Multiplying 16-Bit Binary Data

    Multiplying 16-bit binary data *(_U) These instructions multiply the two sets of 16-bit binary data specified. ENO:=MULTI(EN,s1,s2,d); ENO:=MULTI_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) Multiplicand data or the device where multiplicand data is stored -32768 to 32767 ANY16_S 0 to 65535...
  • Page 71: Dividing 16-Bit Binary Data

    Dividing 16-bit binary data /(_U) These instructions perform division between the two sets of 16-bit binary data specified. ENO:=DIVISION(EN,s1,s2,d); ENO:=DIVISION_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) Dividend data or the device where dividend data is stored -32768 to 32767 ANY16_S 0 to 65535...
  • Page 72: Multiplying 32-Bit Binary Data

    Multiplying 32-bit binary data D*(_U) These instructions multiply the two sets of 32-bit binary data specified. ENO:=DMULTI(EN,s1,s2,d); ENO:=DMULTI_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition D*_U Setting data ■Description, range, data type Operand Description Range Data type (s1) Multiplicand data or the start device where multiplicand data is stored -2147483648 to 2147483647 ANY32_S D*_U...
  • Page 73: Dividing 32-Bit Binary Data

    Dividing 32-bit binary data D/(_U) These instructions perform division between the two sets of 32-bit binary data specified. ENO:=DDIVISION(EN,s1,s2,d); ENO:=DDIVISION_U(EN,s1,s2,d); ■Execution condition Instruction Execution condition D/_U Setting data ■Description, range, data type Operand Description Range Data type (s1) Dividend data or the start device where dividend data is stored -2147483648 to 2147483647 ANY32_S D/_U...
  • Page 74: Incrementing 16-Bit Binary Data

    Incrementing 16-bit binary data INC(_U) These instructions increment the specified 16-bit binary data by one. ENO:=INC(EN,d); ENO:=INC_U(EN,d); ■Execution condition Instruction Execution condition INC_U Setting data ■Description, range, data type Operand Description Range Data type Increment target device -32768 to 32767 ANY16_S INC_U 0 to 65535...
  • Page 75: Decrementing 16-Bit Binary Data

    Decrementing 16-bit binary data DEC(_U) These instructions decrement the specified 16-bit binary data by one. ENO:=DEC(EN,d); ENO:=DEC_U(EN,d); ■Execution condition Instruction Execution condition DEC_U Setting data ■Description, range, data type Operand Description Range Data type Decrement target device -32768 to 32767 ANY16_S DEC_U 0 to 65535...
  • Page 76: Incrementing 32-Bit Binary Data

    Incrementing 32-bit binary data DINC(_U) These instructions increment the specified 32-bit binary data by one. ENO:=DINC(EN,d); ENO:=DINC_U(EN,d); ■Execution condition Instruction Execution condition DINC DINC_U Setting data ■Description, range, data type Operand Description Range Data type DINC Increment target start device -2147483648 to 2147483647 ANY32_S DINC_U...
  • Page 77: Decrementing 32-Bit Binary Data

    Decrementing 32-bit binary data DDEC(_U) These instructions decrement the specified 32-bit binary data by one. ENO:=DDEC(EN,d); ENO:=DDEC_U(EN,d); ■Execution condition Instruction Execution condition DDEC DDEC_U Setting data ■Description, range, data type Operand Description Range Data type DDEC Decrement target start device -2147483648 to 2147483647 ANY32_S DDEC_U...
  • Page 78: Logical Operation Instructions

    Logical Operation Instructions Performing an AND operation on 16-bit data WAND This instruction performs an AND operation on the two sets of 16-bit binary data specified. ENO:=WAND(EN,s1,s2,d); ■Execution condition Instruction Execution condition WAND Setting data ■Description, range, data type Operand Description Range Data type...
  • Page 79: Performing An And Operation On 32-Bit Data

    Performing an AND operation on 32-bit data DAND This instruction performs an AND operation on the two sets of 32-bit binary data specified. ENO:=DAND(EN,s1,s2,d); ■Execution condition Instruction Execution condition DAND Setting data ■Description, range, data type Operand Description Range Data type (s1) Logical AND data or the start device where logical AND data is stored -2147483648 to 2147483647...
  • Page 80: Performing An Or Operation On 16-Bit Data

    Performing an OR operation on 16-bit data This instruction performs an OR operation on the two sets of 16-bit binary data specified. ENO:=WOR(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) Logical OR data or the device where logical OR data is stored -32768 to 32767 ANY16...
  • Page 81: Performing An Or Operation On 32-Bit Data

    Performing an OR operation on 32-bit data This instruction performs an OR operation on the two sets of 32-bit binary data specified. ENO:=DOR(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type (s1) Logical OR data or the start device where logical OR data is stored -2147483648 to 2147483647 ANY32...
  • Page 82: Performing An Xor Operation On 16-Bit Data

    Performing an XOR operation on 16-bit data WXOR This instruction performs an XOR operation on the two sets of 16-bit binary data specified. ENO:=WXOR(EN,s1,s2,d); ■Execution condition Instruction Execution condition WXOR Setting data ■Description, range, data type Operand Description Range Data type (s1) Exclusive OR data or the device where exclusive OR data is stored -32768 to 32767...
  • Page 83: Performing An Xor Operation On 32-Bit Data

    Performing an XOR operation on 32-bit data DXOR This instruction performs an XOR operation on the two sets of 32-bit binary data specified. ENO:=DXOR(EN,s1,s2,d); ■Execution condition Instruction Execution condition DXOR Setting data ■Description, range, data type Operand Description Range Data type (s1) Exclusive OR data or the start device where exclusive OR data is stored -2147483648 to 2147483647...
  • Page 84: Performing An Xnor Operation On 16-Bit Data

    Performing an XNOR operation on 16-bit data WXNR This instruction performs an XNOR operation on the two sets of 16-bit binary data specified. ENO:=WXNR(EN,s1,s2,d); ■Execution condition Instruction Execution condition WXNR Setting data ■Description, range, data type Operand Description Range Data type (s1) Exclusive NOR data or the device where exclusive NOR data is stored -32768 to 32767...
  • Page 85: Performing An Xnor Operation On 32-Bit Data

    Performing an XNOR operation on 32-bit data DXNR This instruction performs an XNOR operation on the two sets of 32-bit binary data specified. ENO:=DXNR(EN,s1,s2,d); ■Execution condition Instruction Execution condition DXNR Setting data ■Description, range, data type Operand Description Range Data type (s1) Exclusive NOR data or the start device where exclusive NOR data is -2147483648 to 2147483647...
  • Page 86: Data Conversion Instructions

    Data Conversion Instructions Two's complement of 16-bit binary data (sign inversion) Invert the sign of 16-bit binary device. ENO:=NEG(EN,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Device where the data subjected to two's complement is stored ANY16 ...
  • Page 87: Two's Complement Of 32-Bit Binary Data (Sign Inversion)

    Two's complement of 32-bit binary data (sign inversion) DNEG This instruction inverts the sign of 32-bit binary device. ENO:=DNEG(EN,d); ■Execution condition Instruction Execution condition DNEG Setting data ■Description, range, data type Operand Description Range Data type Start device where the data subjected to two's complement is stored ...
  • Page 88: Data Transfer Instructions

    Data Transfer Instructions Transferring 16-bit binary data This instruction transfers the 16-bit binary data in the device specified. ENO:=MOV(EN,s,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Transfer source data or the number of the device where the transfer -32768 to 32767 ANY16 source data is stored...
  • Page 89: Transferring 32-Bit Binary Data

    Transferring 32-bit binary data DMOV This instruction transfers the 32-bit binary data in the device specified. ENO:=DMOV(EN,s,d); ■Execution condition Instruction Execution condition DMOV Setting data ■Description, range, data type Operand Description Range Data type Transfer source data or the number of the device where the transfer -2147483648 to 2147483647 ANY32 source data is stored...
  • Page 90: Inverting And Transferring 16-Bit Binary Data

    Inverting and transferring 16-bit binary data This instruction inverts the specified 16-bit binary data bit by bit, and transfer the inverted data. ENO:=CML(EN,s,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type Inversion target data or the number of the device where the inversion -32768 to 32767 ANY16 target data is stored...
  • Page 91: Inverting And Transferring 32-Bit Binary Data

    Inverting and transferring 32-bit binary data DCML This instruction inverts the specified 32-bit binary data bit by bit, and transfer the inverted data. ENO:=DCML(EN,s,d); ■Execution condition Instruction Execution condition DCML Setting data ■Description, range, data type Operand Description Range Data type Inversion target data or the number of the device where the inversion -2147483648 to 2147483647 ANY32...
  • Page 92: Inverting And Transferring 1-Bit Data

    Inverting and transferring 1-bit data CMLB This instruction inverts the specified bit data, and transfer the inverted data. ENO:=CMLB(EN,s,d); ■Execution condition Instruction Execution condition CMLB Setting data ■Description, range, data type Operand Description Range Data type Inversion target data or the number of the device where the inversion ANY_BOOL ...
  • Page 93: Transferring 1-Bit Data

    Transferring 1-bit data MOVB This instruction transfers the specified 1-bit data. ENO:=MOVB(EN,s,d); ■Execution condition Instruction Execution condition MOVB Setting data ■Description, range, data type Operand Description Range Data type Number of the device where the transfer target data is stored ANY_BOOL ...
  • Page 94 MEMO 6 BASIC INSTRUCTIONS 6.4 Data Transfer Instructions...
  • Page 95: Part 5 Application Instructions

    PART 5 APPLICATION INSTRUCTIONS This part consists of the following chapters. 7 PROGRAM CONTROL 8 DATA PROCESSING 9 STRING PROCESSING 10 REAL VALUE PEOCESSING...
  • Page 96: Chapter 7 Program Control

    PROGRAM CONTROL Program Execution Control Instructions Disabling/enabling interrupt programs DI, EI • DI: This instruction disables execution of fixed scan execution type programs. • EI: This instruction clears the fixed scan execution type programs execution disabled state. ENO:=DI(EN); ENO:=EI(EN); ■Execution condition Instruction Execution condition Every scan...
  • Page 97: Program Control Instructions

    Program Control Instructions Changing the program execution type to standby type PSTOP This instruction changes the execution type of the program with the specified program name to a standby type. ENO:=PSTOP(EN,program name); ■Execution condition Instruction Execution condition PSTOP Setting data ■Description, range, data type Operand Description...
  • Page 98: Changing The Program Execution Type To Scan Execution Type

    Changing the program execution type to scan execution type PSCAN This instruction changes the execution type of the program with the specified program name to a normal execution type. ENO:=PSCAN(EN,program name); ■Execution condition Instruction Execution condition PSCAN Setting data ■Description, range, data type Operand Description Range...
  • Page 99: Chapter 8 Data Processing

    DATA PROCESSING Data Processing Instructions Adding 16-bit binary data WSUM(_U) These instructions add the (n) points of 16-bit binary data from the specified device. ENO:=WSUM(EN,s,n,d); ENO:=WSUM_U(EN,s,n,d); ■Execution condition Instruction Execution condition WSUM WSUM_U Setting data ■Description, range, data type Operand Description Range Data type...
  • Page 100: Adding 32-Bit Binary Data

    Adding 32-bit binary data DWSUM(_U) These instructions add the (n) points of 32-bit binary data in the devices starting from the specified one. ENO:=DWSUM(EN,s,n,d); ENO:=DWSUM_U(EN,s,n,d); ■Execution condition Instruction Execution condition DWSUM DWSUM_U Setting data ■Descriptions, ranges, and data types Operand Description Range Data type...
  • Page 101: Calculating The Mean Value Of 16-Bit Binary Data

    Calculating the mean value of 16-bit binary data MEAN(_U) These instructions calculate the average value of the (n) points of 16-bit data in the devices starting from the specified one. ENO:=MEAN(EN,s,n,d); ENO:=MEAN_U(EN,s,n,d); ■Execution condition Instruction Execution condition MEAN MEAN_U Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 102: Calculating The Mean Value Of 32-Bit Binary Data

    Calculating the mean value of 32-bit binary data DMEAN(_U) These instructions calculate the average value of the (n) points of 32-bit data in the devices starting from the specified one. ENO:=DMEAN(EN,s,n,d); ENO:=DMEAN_U(EN,s,n,d); ■Execution condition Instruction Execution condition DMEAN DMEAN_U Setting data ■Descriptions, ranges, and data types Operand Description...
  • Page 103: Calculating The Square Root Of 32-Bit Binary Data

    Calculating the square root of 32-bit binary data DSQRT These instructions perform a square root operation of the specified 32-bit binary data. ENO:=DSQRT(EN,s,d); ■Execution condition Instruction Execution condition DSQRT Setting data ■Description, range, data type Operand Description Range Data type Device where the data whose square root is to be calculated is stored 0 to 4294967295 ANY32...
  • Page 104: Chapter 9 String Processing

    STRING PROCESSING String Processing Instructions Transferring string data $MOV This instruction transfers string data to the specified device number and later. ENO:=STRINGMOV(EN,s,d); ■Execution condition Instruction Execution condition $MOV Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Character string to be transferred (maximum of 255 characters) ANYSTRING_SINGLE ...
  • Page 105 Processing details • This instruction transfers the character string data in the device specified by (s) to the device number specified by (d) and later. The character strings specified by (s) or the character strings from the device number specified by (s) to the device number containing 00H are transferred all at once.
  • Page 106: Transferring Unicode String Data

    Transferring Unicode string data $MOV_WS This instruction transfers character string [Unicode] data to the specified device number and later. ENO:=STRINGMOV_WS(EN,s,d); ■Execution condition Instruction Execution condition $MOV_WS Setting data ■Descriptions, ranges, and data types Operand Description Range Data type Character string [Unicode] to be transferred (maximum of 255 characters) or the start device ANYSTRING_DOUBLE ...
  • Page 107: Chapter 10 Real Value Peocessing

    REAL VALUE PEOCESSING 10.1 Floating-point instruction Adding single-precision real numbers This instruction adds single-precision real numbers. ENO:=EPLUS(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -126 (s1) First addend data or the start device where the first addend data is stored 0, 2 ANYREAL_32 ≤|(s1)|<2...
  • Page 108: Subtracting Single-Precision Real Numbers

    Subtracting single-precision real numbers This instruction performs subtraction between single-precision real numbers. ENO:=EMINUS(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -126 (s1) Minuend data or the start device where minuend data is stored 0, 2 ANYREAL_32 ≤|(s1)|<2...
  • Page 109: Adding Double-Precision Real Numbers

    Adding double-precision real numbers This instruction adds double-precision real numbers. ENO:=EDPLUS(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -1022 1024 (s1) First addend data or the start device where the first addend data is stored 0, 2 ANYREAL_64 ≤|(s1)|<2...
  • Page 110: Subtracting Double-Precision Real Numbers

    Subtracting double-precision real numbers This instruction performs subtraction between double-precision real numbers. ENO:=EDMINUS(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -1022 1024 (s1) Minuend data or the start device where minuend data is stored 0, 2 ANYREAL_64 ≤|(s1)|<2...
  • Page 111: Multiplying Single-Precision Real Numbers

    Multiplying single-precision real numbers This instruction multiplies single-precision real numbers. ENO:=EMULTI(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -126 (s1) Multiplicand data or the start device where multiplicand data is stored 0, 2 ANYREAL_32 ≤|(s1)|<2...
  • Page 112: Dividing Single-Precision Real Numbers

    Dividing single-precision real numbers This instruction performs division between single-precision real numbers. ENO:=EDIVISION(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -126 (s1) Dividend data or the start device where dividend data is stored 0, 2 ANYREAL_32 ≤|(s1)|<2...
  • Page 113: Multiplying Double-Precision Real Numbers

    Multiplying double-precision real numbers This instruction multiplies double-precision real numbers. ENO:=EDMULTI(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -1022 1024 (s1) Multiplicand data or the start device where multiplicand data is stored 0, 2 ANYREAL_64 ≤|(s1)|<2...
  • Page 114: Dividing Double-Precision Real Numbers

    Dividing double-precision real numbers This instruction performs division between double-precision real numbers. ENO:=EDDIVISION(EN,s1,s2,d); ■Execution condition Instruction Execution condition Setting data ■Description, range, data type Operand Description Range Data type -1022 1024 (s1) Dividend data or the start device where dividend data is stored 0, 2 ANYREAL_64 ≤|(s1)|<2...
  • Page 115: Inverting The Sign Of Single-Precision Real Number

    Inverting the sign of single-precision real number ENEG This instruction inverts the sign of single-precision real number data. ENO:=ENEG(EN,d); ■Execution condition Instruction Execution condition ENEG Setting data ■Description, range, data type Operand Description Range Data type Start device containing the single-precision real number data subject to ANYREAL_32 ...
  • Page 116: Inverting The Sign Of Double-Precision Real Number

    Inverting the sign of double-precision real number EDNEG This instruction inverts the sign of double-precision real number data. ENO:=EDNEG(EN,d); ■Execution condition Instruction Execution condition EDNEG Setting data ■Description, range, data type Operand Description Range Data type Start device containing the double-precision real number subject to sign ANYREAL_64 ...
  • Page 117: Transferring Single-Precision Real Number

    Transferring single-precision real number EMOV This instruction transfers single-precision real number data to the specified device. ENO:=EMOV(EN,s,d); ■Execution condition Instruction Execution condition EMOV Setting data ■Description, range, data type Operand Description Range Data type -126 Data to be transferred or start device containing the data to be transferred 0, 2 ANYREAL_32 ≤|(s)|<2...
  • Page 118: Transferring Double-Precision Real Number

    Transferring double-precision real number EDMOV This instruction transfers double-precision real number data to the specified device. ENO:=EDMOV(EN,s,d); ■Execution condition Instruction Execution condition EDMOV Setting data ■Description, range, data type Operand Description Range Data type -1022 1024 Data to be transferred or start device containing the data to be transferred 0, 2 ANYREAL_64 ≤|(s)|<2...
  • Page 119: Part 6 Motion Dedicated Instructions

    PART 6 MOTION DEDICATED INSTRUCTIONS This part consists of the following chapter. 11 MOTION DEDICATED INSTRUCTIONS...
  • Page 120: Chapter 11 Motion Dedicated Instructions

    MOTION DEDICATED INSTRUCTIONS 11.1 Overview The module dedicated instruction enables access and execution of instructions to the labels defined in the motion from control CPUs such as a programmable controller CPU. The dedicated instruction which can be executed from the programmable controller CPU to the Motion module is shown below.
  • Page 121: User Function Execution Instruction

    11.2 User Function Execution Instruction G(P).CEXECUTE These instructions instruct the execution of processing in the Motion module. ENO:=G_CEXECUTE(EN,U,s1,s2,d1,d2); ENO:=GP_CEXECUTE(EN,U,s1,s2,d1,d2); ■Execution condition Instruction Execution condition G.CEXECUTE GP.CEXECUTE Setting data ■Description, range, data type Operand Description Range Data type Start I/O number (first three digits in four-digit hexadecimal 00H to FEH ANY16 representation) of a module...
  • Page 122 ■Response data Operand: (d1) Device Item Description Setting range Set by Response data length The response data length is stored. (Number of words) 0 to 8192 System +1 to + Response data The response data is stored. System  Processing details •...
  • Page 123 ■Label write request Writes labels to the Motion module. The execution of this request requires the SignalIO add-on. Operand: (s2) Device Item Description Setting range Set by Request data Specify the request data length. (Number of words from +1 to +) 4 to 8192 User length...
  • Page 124 *1 Return the response data by executing the acceptance of instruction with dedicated instruction task. After that, execute the change processing with the normal task cycle. *2 It is always 1 when this instruction is executed. The judgement of the success and failure by execution, check the PROGRAM_INFO.Status.
  • Page 125 Precautions • The G(P).CEXECUTE instruction cannot be executed additionally while another G(P).CEXECUTE instruction is being executed. (If attempted, an error code (1802H) is stored in the completion status (S1)+1.) • The operand must be specified even when request data and response data are not required. •...
  • Page 126 MEMO 11 MOTION DEDICATED INSTRUCTIONS 11.2 User Function Execution Instruction...
  • Page 127: Part 7 Standard Functions

    PART 7 STANDARD FUNCTIONS This part consists of the following chapters. 12 TYPE CONVERSION FUNCTIONS 13 SINGLE VARIABLE FUNCTIONS 14 ARITHMETIC OPERATION FUNCTIONS 15 BOOLEAN FUNCTIONS 16 SELECTION FUNCTIONS...
  • Page 128: Chapter 12 Type Conversion Functions

    TYPE CONVERSION FUNCTIONS 12.1 Converting BOOL to WORD BOOL_TO_WORD This function converts a value from BOOL data type to WORD data type. d:=BOOL_TO_WORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable BOOL Output Output variable WORD...
  • Page 129: Converting Bool To Dword

    12.2 Converting BOOL to DWORD BOOL_TO_DWORD This function converts a value from BOOL data type to DWORD data type. Structured text d:=BOOL_TO_DWORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable BOOL Output Output variable DWORD Processing details...
  • Page 130: Converting Bool To Int

    12.3 Converting BOOL to INT BOOL_TO_INT This function converts a value from BOOL data type to INT data type. Structured text d:=BOOL_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable BOOL Output Output variable Processing details ■Operation processing...
  • Page 131: Converting Bool To Dint

    12.4 Converting BOOL to DINT BOOL_TO_DINT This function converts a value from BOOL data type to DINT data type. Structured text d:=BOOL_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable BOOL Output Output variable DINT Processing details...
  • Page 132: Converting Bool To Time

    12.5 Converting BOOL to TIME BOOL_TO_TIME This function converts a value from BOOL data type to TIME data type. Structured text d:=BOOL_TO_TIME(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable BOOL Output Output variable TIME Processing details...
  • Page 133: Converting Word To Bool

    12.6 Converting WORD to BOOL WORD_TO_BOOL This function converts a value from WORD data type to BOOL data type. Structured text d:=WORD_TO_BOOL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable WORD Output Output variable BOOL Processing details...
  • Page 134: Converting Word To Dword

    12.7 Converting WORD to DWORD WORD_TO_DWORD This function converts a value from WORD data type to DWORD data type. Structured text d:=WORD_TO_DWORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable WORD Output Output variable DWORD Processing details...
  • Page 135: Converting Word To Int

    12.8 Converting WORD to INT WORD_TO_INT This function converts a value from WORD data type to INT data type. Structured text d:=WORD_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable WORD Output Output variable Processing details ■Operation processing...
  • Page 136: Converting Word To Dint

    12.9 Converting WORD to DINT WORD_TO_DINT This function converts a value from WORD data type to DINT data type. Structured text d:=WORD_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable WORD Output Output variable DINT Processing details...
  • Page 137: Converting Word To Time

    12.10 Converting WORD to TIME WORD_TO_TIME This function converts a value from WORD data type to TIME data type. Structured text d:=WORD_TO_TIME(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable WORD Output Output variable TIME Processing details...
  • Page 138: Converting Dword To Bool

    12.11 Converting DWORD to BOOL DWORD_TO_BOOL This function converts a value from DWORD data type to BOOL data type. Structured text d:=DWORD_TO_BOOL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DWORD Output Output variable BOOL Processing details...
  • Page 139: Converting Dword To Word

    12.12 Converting DWORD to WORD DWORD_TO_WORD This function converts a value from DWORD data type to WORD data type. Structured text d:=DWORD_TO_WORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DWORD Output Output variable WORD Processing details...
  • Page 140: Converting Dword To Int

    12.13 Converting DWORD to INT DWORD_TO_INT This function converts a value from DWORD data type to INT data type. Structured text d:=DWORD_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DWORD Output Output variable Processing details ■Operation processing...
  • Page 141: Converting Dword To Dint

    12.14 Converting DWORD to DINT DWORD_TO_DINT This function converts a value from DWORD data type to DINT data type. Structured text d:=DWORD_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DWORD Output Output variable DINT Processing details...
  • Page 142: Converting Dword To Time

    12.15 Converting DWORD to TIME DWORD_TO_TIME This function converts a value from DWORD data type to TIME data type. Structured text d:=DWORD_TO_TIME(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DWORD Output Output variable TIME Processing details...
  • Page 143: Converting Int To Bool

    12.16 Converting INT to BOOL INT_TO_BOOL This function converts a value from INT data type to BOOL data type. Structured text d:=INT_TO_BOOL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable BOOL Processing details ■Operation processing...
  • Page 144: Converting Int To Word

    12.17 Converting INT to WORD INT_TO_WORD This function converts a value from INT data type to WORD data type. Structured text d:=INT_TO_WORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable WORD Processing details ■Operation processing...
  • Page 145: Converting Int To Dword

    12.18 Converting INT to DWORD INT_TO_DWORD This function converts a value from INT data type to DWORD data type. Structured text d:=INT_TO_DWORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable DWORD Processing details ■Operation processing...
  • Page 146: Converting Int To Dint

    12.19 Converting INT to DINT INT_TO_DINT This function converts a value from INT data type to DINT data type. Structured text d:=INT_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable DINT Processing details ■Operation processing...
  • Page 147: Converting Int To Real

    12.20 Converting INT to REAL INT_TO_REAL This function converts a value from INT data type to REAL data type. Structured text d:=INT_TO_REAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable REAL Processing details ■Operation processing...
  • Page 148: Converting Int To Lreal

    12.21 Converting INT to LREAL INT_TO_LREAL This function converts a value from INT data type to LREAL data type. Structured text d:=INT_TO_LREAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable LREAL Processing details ■Operation processing...
  • Page 149: Converting Int To Time

    12.22 Converting INT to TIME INT_TO_TIME This function converts a value from INT data type to TIME data type. Structured text d:=INT_TO_TIME(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable TIME Processing details ■Operation processing...
  • Page 150: Converting Dint To Bool

    12.23 Converting DINT to BOOL DINT_TO_BOOL This function converts a value from DINT data type to BOOL data type. Structured text d:=DINT_TO_BOOL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable BOOL Processing details...
  • Page 151: Converting Dint To Word

    12.24 Converting DINT to WORD DINT_TO_WORD This function converts a value from DINT data type to WORD data type. Structured text d:=DINT_TO_WORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable WORD Processing details...
  • Page 152: Converting Dint To Dword

    12.25 Converting DINT to DWORD DINT_TO_DWORD This function converts a value from DINT data type to DWORD data type. Structured text d:=DINT_TO_DWORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable DWORD Processing details...
  • Page 153: Converting Dint To Int

    12.26 Converting DINT to INT DINT_TO_INT This function converts a value from DINT data type to INT data type. Structured text d:=DINT_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable Processing details ■Operation processing...
  • Page 154: Converting Dint To Real

    12.27 Converting DINT to REAL DINT_TO_REAL This function converts a value from DINT data type to REAL data type. Structured text d:=DINT_TO_REAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable REAL Processing details...
  • Page 155: Converting Dint To Lreal

    12.28 Converting DINT to LREAL DINT_TO_LREAL This function converts a value from DINT data type to LREAL data type. Structured text d:=DINT_TO_LREAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable LREAL Processing details...
  • Page 156: Converting Dint To Time

    12.29 Converting DINT to TIME DINT_TO_TIME This function converts a value from DINT data type to TIME data type. Structured text d:=DINT_TO_TIME(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable DINT Output Output variable TIME Processing details...
  • Page 157: Converting Real To Int

    12.30 Converting REAL to INT REAL_TO_INT This function converts a value from REAL data type to INT data type. Structured text d:=REAL_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable REAL Output Output variable Processing details ■Operation processing...
  • Page 158: Converting Real To Dint

    12.31 Converting REAL to DINT REAL_TO_DINT This function converts a value from REAL data type to DINT data type. Structured text d:=REAL_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable REAL Output Output variable DINT Processing details...
  • Page 159: Converting Real To Lreal

    12.32 Converting REAL to LREAL REAL_TO_LREAL This function converts a value from REAL data type to LREAL data type. Structured text d:=REAL_TO_LREAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable REAL Output Output variable LREAL Processing details...
  • Page 160: Converting Lreal To Int

    12.33 Converting LREAL to INT LREAL_TO_INT This function converts a value from LREAL data type to INT data type. Structured text d:=LREAL_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable LREAL Output Output variable Processing details ■Operation processing...
  • Page 161: Converting Lreal To Dint

    12.34 Converting LREAL to DINT LREAL_TO_DINT This function converts a value from LREAL data type to DINT data type. Structured text d:=LREAL_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable LREAL Output Output variable DINT Processing details...
  • Page 162: Converting Lreal To Real

    12.35 Converting LREAL to REAL LREAL_TO_REAL This function converts a value from LREAL data type to REAL data type. Structured text d:=LREAL_TO_REAL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable LREAL Output Output variable REAL Processing details...
  • Page 163: Converting Time To Bool

    12.36 Converting TIME to BOOL TIME_TO_BOOL This function converts a value from TIME data type to BOOL data type. Structured text d:=TIME_TO_BOOL(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable TIME Output Output variable BOOL Processing details...
  • Page 164: Converting Time To Word

    12.37 Converting TIME to WORD TIME_TO_WORD This function converts a value from TIME data type to WORD data type. Structured text d:=TIME_TO_WORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable TIME Output Output variable WORD Processing details...
  • Page 165: Converting Time To Dword

    12.38 Converting TIME to DWORD TIME_TO_DWORD This function converts a value from TIME data type to DWORD data type. Structured text d:=TIME_TO_DWORD(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable TIME Output Output variable DWORD Processing details...
  • Page 166: Converting Time To Int

    12.39 Converting TIME to INT TIME_TO_INT This function converts a value from TIME data type to INT data type. Structured text d:=TIME_TO_INT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable TIME Output Output variable Processing details ■Operation processing...
  • Page 167: Converting Time To Dint

    12.40 Converting TIME to DINT TIME_TO_DINT This function converts a value from TIME data type to DINT data type. Structured text d:=TIME_TO_DINT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable TIME Output Output variable DINT Processing details...
  • Page 168: Chapter 13 Single Variable Functions

    SINGLE VARIABLE FUNCTIONS 13.1 Calculating the Absolute Value This function outputs the absolute value of an input value. Structured text d:=ABS(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_NUM Output Output variable ANY_NUM Processing details ■Operation processing...
  • Page 169: Calculating The Square Root

    13.2 Calculating the Square Root SQRT These functions calculate the square root of an input value. Structured text d:=SQRT(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing •...
  • Page 170: Calculating The Natural Logarithm

    13.3 Calculating the Natural Logarithm These functions output the natural logarithm (logarithm with base e) of an input value. Structured text d:=LN(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details...
  • Page 171: Calculating The Common Logarithm

    13.4 Calculating the Common Logarithm These functions output the common logarithm (logarithm with base 10) of an input value. Structured text d:=LOG(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details...
  • Page 172: Calculating The Exponent

    13.5 Calculating the Exponent These functions output the exponent of an input value. Structured text d:=EXP(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing •...
  • Page 173: Calculating The Sine

    13.6 Calculating the Sine These functions output the sine of an input value. Structured text d:=SIN(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing •...
  • Page 174: Calculating The Cosine

    13.7 Calculating the Cosine These functions output the cosine of an input value. Structured text d:=COS(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing •...
  • Page 175: Calculating The Tangent

    13.8 Calculating the Tangent These functions output the tangent of an input value. Structured text d:=TAN(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing •...
  • Page 176: Calculating The Arc Sine

    13.9 Calculating the Arc Sine ASIN These functions output the arc sine (SIN ) of an input value. Structured text d:=ASIN(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing...
  • Page 177: Calculating The Arc Cosine

    13.10 Calculating the Arc Cosine ACOS These functions output the arc cosine (COS ) of an input value. Structured text d:=ACOS(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing...
  • Page 178: Calculating The Arc Tangent

    13.11 Calculating the Arc Tangent ATAN These functions output the arc tangent (TAN ) of an input value. Structured text d:=ATAN(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable ANY_REAL Output Output variable ANY_REAL Processing details ■Operation processing...
  • Page 179: Chapter 14 Arithmetic Operation Functions

    ARITHMETIC OPERATION FUNCTIONS 14.1 Addition This function outputs the sum of input values ((s1)+(s2)+⋅⋅⋅+(s28)). Structured text d:=ADD(s1,s2); *1 The input variable s can be changed within the range from 2 to 28. Setting data ■Description, type, data type Argument Description Type Data type s1 (IN1) to s28 (IN28)
  • Page 180 • If an underflow or overflow occurs in the operation result, the output from (d) will be as follows. Data type Description Even if an underflow or overflow occurs, no operation error is issued. [Example 1] 32767+2=-32767 (7FFFH)+(0002H)=(8001H) A negative value results because the most significant bit is 1. [Example 2] -32767+(-2)=32766 (8000H)+(FFFEH)=(7FFEH)
  • Page 181: Multiplication

    14.2 Multiplication This function outputs the product of input values ((s1)×(s2)×⋅⋅⋅×(s28)). Structured text d:=MUL(s1,s2); *1 The input variable s can be changed within the range from 2 to 28. Setting data ■Description, type, data type Argument Description Type Data type s1 (IN1) to s28 (IN28) Input Input variable...
  • Page 182 Operation error • When (s1) to (s28) are of REAL data type Error code Description 3402H The value input to (s1) to (s28) is -0, a subnormal number, NaN (not a number), or ±∞. 3403H The data output from (d) exceeds the following range. (An overflow has occurred.) |(d)|<2 •...
  • Page 183: Subtraction

    14.3 Subtraction This function outputs the difference between input values ((s1)-(s2)). Structured text d:=SUB(s1,s2); Setting data ■Description, type, data type Argument Description Type Data type s1 (IN1) Input Input variable ANY_NUM s2 (IN2) Input Input variable ANY_NUM Output Output variable ANY_NUM Processing details ■Operation processing...
  • Page 184 ■Operation result The operation processing is performed. The operation result is output from (d). Operation error • When (s1) and (s2) are of REAL data type Error code Description 3402H The value input to (s1) is -0, a subnormal number, NaN (not a number), or ±∞. The value input to (s2) is -0, a subnormal number, NaN (not a number), or ±∞.
  • Page 185: Division

    14.4 Division This function outputs the quotient of input values ((s1)÷(s2)). Structured text d:=DIV(s1,s2); Setting data ■Description, type, data type Argument Description Type Data type s1 (IN1) Dividend Input variable ANY_NUM s2 (IN2) Divisor Input variable ANY_NUM Output Output variable ANY_NUM Processing details ■Operation processing...
  • Page 186 • When (s1) and (s2) are of LREAL data type Error code Description 3400H The value (divisor) input to (s2) is 0. 3402H The value input to (s1) is -0, a subnormal number, NaN (not a number), or ±∞. The value input to (s2) is -0, a subnormal number, NaN (not a number), or ±∞. 3403H The data output from (d) exceeds the following range.
  • Page 187: Remainder

    14.5 Remainder This function outputs the remainder of input values ((s1)÷(s2)). Structured text The function is described as an operator. ( MELSEC iQ-R Programming Manual (Program Design)) Setting data ■Description, type, data type Argument Description Type Data type s1 (IN1) Dividend Input variable ANY_INT...
  • Page 188: Assignment (Move Operation)

    14.6 Assignment (Move Operation) MOVE This function outputs the assignment value of an input value. Structured text d:=MOVE(s); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable Output Output variable Processing details ■Operation processing •...
  • Page 189: Chapter 15 Boolean Functions

    BOOLEAN FUNCTIONS 15.1 NOT Operation This function outputs the logical NOT of input values. Structured text The function is described as an operator. ( MELSEC iQ-R Programming Manual (Program Design)) Setting data ■Description, type, data type Argument Description Type Data type s (IN) Input Input variable...
  • Page 190: Chapter 16 Selection Functions

    SELECTION FUNCTIONS 16.1 Selecting the Maximum/Minimum Value MAX, MIN • MAX: This function outputs the maximum input value. • MIN: This function outputs the minimum input value. Structured text d:=MAX(s1,s2); d:=MIN(s1,s2); *1 The input variable s can be changed within the range from 2 to 28. Setting data ■Description, type, data type Argument...
  • Page 191 ■Operation result The operation processing is performed. The operation result is output from (d). Operation error Error code Description 2820H There is no NULL code (00H) in each setting area specified by (s1) to (s28) in the device/label memory. 3405H The number of characters in the strings input to (s1) to (s28) exceeds 16383.
  • Page 192 MEMO 16 SELECTION FUNCTIONS 16.1 Selecting the Maximum/Minimum Value...
  • Page 193: Part 8 Standard Function Blocks

    PART 8 STANDARD FUNCTION BLOCKS This part consists of the following chapters. 17 BISTABLE FUNCTION BLOCKS 18 EDGE DETECTION FUNCTION BLOCKS 19 TIMER FUNCTION BLOCKS...
  • Page 194: Chapter 17 Bistable Function Blocks

    BISTABLE FUNCTION BLOCKS 17.1 Bistable Function Block (Set-Dominant) These function blocks discriminate between two input values, and output 1 (TRUE) or 0 (FALSE). Structured text Instance name(S1:=s1,R:=s2,Q1:=d); Setting data ■Description, type, data type Argument Description Type Data type s1 (S1) Set command Input variable BOOL...
  • Page 195: Bistable Function Block (Reset-Dominant)

    17.2 Bistable Function Block (Reset-Dominant) These function blocks discriminate between two input values, and output 1 (TRUE) or 0 (FALSE). Structured text Instance name(S:=s1,R1:=s2,Q1:=d); Setting data ■Description, type, data type Argument Description Type Data type s1 (S) Set command Input variable BOOL s2 (R1) Reset command...
  • Page 196 MEMO 17 BISTABLE FUNCTION BLOCKS 17.2 Bistable Function Block (Reset-Dominant)
  • Page 197: Chapter 18 Edge Detection Function Blocks

    EDGE DETECTION FUNCTION BLOCKS 18.1 Detecting a Rising Edge R_TRIG These function blocks detect a signal rising edge, and outputs the pulse signal. Structured text Instance name(CLK:=s,Q:=d); Setting data ■Description, type, data type Argument Description Type Data type s (CLK) Rising edge detection input Input variable BOOL...
  • Page 198: Detecting A Falling Edge

    18.2 Detecting a Falling Edge F_TRIG These function blocks detect a signal falling edge, and outputs the pulse signal. Structured text Instance name(CLK:=s,Q:=d); Setting data ■Description, type, data type Argument Description Type Data type s (CLK) Falling edge detection input Input variable BOOL d (Q)
  • Page 199: Chapter 19 Timer Function Blocks

    TIMER FUNCTION BLOCKS 19.1 Pulse Timer These function blocks keep the signal on for the specified period of time. Structured text Instance name(IN:=s,PT:=n,Q:=d1,ET:=d2); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Start of output Input variable BOOL n (PT) Output time setting value...
  • Page 200 ■Operation result The operation result will be as follows. Operation result (d1), (d2) No operation error Operation result output value Operation error Undefined value • Timing chart When n=T#5s (5s) (d1) (d2) (1) When (s) turns on, (d1) turns on. When (s) turns on, (d2) starts measuring time. (2) When the time measured in (d2) reaches the time set in (n), (d1) turns off.
  • Page 201: On Delay Timer

    19.2 On Delay Timer These function blocks turn on a signal after the specified period of time. Structured text Instance name(IN:=s,PT:=n,Q:=d1,ET:=d2); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Time measurement Input variable BOOL n (PT) Delay time setting value Input variable TIME...
  • Page 202 ■Operation result The operation result will be as follows. Operation result (d1), (d2) No operation error Operation result output value Operation error Undefined value • Timing chart When n=T#5s (5s) (d1) (d2) (1) When (s) turns on, (d2) starts measuring time. (2) When the time measured in (d2) reaches the time set in (n), (d1) turns on.
  • Page 203: Off Delay Timer

    19.3 Off Delay Timer These function blocks turn off a signal after the specified period of time. Structured text Instance name(IN:=s,PT:=n,Q:=d1,ET:=d2); Setting data ■Description, type, data type Argument Description Type Data type s (IN) Time measurement Input variable BOOL n (PT) Delay time setting value Input variable TIME...
  • Page 204 ■Operation result The operation result will be as follows. Operation result (d1), (d2) No operation error Operation result output value Operation error Undefined value • Timing chart When n=T#5s (5s) (d1) (d2) (1) When (s) turns off, (d2) starts measuring time. (2) When the time measured in (d2) reaches the time set in (n), (d1) turns on.
  • Page 205: Timer Function Block

    19.4 Timer Function Block TIMER__M These function blocks start counting a timer when the execution condition is satisfied, and continue counting until the timer reaches the set value. Structured text Instance name(Coil:=s1,Preset:=s2,ValueIn:=s3,ValueOut:=d1,Status:=d2); Setting data ■Description, type, data type Argument Description Type Data type s1 (Coil)
  • Page 206 ■TIMER_LOW_FB_M • This is a low-speed timer whose unit of measurement is 1 to 1000 ms. When (s1) turns on, measurement of the current value starts. The measurement starts from (s3)×1 to 1000 ms (variable; set in parameter). When the value reaches (s2)×1 to 1000 ms, (d2) turns on.
  • Page 207 [Label definitions] Label name Data type Class Description TIMER_CONT_FB_M_1 TIMER_CONT_FB_M An instance of standard FB i_Coil_B Executing condition (TRUE: Execution, FALSE: Stop) o_ValueOut_I Word (signed) Timer current value o_Status_B Output [Program] TIMER_CONT_FB_M_1( Coil := i_Coil_B , Preset := 200 , ValueIn := 0 , ValueOut =>...
  • Page 208 MEMO 19 TIMER FUNCTION BLOCKS 19.4 Timer Function Block...
  • Page 209: Index

    INDEX ....191 Standard function blocks 0 to 9 ..... .125 Standard functions .
  • Page 210: Instruction Index

    INSTRUCTION INDEX .....139 DWORD_TO_DINT Symbols ..... . .138 DWORD_TO_INT .
  • Page 211 ......165 TIME_TO_DINT .....163 TIME_TO_DWORD .
  • Page 212: Revisions

    Japanese manual number: IB-0300430-B This manual confers no industrial property rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.
  • Page 213: Warranty

    WARRANTY Warranty 1. Warranty period and coverage We will repair any failure or defect hereinafter referred to as "failure" in our FA equipment hereinafter referred to as the "Product" arisen during warranty period at no charge due to causes for which we are responsible through the distributor from which you purchased the Product or our service provider.
  • Page 214: Trademarks

    TRADEMARKS Microsoft, Microsoft Access, Excel, SQL Server, Visual Basic, Visual C++, Visual Studio, Windows, Windows NT, Windows Server, Windows Vista, and Windows XP are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The company names, system names and product names mentioned in this manual are either registered trademarks or trademarks of their respective companies.
  • Page 216 IB(NA)-0300431ENG-B(2001)MEE MODEL: RD78-P-MF-E HEAD OFFICE : TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN NAGOYA WORKS : 1-14 , YADA-MINAMI 5-CHOME , HIGASHI-KU, NAGOYA , JAPAN When exported from Japan, this manual does not require application to the Ministry of Economy, Trade and Industry for service transaction permission. Specifications subject to change without notice.

Table of Contents