SAFETY PRECAUTIONS (Always read these instructions before using this product.) Before using the MELSEC-Q series programmable controller, thoroughly read the manuals attached to the products and the relevant manuals introduced in the attached manuals. Also pay careful attention to safety and handle the products properly.
This manual confers no industrial property rights or any 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.
INTRODUCTION Thank you for purchasing the Mitsubishi MELSEC-Q series programmable controller. Before using the product, thoroughly read this manual to develop full familiarity with the programming specifications to ensure correct use. Please forward this manual to the end user. CONTENTS SAFETY PRECAUTIONS ..........................A - 1...
Page 6
3.7.1 Precautions on assigning a name....................3 - 10 4. HOW TO READ FUNCTIONS 4 - 1 to 4 - 4 5. APPLICATION FUNCTIONS 5 - 1 to 5 - 218 5.1 Type Conversion Functions 5 - 2 5.1.1 Bit type → word (signed), double word (signed) type conversion..........5 - 2 5.1.2 Bit type →...
MANUALS Related manuals The manuals related to this product are shown below. Refer to the following tables when ordering required manuals. (1) Structured programming Manual number Manual name (Model code) QCPU Structured Programming Manual (Fundamentals) Explains the programming method, types of programming languages, and other information required to create structured SH-080782ENG programs.
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 list of 'Related manuals'.
Page 11
(2) Programming User's Manual for intelligent function QCPU(Q mode)/QnACPU QCPU Structured Programming Manual module/ Programming Manual Reference Manual for network module Purpose Common Special Application Common PID Control − Fundamentals Instructions Instructions Functions Instructions Instructions Learning the types and details of common instructions, descriptions of...
Generic Terms and Abbreviations in This Manual 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. Generic term and Description abbreviation GX Works2...
How to Read Function Tables Function name Argument Processing details Page ,... ADD(_E) 5-139 Outputs the sum ( +···+ ) of input values. (Number of pins variable) ,... 5-142 MUL(_E) Outputs the product ( ··· ) of input values. (Number of pins variable) SUB(_E) 5-145...
2.1.1 Type conversion functions Function name Argument Processing details Page BOOL_TO_INT(_E) Converts bit type data into word (signed) or double word (signed) type data. BOOL_TO_DINT(_E) BOOL_TO_STR(_E) Converts bit type data into string type data. BOOL_TO_WORD(_E) Converts bit type data into word (unsigned)/16-bit string or double BOOL_TO_DWORD(_E) word (unsigned)/32-bit string type date.
Function name Argument Processing details Page 5-92 STR_TO_WORD(_E) Converts string type data into word (unsigned)/16-bit string or double word (unsigned)/32-bit string type data. 5-92 STR_TO_DWORD(_E) 5-95 STR_TO_TIME(_E) Converts string type data into time type data. 5-98 STR_TO_BCD(_E) Converts string type data into BCD type data. BCD_TO_INT(_E) 5-101 Converts BCD type data into word (signed) or double word (signed)
2.1.5 Standard selection functions Function name Argument Processing details Page SEL(_E) Outputs the value selected from the input values. 5-148 ,... 5-151 MUX(_E) Outputs one of the multiple input values. (Number of pins variable) 2.1.6 Standard comparison functions Function name Argument Processing details Page...
2.1.10 Standard edge detection function blocks Function name Argument Processing details Page RTRIG(_E) Detects the rising edge of a signal and outputs pulse signals. 5-190 F_TRIG(_E) Detects the falling edge of a signal and outputs pulse signals. 5-192 2.1.11 Standard counter function blocks Function name Argument Processing details...
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 the number of input pins change operation GX Works2 Version1 Operating Manual (Structured Project) Adding a pin Deleting a pin...
Functions with EN The function has two types: ordinary functions and functions with EN that have EN/ENO pins. Functions with EN allow control of function execution. EN inputs the condition for executing a function. ENO outputs execution status. The following table shows the status of EN and ENO and the operation result according to the status of EN.
Labels Labels include global labels and local labels. 3.3.1 Global labels The global labels are labels that can be used in program blocks and function blocks. In the setting of a global label, a label name, a class, a data type, and a device are associated with each other.
3.3.4 Setting labels Labels used in a program require setting of either global label or local label. The following describes setting examples of the arguments g_bool1 and g_int1 of the BOOL_TO_INT_E function. ● Using the arguments of the BOOL_TO_INT_E function as global labels Set the Class, Label Name, Data Type, Device, and Address.
Data Types Data types of labels include the elementary data types and the generic data types. Generic data type is the data type of labels covering some elementary data types. The data type name starts with 'ANY'. The following shows the list of elementary data types and generic data types. Table 3.4-1 Elementary data types Data type Description...
Page 25
Generic data types ANY_SIMPLE Array Structure ANY_NUM ANY_BIT Time String Word (unsigned)/ ANY_REAL ANY_INT 16-bit string Word Single-precision Double word (signed) real (unsigned)/ The higher 'ANY' data types include sub-level data types. 32-bit string Double-precision Double word The highest 'ANY' data type includes all data types. real (signed) ANY16...
Device and Address This section explains the method for expressing programmable controller CPU devices. The following two types of format are available. • Device: This format consists of a device name and a device number. • Address: A format defined in IEC61131-3. In this format, a device name starts with %. 3.5.1 Device Device is a format that uses a device name and a device number.
Page 27
● Data size Data size is a class indicating the size of data. The following shows the format rules corresponding to the device format. • Bit device : X (bit) • Word device : W (word), D (double word), L (long word) ●...
Expressing Methods of Constants The following table shows the expressing method for setting a constant to a label. Table 3.6-1 Constant expressing method Constant Expressing method Example type Bool Input FALSE or TRUE, or input 0 or 1. TRUE, FALSE Binary Append '2#' in front of a binary number.
Page 29
(8) An elementary data type name cannot be used. (9) Part names of function/FB cannot be used. Reserved words list Table 3.7-1 Reserved words (1/2) Category Character string VAR, VAR_RETAIN, VAR_ACCESS, VAR_CONSTANT, VAR_CONSTANT_RETAIN, VAR_INPUT, VAR_INPUT_RETAIN, VAR_OUTPUT, VAR_OUTPUT_RETAIN, VAR_IN_OUT, VAR_IN_EXT, VAR_EXTERNAL, VAR_EXTERNAL_CONSTANT, Class identifier VAR_EXTERNAL_CONSTANT_RETAIN, VAR_EXTERNAL_RETAIN, VAR_GLOBAL, VAR_GLOBAL_CONSTANT, VAR_GLOBAL_CONSTANT_RETAIN, VAR_GLOBAL_RETAIN...
Page 30
Table 3.7-2 Reserved words (2/2) Category Character string Standard function block Function block names in application functions such as CTD, CTU name Symbol ", %, ', ~, ^, ¦, @, [, ] , {, }, ;, :, , , ., ?, \, !, #, $, ', _, *, /, +, <, >, =, &, (, ), - Date and time literal DATE, DATE_AND_TIME, DT, TIME, TIME_OF_DAY, TOD ACTION, END_ACTION, CONFIGURATION, END_CONFIGURATION, CONSTANT, F_EDGE, R_EDGE, AT, PROGRAM,...
Page 32
Chapter 5 provides detailed explanation on each function in the layout as shown below. Indicates a section number and an outline of a function. Indicates a function to be explained.
Page 33
Indicates the CPU modules that can use the function. Icon Description Universal model High Performance model QCPU QCPU High The normal icon indicates that the CPU module can use the Universal Performance corresponding functions. The icon with symbol indicates that the CPU module can use the High Performance Universal...
Page 34
Generic data Description type Can use all elementary data types. Can use elementary data type of single-precision real, double-precision real, word (signed), and double ANY_NUM word (signed). ANY_REAL Can use elementary data type of single-precision real and double-precision real. ANY_INT Can use elementary data type of word (signed) and double word (signed).
BOOL_TO_INT(_E), BOOL_TO_DINT(_E) Type Conversion Functions 5.1.1 Bit type → word (signed), double word (signed) type conversion BOOL_TO_INT(_E), BOOL_TO_DINT(_E) High Performance Universal BOOL_TO_INT(_E) _E: With EN/ENO BOOL_TO_DINT(_E) indicates any of the following functions. Structured ladder BOOL_TO_INT BOOL_TO_INT_E BOOL_TO_INT_E BOOL_TO_DINT BOOL_TO_DINT_E ENO:= (EN, s, d);...
Page 37
BOOL_TO_INT(_E), BOOL_TO_DINT(_E) (2) BOOL_TO_DINT, BOOL_TO_DINT_E Converts bit type data input to into double word (signed) type data, and outputs the operation result from When the input value is FALSE, 0 is output in double word (signed) type data. When the input value is TRUE, 1 is output in double word (signed) type data. FALSE TRUE Bit type...
BOOL_TO_INT(_E), BOOL_TO_DINT(_E) Operation Error No operation error occurs in the execution of the BOOL_TO_INT(_E) and BOOL_TO_DINT(_E) functions. Program Example (1) The program which converts bit type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (BOOL_TO_INT) [Structured ladder] [ST]...
BOOL_TO_STR(_E) 5.1.2 Bit type → string type conversion BOOL_TO_STR(_E) High Performance Universal BOOL_TO_STR(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder BOOL_TO_STR BOOL_TO_STR_E BOOL_TO_STR_E ENO:= (EN, s, d); BOOL_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 40
BOOL_TO_STR(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
BOOL_TO_WORD(_E), BOOL_TO_DWORD(_E) 5.1.3 Bit type → word (unsigned)/16-bit string, double word (unsigned)/32-bit string type conversion BOOL_TO_WORD(_E), BOOL_TO_DWORD(_E) High Performance Universal BOOL_TO_WORD(_E) _E: With EN/ENO BOOL_TO_DWORD(_E) indicates any of the following functions. Structured ladder BOOL_TO_WORD BOOL_TO_WORD_E BOOL_TO_DWORD BOOL_TO_DWORD_E ENO:= (EN, s, d); BOOL_TO_DWORD_E BOOL_TO_DWORD_E Input argument,...
Page 42
BOOL_TO_WORD(_E), BOOL_TO_DWORD(_E) (2) BOOL_TO_DWORD, BOOL_TO_DWORD_E Converts bit type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from When the input value is FALSE, 0 is output in double word (unsigned)/32-bit string type data. When the input value is TRUE, 1 is output in double word (unsigned)/32-bit string type data.
Page 43
BOOL_TO_WORD(_E), BOOL_TO_DWORD(_E) Operation Error No operation error occurs in the execution of the BOOL_TO_WORD(_E) and BOOL_TO_DWORD(_E) functions. Program Example (1) The program which converts bit type data input to into word (unsigned)/16-bit string type data, and outputs the operation result from (a) Function without EN/ENO (BOOL_TO_WORD) [Structured ladder] [ST]...
BOOL_TO_TIME(_E) 5.1.4 Bit type → time type conversion BOOL_TO_TIME(_E) High Performance Universal BOOL_TO_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder BOOL_TO_TIME BOOL_TO_TIME_E BOOL_TO_TIME_E ENO:= (EN, s, d); BOOL_TO_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 45
BOOL_TO_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 46
BOOL_TO_TIME(_E) Operation Error No operation error occurs in the execution of the BOOL_TO_TIME(_E) function. Program Example The program which converts bit type data input to into time type data, and outputs the operation result from (a) Function without EN/ENO (BOOL_TO_TIME) [Structured ladder] [ST] g_time1 := BOOL_TO_TIME (g_bool1);...
INT_TO_DINT(_E) 5.1.5 Word (signed) type → double word (signed) type conversion INT_TO_DINT(_E) High Performance Universal INT_TO_DINT(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder INT_TO_DINT INT_TO_DINT_E INT_TO_DINT_E ENO:= (EN, s, d); INT_TO_DINT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Word (signed)
Page 48
INT_TO_DINT(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 49
INT_TO_DINT(_E) Operation Error No operation error occurs in the execution of the INT_TO_DINT(_E) function. Program Example The program which converts word (signed) type data input to into double word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_DINT) [Structured ladder] [ST] g_dint1 := INT_TO_DINT (g_int1);...
DINT_TO_INT(_E) 5.1.6 Double word (signed) type → word (signed) type conversion DINT_TO_INT(_E) High Performance Universal DINT_TO_INT(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder DINT_TO_INT DINT_TO_INT_E DINT_TO_INT_E ENO:= (EN, s, d); DINT_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Double word (signed)
Page 51
DINT_TO_INT(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 52
DINT_TO_INT(_E) Operation Error No operation error occurs in the execution of the DINT_TO_INT(_E) function. Program Example The program which converts double word (signed) type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (DINT_TO_INT) [Structured ladder] [ST] g_int1 := DINT_TO_INT(g_dint1);...
INT_TO_BOOL(_E), DINT_TO_BOOL(_E) 5.1.7 Word (signed), double word (signed) type → bit type conversion INT_TO_BOOL(_E), DINT_TO_BOOL(_E) High Performance Universal INT_TO_BOOL(_E) _E: With EN/ENO DINT_TO_BOOL(_E) indicates any of the following functions. Structured ladder INT_TO_BOOL INT_TO_BOOL_E INT_TO_BOOL_E DINT_TO_BOOL DINT_TO_BOOL_E ENO:= (EN, s, d); INT_TO_BOOL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 54
INT_TO_BOOL(_E), DINT_TO_BOOL(_E) (2) DINT_TO_BOOL, DINT_TO_BOOL_E Converts double word (signed) type data input to into bit type data, and outputs the operation result from When the input value is 0, FALSE is output in bit type data. When the input value is other than 0, TRUE is output in bit type data. FALSE 12345678 TRUE...
Page 55
INT_TO_BOOL(_E), DINT_TO_BOOL(_E) Operation Error No operation error occurs in the execution of the INT_TO_BOOL(_E) and DINT_TO_BOOL(_E) functions. Program Example (1) The program which converts word (signed) type data input to into bit type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_BOOL) [Structured ladder] [ST]...
Page 56
INT_TO_BOOL(_E), DINT_TO_BOOL(_E) (2) The program which converts double word (signed) type data input to into bit type data, and outputs the operation result from (a) Function without EN/ENO (DINT_TO_BOOL) [Structured ladder] [ST] g_bool1 := DINT_TO_BOOL(g_dint1); 5.1 Type Conversion Functions 5-22 →...
INT_TO_REAL(_E), DINT_TO_REAL(_E) 5.1.8 Word (signed), double word (signed) type → single-precision real type conversion INT_TO_REAL(_E), DINT_TO_REAL(_E) High Performance Universal INT_TO_REAL(_E) _E: With EN/ENO DINT_TO_REAL(_E) indicates any of the following functions. Structured ladder INT_TO_REAL INT_TO_REAL_E DINT_TO_REAL DINT_TO_REAL_E INT_TO_REAL_E ENO:= (EN, s, d); INT_TO_REAL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 58
INT_TO_REAL(_E), DINT_TO_REAL(_E) (2) DINT_TO_REAL, DINT_TO_REAL_E (a) Converts double word (signed) type data input to into single-precision real type data, and outputs the operation result from 16543521 16543521.0 Double word (signed) type Single-precision real type (b) The number of significant figures of single-precision real type data is approximately 7 since the data is processed in 32-bit single precision.
Page 59
INT_TO_REAL(_E), DINT_TO_REAL(_E) Operation Error No operation error occurs in the execution of the INT_TO_REAL(_E) and DINT_TO_REAL(_E) functions. Program Example (1) The program which converts word (signed) type data input to into single-precision real type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_REAL) [Structured ladder] [ST]...
Page 60
INT_TO_LREAL(_E), DINT_TO_LREAL(_E) 5.1.9 Word (signed), double word (signed) type → double-precision real type conversion INT_TO_LREAL(_E), DINT_TO_LREAL(_E) Universal INT_TO_LREAL(_E) _E: With EN/ENO DINT_TO_LREAL(_E) indicates any of the following functions. Structured ladder INT_TO_LREAL INT_TO_LREAL_E INT_TO_LREAL_E DINT_TO_LREAL DINT_TO_LREAL_E ENO:= (EN, s, d); INT_TO_LREAL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit...
Page 61
INT_TO_LREAL(_E), DINT_TO_LREAL(_E) (2) DINT_TO_LREAL, DINT_TO_LREAL_E Converts double word (signed) type data input to into double-precision real type data, and outputs the operation result from 16543521 16543521.0 Double word (signed) type Double-precision real type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
INT_TO_LREAL(_E), DINT_TO_LREAL(_E) Operation Error No operation error occurs in the execution of the INT_TO_LREAL(_E) and DINT_TO_LREAL(_E) functions. Program Example (1) The program which converts word (signed) type data input to into double-precision real type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_LREAL) [Structured ladder] [ST]...
INT_TO_STR(_E), DINT_TO_STR(_E) 5.1.10 Word (signed), double word (signed) type → string type conversion INT_TO_STR(_E), DINT_TO_STR(_E) High Performance Universal INT_TO_STR(_E) _E: With EN/ENO DINT_TO_STR(_E) indicates any of the following functions. Structured ladder INT_TO_STR INT_TO_STR_E DINT_TO_STR DINT_TO_STR_E INT_TO_STR_E ENO:= (EN, s, d); INT_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 64
INT_TO_STR(_E), DINT_TO_STR(_E) (c) If the number of significant figures is less, '20 (space)' is stored to high-order digits. (Example) Inputting −123 High-order byte Low-order byte (space) String 1st word (space) 2nd word -123 ( 3 ) 3rd word Word (signed) type 4th word (d) '00 ' is automatically stored at the end of the character string (4th word).
Page 65
INT_TO_STR(_E), DINT_TO_STR(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE...
Page 66
INT_TO_STR(_E), DINT_TO_STR(_E) Operation Error No operation error occurs in the execution of the INT_TO_STR(_E) and DINT_TO_STR(_E) functions. Program Example (1) The program which converts word (signed) type data input to into string type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_STR) [Structured ladder] [ST]...
INT_TO_WORD(_E), DINT_TO_WORD(_E) 5.1.11 Word (signed), double word (signed) type → word (unsigned)/16-bit string type conversion INT_TO_WORD(_E), DINT_TO_WORD(_E) High Performance Universal INT_TO_WORD(_E) _E: With EN/ENO DINT_TO_WORD(_E) indicates any of the following functions. Structured ladder INT_TO_WORD INT_TO_WORD_E DINT_TO_WORD DINT_TO_WORD_E INT_TO_WORD_E ENO:= (EN, s, d); INT_TO_WORD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 68
INT_TO_WORD(_E), DINT_TO_WORD(_E) (2) DINT_TO_WORD, DINT_TO_WORD_E Converts double word (signed) type data input to into word (unsigned)/16-bit string type data, and outputs the operation result from 12345678 614E Double word (signed) type Word (unsigned)/16-bit string type 12345678 614E High-order 16-bit data is discarded. Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from...
Page 69
INT_TO_WORD(_E), DINT_TO_WORD(_E) Operation Error No operation error occurs in the execution of the INT_TO_WORD(_E) and DINT_TO_WORD(_E) functions. Program Example (1) The program which converts word (signed) type data input to into word (unsigned)/16-bit string type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_WORD) [Structured ladder] [ST]...
INT_TO_DWORD(_E), DINT_TO_DWORD(_E) 5.1.12 Word (signed), double word (signed) type → double word (unsigned)/32-bit string type conversion INT_TO_DWORD(_E), DINT_TO_DWORD(_E) High Performance Universal INT_TO_DWORD(_E) _E: With EN/ENO DINT_TO_DWORD(_E) indicates any of the following functions. Structured ladder INT_TO_DWORD INT_TO_DWORD_E DINT_TO_DWORD DINT_TO_DWORD_E INT_TO_DWORD_E ENO:= (EN, s, d);...
Page 71
INT_TO_DWORD(_E), DINT_TO_DWORD(_E) (2) DINT_TO_DWORD, DINT_TO_DWORD_E Converts double word (signed) type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from 12345678 BC614E Double word (signed) type Double word (unsigned)/32-bit string type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results...
Page 72
INT_TO_DWORD(_E), DINT_TO_DWORD(_E) Operation Error No operation error occurs in the execution of the INT_TO_DWORD(_E) and DINT_TO_DWORD(_E) functions. Program Example (1) The program which converts word (signed) type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_DWORD) [Structured ladder] [ST]...
INT_TO_BCD(_E), DINT_TO_BCD(_E) 5.1.13 Word (signed), double word (signed) type → BCD type conversion INT_TO_BCD(_E), DINT_TO_BCD(_E) High Performance Universal INT_TO_BCD(_E) _E: With EN/ENO DINT_TO_BCD(_E) indicates any of the following functions. Structured ladder INT_TO_BCD INT_TO_BCD_E DINT_TO_BCD DINT_TO_BCD_E INT_TO_BCD_E ENO:= (EN, s, d); INT_TO_BCD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 74
INT_TO_BCD(_E), DINT_TO_BCD(_E) (2) DINT_TO_BCD, DINT_TO_BCD_E (a) Converts double word (signed) type data input to into BCD type data, and outputs the operation result from 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 75
INT_TO_BCD(_E), DINT_TO_BCD(_E) Operation Error An operation error occurs when the value input exceeds 9999 or 99999999 respectively in the execution of the INT_TO_BCD(_E) or DINT_TO_BCD(_E) function. (Error code: 4100) Program Example (1) The program which converts word (signed) type data input to into BCD type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_BCD)
Page 76
INT_TO_TIME(_E), DINT_TO_TIME(_E) 5.1.14 Word (signed), double word (signed) type → time type conversion INT_TO_TIME(_E), DINT_TO_TIME(_E) High Performance Universal INT_TO_TIME(_E) _E: With EN/ENO DINT_TO_TIME(_E) indicates any of the following functions. Structured ladder INT_TO_TIME INT_TO_TIME_E DINT_TO_TIME DINT_TO_TIME_E INT_TO_TIME_E ENO:= (EN, s, d); INT_TO_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 77
INT_TO_TIME(_E), DINT_TO_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE...
INT_TO_TIME(_E), DINT_TO_TIME(_E) Operation Error No operation error occurs in the execution of the INT_TO_TIME(_E) and DINT_TO_TIME(_E) functions. Program Example (1) The program which converts word (signed) type data input to into time type data, and outputs the operation result from (a) Function without EN/ENO (INT_TO_TIME) [Structured ladder] [ST]...
REAL_TO_INT(_E), REAL_TO_DINT(_E) 5.1.15 Single-precision real type → word (signed), double word (signed) type conversion REAL_TO_INT(_E), REAL_TO_DINT(_E) High Performance Universal REAL_TO_INT(_E) _E: With EN/ENO REAL_TO_DINT(_E) indicates any of the following functions. Structured ladder REAL_TO_INT REAL_TO_INT_E REAL_TO_DINT REAL_TO_DINT_E REAL_TO_INT_E ENO:= (EN, s, d); REAL_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 80
REAL_TO_INT(_E), REAL_TO_DINT(_E) (2) REAL_TO_DINT, REAL_TO_DINT_E (a) Converts single-precision real type data input to into double word (signed) type data, and outputs the operation result from 16543521.0 16543521 Single -precision real type Double word (signed) type (b) The value to be input to is single-precision real type data within the range from −2147483648 to 2147483647.
Page 81
REAL_TO_INT(_E), REAL_TO_DINT(_E) Operation Error An operation error occurs in the following cases. • REAL_TO_INT(_E): The input value is outside the range of −32768 to 32767. (Error code: 4100) • REAL_TO_DINT(_E): The input value is outside the range of −2147483648 to 2147483647.
Page 82
LREAL_TO_INT(_E), LREAL_TO_DINT(_E) 5.1.16 Double-precision real type → word (signed), double word (signed) type conversion LREAL_TO_INT(_E), LREAL_TO_DINT(_E) Universal LREAL_TO_INT(_E) _E: With EN/ENO LREAL_TO_DINT(_E) indicates any of the following functions. Structured ladder LREAL_TO_INT LREAL_TO_INT_E LREAL_TO_DINT LREAL_TO_DINT_E LREAL_TO_INT_E ENO:= (EN, s, d); LREAL_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit...
Page 83
LREAL_TO_INT(_E), LREAL_TO_DINT(_E) (2) LREAL_TO_DINT, LREAL_TO_DINT_E (a) Converts double-precision real type data input to into double word (signed) type data, and outputs the operation result from 16543521.0 16543521 Double -precision real type Double word (signed) type (b) The value to be input to is double-precision real type data within the range from −2147483648 to 2147483647.
LREAL_TO_INT(_E), LREAL_TO_DINT(_E) Operation Error An operation error occurs in the following cases. • The input value is -0 or outside the following range. (Error code: 4140) -1022 1024 0, 2 • LREAL_TO_INT(_E): The input value is outside the range of -32768 to 32767. (Error code: 4140) •...
REAL_TO_LREAL(_E) 5.1.17 Single-precision real type → double-precision real type conversion REAL_TO_LREAL(_E) Universal REAL_TO_LREAL(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder REAL_TO_LREAL REAL_TO_LREAL_E REAL_TO_LREAL_E ENO:= (EN, s, d); REAL_TO_LREAL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Single-precision real...
Page 86
REAL_TO_LREAL(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 87
REAL_TO_LREAL(_E) Operation Error An operation error occurs in the following cases. • The input value is -0 or outside the following range. (Error code: 4140) -126 0, 2 • The operation result is outside the following range (an overflow occurrence). (Error code: 4141) 1024 | operation result |...
LREAL_TO_REAL(_E) 5.1.18 Double-precision real type → single-precision real type conversion LREAL_TO_REAL(_E) Universal LREAL_TO_REAL(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder LREAL_TO_REAL LREAL_TO_REAL_E LREAL_TO_REAL_E ENO:= (EN, s, d); LREAL_TO_REAL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Double-precision real...
Page 89
LREAL_TO_REAL(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 90
LREAL_TO_REAL(_E) Operation Error An operation error occurs in the following cases. • The input value is -0 or outside the following range. (Error code: 4140) -1022 1024 0, 2 • The operation result is outside the following range (an overflow occurrence). (Error code: 4141) | operation result | Program Example...
REAL_TO_STR(_E) 5.1.19 Single-precision real type → string type conversion REAL_TO_STR(_E) High Performance Universal REAL_TO_STR(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder REAL_TO_STR REAL_TO_STR_E REAL_TO_STR_E ENO:= (EN, s, d); REAL_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Single-precision real...
Page 92
REAL_TO_STR(_E) (2) The character string data after conversion is output from output variable in the following manner. (a) The number of digits is fixed respectively for the integral part, decimal part, and exponent part. (Integral part: 1 digit, decimal part: 5 digits, exponent part: 2 digits) ' (.) and '45 ' (E) are automatically stored in the 3rd and 9th bytes, respectively.
Page 93
REAL_TO_STR(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 94
REAL_TO_STR(_E) Operation Error An operation error occurs in the following case. −38 • The input value is outside the range of ±1.17549 to ±3.40282 (Error code: 4100) Program Example The program which converts single-precision real type data input to into string type (exponent form) data, and outputs the operation result from (a) Function without EN/ENO (REAL_TO_STR) [Structured ladder]...
WORD_TO_BOOL(_E), DWORD_TO_BOOL(_E) 5.1.20 Word (unsigned)/16-bit string, double word (unsigned)/32-bit string type → bit type conversion WORD_TO_BOOL(_E), DWORD_TO_BOOL(_E) High Performance Universal WORD_TO_BOOL(_E) _E: With EN/ENO DWORD_TO_BOOL(_E) indicates any of the following functions. Structured ladder WORD_TO_BOOL WORD_TO_BOOL_E DWORD_TO_BOOL WORD_TO_BOOL_E ENO:= (EN, s, d); WORD_TO_BOOL_E DWORD_TO_BOOL_E Input argument,...
Page 96
WORD_TO_BOOL(_E), DWORD_TO_BOOL(_E) (2) DWORD_TO_BOOL, DWORD_TO_BOOL_E Converts double word (unsigned)/32-bit string type data input to into bit type data, and outputs the operation result from When the input value is 0 , FALSE is output. When the input value is other than 0 , TRUE is output.
Page 97
WORD_TO_BOOL(_E), DWORD_TO_BOOL(_E) Operation Error No operation error occurs in the execution of the WORD_TO_BOOL(_E) and DWORD_TO_BOOL(_E) functions. Program Example (1) The program which converts word (unsigned)/16-bit string type data input to into bit type data, and outputs the operation result from (a) Function without EN/ENO (WORD_TO_BOOL) [Structured ladder] [ST]...
WORD_TO_INT(_E), WORD_TO_DINT(_E) 5.1.21 Word (unsigned)/16-bit string type → word (signed), double word (signed) type conversion WORD_TO_INT(_E), WORD_TO_DINT(_E) High Performance Universal WORD_TO_INT(_E) _E: With EN/ENO WORD_TO_DINT(_E) indicates any of the following functions. Structured ladder WORD_TO_INT WORD_TO_INT_E WORD_TO_DINT WORD_TO_DINT_E WORD_TO_INT_E ENO:= (EN, s, d); WORD_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 99
WORD_TO_INT(_E), WORD_TO_DINT(_E) (2) WORD_TO_DINT, WORD_TO_DINT_E Converts word (unsigned)/16-bit string type data input to into double word (signed) type data, and outputs the operation result from 5678 22136 Word (unsigned)/16-bit string type Double word (signed) type 5678 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 Data conversion 22136 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0...
Page 100
WORD_TO_INT(_E), WORD_TO_DINT(_E) Operation Error No operation error occurs in the execution of the WORD_TO_INT(_E) and WORD_TO_DINT(_E) functions. Program Example (1) The program which converts word (unsigned)/16-bit string type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (WORD_TO_INT) [Structured ladder] [ST]...
DWORD_TO_INT(_E), DWORD_TO_DINT(_E) 5.1.22 Double word (unsigned)/32-bit string type → word (signed), double word (signed) type conversion DWORD_TO_INT(_E), DWORD_TO_DINT(_E) High Performance Universal DWORD_TO_INT(_E) _E: With EN/ENO DWORD_TO_DINT(_E) indicates any of the following functions. Structured ladder DWORD_TO_INT DWORD_TO_INT_E DWORD_TO_DINT DWORD_TO_DINT_E DWORD_TO_INT_E ENO:= (EN, s, d);...
Page 102
DWORD_TO_INT(_E), DWORD_TO_DINT(_E) (2) DWORD_TO_DINT, DWORD_TO_DINT_E Converts double word (unsigned)/32-bit string type data input to into double word (signed) type data, and outputs the operation result from BC614E 12345678 Double word (unsigned)/32-bit string type Double word (signed) type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
Page 103
DWORD_TO_INT(_E), DWORD_TO_DINT(_E) Operation Error No operation error occurs in the execution of the DWORD_TO_INT(_E) and DWORD_TO_DINT(_E) functions. Program Example (1) The program which converts double word (unsigned)/32-bit string type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (DWORD_TO_INT) [Structured ladder] [ST]...
WORD_TO_DWORD(_E) 5.1.23 Word (unsigned)/16-bit string type → double word (unsigned)/32-bit string type conversion WORD_TO_DWORD(_E) High Performance Universal WORD_TO_DWORD(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder WORD_TO_DWORD WORD_TO_DWORD_E WORD_TO_DWORD_E ENO:= (EN, s, d); WORD_TO_DWORD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Word (unsigned)/16-bit string...
Page 105
WORD_TO_DWORD(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 106
WORD_TO_DWORD(_E) Operation Error No operation error occurs in the execution of the WORD_TO_DWORD(_E) function. Program Example The program which converts word (unsigned)/16-bit string type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from (a) Function without EN/ENO (WORD_TO_DWORD) [Structured ladder] [ST]...
DWORD_TO_WORD(_E) 5.1.24 Double word (unsigned)/32-bit string type → word (unsigned)/16-bit string type conversion DWORD_TO_WORD(_E) High Performance Universal DWORD_TO_WORD(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder DWORD_TO_WORD DWORD_TO_WORD_E DWORD_TO_WORD_E ENO:= (EN, s, d); DWORD_TO_WORD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Double word (unsigned)/32-bit string...
Page 108
DWORD_TO_WORD(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 109
DWORD_TO_WORD(_E) Operation Error No operation error occurs in the execution of the DWORD_TO_WORD(_E) function. Program Example The program which converts double word (unsigned)/32-bit string type data input to into word (unsigned)/16-bit string type data, and outputs the operation result from (a) Function without EN/ENO (DWORD_TO_WORD) [Structured ladder] [ST]...
WORD_TO_STR(_E), DWORD_TO_STR(_E) 5.1.25 Word (unsigned)/16-bit string, double word (unsigned)/32-bit string type → string type conversion WORD_TO_STR(_E), DWORD_TO_STR(_E) High Performance Universal WORD_TO_STR(_E) _E: With EN/ENO DWORD_TO_STR(_E) indicates any of the following functions. Structured ladder WORD_TO_STR WORD_TO_STR_E DWORD_TO_STR DWORD_TO_STR_E WORD_TO_STR_E ENO:= (EN, s, d); WORD_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 111
WORD_TO_STR(_E), DWORD_TO_STR(_E) (2) DWORD_TO_STRING, DWORD_TO_STRING_E Converts double word (unsigned)/32-bit string type data input to into string type data, and outputs the operation result from ' 0 ' 12345678 ' 12345678 ' Double word (unsigned)/32-bit string type String type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO...
Page 112
WORD_TO_STR(_E), DWORD_TO_STR(_E) Operation Error No operation error occurs in the execution of the WORD_TO_STR(_E) and DWORD_TO_STR(_E) functions. Program Example (1) The program which converts word (unsigned)/16-bit string type data input to into string type data, and outputs the operation result data from (a) Function without EN/ENO (WORD_TO_STR) [Structured ladder] [ST]...
WORD_TO_TIME(_E), DWORD_TO_TIME(_E) 5.1.26 Word (unsigned)/16-bit string, double word (unsigned)/32-bit string type → time type conversion WORD_TO_TIME(_E), DWORD_TO_TIME(_E) High Performance Universal WORD_TO_TIME(_E) _E: With EN/ENO DWORD_TO_TIME(_E) indicates any of the following functions. Structured ladder WORD_TO_TIME WORD_TO_ TIME _E WORD_TO_TIME_E ENO:= (EN, s, d); WORD_TO_TIME_E DWORD_TO_TIME DWORD_TO_ TIME _E...
Page 114
WORD_TO_TIME(_E), DWORD_TO_TIME(_E) (2) DWORD_TO_TIME, DWORD_TO_TIME_E Converts double word (unsigned)/32-bit string type data input to into time type data, and outputs the operation result from 1234567 20m34s567ms Double word (unsigned)/32-bit string type Time type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
Page 115
WORD_TO_TIME(_E), DWORD_TO_TIME(_E) Operation Error No operation error occurs in the execution of the WORD_TO_TIME(_E) and DWORD_TO_TIME(_E) functions. Program Example (1) The program which converts word (unsigned)/16-bit string type data input to into time type data, and outputs the operation result from (a) Function without EN/ENO (WORD_TO_TIME) [Structured ladder] [ST]...
STR_TO_BOOL(_E) 5.1.27 String type → bit type conversion STR_TO_BOOL(_E) High Performance Universal STR_TO_BOOL(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder STR_TO_BOOL STR_TO_BOOL_E STR_TO_BOOL_E ENO:= (EN, s, d); STR_TO_BOOL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String...
Page 117
STR_TO_BOOL(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 118
STR_TO_BOOL(_E) Operation Error No operation error occurs in the execution of the STR_TO_BOOL(_E) function. Program Example The program which converts string type data input to into bit type data, and outputs the operation result from (a) Function without EN/ENO (STR_TO_BOOL) [Structured ladder] [ST] g_bool1 := STR_TO_BOOL (g_string1);...
STR_TO_INT(_E), STR_TO_DINT(_E) 5.1.28 String type → word (signed), double word (signed) type conversion STR_TO_INT(_E), STR_TO_DINT(_E) High Performance Universal STR_TO_INT(_E) _E: With EN/ENO STR_TO_DINT(_E) indicates any of the following functions. Structured ladder STR_TO_INT STR_TO_INT_E STR_TO_DINT STR_TO_DINT_E STR_TO_INT_E ENO:= (EN, s, d); STR_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 120
STR_TO_INT(_E), STR_TO_DINT(_E) (2) STRING_TO_DINT, STRING_TO_DINT_E (a) Converts string type data input to into double word (signed) type data, and outputs the operation result from High-order byte Low-order byte String 1st word ASCII code of billions place Sign data 2nd word ASCII code of ten-millions place ASCII code of hundred-millions place 3rd word ASCII code of hundred-thousands place ASCII code of millions place...
Page 121
STR_TO_INT(_E), STR_TO_DINT(_E) Operation Error An operation error occurs in the following cases. • The input value is other than '30 ' to '39 ', '20 ', '2D ', and '00 ' of ASCII code. (Error code: 4100) • The input value is outside the following ranges of ASCII code. (Error code: 4100) STR_TO_INT(_E): '−32768 to 32767' STR_TO_DINT(_E): '−2147483648 to 2147483647'...
STR_TO_REAL(_E) 5.1.29 String type → single-precision real type conversion STR_TO_REAL(_E) High Performance Universal STR_TO_REAL(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder STR_TO_REAL STR_TO_REAL_E STR_TO_REAL_E ENO:= (EN, s, d); STR_TO_REAL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String...
Page 123
STR_TO_REAL(_E) (2) Both string type data in decimal point form and exponent form can be converted to single- precision real type data. (a) Decimal point form High-order byte Low-order byte String 1st word 2nd word 3rd word -1.35034 4th word 5th word Single-precision real type (b) Exponent form...
Page 124
STR_TO_REAL(_E) (6) When '20 ' (space) or '30 ' (0) exists before the first 0 in string type data, the conversion is executed ignoring '20 ' and '30 (a) Decimal point form 0 3 4 -1.35034 Single-precision real type Neglected (b) Exponent form 0 3 4 E - 1 0 -1.35034E-10...
Page 125
STR_TO_REAL(_E) Operation Error An operation error occurs in the following cases. • Any characters other than 30 to 39 exist in the integral or decimal part. (Error code: 4100) • Two or more 2EH exist. (Error code: 4100) • Any characters other than '45 (E), 2C (+)' or '45 (E), 2D...
STR_TO_WORD(_E), STR_TO_DWORD(_E) 5.1.30 String type → word (unsigned)/16-bit string, double word (unsigned)/32-bit string type conversion STR_TO_WORD(_E), STR_TO_DWORD(_E) High Basic Performance STR_TO_WORD(_E) _E: With EN/ENO STR_TO_DWORD(_E) indicates any of the following functions. Structured ladder STR_TO_WORD STR_TO_WORD_E STR_TO_DWORD STR_TO_DWORD_E STR_TO_WORD_E ENO:= (EN, s, d); STR_TO_WORD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 127
STR_TO_WORD(_E), STR_TO_DWORD(_E) (2) STR_TO_DWORD, STR_TO_DWORD_E Converts the string type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from When the input value is FALSE, 0 is output in double word (unsigned)/32-bit string type data.
Page 128
STR_TO_WORD(_E), STR_TO_DWORD(_E) Operation Error No operation error occurs in the execution of the STR_TO_WORD(_E) and STR_TO_DWORD(_E) functions. Program Example (1) The program which converts string type data input to into word (unsigned)/16-bit string type data, and outputs the converted data from (a) Function without EN/ENO (STR_TO_WORD) [Structured ladder] [ST]...
STR_TO_TIME(_E) 5.1.31 String type → time type conversion STR_TO_TIME(_E) High Performance Universal STR_TO_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder STR_TO_TIME STR_TO_ TIME _E STR_TO_TIME_E ENO:= (EN, s, d); STR_TO_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String...
Page 130
STR_TO_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 131
STR_TO_TIME(_E) Operation Error No operation error occurs in the execution of the STR_TO_TIME(_E) function. Program Example The program which converts string type data input to into time type data, and outputs the operation result from (a) Function without EN/ENO (STR_TO_TIME) [Structured ladder] [ST] g_time1 := STR_TO_TIME (g_string1);...
STR_TO_BCD(_E) 5.1.32 String type → BCD type conversion STR_TO_BCD(_E) High Performance Universal STR_TO_BCD(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder STR_TO_BCD STR_TO_ BCD _E STR_TO_BCD_E ENO:= (EN, s, d); STR_TO_BCD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String...
Page 133
STR_TO_BCD(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 134
STR_TO_BCD(_E) Operation Error An operation error occurs in the following cases. • The input character string is outside the range of ASCII code '30 ' to '39 (Error code 4100) • The input character string is within the range of ASCII code '30 ' to '39 ' and exceeding '9999'.
BCD_TO_INT(_E), BCD_TO_DINT(_E) 5.1.33 BCD type → word (signed), double word (signed) type conversion BCD_TO_INT(_E), BCD_TO_DINT(_E) High Performance Universal BCD_TO_INT(_E) _E: With EN/ENO BCD_TO_DINT(_E) indicates any of the following functions. Structured ladder BCD_TO_INT BCD_TO_INT_E BCD_TO_DINT BCD_TO_DINT_E BCD_TO_INT_E ENO:= (EN, s, d); BCD_TO_INT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop)
Page 136
BCD_TO_INT(_E), BCD_TO_DINT(_E) (2) BCD_TO_DINT, BCD_TO_DINT_E (a) Converts BCD type data input to into double word (signed) type data, and outputs the operation result from 99999999 99999999 Double word (unsigned)/32-bit string type Double word (signed) type × × × × × ×...
Page 137
BCD_TO_INT(_E), BCD_TO_DINT(_E) Operation Error No operation error occurs in the execution of the BCD_TO_INT(_E) and BCD_TO_DINT(_E) functions. Program Example (1) The program which converts BCD type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (BCD_TO_INT) [Structured ladder] [ST]...
BCD_TO_STR(_E) 5.1.34 BCD type → string type conversion BCD_TO_STR(_E) High Performance Universal BCD_TO_STR(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder BCD_TO_STR BCD_TO_STR_E BCD_TO_STR_E ENO:= (EN, s, d); BCD_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Word (unsigned)/16-bit string, double word...
Page 139
BCD_TO_STR(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 140
BCD_TO_STR(_E) Operation Error No operation error occurs in the execution of the BCD_TO_STR(_E) function. Program Example The program which converts word (unsigned)/16-bit string type data input to into string type data, and outputs the operation result from (a) Function without EN/ENO (BCD _TO_STR) [Structured ladder] [ST] g_string1 := BCD_TO_STR (g_word1);...
TIME_TO_BOOL(_E) 5.1.35 Time type → bit type conversion TIME_TO_BOOL(_E) High Performance Universal TIME_TO_BOOL(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder TIME_TO_BOOL TIME_TO_BOOL_E TIME_TO_BOOL_E ENO:= (EN, s, d); TIME_TO_BOOL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time...
Page 142
TIME_TO_BOOL(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 143
TIME_TO_BOOL(_E) Operation Error No operation error occurs in the execution of the TIME_TO_BOOL(_E) function. Program Example The program which converts time type data input to into bit type data, and outputs the operation result from (a) Function without EN/ENO (TIME_TO_BOOL) [Structured ladder] [ST] g_bool1 := TIME_TO_BOOL (g_time1);...
Page 144
TIME_TO_INT(_E), TIME_TO_DINT(_E) 5.1.36 Time type → word (signed), double word (signed) type conversion TIME_TO_INT(_E), TIME_TO_DINT(_E) High Performance Universal TIME_TO_INT(_E) _E: With EN/ENO TIME_TO_DINT(_E) indicates any of the following functions. Structured ladder TIME_TO_INT TIME _TO_INT_E TIME _TO_DINT TIME _TO_DINT_E TIME_TO_INT_E ENO:= (EN, s, d);...
Page 145
TIME_TO_INT(_E), TIME_TO_DINT(_E) (2) TIME _TO_DINT, TIME _TO_DINT_E Converts time type data input to into double word (signed) type data, and outputs the operation result from 20m34s567ms 1234567 Time type Double word (signed) type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
TIME_TO_INT(_E), TIME_TO_DINT(_E) Operation Error No operation error occurs in the execution of the TIME_TO_INT(_E) and TIME_TO_DINT(_E) functions. Program Example (1) The program which converts time type data input to into word (signed) type data, and outputs the operation result from (a) Function without EN/ENO (TIME _TO_INT) [Structured ladder] [ST]...
TIME_TO_STR(_E) 5.1.37 Time type → string type conversion TIME_TO_STR(_E) High Performance Universal TIME_TO_STR(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder TIME_TO_STR TIME _TO_STR_E TIME_TO_STR_E ENO:= (EN, s, d); TIME_TO_STR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time...
Page 148
TIME_TO_STR(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 149
TIME_TO_STR(_E) Operation Error No operation error occurs in the execution of the TIME_TO_STR(_E) function. Program Example The program which converts time type data input to into string type data, and outputs the operation result from (a) Function without EN/ENO (TIME_TO_STR) [Structured ladder] [ST] g_string1 := TIME_TO_STR (g_time1);...
TIME_TO_WORD(_E), TIME_TO_DWORD(_E) 5.1.38 Time type → word (unsigned)/16-bit string, double word (unsigned)/32-bit string type conversion TIME_TO_WORD(_E), TIME_TO_DWORD(_E) High Performance Universal TIME_TO_WORD(_E) _E: With EN/ENO TIME_TO_DWORD(_E) indicates any of the following functions. Structured ladder TIME_TO_WORD TIME _TO_WORD_E TIME _TO_DWORD TIME_TO_WORD_E ENO:= (EN, s, d);...
Page 151
TIME_TO_WORD(_E), TIME_TO_DWORD(_E) (2) TIME _TO_DWORD, TIME _TO_DWORD_E Converts time type data input to into double word (unsigned)/32-bit string type data, and outputs the operation result from 20m34s567ms 1234567 Time type Double word (unsigned)/32-bit string type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
Page 152
TIME_TO_WORD(_E), TIME_TO_DWORD(_E) Operation Error No operation error occurs in the execution of the TIME_TO_WORD(_E) and TIME_TO_DWORD(_E) functions. Program Example (1) The program which converts time type data input to into word (unsigned)/16-bit string type data, and outputs the operation result from (a) Function without EN/ENO (TIME _TO_WORD) [Structured ladder] [ST]...
ABS(_E) Standard Functions of One Numeric Variable 5.2.1 Absolute value ABS(_E) High Performance Universal ABS(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder ABS_E ABS_E ENO:= (EN, s, d); ABS_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY_NUM...
Page 154
ABS(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 155
ABS(_E) Operation Error No operation error occurs in the execution of the ABS(_E) function. Program Example The program which outputs the absolute value of word (signed), double word (signed) or single- precision real type data input to from in the same data type as that of (a) Function without EN/ENO (ABS) [Structured ladder] [ST]...
ADD(_E) Standard Arithmetic Functions 5.3.1 Addition ADD(_E) High Performance Universal ADD(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. ADD_E ADD_E (EN, s1, s2 ... s27, d); ENO:= ADD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit s1 to s27: Input...
Page 157
ADD(_E) (4) If an underflow/overflow occurs in the operation result, data is output from as follows. (a) Word (signed) type data No operation error occurs even if an underflow/overflow occurs. In case of ADD_E, TRUE is output from ENO. 2 = −32767 32767 + Since the highest-order bit is 1, the result value is negative.
Page 158
ADD(_E) Operation Error No operation error occurs in the execution of the ADD(_E) function. Program Example The program which performs addition ( ) on double word (signed) type data input to , and outputs the operation result from in the same data type as that of (a) Function without EN/ENO (ADD) [Structured ladder] [ST]...
MUL(_E) 5.3.2 Multiplication MUL(_E) High Performance Universal MUL(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. MUL_E MUL_E (EN, s1, s2 ... s27, d); ENO:= MUL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit s1 to s27: Input :ANY_NUM Output argument,...
Page 160
MUL(_E) (4) If an underflow/overflow occurs in the operation result, data is output from as follows. (a) Word (signed) type data No operation error occurs even if an underflow/overflow occurs. In case of MUL_E, TRUE is output from ENO. Even if the operation result exceeds the word (signed) type data range, data is output in word (signed) type.
Page 161
MUL(_E) Operation Error No operation error occurs in the execution of the MUL(_E) function. Program Example The program which performs multiplication ( ) on double word (signed) type data input to , and outputs the operation result from in the same data type as that of (a) Function without EN/ENO (MUL) [Structured ladder] [ST]...
SUB(_E) 5.3.3 Subtraction SUB(_E) High Performance Universal SUB(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. SUB_E SUB_E ENO:= (EN, s1, s2, d); SUB_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY_NUM Output argument, ENO: Output status (TRUE: Normal, FALSE: Error) :Bit...
Page 163
SUB(_E) (3) If an underflow/overflow occurs in the operation result, data is output from as follows. (a) Word (signed) type data No operation error occurs even if an underflow/overflow occurs. In case of SUB_E, TRUE is output from ENO. 32767− (−2)=−32767 Since the highest-order bit is 1, the result value is negative.
Page 164
SUB(_E) Operation Error No operation error occurs in the execution of the SUB(_E) function. Program Example − The program which performs subtraction ( ) on double word (signed) type data input to , and outputs the operation result from in the same data type as that of (a) Function without EN/ENO (SUB) [Structured ladder] [ST]...
DIV(_E) 5.3.4 Division DIV(_E) High Performance Universal DIV(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. DIV_E DIV_E ENO:= (EN, s1, s2, d); DIV_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY_NUM Output argument, ENO: Output status (TRUE: Normal, FALSE: Error) :Bit...
Page 166
DIV(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 167
DIV(_E) Operation Error An operation error occurs in the following case. • The value to be input to is 0. (Division by 0) (Error code: 4100) Program Example ÷ The program which performs division ( ) on double word (signed) type data input to , and outputs the quotient of the operation result from in the same data type as that of (a) Function without EN/ENO (DIV)
MOD(_E) 5.3.5 Modulus operation MOD(_E) High Performance Universal MOD(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. MOD_E MOD_E ENO:= (EN, s1, s2, d); MOD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY_INT Output argument, ENO: Output status (TRUE: Normal, FALSE: Error) :Bit...
Page 169
MOD(_E) Operation result (1) Function without EN/ENO The following table shows the operation results. Operation result No operation error Operation output value Operation error Undefined value (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (No operation error) Operation output value TRUE (Operation execution)
Page 170
MOD(_E) Operation Error An operation error occurs in the following case. • The value to be input to is 0. (Division by 0) (Error code: 4100) Program Example ÷ The program which performs division ( ) on double word (signed) type data input to , and outputs the remainder of the operation result from in the same data type as that of (a) Function without EN/ENO (MOD)
EXPT(_E) 5.3.6 Exponentiation EXPT(_E) High Performance Universal EXPT(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. EXPT_E EXPT EXPT _E ENO:= (EN, s1, s2, d); EXPT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY_REAL Input :ANY_NUM Output argument,...
Page 172
EXPT(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 173
EXPT(_E) Operation Error No operation error occurs in the execution of the EXPT(_E) function. Program Example The program which performs exponentiation and outputs the operation result from in the same data type as that of (a) Function without EN/ENO (EXPT) [Structured ladder] [ST] g_real2:= EXPT(g_real1, g_int1);...
MOVE(_E) 5.3.7 Move operation MOVE(_E) High Performance Universal MOVE(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder MOVE MOVE_E MOVE_E ENO:= (EN, s, d); MOVE_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :ANY Output argument, ENO: Output status (TRUE: Normal, FALSE: Error) :Bit...
Page 175
MOVE(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 176
MOVE(_E) Operation Error No operation error occurs in the execution of the MOVE(_E) function. Program Example The program which moves the word (signed) type data input to (a) Function without EN/ENO (MOVE) [Structured ladder] [ST] g_int2:= MOVE(g_int1); (b) Function with EN/ENO (MOVE_E) [Structured ladder] [ST] g_bool3 := MOVE_E(g_bool1, g_int1, g_int2);...
AND(_E), OR(_E), XOR(_E), NOT(_E) Standard Bitwise Boolean Functions 5.4.1 Boolean AND, boolean OR, boolean exclusive OR, and boolean NOT AND(_E), OR(_E), XOR(_E), NOT(_E) High Performance Universal AND(_E) OR(_E) _E: With EN/ENO XOR(_E) NOT(_E) indicates any of the following Structured ladder functions.
Page 178
AND(_E), OR(_E), XOR(_E), NOT(_E) (b) The number of pins of variable 's' can be changed in the range from 2 to 27. (2) OR, OR_E (a) Performs Boolean OR on bit, word (unsigned)/16-bit string or double word (unsigned)/ 32-bit string type data input to variables bit by bit, and outputs the operation result from in the same data type as that of variables...
Page 179
AND(_E), OR(_E), XOR(_E), NOT(_E) (4) NOT, NOT_E Performs Boolean NOT on bit, word (unsigned)/16-bit string or double word (unsigned)/32- bit string type data input to variable bit by bit, and outputs the operation result from the same data type as that of variable (Example) Word (unsigned)/16-bit string type data (5) The value to be input to variables is bit, word (unsigned)/16-bit string or double...
Page 180
AND(_E), OR(_E), XOR(_E), NOT(_E) Operation Error No operation error occurs in the execution of the AND(_E), OR(_E), XOR(_E), and NOT(_E) functions. Program Example (1) The program which performs Boolean AND on bit, word (unsigned)/16-bit string or double word (unsigned)/32-bit string type data input to variables bit by bit, and outputs the operation result from in the same data type as that of variables...
Page 181
AND(_E), OR(_E), XOR(_E), NOT(_E) (2) The program which performs Boolean OR on bit, word (unsigned)/16-bit string or double word (unsigned)/32-bit string type data input to variables bit by bit, and outputs the operation result from in the same data type as that of variables (a) Function without EN/ENO (OR) [Structured ladder] [ST]...
SEL(_E) Standard Selection Functions 5.5.1 Selection SEL(_E) High Performance Universal SEL(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. SEL_E SEL_E ENO:= (EN, s1, s2, s3, d); SEL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Output condition (TRUE: s3 output, FALSE: s2 output) :Bit Input...
Page 183
SEL(_E) (Example) are word (signed) type data FALSE Bit type 1234 1234 Word (signed) type Word (signed) type 5678 Word (signed) type Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results.
Page 184
SEL(_E) Operation Error No operation error occurs in the execution of the SEL(_E) function. Program Example The program which selects either of values input to according to the value input to and outputs the operation result from in the same data type as that of (a) Function without EN/ENO (SEL) [Structured ladder] [ST]...
MUX(_E) 5.5.2 Multiplexer MUX(_E) High Performance Universal MUX(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. MUX_E MUX_E (EN, n, s1, s2 ... s27, d); ENO:= MUX_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Output value selection :Word (signed) s1 to s27: Input...
Page 186
MUX(_E) (3) The value to be input to is word (signed) type data within the range from 1 to 27 (within the range of the number of pins of variable 's'). (4) The value to be input to variable 's' is bit, word (signed), double word (signed), word (unsigned)/16-bit string, double word (unsigned)/32-bit string, single-precision real, double- precision real or string type data.
Page 187
MUX(_E) Operation Error No operation error occurs in the execution of the MUX(_E) function. Program Example The program which selects the value to be output among the values input to variables according to the value input to , and outputs the operation result from in the same data type as that of variable (a) Function without EN/ENO (MUX)
GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E), NE(_E) Standard Comparison Functions 5.6.1 Comparison GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E), NE(_E) High Performance Universal GT(_E) GE(_E) EQ(_E) _E: With EN/ENO LE(_E) LT(_E) NE(_E) indicates any of the following Structured ladder functions. GT_E GT_E GE_E (EN, s1, s2 ...
Page 189
GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E), NE(_E) > > > (a) GT, GT_E(>) Performs comparison of [ ]&[ ]&···&[ (n−1) > • Outputs TRUE if all of comparisons satisfy (n−1) • Outputs FALSE if any of comparisons satisfies (n−1) (b) GE, GE_E( ) Performs comparison of [ ]&[ ]&···&[...
Page 190
GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E), NE(_E) Operation Error No operation error occurs in the execution of the GT(_E), GE(_E), EQ(_E), LE(_E), LT(_E), and NE(_E) functions. Program Example The program which performs comparison operation between the values input to , and outputs the operation result from (a) Function without EN/ENO (GT) [Structured ladder]...
MID(_E) Standard Character String Functions 5.7.1 Extract mid string MID(_E) High Performance Universal MID(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. MID_E MID_E ENO:= (EN, s, n1, n2, d); MID_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String...
Page 192
MID(_E) (Example) Values input to are 5 'ABCDEF12345' 'EF123' High-order byte Low-order byte High-order byte Low-order byte 1st word 1st word 2nd word 2nd word 3rd word Start position to 3rd word be extracted 4th word 5th character 5th word 6th word Number of characters to be extracted : 5 characters...
Page 193
MID(_E) Operation Error No operation error occurs in the execution of the MID(_E) function. Program Example The program which extracts the specified number of characters from the specified start position in the character string input to , and outputs the operation result from (a) Function without EN/ENO (MID) [Structured ladder] [ST]...
CONCAT(_E) 5.7.2 String concatenation CONCAT(_E) High Performance Universal CONCAT(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder CONCAT CONCAT_E CONCAT_E ENO:= (EN, s1, s2, d); CONCAR_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String Output argument, ENO: Output status (TRUE: Normal, FALSE: Error)
Page 195
CONCAT(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 196
CONCAT(_E) Operation Error No operation error occurs in the execution of the CONCAT(_E) function. Program Example The program which concatenates the character string input to following the one input to and outputs the operation result from (a) Function without EN/ENO (CONCAT) [Structured ladder] [ST] g_string3:=CONCAT(g_string1, g_string2);...
INSERT(_E) 5.7.3 String insertion INSERT(_E) High Performance Universal INSERT(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. INSERT_E INSERT INSERT_E ENO:= (EN, s1, s2, n, d); INSERT_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String Start position to be inserted :Word (signed)
Page 198
INSERT(_E) (Example) Value input to is 4 Input value to IN1 Output value 'ABCDE' 'ABC123456DE' High-order byte Low-order byte High-order byte Low-order byte 1st word 1st word 2nd word 2nd word Start position to be inserted 3rd word 3rd word 4th character 4th word Input value to IN2...
Page 199
INSERT(_E) Operation Error No operation error occurs in the execution of the INSERT(_E) function. Program Example The program which inserts the character string input to to the specified position in the character string input to , and outputs the operation result from (a) Function without EN/ENO (INSERT) [Structured ladder] [ST]...
DELETE(_E) 5.7.4 String deletion DELETE(_E) High Performance Universal DELETE(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. DELETE_E DELETE DELETE_E ENO:= (EN, s, n1, n2, d); DELETE_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String Number of characters to be deleted :Word (signed)
Page 201
DELETE(_E) (Example) Values input to are 5 'ABCDEF12345' 'ABCD45' High-order byte Low-order byte High-order byte Low-order byte 1st word 1st word 2nd word 2nd word 3rd word 3rd word Start position to be deleted 4th word 4th word 5th character 5th word 6th word Number of characters to be deleted...
Page 202
DELETE(_E) Operation Error No operation error occurs in the execution of the DELETE(_E) function. Program Example The program which deletes the specified number of characters from the specified position in the character string input to , and outputs the remaining character string from (a) Function without EN/ENO (DELETE) [Structured ladder] [ST]...
REPLACE(_E) 5.7.5 String replacement REPLACE(_E) High Performance Universal REPLACE(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. REPLACE_E REPLACE REPLACE_E ENO:= (EN, s1, s2, n1, n2, d); REPLACE_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :String Number of characters to be replaced...
Page 204
REPLACE(_E) (Example) Values input to are 5 Input value to IN1 Output value 'ABCDEFGH123' 'ABCD1234523' High-order byte Low-order byte High-order byte Low-order byte 1st word 1st word 2nd word 2nd word Start position to 3rd word 3rd word be replaced 4th word 4th word 5th character...
Page 205
REPLACE(_E) Operation Error No operation error occurs in the execution of the REPLACE(_E) function. Program Example The program which replaces the specified number of characters from the specified position in the character string input to with the character string input to , and outputs the operation result from (a) Function without EN/ENO (REPLACE)
ADD_TIME(_E) Functions of Time Data Type 5.8.1 Addition ADD_TIME(_E) High Performance Universal ADD_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder ADD_TIME ADD_TIME_E ADD_TIME_E ENO:= ADD_TIME_E (EN, s1, s2, d); Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time...
Page 207
ADD_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 208
ADD_TIME(_E) Operation Error No operation error occurs in the execution of the ADD_TIME(_E) function. Program Example The program which performs addition ( ) on time type data input to , and outputs the operation result from in time type. (a) Function without EN/ENO (ADD_TIME) [Structured ladder] [ST] g_time3:= ADD_TIME(g_time1, g_time2);...
SUB_TIME(_E) 5.8.2 Subtraction SUB_TIME(_E) High Performance Universal SUB_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder SUB_TIME SUB_TIME_E SUB_TIME_E ENO:= (EN, s1, s2, d); SUB_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time Output argument, ENO: Output status (TRUE: Normal, FALSE: Error) :Bit...
Page 210
SUB_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 211
SUB_TIME(_E) Operation Error No operation error occurs in the execution of the SUB_TIME(_E) function. Program Example − The program which performs subtraction ( ) on time type data input to , and outputs the operation result from in time type. (a) Function without EN/ENO (SUB_TIME) [Structured ladder] [ST]...
MUL_TIME(_E) 5.8.3 Multiplication MUL_TIME(_E) High Performance Universal MUL_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder MUL_TIME MUL_TIME_E MUL_TIME_E ENO:= (EN, s1, s2, d); MUL_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time Input :ANY_NUM Output argument, ENO:...
Page 213
MUL_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 214
MUL_TIME(_E) Operation Error No operation error occurs in the execution of the MUL_TIME(_E) function. Program Example The program which performs multiplication ( ) on time type data input to , and outputs the operation result from in time type. (a) Function without EN/ENO (MUL_TIME) [Structured ladder] [ST] g_time2:= MUL_TIME(g_time1, g_int1);...
DIV_TIME(_E) 5.8.4 Division DIV_TIME(_E) High Performance Universal DIV_TIME(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder DIV_TIME DIV_TIME_E DIV_TIME_E ENO:= (EN, s1, s2, d); DIV_TIME_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Time Input :ANY_NUM Output argument, ENO:...
Page 216
DIV_TIME(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) Function with EN/ENO The following table shows the executing conditions and operation results. TRUE (Operation execution) TRUE Operation output value FALSE (Operation stop) Undefined value FALSE *1 When FALSE is output from ENO, the data output from...
Page 217
DIV_TIME(_E) Operation Error No operation error occurs in the execution of the DIV_TIME(_E) function. Program Example ÷ The program which performs division ( ) on time type data input to , and outputs the quotient of the operation result from in time type.
SR(_E) Standard Bistable Function Blocks 5.9.1 Standard bistable function blocks (Set-dominant) SR(_E) High Performance Universal SR(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder SR_E SR_E ENO:= SR_E (EN, s1, s2, d); Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 219
SR(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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 *1 The previous operation output value is held at...
Page 220
SR(_E) Operation Error No operation error occurs in the execution of the SR (_E) function. Program Example The program which outputs bit type data input to from and holds the output, and resets the value of only when bit type data input to is 1 and the data input to is 0.
RS(_E) 5.9.2 Standard bistable function blocks (Reset-dominant) RS(_E) High Performance Universal RS(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder RS_E RS_E ENO:= (EN, s1, s2, d); RS_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit Output argument,...
Page 222
RS(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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 *1 The previous operation output value is held at...
Page 223
RS(_E) Operation Error No operation error occurs in the execution of the RS (_E) function. Program Example The program which outputs bit type data input to from and holds the output, and resets forcibly the value of when bit type data input to is 1.
R_TRIG(_E) 5.10 Standard Edge Detection Function Blocks 5.10.1 Rising edge detector R_TRIG(_E) High Performance Universal R_TRIG(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder R_TRIG R_TRIG_E R_TRIG_E ENO:= (EN, s, d); R_TRIG_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 225
R_TRIG(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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 *1 The previous operation output value is held at...
F_TRIG(_E) 5.10.2 Falling edge detector F_TRIG(_E) High Performance Universal F_TRIG(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder F_TRIG F_TRIG_E F_TRIG_E ENO:= (EN, s, d); F_TRIG_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit Output argument, ENO: Output status (TRUE: Normal, FALSE: Error or stop)
Page 227
F_TRIG(_E) Operation Error No operation error occurs in the execution of the F_TRIG (_E) function. Program Example The program which turns ON for one scan when bit type data input to is turned from ON to OFF. (a) Function without EN/ENO (R_TRIG) [Structured ladder] [ST] F_TRIG_Inst ( g_bool1, g_bool2 );...
CTU(_E) 5.11 Standard Counter Function Blocks 5.11.1 Up counter CTU(_E) High Performance Universal CTU(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder CTU_E WORD_TO_BOOL_E ENO:= (EN, s, d); WORD_TO_BOOL_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Count signal input :Bit...
Page 229
CTU(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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 *1 The previous operation output value is held at...
Page 230
CTU(_E) Operation Error No operation error occurs in the execution of the CTU (_E) function. Program Example The program which counts the number of times that bit type data input to is turned from OFF to ON, and outputs the count value from (a) Function without EN/ENO (CTU) [Structured ladder] [ST]...
CTD(_E) 5.11.2 Down counter CTD(_E) High Performance Universal CTD(_E) _E: With EN/ENO indicates any of the following Structured ladder functions. CTD_E CTD_E ENO:= (EN, s1, s2, n, d1, d2); CUD_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Count signal input :Bit Count reset :Bit...
Page 232
CTD(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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 *1 The previous operation output value is held at...
Page 233
CTD(_E) Operation Error No operation error occurs in the execution of the CTD (_E) function. Program Example The program which counts the number of times that bit type data input to is turned from OFF to ON, and turns ON when the value of reaches 0.
CTUD(_E) 5.11.3 Up/Down counter CTUD(_E) High Performance Universal CTUD(_E) _E: With EN/ENO indicates any of the following functions. CTUD CTUD_E Structured ladder CTUD_E ENO:= (EN, s1, s2, s3, s4, CTUD_E n, d1, d2, d3); Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Count-up signal input :Bit...
Page 235
CTUD(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from , and (2) 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...
Page 236
CTUD(_E) Operation Error No operation error occurs in the execution of the CTUD (_E) function. Program Example The program which counts the number of times that bit type data input to is turned from OFF to ON, and turns ON when the value of reaches the value set at .
COUNTER_FB_M 5.11.4 Counter function blocks COUNTER_FB_M High Performance Universal *1: The first five digits of the serial number are '04012' or higher. COUNTER_FB_M indicates the following function. COUNTER_FB_M Structured ladder COUNTER_FB_M (s1, s2, s3, d1, d2) COUNTER_FB_M Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Counter setting value :Word (signed)
Page 238
COUNTER_FB_M Operation Error No operation error occurs in the execution of the counter function blocks. Program Example The program which counts the number of times that bit type data input to is turned from OFF to ON, and outputs the count value from [Structured ladder] [ST] COUNTER_FB_M_Inst ( Var_M0, 10, 0, Var_D10, Var_M10 );...
TP(_E), TP_HIGH(_E) 5.12 Standard Timer Function Blocks 5.12.1 Pulse timer TP(_E), TP_HIGH(_E) High Performance Universal TP(_E), TP_HIGH(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder TP_E TP_HIGH_E TP_HIGH TP_HIGH_E ENO:= (EN, s, n, d1, d2); TP_HIGH_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input...
Page 240
TP(_E), TP_HIGH(_E) (1) TP(_E) Uses a low-speed timer to count the elapsed time. Output time can be set between 1ms and 1000ms. The unit is set in Timer limit setting on the PLC system of PLC parameter. (2) TP_HIGH(_E) Uses a high-speed timer to count the elapsed time. Output time can be set between 1ms and 1000ms.
Page 241
TP(_E), TP_HIGH(_E) Operation Error No operation error occurs in the execution of the TP (_E) function. Program Example The program which turns ON bit type data of for 10 seconds after bit type data input to turned ON. (a) Function without EN/ENO (TP) [Structured ladder] [ST] TP_Inst (g_bool1, T#10s, g_bool2, g_time1);...
TON(_E), TON_HIGH(_E) 5.12.2 On delay timer TON(_E), TON_HIGH(_E) High Performance Universal TON(_E), TON_HIGH(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder TON_E TON_HIGH_E TON_HIGH TON_HIGH_E ENO:= (EN, s, n, d1, d2); TON_HIGH_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 243
TON(_E), TON_HIGH(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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...
Page 244
TON(_E), TON_HIGH(_E) Operation Error No operation error occurs in the execution of the TON (_E) function. Program Example The program which turns ON bit type data of 10 seconds after bit type data input to turned ON. (a) Function without EN/ENO (TON) [Structured ladder] [ST] TON_Inst (g_bool1, T#10s, g_bool2, g_time1);...
TOF(_E), TOF_HIGH(_E) 5.12.3 Off delay timer TOF(_E), TOF_HIGH(_E) High Performance Universal TOF(_E), TOF_HIGH(_E) _E: With EN/ENO indicates any of the following functions. Structured ladder TOF_E TOF_HIGH_E TOF_HIGH TOF_HIGH_E ENO:= (EN, s, n, d1, d2); TOF_HIGH_E Input argument, Executing condition (TRUE: Execution, FALSE: Stop) :Bit Input :Bit...
Page 246
TOF(_E), TOF_HIGH(_E) Operation result (1) Function without EN/ENO An operation is executed and the operation value is output from (2) 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...
Page 247
TOF(_E), TOF_HIGH(_E) Operation Error No operation error occurs in the execution of the TOF(_E) function. Program Example The program which turns ON bit type data of when bit type data input to is turned ON, and turns OFF 10 seconds after is turned OFF.
TIMER_10_FB_M 5.12.4 Timer function blocks TIMER_10_FB_M High Performance Universal *1: The first five digits of the serial number are '04012' or higher. TIMER_10_FB_M TIMER_100_FB_M TIMER_HIGH_FB_M TIMER_LOW_FB_M TIMER_CONT_FB_M TIMER_CONTHFB_M indicates any of the following functions. Structured ladder TIMER_10_FB_M TIMER_100_FB_M TIMER_10_FB_M TIMER_HIGH_FB_M TIMER_LOW_FB_M (s1, s2, s3, d1, d2) TIMER_10_FB_M...
Page 249
TIMER_10_FB_M (2) TIMER_100_FB_M (a) Starts measuring the current value when the executing condition of turns ON. Starts measuring from the value input to 100ms, and when the measuring value reaches to the value input to 100ms, turns ON. The current value is output from (b) When the executing condition of turns OFF, the current value is set to the value input , and...
Page 250
TIMER_10_FB_M (5) TIMER_CONT_FB_M, TIMER_CONTHFB_M (a) The retentive timer that measures the time during variable is ON. Starts measuring the current value when the executing condition of turns ON. The low-speed retentive timer (TIMER_CONT_FB_M) and the high-speed retentive timer (TIMER_CONTHFB_M) are the two types of retentive timer. Starts measuring from the value input to 1 to 1000ms, and when the count value reaches to the value input to...
Page 251
TIMER_10_FB_M Program Example (1) TIMER_10_FB_M The program which starts measuring from 0 when the executing condition of turns ON, and when the measuring value reaches to the value input to 10ms, turns ON. [Structured ladder] [ST] TIMER_10_FB_M_Inst ( Var_M0, 10, 0, Var_D10, Var_M10 ); [Timing chart] Var_M0 Value of Var_D0...
Page 252
TIMER_10_FB_M (3) TIMER_LOW_FB_M The program which starts measuring from 0 when the executing condition of turns ON, and when the measuring value reaches to the value input to 1 to 1000ms, turns [Structured ladder] [ST] TIMER_LOW_FB_M_Inst ( Var_M0, 10, 0, Var_D10, Var_M10 ); [Timing chart] Var_M0 Value of Var_D10...
APPENDIX Appendix 1 Correspondence between Generic Data Types and Devices ..App-2 Appendix 2 Correspondence between Devices and Addresses ....App-6 App-1...
Appendix 1 Correspondence between Generic Data Types and Devices The following table shows the correspondence between generic data types and devices. Table App. 1-1 Correspondence between generic data types and devices Device Classification Type Device name Device symbol Input Output Internal relay Latch relay Annunciator...
Page 255
Generic data type ANY_SIMPLE ANY_NUM ANY_BIT ANY_INT ANY_REAL Double Array Structure Word Double Single- Double- Time String word Word (unsigned)/ word precision precision ANY16 ANY32 (unsigned)/ (signed) 16-bit string (signed) real real 32-bit string − − − − − − −...
Page 256
Device Classification Type Device name Device symbol Link input Jn\X Link output Jn\Y Bit device Link relay Jn\B Link direct device Link special relay Jn\SB Link register Jn\W Word device Link special register Jn\SW Intelligent function module Word device Intelligent function module device Un\G device Index register...
Page 257
Generic data type ANY_SIMPLE ANY_NUM ANY_BIT ANY_INT ANY_REAL Double Array Structure Word Double Single- Double- Time String word Word (unsigned)/ word precision precision ANY16 ANY32 (unsigned)/ (signed) 16-bit string (signed) real real 32-bit string − − − − − − −...
Appendix 2 Correspondence between Devices and Addresses The following table shows the correspondence between devices and addresses. Table App. 2-1 Correspondence between devices and addresses Example of correspondence between Expressing method device and address Device Device Address Device Address Input %IXn X7FF %IX2047...
Page 259
Table App. 2-2 Correspondence between devices and addresses Example of correspondence between Expressing method Device device and address Device Address Device Address Step relay %MX2.n S127 %MX2.127 SFC transition device %MX18.n %MX18.3 SFC block device %MX17.n %MX17.3 Link input Jx\Xn %IX16.x.n J1\X1FFF %IX16.1.8191...
Page 265
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 266
Microsoft, Windows are registered trademarks of Microsoft Corporation in the United States and other countries. Other company names and product names used in this document are trademarks or registered trademarks of respective companies.
Page 268
QCPU Structured Programming Manual (Application Functions) 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.