Mitsubishi Electric MELSEC-Q/L Programming Manual
Mitsubishi Electric MELSEC-Q/L Programming Manual

Mitsubishi Electric MELSEC-Q/L Programming Manual

Hide thumbs Also See for MELSEC-Q/L:
Table of Contents

Advertisement

MELSEC-Q/L Structured Programming Manual
(Application Functions)

Advertisement

Table of Contents
loading

Summary of Contents for Mitsubishi Electric MELSEC-Q/L

  • Page 1 MELSEC-Q/L Structured Programming Manual (Application Functions)
  • Page 3: Safety Precautions

    SAFETY PRECAUTIONS (Read these precautions before using this product.) Before using MELSEC-Q or -L series programmable controllers, please read the manuals included with each product and the relevant manuals introduced in those manuals carefully, and pay full attention to safety to handle the product correctly. Make sure that the end users read the manuals included with each product, and keep the manuals in a safe place for future reference.
  • Page 4: Introduction

    INTRODUCTION Thank you for purchasing the Mitsubishi Electric MELSEC-Q or -L series programmable controllers. Before using this product, please read this manual and the relevant manuals carefully and develop familiarity with the programming specifications to handle the product correctly. When applying the program examples introduced in this manual to an actual system, ensure the applicability and confirm that...
  • Page 5 MEMO...
  • Page 6: Table Of Contents

    CONTENTS SAFETY PRECAUTIONS ..............1 CONDITIONS OF USE FOR THE PRODUCT .
  • Page 7 Converting word (signed), double word (signed) type to double word (unsigned)/32-bit string type..47 Converting word (signed), double word (signed) type to BCD type........49 Converting word (signed), double word (signed) type to time type .
  • Page 8 Upper/Lower limit control..............148 Multiplexer .
  • Page 9 INSTRUCTION INDEX REVISIONS ................220 WARRANTY .
  • Page 10: Manuals

    MELSEC-Q/L/F Structured Programming Manual Methods and languages for structured programming (Fundamentals) <SH-080782ENG> MELSEC-Q/L Structured Programming Manual (Common Specifications and functions of common instructions, such as sequence instructions, basic Instructions) instructions, and application instructions, that can be used in structured programs <SH-080783ENG>...
  • Page 11: Terms

    TERMS This manual uses the generic terms and abbreviations listed in the following table to discuss the software packages and programmable controller CPUs. Corresponding module models are also listed if needed. Term Description Application function A generic term for the functions, such as functions and function blocks, defined in IEC61131-3. (It is executed by combinations of multiple common instructions in a programmable controller.) Basic model QCPU A generic term for the Q00JCPU, Q00CPU, and Q01CPU...
  • Page 12: Chapter 1 Overview

    OVERVIEW Purpose of This Manual This manual explains the application functions used for creating structured programs. Manuals for reference are listed in the following table according to their purpose. For information such as the contents and number of each manual, refer to the following. Page 8 RELEVANT MANUALS Operation of GX Works2 Purpose...
  • Page 13  Use's Manual (Hardware Design, controller CPU error codes, special Maintenance and Inspection) for the CPU relays, and special registers module used   MELSEC-Q/L Programming Manual Using ladder Learning the types and details of language common instructions (Common Instruction) Learning the types and details of ...
  • Page 14: Chapter 2 Function Tables

    FUNCTION TABLES How to Read Function Tables Function tables in Page 13 Function Tables are shown in the following format. Ò Ó Ô Õ Description Indicates the functions used in a program. 'Function name(_E)' is used as a function with EN/ENO. Without "_E", it is used as a a function without EN/ENO.
  • Page 15: Function Tables

    Function Tables Type conversion functions Function name Argument Processing details Reference BOOL_TO_INT(_E) (s), (d) Converts bit type data into word (signed) or double word (signed) type Page 24 Converting bit type to data. word (signed), double word BOOL_TO_DINT(_E) (s), (d) (signed) type BOOL_TO_STR(_E) (s), (d)
  • Page 16 Function name Argument Processing details Reference LREAL_TO_REAL(_E) (s), (d) Converts double-precision real type data into single-precision real type Page 60 Converting double- data. precision real type to single- precision real type REAL_TO_STR(_E) (s), (d) Converts single-precision real type data into string type (exponential Page 62 Converting single- form) data.
  • Page 17 Function name Argument Processing details Reference BITARR_TO_INT(_E) (s), n, (d) Converts specified number of bits from bit array into word (signed) type, Page 109 Converting bit array word (unsigned)/16-bit string type, double word (signed) type, or double to word (signed) type, word BITARR_TO_DINT(_E) (s), n, (d) word (unsigned)/32-bit string type data.
  • Page 18: Standard Functions Of One Numeric Variable

    Standard functions of one numeric variable Function name Argument Processing details Reference ABS(_E) (s), (d) Outputs the absolute value of an input value. Page 123 Absolute value Standard arithmetic functions Function name Argument Processing details Reference Outputs the sum ((s1)+(s2)+  +(s28)) of input values. ADD_E (s1), (s2), ...(s28), (d) Page 126 Addition...
  • Page 19: Standard Comparison Functions

    Standard comparison functions Function name Argument Processing details Reference GT_E (s1), (s2), ...(s28), (d) Outputs the comparison value of an input value. Page 152 Comparison (Number of pins variable) GE_E (s1), (s2), ...(s28), (d) (Number of pins variable) EQ_E (s1), (s2), ...(s28), (d) (Number of pins variable) LE_E (s1), (s2), ...(s28), (d)
  • Page 20: Standard Edge Detection Function Blocks

    Standard edge detection function blocks Function name Argument Processing details Reference R_TRIG(_E) (s), (d) Detects the rising edge of a signal and outputs pulse signals. Page 177 Rising edge detector F_TRIG(_E) (s), (d) Detects the falling edge of a signal and outputs pulse signals. Page 179 Falling edge detector Standard counter function blocks Function name...
  • Page 21: Operator Tables

    Operator Tables Arithmetic operations Operator name Argument Processing details Reference Structured ladder/ Outputs the sum ((s1)+(s2)+  +(s28)) of input values. (s1), (s2), ...(s28), (d) Page 204 Addition (Number of pins variable) Outputs the product ((s1)  (s2)    (s28)) of input (s1), (s2), ...(s28), (d) Page 206 Multiplication (Number of pins variable)
  • Page 22: Chapter 3 Configuration Of Functions

    Execution result (ENO) An output variable ENO outputs an execution result. For details of the configuration of functions for labels and structures, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 3 CONFIGURATION OF FUNCTIONS 3.1 Configuration of Functions...
  • Page 23: Input Pins Variable Function

    Input Pins Variable Function Some functions allow the number of input pins to be changed. To change the number of input pins, select the target function and change the number. For details, refer to the following.  GX Works2 Version 1 Operating Manual (Structured Project) Adding a pin Deleting a pin 3 CONFIGURATION OF FUNCTIONS...
  • Page 24: Chapter 4 How To Read Functions

    HOW TO READ FUNCTIONS Chapter 5 and after provides detailed explanation on each function in the layout as shown below. Ò Ó Ô Õ Ö × Ø Ù  Indicates an outline of a function.  Indicates a function to be explained. 4 HOW TO READ FUNCTIONS...
  • Page 25  Indicates the names of input and output arguments, and the data type of each argument. For details of each data type, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals)  Indicates the processing performed by the function.
  • Page 26: Chapter 5 Application Functions

    APPLICATION FUNCTIONS Type Conversion Functions Converting bit type to word (signed), double word (signed) type BOOL_TO_INT(_E), BOOL_TO_DINT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD BOOL_TO_INT_E ENO:= (EN, s, d); BOOL_TO_INT_E The following function(s) can go in the dotted squares. BOOL_TO_INT, BOOL_TO_INT_E, BOOL_TO_DINT, BOOL_TO_DINT_E ■Argument Input/output...
  • Page 27 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 28: Converting Bit Type To String Type

    Converting bit type to string type BOOL_TO_STR(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD BOOL_TO_STR_E ENO:= (EN, s, d); BOOL_TO_STR_E The following function(s) can go in the dotted squares. BOOL_TO_STR, BOOL_TO_STR_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 29 Operation error • No operation error occurs. Program example ■BOOL_TO_STR(_E) The program which converts bit type data input to (s) into string type data, and outputs the operation result from (d). • Function without EN/ENO (BOOL_TO_STR) [Structured ladder/FBD] [ST] g_string1 := BOOL_TO_STR(g_bool1); 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 30: Converting Bit Type To Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type

    Converting bit type to word (unsigned)/16-bit string, double word (unsigned)/32-bit string type BOOL_TO_WORD(_E), BOOL_TO_DWORD(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD BOOL_TO_WORD_E ENO:= (EN, s, d); BOOL_TO_WORD_E The following function(s) can go in the dotted squares. BOOL_TO_WORD, BOOL_TO_WORD_E, BOOL_TO_DWORD, BOOL_TO_DWORD_E ■Argument Input/output Name...
  • Page 31 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 32: Converting Bit Type To Time Type

    Converting bit type to time type BOOL_TO_TIME(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD BOOL_TO_TIME_E ENO:= (EN, s, d); BOOL_TO_TIME_E The following function(s) can go in the dotted squares. BOOL_TO_TIME, BOOL_TO_TIME_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 33 Operation error • No operation error occurs. Program example ■BOOL_TO_TIME(_E) The program which converts bit type data input to (s) into time type data, and outputs the operation result from (d). • Function without EN/ENO (BOOL_TO_TIME) [Structured ladder/FBD] [ST] g_time1 := BOOL_TO_TIME(g_bool1); The program which converts bit type data input to (s) into time type data, and outputs the operation result from (d).
  • Page 34: Converting Word (Signed) Type To Double Word (Signed) Type

    Converting word (signed) type to double word (signed) type INT_TO_DINT(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD INT_TO_DINT_E ENO:= (EN, s, d); INT_TO_DINT_E The following function(s) can go in the dotted squares. INT_TO_DINT, INT_TO_DINT_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 35 Operation error • No operation error occurs. Program example ■INT_TO_DINT(_E) The program which converts word (signed) type data input to (s) into double word (signed) type data, and outputs the operation result from (d). • Function without EN/ENO (INT_TO_DINT) [Structured ladder/FBD] [ST] g_dint1 := INT_TO_DINT(g_int1);...
  • Page 36: Converting Double Word (Signed) Type To Word (Signed) Type

    Converting double word (signed) type to word (signed) type DINT_TO_INT(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD DINT_TO_INT_E ENO:= (EN, s, d); DINT_TO_INT_E The following function(s) can go in the dotted squares. DINT_TO_INT, DINT_TO_INT_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 37 Operation error • No operation error occurs. Program example ■DINT_TO_INT(_E) The program which converts double word (signed) type data input to (s) into word (signed) type data, and outputs the operation result from (d). • Function without EN/ENO (DINT_TO_INT) [Structured ladder/FBD] [ST] g_int1 := DINT_TO_INT(g_dint1);...
  • Page 38: Converting Word (Signed), Double Word (Signed) Type To Bit Type

    Converting word (signed), double word (signed) type to bit type INT_TO_BOOL(_E), DINT_TO_BOOL(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD INT_TO_BOOL_E ENO:= (EN, s, d); INT_TO_BOOL_E The following function(s) can go in the dotted squares. INT_TO_BOOL, INT_TO_BOOL_E, DINT_TO_BOOL, DINT_TO_BOOL_E ■Argument Input/output Name...
  • Page 39 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 40: Converting Word (Signed), Double Word (Signed) Type To Single-Precision Real Type

    Converting word (signed), double word (signed) type to single- precision real type INT_TO_REAL(_E), DINT_TO_REAL(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD INT_TO_REAL_E ENO:= (EN, s, d); INT_TO_REAL_E The following function(s) can go in the dotted squares. INT_TO_REAL, INT_TO_REAL_E, DINT_TO_REAL, DINT_TO_REAL_E ■Argument Input/output Name...
  • Page 41 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 42: Converting Word (Signed), Double Word (Signed) Type To Double-Precision Real Type

    Converting word (signed), double word (signed) type to double- precision real type INT_TO_LREAL(_E), DINT_TO_LREAL(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INT_TO_LREAL_E ENO:= (EN, s, d); INT_TO_LREAL_E The following function(s) can go in the dotted squares. INT_TO_LREAL, INT_TO_LREAL_E, DINT_TO_LREAL, DINT_TO_LREAL_E ■Argument Input/output Name...
  • Page 43 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 44: Converting Word (Signed), Double Word (Signed) Type To String Type

    Converting word (signed), double word (signed) type to string type INT_TO_STR(_E), DINT_TO_STR(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INT_TO_STR_E ENO:= (EN, s, d); INT_TO_STR_E The following function(s) can go in the dotted squares. INT_TO_STR, INT_TO_STR_E, DINT_TO_STR, DINT_TO_STR_E ■Argument Input/output Name...
  • Page 45 • DINT_TO_STR, DINT_TO_STR_E Converts double word (signed) type data input to (s) into string type data, and outputs the operation result from (d). High-order byte Low-order byte ASCII code of billions place Sign data String 1st word ASCII code of ten-millions place ASCII code of hundred-millions place 2nd word ASCII code of hundred-thousands place ASCII code of millions place 3rd word...
  • Page 46 Operation error • No operation error occurs. Program example ■INT_TO_STR(_E) The program which converts word (signed) type data input to (s) into string type data, and outputs the operation result from (d). • Function without EN/ENO (INT_TO_STR) [Structured ladder/FBD] [ST] g_string1 := INT_TO_STR(g_int1);...
  • Page 47: Converting Word (Signed), Double Word (Signed) Type To Word (Unsigned)/16-Bit String Type

    Converting word (signed), double word (signed) type to word (unsigned)/16-bit string type INT_TO_WORD(_E), DINT_TO_WORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INT_TO_WORD_E ENO:= (EN, s, d); INT_TO_WORD_E The following function(s) can go in the dotted squares. INT_TO_WORD, INT_TO_WORD_E, DINT_TO_WORD, DINT_TO_WORD_E ■Argument Input/output Name...
  • Page 48 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 49: Converting Word (Signed), Double Word (Signed) Type To Double Word (Unsigned)/32-Bit String Type

    Converting word (signed), double word (signed) type to double word (unsigned)/32-bit string type INT_TO_DWORD(_E), DINT_TO_DWORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INT_TO_DWORD_E ENO:= (EN, s, d); INT_TO_DWORD_E The following function(s) can go in the dotted squares. INT_TO_DWORD, INT_TO_DWORD_E, DINT_TO_DWORD, DINT_TO_DWORD_E ■Argument Input/output Name...
  • Page 50 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 51: Converting Word (Signed), Double Word (Signed) Type To Bcd Type

    Converting word (signed), double word (signed) type to BCD type INT_TO_BCD(_E), DINT_TO_BCD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INT_TO_BCD_E ENO:= (EN, s, d); INT_TO_BCD_E The following function(s) can go in the dotted squares. INT_TO_BCD, INT_TO_BCD_E, DINT_TO_BCD, DINT_TO_BCD_E ■Argument Input/output Name...
  • Page 52 • DINT_TO_BCD, DINT_TO_BCD_E Converts double word (signed) type data input to (s) into BCD type data, and outputs the operation result from (d). 99999999 99999999 Double word (signed) type Double word (unsigned)/32-bit string type 99999999 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 Must always be 0.
  • Page 53 Operation error • An operation error occurs in the following cases. Error Description Q00J/ QnPH QnPRH LCPU code Q00/       4100 When the value input exceeds 9999 in the execution of the INT_TO_BCD(_E) When the value input exceeds 99999999 in the execution of the DINT_TO_BCD(_E) Program example ■INT_TO_BCD(_E)
  • Page 54: Converting Word (Signed), Double Word (Signed) Type To Time Type

    Converting word (signed), double word (signed) type to time type INT_TO_TIME(_E), DINT_TO_TIME(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD INT_TO_TIME_E ENO:= (EN, s, d); INT_TO_TIME_E The following function(s) can go in the dotted squares. INT_TO_TIME, INT_TO_TIME_E, DINT_TO_TIME, DINT_TO_TIME_E ■Argument Input/output Name...
  • Page 55 Operation error • No operation error occurs. Program example ■INT_TO_TIME(_E) The program which converts word (signed) type data input to (s) into time type data, and outputs the operation result from (d). • Function without EN/ENO (INT_TO_TIME) [Structured ladder/FBD] [ST] g_time1:= INT_TO_TIME(g_int1);...
  • Page 56: Converting Single-Precision Real Type To Word (Signed), Double Word (Signed) Type

    However, a rounding error may occur when setting the input value by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) The converted data is the value rounded single-precision real type data to the first digit after the decimal point.
  • Page 57 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 58: Converting Double-Precision Real Type To Word (Signed), Double Word (Signed) Type

    For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) The converted data is the value rounded double-precision real type data to the first digit after the decimal point.
  • Page 59 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 60: Converting Single-Precision Real Type To Double-Precision Real Type

    • Rounding error may occur when specifying the input value to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 61 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 62: Converting Double-Precision Real Type To Single-Precision Real Type

    • Rounding error may occur when setting the input value to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 63 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 64: Converting Single-Precision Real Type To String Type

    Converting single-precision real type to string type REAL_TO_STR(_E) Ver. High Basic Process LCPU Redundant Universal performance This function is used in the Basic model QCPU with a serial number (first five digits) of "04122" or later. Structured ladder/FBD REAL_TO_STR_E ENO:= (EN, s, d);...
  • Page 65 • Rounding error may occur when specifying the input value to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 66 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 67: Converting Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type To Bit Type

    Converting word (unsigned)/16-bit string, double word (unsigned)/32-bit string type to bit type WORD_TO_BOOL(_E), DWORD_TO_BOOL(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD WORD_TO_BOOL_E ENO:= (EN, s, d); WORD_TO_BOOL_E The following function(s) can go in the dotted squares. WORD_TO_BOOL, WORD_TO_BOOL_E, DWORD_TO_BOOL, DWORD_TO_BOOL_E ■Argument Input/output Name...
  • Page 68 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 69: Converting Word (Unsigned)/16-Bit String Type To Word (Signed), Double Word (Signed) Type

    Converting word (unsigned)/16-bit string type to word (signed), double word (signed) type WORD_TO_INT(_E), WORD_TO_DINT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD WORD_TO_INT_E ENO:= (EN, s, d); WORD_TO_INT_E The following function(s) can go in the dotted squares. WORD_TO_INT, WORD_TO_INT_E, WORD_TO_DINT, WORD_TO_DINT_E ■Argument Input/output Name...
  • Page 70 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 71: Converting Double Word (Unsigned)/32-Bit String Type To Word (Signed), Double Word (Signed) Type

    Converting double word (unsigned)/32-bit string type to word (signed), double word (signed) type DWORD_TO_INT(_E), DWORD_TO_DINT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD DWORD_TO_INT_E ENO:= (EN, s, d); DWORD_TO_INT_E The following function(s) can go in the dotted squares. DWORD_TO_INT, DWORD_TO_INT_E, DWORD_TO_DINT, DWORD_TO_DINT_E ■Argument Input/output Name...
  • Page 72 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 73: Converting Word (Unsigned)/16-Bit String Type To Double Word (Unsigned)/32-Bit String Type

    Converting word (unsigned)/16-bit string type to double word (unsigned)/32-bit string type WORD_TO_DWORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD WORD_TO_DWORD_E ENO:= (EN, s, d); WORD_TO_DWORD_E The following function(s) can go in the dotted squares. WORD_TO_DWORD, WORD_TO_DWORD_E ■Argument Input/output Name Description Data type...
  • Page 74 Operation error • No operation error occurs. Program example ■WORD_TO_DWORD(_E) The program which converts word (unsigned)/16-bit string type data input to (s) into double word (unsigned)/32-bit string type data, and outputs the operation result from (d). • Function without EN/ENO (WORD_TO_DWORD) [Structured ladder/FBD] [ST] g_dword1 := WORD_TO_DWORD(g_word1);...
  • Page 75: Converting Double Word (Unsigned)/32-Bit String Type To Word (Unsigned)/16-Bit String Type

    Converting double word (unsigned)/32-bit string type to word (unsigned)/16-bit string type DWORD_TO_WORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD DWORD_TO_WORD_E ENO:= (EN, s, d); DWORD_TO_WORD_E The following function(s) can go in the dotted squares. DWORD_TO_WORD, DWORD_TO_WORD_E ■Argument Input argument/ Name Description Data type...
  • Page 76 When the DWORD_TO_WORD(_E) function is executed, low-order 16-bit data of double word (unsigned)/32- bit string type data input to (s) are converted into word (unsigned)/16-bit string type data. High-order 16-bit data are discarded. Operation error • No operation error occurs. Program example ■DWORD_TO_WORD(_E) The program which converts double word (unsigned)/32-bit string type data input to (s) into word (unsigned)/16-bit string type...
  • Page 77: Converting Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type To String Type

    Converting word (unsigned)/16-bit string, double word (unsigned)/32-bit string type to string type WORD_TO_STR(_E), DWORD_TO_STR(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD WORD_TO_STR_E ENO:= (EN, s, d); WORD_TO_STR_E The following function(s) can go in the dotted squares. WWORD_TO_STR, ORD_TO_STR_E, DWORD_TO_STR, DWORD_TO_STR_E ■Argument Input/output Name...
  • Page 78 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 79: Converting Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type To Time Type

    Converting word (unsigned)/16-bit string, double word (unsigned)/32-bit string type to time type WORD_TO_TIME(_E), DWORD_TO_TIME(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD WORD_TO_TIME_E ENO:= (EN, s, d); WORD_TO_TIME_E The following function(s) can go in the dotted squares. WORD_TO_TIME, WORD_TO_TIME_E, DWORD_TO_TIME, DWORD_TO_TIME_E ■Argument Input/output Name...
  • Page 80 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 81: Converting String Type To Bit Type

    Converting string type to bit type STR_TO_BOOL(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD STR_TO_BOOL_E ENO:= (EN, s, d); STR_TO_BOOL_E The following function(s) can go in the dotted squares. STR_TO_BOOL, STR_TO_BOOL_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 82 Operation error • No operation error occurs. Program example ■STR_TO_BOOL(_E) The program which converts string type data input to (s) into bit type data, and outputs the operation result from (d). • Function without EN/ENO (STR_TO_BOOL) [Structured ladder/FBD] [ST] g_bool1 := STR_TO_BOOL(g_string1); •...
  • Page 83: Converting String Type To Word (Signed), Double Word (Signed) Type

    Converting string type to word (signed), double word (signed) type STR_TO_INT(_E), STR_TO_DINT(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD STR_TO_INT_E ENO:= (EN, s, d); STR_TO_INT_E The following function(s) can go in the dotted squares. STR_TO_INT, STR_TO_INT_E, STR_TO_DINT, STR_TO_DINT_E ■Argument Input/output Name...
  • Page 84 The value to be input to (s) is string type data within the following range. ASCII code: '30H' to '39H', '20H', '2DH', and '00H' String type data: -2147483648 to 2147483647 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value...
  • Page 85 ■STR_TO_DINT(_E) The program which converts string type data input to (s) into double word (signed) type data, and outputs the operation result from (d). • Function without EN/ENO (STR_TO_DINT) [Structured ladder/FBD] [ST] g_dint1 := STR_TO_DINT(g_string1); 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 86: Converting String Type To Single-Precision Real Type

    Converting string type to single-precision real type STR_TO_REAL(_E) Ver. High Basic Process LCPU Redundant Universal performance This function is used in the Basic model QCPU with a serial number (first five digits) of "04122" or later. Structured ladder/FBD STR_TO_REAL_E ENO:= (EN, s, d);...
  • Page 87 • Both string type data in decimal form and exponential form can be converted to single-precision real type data. Decimal form High-order byte Low-order byte String 1st word 2nd word 3rd word -1.35034 4th word 5th word Single-precision real type Exponential form High-order byte Low-order byte...
  • Page 88 • When '20H' (space) or '30H' (0) exists before the first 0 in string type data, the conversion is executed ignoring '20H' and '30H'. Decimal form 0 3 4 -1.35034 Single-precision real type Neglected Exponential form 0 3 4 E - 1 0 -1.35034E-10 Single-precision real type Neglected...
  • Page 89 Program example ■STR_TO_REAL(_E) The program which converts string type data input to (s) into single-precision real type data, and outputs the operation result from (d). • Function without EN/ENO (STR_TO_REAL) [Structured ladder/FBD] [ST] g_real1 := STR_TO_REAL(g_string1); • Function with EN/ENO (STR_TO_REAL_E) [Structured ladder/FBD] [ST] g_bool3 := STR_TO_REAL_E(g_bool1, g_string1, g_real1);...
  • Page 90: Converting String Type To Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type

    Converting string type to word (unsigned)/16-bit string, double word (unsigned)/32-bit string type STR_TO_WORD(_E), STR_TO_DWORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD STR_TO_WORD_E ENO:= (EN, s, d); STR_TO_WORD_E The following function(s) can go in the dotted squares. STR_TO_WORD, STR_TO_WORD_E, STR_TO_DWORD, STR_TO_DWORD_E ■Argument Input/output Name...
  • Page 91 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 92 ■STR_TO_DWORD(_E) The program which converts string type data input to (s) into double word (unsigned)/32-bit string type data, and outputs the operation result from (d). • Function without EN/ENO (STR_TO_DWORD) [Structured ladder/FBD] [ST] g_string1 := "00000012"; g_dword1 := STR_TO_DWORD(g_string1); 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 93: Converting String Type To Time Type

    Converting string type to time type STR_TO_TIME(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD STR_TO_TIME_E ENO:= (EN, s, d); STR_TO_TIME_E The following function(s) can go in the dotted squares. STR_TO_TIME, STR_TO_TIME_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 94 Operation error This function consists of the following instruction. STR_TO_TIME(_E): DDABIN • In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and the corresponding error code is stored to SD0. Error Description Q00J/ QnPH QnPRH...
  • Page 95: Converting String Type To Bcd Type

    Converting string type to BCD type STR_TO_BCD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD STR_TO_BCD_E ENO:= (EN, s, d); STR_TO_BCD_E The following function(s) can go in the dotted squares. STR_TO_BCD, STR_TO_BCD_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 96 • When double word (unsigned)/32-bit string type is specified for output argument. Converts string type 8-character-string data input to (s) into BCD type data, and outputs the operation result from (d). " 99999999 " 99999999 String type Double word (unsigned)/32-bit string type When '20H' (space) exists in the character string, the conversion is executed ignoring '20H'.
  • Page 97 Program example ■STR_TO_BCD(_E) (when word (unsigned)/16-bit string is specified for (d)) The program which converts string type data input to (s) into BCD type data, and outputs the operation result from (d). • Function without EN/ENO (STR_TO_BCD) [Structured ladder/FBD] [ST] g_string1 := "0012";...
  • Page 98: Converting Bcd Type To Word (Signed), Double Word (Signed) Type

    Converting BCD type to word (signed), double word (signed) type BCD_TO_INT(_E), BCD_TO_DINT(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD BCD_TO_INT_E ENO:= (EN, s, d); BCD_TO_INT_E The following function(s) can go in the dotted squares. BCD_TO_INT, BCD_TO_INT_E, BCD_TO_DINT, BCD_TO_DINT_E ■Argument Input/output Name...
  • Page 99 • BCD_TO_DINT, BCD_TO_DINT_E Converts BCD type data input to (s) into double word (signed) type data, and outputs the operation result from (d). • When word (unsigned)/16-bit string is specified for (s) 9999 9999 Word (unsigned)/16-bit string type Double word (signed) type ×...
  • Page 100 Operation error These functions consist of the following common instructions. BCD_TO_INT(_E): BIN BCD_TO_DINT(_E): BIN, WAND • In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and the corresponding error code is stored to SD0. Error Description Q00J/...
  • Page 101: Converting Bcd Type To String Type

    Converting BCD type to string type BCD_TO_STR(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD BCD_TO_STR_E ENO:= (EN, s, d); BCD_TO_STR_E The following function(s) can go in the dotted squares. BCD_TO_STR, BCD_TO_STR_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 102 Operation error These functions consist of the following common instructions. When word (unsigned)/16-bit string type is specified for (s): BCDDA When double word (unsigned)/32-bit string type is specified for (d): DBCDDA • In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and the corresponding error code is stored to SD0.
  • Page 103: Converting Time Type To Bit Type

    Converting time type to bit type TIME_TO_BOOL(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TIME_TO_BOOL_E ENO:= (EN, s, d); TIME_TO_BOOL_E The following function(s) can go in the dotted squares. TIME_TO_BOOL, TIME_TO_BOOL_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 104 Operation error • No operation error occurs. Program example ■TIME_TO_BOOL(_E) The program which converts time type data input to (s) into bit type data, and outputs the operation result from (d). • Function without EN/ENO (TIME_TO_BOOL) [Structured ladder/FBD] [ST] g_bool1 := TIME_TO_BOOL(g_time1); •...
  • Page 105: Converting Time Type To Word (Signed), Double Word (Signed) Type

    Converting time type to word (signed), double word (signed) type TIME_TO_INT(_E), TIME_TO_DINT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TIME_TO_INT_E ENO:= (EN, s, d); TIME_TO_INT_E The following function(s) can go in the dotted squares. TIME_TO_INT, TIME_TO_INT_E, TIME_TO_DINT, TIME_TO_DINT_E ■Argument Input/output Name...
  • Page 106 Operation error • No operation error occurs. Program example ■TIME_TO_INT(_E) The program which converts time type data input to (s) into word (signed) type data, and outputs the operation result from (d). • Function without EN/ENO (TIME _TO_INT) [Structured ladder/FBD] [ST] g_int1 := TIME_TO_INT(g_time1);...
  • Page 107: Converting Time Type To String Type

    Converting time type to string type TIME_TO_STR(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TIME_TO_STR_E ENO:= (EN, s, d); TIME_TO_STR_E The following function(s) can go in the dotted squares. TIME_TO_STR, TIME_TO_STR_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 108 Operation error These functions consist of the following common instructions. TIME_TO_STR(_E): DBINDA • In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and the corresponding error code is stored to SD0. Error Description Q00J/ QnPH...
  • Page 109: Converting Time Type To Word (Unsigned)/16-Bit String, Double Word (Unsigned)/32-Bit String Type

    Converting time type to word (unsigned)/16-bit string, double word (unsigned)/32-bit string type TIME_TO_WORD(_E), TIME_TO_DWORD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TIME_TO_WORD_E ENO:= (EN, s, d); TIME_TO_WORD_E The following function(s) can go in the dotted squares. TIME_TO_WORD, TIME_TO_WORD_E, TIME_TO_DWORD, TIME_TO_DWORD_E ■Argument Input/output Name...
  • Page 110 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 111: Converting Bit Array To Word (Signed) Type, Word (Unsigned)/16-Bit String Type, Double Word (Signed) Type, Double Word (Unsigned)/32-Bit String Type

    Converting bit array to word (signed) type, word (unsigned)/16-bit string type, double word (signed) type, double word (unsigned)/ 32-bit string type BITARR_TO_INT(_E), BITARR_TO_DINT(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD BITARR_TO_INT_E ENO:= (EN, s, n, d); BITARR_TO_INT_E The following function(s) can go in the dotted squares. BITARR_TO_INT, BITARR_TO_INT_E, BITARR_TO_DINT, BITARR_TO_DINT_E ■Argument Input/output...
  • Page 112 Operation error • No operation error occurs. Program example ■BITARR_TO_INT(_E) The program which converts 8 bits from 0 of bit array input to (s) into word (signed) type data, and outputs the operation result from (d). • Function without EN/ENO (BITARR_TO_INT) [Structured ladder/FBD] [ST] g_int1 := BITARR_TO_INT(g_bool4[0], 8);...
  • Page 113: Converting Word (Signed) Type, Word (Unsigned)/16-Bit String Type, Double Word (Signed) Type, Double Word (Unsigned)/32-Bit String Type To Bit Array

    Converting word (signed) type, word (unsigned)/16-bit string type, double word (signed) type, double word (unsigned)/32-bit string type to bit array INT_TO_BITARR(_E), DINT_TO_BITARR(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD INT_TO_BITARR_E ENO:= (EN, s, n, d); INT_TO_BITARR_E The following function(s) can go in the dotted squares. INT_TO_BITARR, INT_TO_BITARR_E, DINT_TO_BITARR, DINT_TO_BITARR_E ■Argument Input/output...
  • Page 114 Operation error • No operation error occurs. Program example ■INT_TO_BITARR(_E) The program which outputs low-order 4 bits of word (signed) type data input to (s) to (d). • Function without EN/ENO (INT_TO_BITARR) [Structured ladder/FBD] [ST] g_bool4[0] := INT_TO_BITARR(g_int1, 4); • Function with EN/ENO (INT_TO_BITARR_E) [Structured ladder/FBD] [ST] g_bool2 := INT_TO_BITARR_E(g_bool1, g_int1, 4, g_bool4[0]);...
  • Page 115: Bit Array Copy

    Bit array copy CPY_BITARR(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CPY_BITARR_E ENO:= CPY_BITARR_E (EN, s, n, d); The following function(s) can go in the dotted squares. CPY_BITARR, CPY_BITARR_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s(_BitArrIn)
  • Page 116 Operation error • No operation error occurs. Program example ■CPY_BITARR(_E) The program which outputs 12 bits from num1 element of bit string input to (s) to num2 and the following bits of (d). • Function without EN/ENO (CPY_BITARR) [Structured ladder/FBD] [ST] g_bool5[num2] := CPY_BITARR(g_bool4[num1], 12);...
  • Page 117: Specified Bit Read Of Word (Signed) Type Data

    Specified bit read of word (signed) type data GET_BIT_OF_INT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD GET_BIT_OF_INT_E ENO:= GET_BIT_OF_INT_E (EN, s, n, d); The following function(s) can go in the dotted squares. GET_BIT_OF_INT, GET_BIT_OF_INT_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 118 Operation error • No operation error occurs. Program example ■GET_BIT_OF_INT(_E) The program which reads a value of 5th bit of data input to (s), and outputs the operation result from (d). • Function without EN/ENO (GET_BIT_OF_INT) [Structured ladder/FBD] [ST] g_bool3 := GET_BIT_OF_INT(g_int1, 5); •...
  • Page 119: Specified Bit Write Of Word (Signed) Type Data

    Specified bit write of word (signed) type data SET_BIT_OF_INT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD SET_BIT_OF_INT_E ENO:= SET_BIT_OF_INT_E (EN, s, n, d); The following function(s) can go in the dotted squares. SET_BIT_OF_INT, SET_BIT_OF_INT_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 120 Operation error • No operation error occurs. Program example ■SET_BIT_OF_INT(_E) The program which writes a value specified for (s) to the 3rd bit of (d). • Function without EN/ENO (SET_BIT_OF_INT) [Structured ladder/FBD] [ST] g_int3 := SET_BIT_OF_INT(g_bool1. 3); • Function with EN/ENO (SET_BIT_OF_INT_E) [Structured ladder/FBD] [ST] g_bool3 := SET_BIT_OF_INT_E(g_bool2, g_bool1, 3, g_int3);...
  • Page 121: Specified Bit Copy Of Word (Signed) Type Data

    Specified bit copy of word (signed) type data CPY_BIT_OF_INT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CPY_BIT_OF_INT_E ENO:= CPY_BIT_OF_INT_E (EN, s, n1, n2, d); The following function(s) can go in the dotted squares. CPY_BIT_OF_INT, CPY_BIT_OF_INT_E ■Argument Input/output Name Description Data type argument...
  • Page 122 Operation error • No operation error occurs. Program example ■CPY_BIT_OF_INT(_E) The program which writes a value of 5th bit of (s) to the 3rd bit of (d). • Function without EN/ENO (CPY_BIT_OF_INT) [Structured ladder/FBD] [ST] g_int3 := CPY_BIT_OF_INT(g_int1, 5, 3); •...
  • Page 123: Nonessential Type Conversion

    • Rounding error may occur when specifying the input value to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result An operation is executed and the operation value is output from (d).
  • Page 124 Operation error • No operation error occurs. Program example ■GET_INT_ADDR The program which directly handles 32-bit input variable Var_D10 as 16-bit input data without the type conversion. [Structured ladder/FBD] [ST] Var_D100 := GET_INT_ADDR(Var_D10); 5 APPLICATION FUNCTIONS 5.1 Type Conversion Functions...
  • Page 125: Standard Functions Of One Numeric Variable

    • Rounding error may occur when specifying single-precision real or double-precision real type data to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.2 Standard Functions of One Numeric Variable...
  • Page 126 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 127 ■ABS(_E) (when single-precision real type data is specified for (s)) The program which outputs the absolute value of single-precision real type data input to (s) from (d) in the same data type as that of (s). • Function without EN/ENO (ABS) [Structured ladder/FBD] [ST] g_real2:= ABS(g_real1);...
  • Page 128: Standard Arithmetic Functions

    Standard Arithmetic Functions Addition ADD_E High Basic Process LCPU Redundant Universal performance Structured ladder/FBD ADD_E (EN, s1, s2 ... s28, d); ENO:= ADD_E The following function(s) can go in the dotted squares. ADD_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 129 • Rounding error may occur when specifying single-precision real or double-precision real type data to (s1) through (s28) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d).
  • Page 130: Multiplication

    Multiplication MUL_E High Basic Process Redundant Universal LCPU performance Structured ladder/FBD MUL_E (EN, s1, s2 ... s28, d); ENO:= MUL_E The following function(s) can go in the dotted squares. MUL_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1 to s28(_IN) Input...
  • Page 131 Rounding error may occur when specifying single-precision real or double-precision real type data to (s1) through (s28) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d).
  • Page 132: Subtraction

    Subtraction SUB_E High Basic Process Redundant Universal LCPU performance Structured ladder/FBD SUB_E ENO:= (EN, s1, s2, d); SUB_E The following function(s) can go in the dotted squares. SUB_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_IN1) Input...
  • Page 133 • Rounding error may occur when specifying single-precision real or double-precision real type data to (s1), (s2) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d).
  • Page 134: Division

    • Rounding error may occur when specifying single-precision real or double-precision real type data to (s1), (s2) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.3 Standard Arithmetic Functions...
  • Page 135 ■Operation result • Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE (No operation error) Operation output value FALSE (Operation stop)
  • Page 136: Remainder

    Remainder MOD(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD MOD_E ENO:= (EN, s1, s2, d); MOD_E The following function(s) can go in the dotted squares. MOD, MOD_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_IN1) Input...
  • Page 137 Operation error • An operation error occurs in the following case. Error Description Q00J/ QnPH QnPRH LCPU code Q00/       4100 The value to be input to (s2) is 0. (Division by 0) Program example ■MOD(_E) The program which performs division ((s1) ...
  • Page 138: Exponentiation

    • Rounding error may occur when specifying single-precision real or double-precision real type data to (s1), (s2) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d).
  • Page 139 Double-precision real type LOGD • For details of an error which occurs when the function is executed, refer to the following.  MELSEC-Q/L Structured Programming Manual (Common Instructions) Program example ■EXPT(_E) The program which performs exponentiation and outputs the operation result from (d) in the same data type as that of (s1) and (s2).
  • Page 140: Move Operation

    Move operation MOVE(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD MOVE_E ENO:= (EN, s, d); MOVE_E The following function(s) can go in the dotted squares. MOVE, MOVE_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s(_IN) Input...
  • Page 141 • Rounding error may occur when specifying single-precision real or double-precision real type data to (s) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d).
  • Page 142: Standard Bitwise Boolean Functions

    Standard Bitwise Boolean Functions Boolean AND, boolean OR, boolean exclusive OR, and boolean AND_E, OR_E, XOR_E, NOT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD AND_E (EN, s1, s2 ... s28, d); ENO:= AND_E The following function(s) can go in the dotted squares. AND_E, OR_E, XOR_E, NOT, NOT_E ■Argument Input/output...
  • Page 143 • OR_E Performs Boolean OR on bit, word (unsigned)/16-bit string or double word (unsigned)/32-bit string type data input to (s1) to (s28) bit by bit, and outputs the operation result from (d) in the same data type as that of (s1) to (s28). Word (unsigned)/16-bit string type data Boolean OR The number of pins of variable 's' can be changed in the range from 2 to 28.
  • Page 144 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 145 ■NOT(_E) The program which performs Boolean NOT on bit, word (unsigned)/16-bit string type data input to (s1) bit by bit, and outputs the operation result from (d) in the same data type as that of (s1). • Function without EN/ENO (NOT) [Structured ladder/FBD] [ST] g_word2 := NOT(g_word1);...
  • Page 146: Standard Selection Functions

    • Rounding error may occur when specifying single-precision real or double-precision real type data to (s2), (s3) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.5 Standard Selection Functions...
  • Page 147 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 148: Maximum/Minimum Selection

    Maximum/Minimum selection MAXIMUM(_E), MINIMUM(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD MAXIMUM_E ENO:= (EN, s1, s2 s28, d); MAXIMUM_E The following function(s) can go in the dotted squares. MAXIMUM, MAXIMUM_E, MINIMUM, MINIMUM_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE:...
  • Page 149 For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) • The number of pins of (s) can be changed in the range from 2 to 28.
  • Page 150: Upper/Lower Limit Control

    Upper/Lower limit control LIMITATION(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD LIMITATION_E ENO:= (EN, s1, s2, s3, d); LIMITATION_E The following function(s) can go in the dotted squares. LIMITATION, LIMITATION_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_MN)
  • Page 151 For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) • If word (unsigned) type/16-bit string type/double word (unsigned) type/32-bit string type is specified for (d), warning C9026 occurs at compilation.
  • Page 152: Multiplexer

    For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) • The number of pins of (s) can be changed in the range from 2 to 28.
  • Page 153 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 154: Standard Comparison Functions

    Standard Comparison Functions Comparison GT_E, GE_E, EQ_E, LE_E, LT_E, NE_E High Basic Process LCPU Redundant Universal performance Structured ladder/FBD GT_E Not supported The following function(s) can go in the dotted squares. GT_E, GE_E, EQ_E, LE_E, LT_E, NE_E ■Argument Input/output Name Description Data type argument...
  • Page 155 For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) • The number of pins of (s) can be changed in the range from 2 to 28. (The number of pins of (s) for comparison operator NE(_E)) is fixed at (s1) and (s2).
  • Page 156: Standard Character String Functions

    Standard Character String Functions Extract mid string MID(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD MID_E ENO:= (EN, s, n1, n2, d); MID_E The following function(s) can go in the dotted squares. MID, MID_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 157 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 158: String Concatenation

    String concatenation CONCAT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CONCAT_E ENO:= (EN, s1, s2 n28, d); CONCAT_E The following function(s) can go in the dotted squares. CONCAT, CONCAT_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1 to s28(_IN)
  • Page 159 Operation error • No operation error occurs. Program example ■CONCAT(_E) The program which concatenates the character string input to (s2) following the one input to (s1), and outputs the operation result from (d). • Function without EN/ENO (CONCAT) [Structured ladder/FBD] [ST] g_string3 := CONCAT(g_string1, g_string2);...
  • Page 160: String Insertion

    String insertion INSERT(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD INSERT_E ENO:= (EN, s1, s2, n, d); INSERT_E The following function(s) can go in the dotted squares. INSERT, INSERT_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_IN1)
  • Page 161 • The values to be input to (s1) and (s2) are string type data within the range from 0 to 255 bytes. • The value to be input to n is word (signed) type data within the range from 1 to 255. (The input value must not exceed the number of characters of character string input to input variable (s1).) ■Operation result •...
  • Page 162: String Deletion

    String deletion DELETE(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD DELETE_E ENO:= (EN, s, n1, n2, d); DELETE_E The following function(s) can go in the dotted squares. DELETE, DELETE_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s(_IN)
  • Page 163 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 164: String Replacement

    String replacement REPLACE(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD REPLACE_E ENO:= (EN, s1, s2, n1, n2, d); REPLACE_E The following function(s) can go in the dotted squares. REPLACE, REPLACE_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_IN1)
  • Page 165 Processing details ■Operation processing • Replaces the specified number of characters from the specified position in the character string input to (s1) with the character string input to (s2), and outputs the operation result from (d). The number of characters to be replaced is specified by the value input to n1. The start position to be replaced in the character string is specified by the value input to n2.
  • Page 166 Program example ■REPLACE(_E) The program which replaces the specified number of characters from the specified position in the character string input to (s1) with the character string input to (s2), and outputs the operation result from (d). • Function without EN/ENO (REPLACE) [Structured ladder/FBD] [ST] g_string3 := REPLACE(g_string1, g_string2, g_int1, g_int2);...
  • Page 167: 5.8 Functions Of Time Data Type

    Functions of Time Data Type Addition ADD_TIME(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD ADD_TIME_E ENO:= ADD_TIME_E (EN, s1, s2, d); The following function(s) can go in the dotted squares. ADD_TIME, ADD_TIME_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE:...
  • Page 168 Underflow T#-24d20h31m23s648ms T#-2ms T#24d20h31m23s646ms (80000000 (FFFFFFFE (7FFFFFFE Since the highest-order bit is 0, the result value is positive. ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results.
  • Page 169: Subtraction

    Subtraction SUB_TIME(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD SUB_TIME_E ENO:= SUB_TIME_E (EN, s1, s2, d); The following function(s) can go in the dotted squares. SUB_TIME, SUB_TIME_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(_IN1) Input...
  • Page 170 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 171: Multiplication

    For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) No operation error occurs even if an underflow/overflow occurs. Data is output from (d) as follows. In case of MUL_TIME_E, TRUE is output from ENO.
  • Page 172 Underflow T#-24d20h31m23s648ms T#0ms (80000000 (00000002 (00000000 Since the highest-order bit is 0, the result value is positive. ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value...
  • Page 173: Division

    • Rounding error may occur when specifying single-precision real or double-precision real type data to (s2) by programming tool. For precautions when setting an input value using a programming tool, refer to the following.  MELSEC-Q/L/F Structured Programming Manual (Fundamentals) 5 APPLICATION FUNCTIONS 5.8 Functions of Time Data Type...
  • Page 174 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d). • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Undefined value *1 When FALSE is output from ENO, the data output from (d) is undefined.
  • Page 175: Standard Bistable Function Blocks

    Standard Bistable Function Blocks Standard bistable function blocks (Set-dominant) SR(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD SR_E SR_E (EN, s1, s2, ENO, d); The following function(s) can go in the dotted squares. SR, SR_E ■Argument Input/output Name Description Data type argument...
  • Page 176 • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] Sets when EN = ON and = ON. Resets when EN = ON, = OFF and = ON.
  • Page 177: Standard Bistable Function Blocks (Reset-Dominant)

    Standard bistable function blocks (Reset-dominant) RS(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD RS_E RS_E (EN, s1, s2, ENO, d); The following function(s) can go in the dotted squares. RS, RS_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop)
  • Page 178 • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] Turns ON when EN = ON, Turns OFF when EN = ON and = ON.
  • Page 179: Standard Edge Detection Function Blocks

    5.10 Standard Edge Detection Function Blocks Rising edge detector R_TRIG(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD R_TRIG_E (EN, s, ENO, d); R_TRIG_E The following function(s) can go in the dotted squares. R_TRIG, R_TRIG_E ■Argument Input/output Name Description Data type argument Input argument...
  • Page 180 • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] Turns ON when Turns OFF at the next scan. When EN = OFF, retains the previous scan output result.
  • Page 181: Falling Edge Detector

    Falling edge detector F_TRIG(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD F_TRIG_E (EN, s, ENO, d); F_TRIG_E The following function(s) can go in the dotted squares. F_TRIG, F_TRIG_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s(_CLK) Input...
  • Page 182 • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] Turns ON when EN = ON Turns OFF at When EN = OFF, retains the previous scan output result.
  • Page 183: 5.11 Standard Counter Function Blocks

    5.11 Standard Counter Function Blocks Up counter CTU(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CTU_E ENO:= (EN, s1, s2, n, d1, d2); CTU_E The following function(s) can go in the dotted squares. CTU, CTU_E ■Argument Input/output Name Description Data type argument...
  • Page 184 • Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] Turns ON when EN = ON and = ON. Clears 0 when = ON.
  • Page 185: Down Counter

    Down counter CTD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CTD_E (EN, s1, s2, n, ENO, d1, d2); CTD_E The following function(s) can go in the dotted squares. CTD, CTD_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE: Stop) s1(CD)
  • Page 186 • Function with EN/ENO The following table shows the executing conditions and operation results. (d1), (d2) TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] When n=3 Initializes when EN = ON Counts down when EN = ON and the falling of = ON.
  • Page 187: Up/Down Counter

    Up/Down counter CTUD(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD CTUD_E (EN, s1, s2, s3, s4, n, CTUD_E ENO, d1, d2, d3); The following function(s) can go in the dotted squares. CTUD, CTUD_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE:...
  • Page 188 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d1), (d2), and (D3). [Timing chart] When n=3 Counts up when Initializes when Counts down when Initializes when is turned from turned from OFF to ON. is turned from OFF to ON.
  • Page 189 • Function with EN/ENO The following table shows the executing conditions and operation results. (d1), (d2), (d3) TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) FALSE Previous output value [Timing chart] When n=3 Counts up when EN = ON Clears 0 when Counts...
  • Page 190 Operation error • No operation error occurs. Program example ■CTUD(_E) The program which counts the number of times that bit type data input to (s1) is turned from OFF to ON, and turns ON (d1) when the value of (D3) reaches the value set at (n). Simultaneously, it counts the number of times that bit type data input to (s2) is turned from OFF to ON, and turns ON (d2) when the value of (D3) reaches 0.
  • Page 191: Counter Function Blocks

    Counter function blocks COUNTER_FB_M High Basic Process LCPU Redundant Universal performance Structured ladder/FBD COUNTER_FB_M (s1, s2, s3, d1, d2) COUNTER_FB_M The following function(s) can go in the dotted squares. COUNTER_FB_M ■Argument Input/output Name Description Data type argument Input argument s1(Coil) Executing condition (TRUE: Execution, FALSE: Stop) s2(Preset)
  • Page 192 Operation error • No operation error occurs. Program example ■COUNTER_FB_M The program which counts the number of times that bit type data input to (s1) is turned from OFF to ON, and outputs the count value from (d1). [Structured ladder/FBD] [ST] COUNTER_FB_M_Inst(Coil:=Var_M0, Preset:=10, ValueIn:=0, ValueOut:=Var_D10, Status:=Var_M10);...
  • Page 193: 5.12 Standard Timer Function Blocks

    5.12 Standard Timer Function Blocks Pulse timer TP(_E), TP_HIGH(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TP_HIGH_E ENO:= (EN, s, n, d1, d2); TP_HIGH_E The following function(s) can go in the dotted squares. TP, TP_E, TP_HIGH, TP_HIGH_E ■Argument Input/output Name Description...
  • Page 194 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d1) and (d2). [Timing chart] When n = T#5s (5 seconds) Turns ON when = ON. Turns OFF when Initializes when = OFF and = OFF.
  • Page 195 Program example ■TP(_E) The program which turns ON bit type data of (d1) for 10 seconds after bit type data input to (s) is turned ON. • Function without EN/ENO (TP) [Structured ladder/FBD] [ST] TP_Inst(IN:=g_bool1, PT:=T#10s, Q:=g_bool2, ET:=g_time1); • Function with EN/ENO (TP_E) [Structured ladder/FBD] [ST] TP_E_Inst(EN:=M0, IN:=g_bool1, PT:=T#10s, Q:=g_bool2, ET:=g_time1, ENO:=M10);...
  • Page 196: On Delay Timer

    On delay timer TON(_E), TON_HIGH(_E) High Basic Process Redundant Universal LCPU performance Structured ladder/FBD TON_HIGH_E ENO:= (EN, s, n, d1, d2); TON_HIGH_E The following function(s) can go in the dotted squares. TON, TON_E, TON_HIGH, TON_HIGH_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE:...
  • Page 197 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d1) and (d2). [Timing chart] When n = T#5s (5 seconds) Starts measuring when = ON. Turns ON when Resets at the falling of reaches the time set to n .
  • Page 198 Operation error • No operation error occurs. Program example ■TON(_E) The program which turns ON bit type data of (d1) 10 seconds after bit type data input to (s) is turned ON. • Function without EN/ENO (TON) [Structured ladder/FBD] [ST] TON_Inst(IN:=g_bool1, PT:=T#10s, Q:=g_bool2, ET:=g_time1);...
  • Page 199: Off Delay Timer

    Off delay timer TOF(_E), TOF_HIGH(_E) High Basic Process LCPU Redundant Universal performance Structured ladder/FBD TOF_HIGH_E ENO:= (EN, s, n, d1, d2); TOF_HIGH_E The following function(s) can go in the dotted squares. TOF, TOF_E, TOF_HIGH, TOF_HIGH_E ■Argument Input/output Name Description Data type argument Input argument Executing condition (TRUE: Execution, FALSE:...
  • Page 200 ■Operation result • Function without EN/ENO An operation is executed and the operation value is output from (d1) and (d2). [Timing chart] When n = T#5s (5 seconds) Starts measuring Turns OFF when reaches Resets when = ON. when = OFF. the time set to n .
  • Page 201 Operation error • No operation error occurs. Program example ■TOF(_E) The program which turns ON bit type data of (d1) when bit type data input to (s) is turned ON, and turns (d1) OFF 10 seconds after (s) is turned OFF. •...
  • Page 202: Timer Function Blocks

    Timer function blocks TIMER__M High Basic Process Redundant Universal LCPU performance Structured ladder/FBD TIMER_10_FB_M (s1, s2, s3, d1, d2) TIMER_10_FB_M The following function(s) can go in the dotted squares. TIMER_10_FB_M, TIMER_100_FB_M, TIMER_HIGH_FB_M, TIMER_LOW_FB_M, TIMER_CONT_FB_M, TIMER_CONTHFB_M ■Argument Input/output Name Description Data type argument Input argument s1(Coil)
  • Page 203 [TIMER_HIGH_FB_M] • The high-speed timer with the unit of measurement from 0.1 to 100ms. Starts measuring the current value when the executing condition of (s1) turns ON. Starts measuring from the value input to (s3)  0.1 to 100ms, and when the measuring value reaches to the value input to (s2) ...
  • Page 204 Operation error • No operation error occurs. Program example ■TIMER_10_FB_M The program which starts measuring from (s3)  10ms when the executing condition of (s1) turns ON, and when the measuring value reaches to the value input to (s2)  10ms, (d2) turns ON. [Structured ladder/FBD] [ST] TIMER_10_FB_M_Inst(Coil:=Var_M0, Preset:=10, ValueIn:=1, ValueOut:=Var_D10, Status:=Var_M10);...
  • Page 205 ■TIMER_LOW_FB_M The program which starts measuring from (s3)  10ms when the executing condition of (s1) turns ON, and when the measuring value reaches to the value input to (s2)  100ms, (d2) turns ON. [Structured ladder/FBD] [ST] TIMER_LOW_FB_M_Inst(Coil:=Var_M0, Preset:=10, ValueIn:=1, ValueOut:=Var_D10, Status:=Var_M10); [Timing chart] Var_M0 Value of Var_D10...
  • Page 206: Chapter 6 Operator

    OPERATOR Arithmetic Operations Addition ADD, + High Basic Process LCPU Redundant Universal performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. Structured ladder/FBD Not supported d:=s1 s28; The following operator(s) can go in the dotted squares. ■Argument Input/output Name...
  • Page 207 Program example ■ADD, + The program which performs addition ((s1) + (s2)) on double word (signed) type data input to (s1) and (s2), and outputs the operation result from (d) in the same data type as that of (s1) and (s2). [Structured ladder/FBD] [ST] g_dint3:=(g_dint1)+(g_dint2);...
  • Page 208: Multiplication

    Multiplication MUL, * High Basic Process Redundant Universal LCPU performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. Structured ladder/FBD Not supported d:=s1 s28; The following operator(s) can go in the dotted squares. ■Argument Input/output Name Description Data type...
  • Page 209: Subtraction

    Subtraction SUB, - High Basic Process LCPU Redundant Universal performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. Structured ladder/FBD Not supported d:=s1 The following operator(s) can go in the dotted squares. ■Argument Input/output Name Description Data type argument...
  • Page 210: Division

    Division DIV, / High Basic Process Redundant Universal LCPU performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. Structured ladder/FBD Not supported d:=s1 The following operator(s) can go in the dotted squares. ■Argument Input/output Name Description Data type argument...
  • Page 211 Program example ■DIV, / The program which performs division ((s1)  (s2)) on double word (signed) type data input to (s1) and (s2), and outputs the quotient of the operation result from (d) in the same data type as that of (s1) and (s2). [Structured ladder/FBD] [ST] g_dint3:=(g_dint1)/(g_dint2);...
  • Page 212: Remainder

    Remainder High Basic Process Redundant Universal LCPU performance Structured ladder/FBD Not supported d:=s1 The following operator(s) can go in the dotted squares. ■Argument Input/output Name Description Data type argument Input argument Input ANY_INT Output argument Output ANY_INT Processing details ■Operation processing For details of the operation processing, refer to the following.
  • Page 213: Exponentiation

    Double-precision real type LOGD • For details of an error which occurs when the operator is executed, refer to the following.  MELSEC-Q/L Structured Programming Manual (Common Instructions) Program example ■** The program which performs exponentiation and outputs the operation result from (d) in the same data type as that of (s1) and (s2).
  • Page 214: Logical Operations

    Logical Operations Boolean AND, boolean OR, boolean exclusive OR, and boolean AND, &, OR, XOR, NOT High Basic Process LCPU Redundant Universal performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. AND, OR, XOR Structured ladder/FBD Not supported d:=s1 s28,d);...
  • Page 215 Program example ■AND, & The program which performs Boolean AND on bit, word (unsigned)/16-bit string type data input to (s1) and (s2) bit by bit, and outputs the operation result from (d) in the same data type as that of (s1) and (s2). [Structured ladder/FBD] [ST] g_word3:= (g_word1) AND (g_word2);...
  • Page 216: Comparison Operations

    Comparison Operations Comparison GT, GE, EQ, LE, LT, NE, >, >=, =, <=, <, <> High Basic Process LCPU Redundant Universal performance Structured ladder/FBD Not supported The following operator(s) can go in the dotted squares. GT, GE, EQ, LE, LT, NE Structured ladder/FBD Not supported d:=s1...
  • Page 217 MEMO 6 OPERATOR 6.3 Comparison Operations...
  • Page 218: Index

    INDEX ... .16 Standard arithmetic functions table ..17 Standard bistable function blocks table ..... . . 9 Application function .
  • Page 219 MEMO...
  • Page 220: Instruction Index

    INSTRUCTION INDEX .......132 Symbols DIV_E ......171 DIV_TIME(_E) .
  • Page 221 ......134 MOD(_E) ......138 MOVE(_E) .
  • Page 222: Revisions

    Japanese manual version SH-080737-P 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 223: Warranty

    WARRANTY Please confirm the following product warranty details before using this product. 1. Gratis Warranty Term and Gratis Warranty Range If any faults or defects (hereinafter "Failure") found to be the responsibility of Mitsubishi occurs during use of the product within the gratis warranty term, the product shall be repaired at no cost via the sales representative or Mitsubishi Service Company.
  • Page 224: Trademarks

    TRADEMARKS Ethernet is a registered trademark of Fuji Xerox Co., Ltd. in Japan. 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.
  • Page 226 SH(NA)-080784ENG-L(1701)KWIX MODEL: Q-KP-OK-E MODEL CODE: 13JW08 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.

Table of Contents