Home
Mitsubishi Electronics Mitsubishi Digital Electronics Welding System FXCPU User's Manual
Contents
1. g_bool1 g_word1 g_const_word1 6 ST me g_bool3 SHL_E g_bool1 g_word1 g_const_word1 g_word2 2 og on o S A s ss ppy pue s dl q USamjaq a9uapuodsa o7 151 FXCPU Structured Programming Manual Application Functions 5 4 Standard Bit Shift Functions PRUE FROG lololo o Jolo o Outline This function shifts data of specified bit length rightward by the specified number of bits 5 4 2 SHR _E 1 Format Expression in each language Structured ladder ST SHR _IN _K Example D10 SHR DO K1 Function name SHR SHR_E EN _IN _N Output label Example SHR E SHR_E X000 D0 K1 D10 1 Output variable 2 Set data Variable Description Data type Execution condition Bit pane N DD Word device which stores data to be shifted rightward ANY_BIT vari _K N D Number of shifted bits ANY_BIT output Execution status Bit variable 4 CdD Word device which will store data obtained by shift ANY_BIT In explanation of functions I O variables inside are described Explanation of function and operation 1 This function shifts word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in a device specified in rightward by n bits and outputs the obtained data to a device specified in Cd using the data type of data stored in a device specified in Cs gt Data is shifted rightward by n bits specified in Cn Example When
2. gt as 20m34s567ms gt TRUE ll s Time data Bit data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 122 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is converted into bit data and the data obtained 2 by conversion is output to a device specified in Cd gt 1 Function without EN ENO TIME_TO_BOOL Structured ladder 2 a TIME_TO_BOOL 2 g_time1 _TIME g_bool1 5 ST g_bool1 TIME_TO_BOOL g_time1 Oo ST 2 Function with EN ENO TIME_TO BOOL_E 28 Structured ladder S g_bool1 TIME_TO_BOOL _E 4 mmTI cxXKO 2 eu EE 2 oD g_bool3 TIME_TO_BOOL_E g_bool1 g_time1 g_bool2 aa 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 123 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo o o o o o o Outline This function converts time data into word signed data and outputs the data obtained by
3. 113 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 UOI ONJSUOD auIno mk sr uoqouny INQ Oo uonouny peay 0 moH a 6 pJepuels syoo g uonoun4 gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions b In the case of exponent format High order byte Low order byte String 1st word 2nd word 3rd word gt 13608410 5th word 6th word Float single precision 7th word data HAN 13501314 1EN 1110 LL _ Ll L ee ee eee gt d eee a d 3 With regard to string data six digits excluding the sign decimal point and exponent part are valid and the 7th and later digits are discarded during conversion a In the case of decimal format HUH BES HONBHA 1 2 0 2 3 1 35034 lt _ lt Discarded Float single precision data b In the case of exponent format IAS NOMS 4 1 21E4 1110 1 35034E 10 y Discarded Float single precision data 4 String data in the decimal format is handled as positive value during conversion when the sign is set to 2BH or when the sign is omitted It is handled as negative value during conversion when the sign is set to 2DH 5 String data in the exponent format is handled as positive value during conversion when the sign of the exponent part is set to 2BH or when the sign is omitted It is handled as negative value during co
4. 2 Set data paddy OW TI Q z O N Execution condition Bit Input Counter set value Word signed variable Counter initial value Word signed Output ValueOut Counter current value ANY16 variable Counter output contact Bit Function and operation explanation The counter starts counting when detecting the rising edge from OFF to ON of the input argument Coil It does not start counting if the Coil remains ON The counter starts counting from the value of input argument Valueln When the input argument Preset value is reached the output argument Status turns ON The current count value is stored in the output argument ValueOut pJepues syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 Structured ladder timing chart Instance name ON ON ON COUNTER _FB_ M vals l 1 Var_MO ValueOut Var_D10 10 2 veces Value of Var_D1i0 1X2 X3 _ XV ST Instance name Coil Var_MO Preset 10 Valueln 1 Var M10 ON Var_D10 Instance name ValueOut Var_M10 Instance name Status 1 Var_D10 is a global label and is defined as D10 2 Var_M10 is a global label and is defined as M10 223 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 9 COUNTER_FB_M Cautions 1 Expression in each language of function block 1 Set the instance when using the function block Describe the instance name when programming the
5. 5 3 2 SUB E PRUE FROG Outline This function performs subtraction using two values A B C and outputs the operation result 1 Format Expression in each language Structured ladder ST SUB_E EN _IN1 _IN2 Output label Example SUB_E X000 D0 D10 D20 Function name SUB E 1 Output variable 2 Set data N Execution condition Bit Input abl _IN1 GD Data to be subtracted or word device which stores such data ANY_NUM variable _IN2 GD Data for subtraction or word device which stores such data ANY_NUM Output ENO Execution status Bit variable Ao Word device which will store the operation result ANY_NUM E In explanation of functions I O variables inside are described Explanation of function and operation 1 This function performs subtraction Cst gt Cs2 gt using word signed double word signed float single precision data stored in devices specified in and s2 and outputs the operation result to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Example When the data type is word signed 12345 6789 gt 5556 Word Word Cd Word signed data signed data signed data 138 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Cautions 1 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Us
6. Application Functions 5 8 Standard Character String Functions 5 8 3 INSERT _E o PROVO Fro o Outline This function inserts a character string 3 2 1 Format a Expression in each language Function name Structured ladder ST Oo INSERT _IN1 _IN2 P INSERT Example S5 Label 1 _1N1 1 Label 3 Label 3 qe INSERT ES Label 2 _ INSERT Label 1 Label 2 D20 a D20 _P INSERT_E EN _IN1 _IN2 _P INSERT_E Output label 4 EN ENO Example as INSERT_E Label 1 _IN1 A INSERT_E X000 Label 1 Label 2 352 Label 2 4 _ D20 Label 3 385 D20 P oD o a 1 Output variable 2 Set data Execution condition it Input Head word device which stores a character string to get insertion String variable Head word device which stores a character string to be inserted String so Word device which stores a character position to get insertion Word signed ENO Execution status status Output variable 77 EAT PR RA device which will store a character string obtained by String Cd insertion In explanation of functions I O variables inside are described 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 187 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Explanation of function and operation 1 2 This function inserts a character string stored in devices specified in into an arbitr
7. Explanation of function and operation This function obtains the logical negation using each bit of bit word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in a device specified in Cs gt and outputs the operation result to a device specified in Cd gt using the data type of data stored in a device specified in Cs gt Example When the data type is word unsigned bit string 16 bit jop1sj1jpoj1fop1j1jojofofoj1j1j1 1 Logical negation GiOiijojol1foj1jofoj1j1f1 1jojojojo Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 160 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions Program example O In this program the logical negation is obtained using each bit of word unsigned bit string 16 bit data stored 3 in a device specified in Cs gt and the operation result is output to a device specified in Cd gt using the data type of data stored in a device specified in Cs gt 1 Function without EN ENO NOT 2 Structured ladder a NOT S g_word1 16 AAAA _IN g_word2 16 5555 T ST g_word2 NOT g_word1 Oo Om 2
8. FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline 192 This function replaces a character string 1 Format Expression in each language Structured ladder ST REPLACE _IN1 _IN2 L P Function name REPLACE Example Label 1 _IN1 1 Label 3 Label 3 REPLACE Label 2 3 REPLACE Label 1 Label 2 D20 D20 D30 D30 REPLACE_E EN _IN1 _IN2 REPLACE_E _L P Output label EN ENO Example Label 1 _IN1 cal REPLACE_E X000 Label 1 Label 2 Y Label 2 D20 D30 Label 3 D20 D30 REPLACE _E 1 Output variable 2 Set data Execution condition Bit _IN1 GD Head word device which stores a character string to be replaced String Input _IN2 GD Head word device which stores a replacement character string String vale L aD Word device which stores the number of characters to be replaced Word signed Word device which stores the head character position to be P D replaced in a character string to be replaced CICS OMe ENO Execution status Bit Output variable cD Head word device which will store a character string obtained by String replacement In explanation of functions I O variables inside are described FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Explanation of function and operation o 1 This function replaces specified number of characters from an arbitrary position of a character string 3 stored in devices specified
9. In this program double word signed data stored in a device specified in is converted into word unsigned bit string 16 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DINT_TO_WORD Structured ladder DINT_TO_ WORD g_dint1 12345678 DINT g_word1 16 614E ST g_word1 DINT_TO_WORD g_dint1 2 Function with EN ENO DINT_TO_WORD E Structured ladder g_bool1 DINT_TO WORD E ST g_bool3 DINT_TO WORD_E g_bool1 g_dint1 g_word1 67 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk sr uoqouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oj o o o o o o o Outline This function converts word signed data into double word unsigned bit string 32 bit data and outputs the data obtained by conversion 5 1 17 INT_TO_DWORD _E 1 Format Expression in each language Function name Structured ladder ST INT_TO_DWORD _INT INT_TO_DWORD INT_TO_DWORD Example DO _INT 4 Label INT_TO_DWORD DO INT_TO_DWORD_E EN _INT INT_TO_DWORD INT_TO_DWORD_E Output label x EN ENO Example pl INT 4 INT_TO_DWORD_E X000 DO Label 1 Output variable 2 Set data Input Soo Execution condition it
10. Input Bit le NY wets P PT QD ENO a GD ET d2 PT GD OFF duration data Time Execution status Bit a Output 59 variable O J ET ED OFF duration current value Time m O el In explanation of functions I O variables inside are described gt Explanation of function and operation When a device specified in turns ON this function block turns ON a device specified in dD When a device specified in turns OFF from ON this function block turns OFF a device specified in after the time specified in Cn The elapsed time until a device specified in turns OFF is set to a device specified in dD When a device specified in turns ON again this function block turns ON a device specified in and resets the elapsed time s ss ppy pue s dl q Sama a9uapuodsao7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 221 FXCPU Structured Programming Manual Application Functions 6 Standard Function Blocks 6 8 TOF
11. Outline This function converts string data into time data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST STR_TO_TIME _STRING STR TO TIME STR_TO_TIME Example ee Label 2 Label 1 STRING 1 Label 2 STR_TO_TIME Label 1 STR_TO TIME _E EN STRING X STR_TO TIME_E Output label STR_TO_TIME_E EN ENO Example Label 1 STRING 4 Label 2 STR_TO_TIME_E X000 Label 1 Label 2 1 Output variable 2 Set data Input Execution condition Bit variable _STRING C amp D Conversion source string data String Output Execution status Bit variable sd CD Time data after conversion Time In explanation of functions I O variables inside are described Explanation of function and operation This function converts string data stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd gt gt 1234567 gt 20m34s567ms l String data Time data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data and 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 116 FXCPU Structured Programming
12. Structured ladder 4 aus g_bool INSERT_E as ENO g_bool3 EE O O g_string1 g_string3 Sal ST g_bool3 INSERT_E g_bool1 g_string1 g_string2 g_int1 g_string3 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 189 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions 5 8 4 DELETE _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function deletes a character string 1 Format Expression in each language Function name Structured ladder ST ENEE DELETE IN L P Example DELETE Label 1 E Label 2 Label 2 D10 DELETE Label 1 D10 D20 D20 DELETE _E EN IN L P X DELETETE Output label ENO Example DELETE_E Label 1 _ Label 2 DELETE_E X000 Label 1 D10 D10 D20 Label 2 D20 1 Output variable 2 Set data Execution condition Bit Input IN Es Head word device which stores a character string to get deletion String variable L MD Number of characters to be deleted Word signed P D Head position to get deletion Word signed Execution status Bit Output A Head word device which will store a character string remaining after In explanation of functions I O variables inside are described Explanation of function and operation 1 This function deletes specified number of characters from an arbitrary position of a character string stored in devic
13. g_word1 g_const_word1 6 ST me s y g_bool3 SHR_E g_bool1 g_word1 g_const_word1 g_word2 z a Q O A s ss ppy pue s dl q USamjaq a9uapuodsa o7 153 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions 5 5 Standard Bitwise Boolean Functions 5 5 1 AND E PRUE FROG Outline This function obtains the logical product of two or more bits and outputs it 1 Format i Expression in each language Function name Structured ladder ST AND_E EN _IN _IN Output label Example AND E El AND_E X000 M0 M10 M20 1 Output variable 2 Variable ib Data type Input Execution condition B it vanapie _IN GD Device used to obtain the logical product ANY BIT eumut Execution status Bit variable Ca Device which will store the operation result ANY_BIT In explanation of functions I O variables inside are described Explanation of function and operation 1 This function obtains the logical product using each bit of bit word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in devices specified in and s2 and outputs the operation result to a device specified in Cd_ using the data type of data stored in devices specified in and s2 Example When the data type is word unsigned bit string 16 bit ap1jiprjrfrprjsijojofofoj1ij1 1 1 Logical product jojojof jojo 1fojojo 1 1jo oj0o
14. 1 Format Expression in each language Function name Structured ladder ST GT_E EN _IN _IN Output label Example GT_E X000 D0 D10 M0 GT_E 1 Output variable 2 Set data ts Data type Input Execution condition Bit variable IN G1 Compared data or word device which stores such data ANY_ SIMPLE Output Execution status Bit variable 1 D Device which will store the comparison result Bit In explanation of functions I O variables inside are described Explanation of function and operation 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Cd This function executes comparison GD gt GD amp GD gt ED amp 4 Gnm 1 gt Gsm a This function outputs TRUE when all comparison results are Cs n 1 gt Cs n b This function outputs FALSE when any comparison result is Cs n 1 lt Cs n 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 172 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions Program example O In this program the contents of dev
15. 20S 9230 258 la Text language 1 ST Structured text language 3 The ST language can describe control achieved by syntax using selective branches with conditional Sa statements and repetition by repetitive statements in the same way as high level languages such as C 38 language By using the ST language you can create simple programs easy to understand Y000 X000 OR YOOO AND NOT X001 6 IF X001 THEN TY D2 D0 When X001 is ON the contents of DO are transferred to D2 32 END IF 33 IF X002 THEN S D4 D4 1 When X002 is ON the contents of D4 are added by 1 ay ELSE D6 D6 1 When X002 is OFF the contents of D6 are added by 1 A END IF s ss ppy pue s dl q USamjaq a9uapuodsa o7 1 2 PLC Series and Programming Software Version PLC Series SORGE 9218 Eo MELE GX Works2 version model name FX3U FX3UC FX3G FX2N FX2NC FX1N FX1NC GX Works2 FX1S SW1DNC GXW2 E FXU FX2C FXON FX0 FXOS Ver 1 08J or later 15 FXCPU Structured Programming Manual 1 Outline Application Functions 1 3 Cautions on Creation of Fundamental Programs 13 Cautions on Creation of Fundamental Programs This section explains cautions on programming Refer to the following manual for cautions on structured programs and programming languages Q FX Structured Programming Manual Fundamentals Refer to the following programming manual for detailed operations of and cautions on devices and parameters FX Structured Pr
16. BOOL_TO_DINT_E EN _BOOL Output label Example BOOL_TO_DINT_E X000 MO Label BOOL TO DINT BOOL TO DINT E 1 Output variable Set data Input Execution condition Bit variable _BOOL Gs Conversion source bit data Bit Output Execution status Bit variable 4 Ca Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd ras gt a RE gt a l SS Bit data Double word signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program bit data stored in a device specified in is converted into double word signed data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO BOOL_TO_DINT Structured ladder ST g_boo
17. E E unsigned variable _ WORD Conversion source word unsigned bit string 16 bit data Bit 16 bit Output ENO ere status status variable E ha Time data after conversion Time In explanation of functions I O variables inside are described 6 PJEPUe S Explanation of function and operation This function converts word unsigned bit string 16 bit data stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd Co gt ts aaa gt hs _Y qe mc Word unsigned Time data bit string 16 bit data syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 103 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word unsigned bit string 16 bit data stored in a device specified in is converted into time data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO WORD_TO_TIME Structured ladder WORD_TO_TIME
18. Sa 2 X a Example EE MID_E X000 Label 1 D10 D20 eh MID_E Label 1 _ Label 2 Label 2 D10 D20 1 Output variable 2 Set data Variable Data type 6 Execution condition Bit pe _IN CD Head word device which stores a character string String gt Input Q variable L D Word device which stores the number of characters to be obtained Word signed Sd Word device which stores the head character position of a character I 8 P 2 string to be obtained Word signed Y Output ENO Execution status Bit A variable 4 0 Head word device which will store the obtained character string String In explanation of functions I O variables inside are described s ss ppy pue s dl q USamjaq a9uapuodsa o7 181 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Explanation of function and operation 1 This function extracts specified number of characters from an arbitrary position of a character string stored in devices specified in Cs gt and outputs the obtained data to devices specified in Cd The value specified in specifies the number of characters to be extracted The value specified in specifies the head character position of characters to be extracted Example When 5 is specified in and ABCDEF 12345 EF 123 High order byte Low order byte High order byte Low order byte 1st word 42H B 41H A dario 46H F 45H E 1st word 2nd word 44H D 43H
19. WORD_TO_BOOL_E X000 DO oxo MO Ana 030 EF 1 Output variable e 2 Set data Execution condition Bit Input Word unsigned variable _ WORD Cs Conversion source word unsigned bit String 16 bit data Bit String 16 bit Output Execution status Bit variable 4 0D Bit data after conversion Bit 6 In explanation of functions I O variables inside are described TD fe og Explanation of function and operation z O O This function converts word unsigned bit string 16 bit data stored in a device specified in into bit data and outputs the data obtained by conversion to a device specified in Cd gt A gt sE E A gt RE ZAYAS A AY Word unsigned Bit data bit string 16 bit data gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions Use the function having _E in its name to connect a bus 87 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word unsigned bit string 16 bit data stored in a device specified in is converted into bit data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO WORD_TO_BOOL Structured ladder WORD_TO_BOOL g_word1 16 0001 WORD g_bool1 ST g_bool1 WORD_TO_BOOL g_word1 p 2 Function with EN ENO WORD_TO BOOL E Structured ladder g_bool1 WORD TO B
20. g_int2 4 aus IST a FE g_bool3 MOVE_E g_bool1 g_int1 g_int2 Sia o o 6 plepuejs syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 149 FXCPU Structured Programming Manual Application Functions 5 4 Standard Bit Shift Functions 5 4 Standard Bit Shift Functions PRUE FROG oj o o o o o o o Outline This function shifts data of specified bit length leftward by the specified number of bits 5 4 1 SHL _E 1 Format Expression in each language Function name st SHL _IN _N Example D10 SHL DO K1 SHL SHL_E EN _IN N Output label Example SHL E SHL_E X000 D0 K1 D10 1 Output variable 2 Set data EN Execution condition Bit Input aie _IN Gs Word device which stores data to be shifted leftward ANY_BIT N D Number of shifted bits ANY_BIT Output ENO Execution status Bit variable 1 0D Word device which will store data obtained by shift ANY_BIT In explanation of functions I O variables inside are described Explanation of function and operation 1 This function shifts word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in a device specified in leftward by n bits and outputs the obtained data to a device specified in Cd using the data type of data stored in a device specified in Cs gt Data is shifted leftward by n bits specified in Cn Example When word unsigned bit strin
21. o o o yo o o Outline This function converts word signed data into time data and outputs the data obtained by conversion 5 1 21 INT_TO_TIME _E 1 Format Expression in each language Function name Structured ladder ST INT_TO_TIME _INT INT_TO_TIME INT_TO_TIME Sample DO _INT 4L Label Label INT_TO_TIME DO INT_TO_TIME E iia INT_TO_TIME E EN ENO Example _INT INT_TO_TIME_E X000 DO Label 1 Output variable 2 Set data verle 4 D vive dat terceros Ti In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd gt FFFFh gt 1m5s535ms KS Fr ll Word signed data Time data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 76 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word signed data stored in a device specified in is converted into time dat
22. variable Conversion source word signed data Word signed ENO ere status status va Double Word d variable ouble Word unsigne A AA Double word unsigned bit string 32 bit data after conversion Bit string 32 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into double word unsigned bit string 32 bit data and outputs the data obtained by conversion to a device specified in Cd gt gt L_ 0000FEBBH AH l Word signed data Double word unsigned bit string 32 bit data Each of high order 16 bits becomes 0 after data conversion Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 68 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program word signed data stored in a device specified in is converted into double word 3 unsigned bit string 32 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO INT_ TO DWORD Structured ladder 2 a I
23. Application Functions 5 3 Standard Arithmetic Functions Error An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error 3 code 1 When the value stored in a device specified in is negative Error code K6706 2 2 When the value stored in a device specified in is O T Error code K6706 a 3 When the operation result is outside the following range Error code K6706 27126 lt Operation result lt 2128 OO Program example Se In this program the value stored in a device specified in is raised to the power of the value stored in a 28 device specified in G2 and the operation result is output to a device specified in Cd gt using the data type of S data stored in a device specified in st 1 Function without EN ENO EXPT 4 Structured ladder E 9 EXPT a g_real1 In1 g_real2 yl g_int1 In2 ST g_real2 EXPT g_real1 g_int1 2 Function with EN ENO EXPT_E Structured ladder 6 g_bool1 syoo g uonoun4 pJepuejs ST g_bool3 EXPT_E g_bool1 g_real1 g_int1 g_real2 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 147 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions PRUE FROG oo o o o o o o Outline This function transfers data stored in a device to another device 5 3 7 MOVE _E 1 Format Expression in each language Function name Structured ladder ST
24. Describe the instance name when programming the function block 2 For the function block the automatic allocation device needs to be set as the timer numbers are allocated 2 automatically OO UON ONSUOD uoljoun4 suoljoun4 jo voneuejdx3 peay 0 moH a paddy OW TI gt Q r O Mm plepuejs syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 227 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 12 TIMER_100_FB_M PRUE Z oo o jojojo ojo Outline This function block generates an output when the condition continues for the specified time The initial value and setting value of the timer is multiplied by 100 ms 6 12 TIMER_100_FB_M 1 Format Expression in each language Function name Structured ladder ST Instance name TIMER_100 FB_M TIMER_100 FB M Coil aa TIMER_100_FB_M Coil Preset Valueln 1 Preset Status Valueln 1 Refer to Cautions 2 Set data Execution condition Bit pu Word ened variable Initial timer value Word signed Output ValueOut Current timer value ANY 16 variable Timer output contact Bit Function and operation explanation 1 When the execution condition of the input argument Coil turns ON counting the current value starts The timer starts counting from Valueln x 100 ms When it counts up to Preset x 100 ms the output argument Status turns ON The current measurement valu
25. E Example DWORD_TO_WORD_E X000 ae 9 Label D10 22 2m 2 naw A Oo 1 Output variable ae 2 Set data EN Execution condition ss condition Input a Word unsigned variable _DWORD Conversion source double word unsigned bit string 32 bit data Bit k 32 bit Execution status Output Word unsigned variable Word unsigned bit string 16 bit data after conversion Bit String 16 bit In explanation of functions I O variables inside are described 6 syoo g uonoun4 plepuejs Explanation of function and operation This function converts double word unsigned bit string 32 bit data stored in a device specified in into word unsigned bit string 16 bit data and outputs the data obtained by conversion to a device specified in Cd gt 12345678H gt 5678H A lt Double word unsigned Word unsigned bit string 32 bit data bit string 16 bit data s ss ppy pue s dl q USamjaq a9uapuodsa o7 MAMA MAMA MAMADA 5678H off 4 041 f0 1 100 4 4 4 4 10 0 Oo OO SOT The information stored in high order 16 bits is discarded Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they
26. FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions 5 6 2 MAXIMUM _E THUG ZE ol lo o o oj o oj j o Outline 1 2 This function searches the maximum value among data and outputs the maximum value Format Expression in each language Function name Structured ladder ST MAXIMUM _IN _IN Example D20 MAXIMUM MAXIMUM DO D10 MAXIMUM_E EN _IN IN Output label Example MAXIMUM_E MAXIMUM_E X000 D0 D10 D20 1 Output variable Set data Variable Description Data type Input Execution condition Bit variable IN GD Compared data or word device which stores such data ANY_SIMPLE Output ENO Execution status Bit variable 4 0D Word device which will store the maximum value ANY_SIMPLE In explanation of functions I O variables inside are described Explanation of function and operation 1 This function outputs the maximum value among ANY_SIMPLE type data stored in devices specified in and to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Example When the data type is word signed Word signed data Word signed data Word signed data 2 The number of pins in can be changed Cautions 164 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different f
27. Float single precision tng 0 is stored Y data Number of digits of decimal part 5 6 e In Sign data exponent part 2BH is stored when the input value is positive and 2DH is no stored when the input value is negative El f 30H 0 is stored in the tens place of the exponent part when the exponent part consists of 1 digit Sa Total number of digits 12 digits a A NO n Number of digits of exponent part 2 T AA eT 12 3456 ES i23 4 0516 HEN RON Float single precision oH 0 is stored data 3 OOH is automatically stored at the end 7th word of the character string gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data and 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 85 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error code 1 When the value stored in a device specified in is outside the following range 0 212 lt Value of device specifi
28. Function name Structured ladder ST ABS _IN Example D10 ABS DO ABS_E EN _IN Output label Example ABS_E X000 D0 D10 ABS ABS E 1 Output variable 2 Set data Variable Description Data type Execution condition Bit Input Data whose absolute value is to be obtained or word device which variable Cs i sD stores such data INM IN Output Execution status Bit varianig 1 Cd Word device which will store the operation result ANY_NUM In explanation of functions I O variables inside are described Explanation of function and operation 1 This function obtains the absolute value of word signed double word signed float single precision data stored in a device specified in Cs gt and outputs the operation result to a device specified in Cd gt using the data type of data stored in devices specified in a device specified in Cs gt This function is expressed as follows when the input value is A and the output operation result is B B Al 2 When the data type stored in a device specified in is word signed and the stored data is 32768 this function outputs 32768 to a device specified in Cd The maximum absolute value handled by this function is 32 767 When the data type stored in a device specified in is double word signed and the stored data is 2147483648 this function outputs 2147483648 to a device specified in Cd gt The maximum absolute v
29. 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 132 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is converted into double word unsigned bit 3 string 32 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO TIME_TO DWORD Structured ladder 2 a TIME TO DWORD 2 g_time1 _TIME g_dword1 5 ST g_dword1 TIME_TO_DWORD g_time1 Oo Oa 2 Function with EN ENO TIME_TO DWORD E 28 Structured ladder F g_bool1 TIME TO DWORD _ E 4 ave age 385 sT ER g_dword1 TIME_TO_DWORD g_time1 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 133 FXCPU Structured Programming Manual Application Functions 5 2 Standard Functions Of One Numeric Variable 5 2 Standard Functions Of One Numeric Variable PRUE FROG oo o o o o o o Outline This function obtains the absolute value and outputs it 5 2 1 ABS _E 1 Format Expression in each language
30. B are connected in parallel A B F C E B F H J gt N na i A E o C e You can program a contact on the right side of a coil In this case make sure to program a coil including a function or function block at the end of the circuit A B C D A E ss 2 i ES HH mc O r 2 Coil connection position A E B D C H HAHAHA MH Handling of general flags 18 The following flags are valid in general sequence instructions Examples M8020 Zero flag M8021 Borrow flag M8022 Carry flag M8029 Instruction execution complete flag M8090 Block comparison signal M8328 Instruction non execution flag M8329 Instruction execution abnormal complete flag M8304 Zero flag M8306 Carry flag 1 Supported only in FX3U FX3uc PLCs 2 Supported only in FX3U FX3UC FX3G PLCs Each of these flags turns ON or OFF every time the PLC executes a corresponding instruction These flags do not turn ON or OFF when the PLC does not execute a corresponding instruction or when an error occurs Because these flags are related to many sequence instructions their ON OFF status changes every time the PLC executes each corresponding instruction Refer to examples in the next page and program a flag contact just under the target sequence instruction FXCPU Structured Programming Manual 1 Outline Application Functions 1 3 Cautions on Creation of Fundamental Programs 1 Program containing many flags Example of
31. C character string to 32H 2 1 31H 1 2nd word 3rd word be extracted 00H 33H 3 ivi 4th word 32H 2 31H 1 Sth character ls 6th word OOH 35H 5 Number of characters to be extracted 5 2 A character string data stored in devices specified in indicates the data until OOH is detected first in units of byte in the range starting from the specified device 3 When the number of characters to be extracted specified in is 0 this function does not execute processing 4 When the number of characters to be extracted specified in is 1 this function outputs the final character of a character string specified in to devices specified in Cd Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling character string data Use global labels when specifying labels Error An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error code 1 When 00H is not set in the corresponding device range after the device specified in Error code K6706 2 When the head character position specified in exceeds the number of characters of a character string stored in devices specified in Error code K6706 3 When the number of characters specified in exceeds the range of devices specified in Cd gt
32. Character String Functions 5 8 2 CONCAT _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function connects character strings 1 Format Expression in each language Function name Structured ladder ST CONCAT _IN _IN CONCAT Example Label 3 CONCAT Label 1 _ 1H Label 3 CONCAT Label 1 Label 2 Label 2 CONCAT _E EN _IN _IN Output x CONCAT_E label ENO Example CONCAT_E CONCAT_E X000 Label 1 Label 2 Label 1 _ zd Label 3 Label 3 Label 2 1 Output variable 2 Set data Execution condition Bit Input ae IN GD Head word device which stores the data character string to be String IN GD connected or directly specified character string Execution status Bit Output variable E Head word device which will store the connected data character String Cd string In explanation of functions I O variables inside are described 184 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Explanation of function and operation O 1 This function connects a character string stored in devices specified in after a character string a stored in devices specified in GD and outputs the character string obtained by connection to devices specified in Cd When connecting a character string stored in devices specified in Cs2 this function ignores OOH which 2 indicates the end of a character string stored in devic
33. FX2NC PLC FX1N Series or FX1N PLC FX1NC Series or FX1NC PLC FX1S Series or FX1S PLC FXU Series or FXU PLC FX2C Series or FX2C PLC FXON Series or FXON PLC FXos Series or FXos PLC FXo Series or FXo PLC Special adapters CF card special adapter CF ADP FX3Uu CF ADP Programming language ST Structured ladder Manuals Name Generic name of FX3U Series PLCs Generic name of FX3UC Series PLCs Generic name of FX3G Series PLCs Generic name of FX2N Series PLCs Generic name of FX2Nc Series PLCs Generic name of FX1N Series PLCs Generic name of FX1NC Series PLCs These products can only used in Japan Generic name of FX1S Series PLCs Generic name of FXU FX FX2 Series PLCs Generic name of FX2C Series PLCs Generic name of FXON Series PLCs Generic name of FXos Series PLCs Generic name of FXo Series PLCs Generic name of CF card special adapters Abbreviation of structured text language Abbreviation of ladder diagram language Q FX Structured Programming Manual Fundamentals FX Structured Programming Manual Device amp Common FX Structured Programming Manual Basic amp Applied Instruction FX Structured Programming Manual Application Functions COMMUNICATION CONTROL EDITION ANALOG CONTROL EDITION POSITIONING CONTROL EDITION Abbreviation of QACPU FXCPU Structured Programming Manual Fundamentals Abbreviation of FXCPU Structured Programming Manual Device amp Common Abbreviation of FXCPU S
34. Instruction id AGQMona menue projects of GX Works2 pene FXCPU Structured Programming ae Application functions provided in structured Manual Application Functions A An pee iona Mania projects of GX Works2 pene FX3U FX3UC FX3G PLCs Manual name Manual number supplied with ieee Contents Model or Additional Manual name code PLC main unit I O specifications wiring and installation of the PLC main unit FX3uU extracted from the FX3U Supplied with product Series User s Manual Hardware Edition For detailed explanation refer to the FX3U Series User s Manual Hardware Edition FX3U Series Hardware Manual JY997D18801 Details about the hardware including I O Additional Manual specifications wiring installation and 09R516 maintenance of the FX3U PLC main unit FX3U Series User s Manual Hardware JY997D16501 Edition I O specifications wiring and installation of the PLC main unit FX3uc D DSS extracted from the Supplied with product FX3Uc Series User s Manual Hardware Edition For detailed explanation refer to the FX3UC Series User s Manual Hardware Edition FX3UC D DSS Series Hardware JY997D28601 Manual I O specifications wiring and installation of the PLC main unit FX3Uc 32MT LT 2 extracted from Supplied with product the FX3uc Series User s Manual Hardware Edition For detailed explanation refer to the FX3UC Series User s Manual Hardware Edition FX3UC 32MT LT 2 Hardware Manual JY997D31601 Deta
35. MOVE _IN Example D10 MOVE DO MOVE MOVE_E EN _IN Output label Example MOVE_E MOVE_E X000 D0 D10 1 Output variable 2 Set data abia Data type Input Execution condition Bit variable IN Gs Transfer source data or word device which stores such data ANY owe Execution status Bit variable 1 C amp D Transfer destination word device ANY In explanation of functions I O variables inside are described Explanation of function and operation This function transfers data stored in a device specified in to a device specified in Cd gt RR gt ma ll ZA ll Word signed data Cd Word signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 148 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Program example In this program word signed data stored in a device specified in is transferred to a device specified in 3 Cd 1 Function without EN ENO MOVE Structured ladder 2 MOVE 3 g_int1 _IN g_int2 e ST g_int2 MOVE g_int1 Oo Om 2 Function with EN ENO MOVE_E e 2o Structured ladder S g_bool1 g_bool3
36. Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error 3 code 1 When the sign data of numeric data specified in is any other than 20H space or 2DH Error code K6706 2 2 When the ASCII code for each digit of character string data specified in is any other than 30H 0 to T 39H 9 20H space or OOH NULL a Error code K6706 5 3 When the numeric value specified in is outside the following range 2 147 483 648 to 2 147 483 647 Error code K6706 OO 9T Program example 2S In this program string data stored in a device specified in is converted into time data and the data S obtained by conversion is output to a device specified in CdD 1 Function without EN ENO STR_TO_TIME 4 TI IT Structured ladder 38 Z STR TO TIME 22m g_string1 _STRING g_time1 ST g_time1 STR_TO_TIME g_string1 2 Function with EN ENO STR_TO_TIME_E Structured ladder 6 g_bool1 STR_TO TIME _E EN ENO g_bool3 o TU g_string1 STRING g_time ae of ST a S ay g_bool3 STR_TO_TIME_E g_bool1 g_string1 g_time1 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 117 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo o o o o o o Outline
37. Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error An operation error occurs in the following case The error flag M8067 turns ON and D8067 stores the error code 1 When the number of points occupied by the string data storage destination device specified in Cd gt exceeds the range of the corresponding device Error code K6706 Program example In this program word signed data stored in a device specified in is converted into string data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO INT_TO_ STR Structured ladder ST INT_TO_STR g_string1 INT_TO_STR g_int1 g_int1 12345 INT g_string 12345 2 Function with EN ENO INT_TO_STR_E Structured ladder ST g_bool3 INT_TO_STR_E g_bool1 g_int1 g_string1 INT_TO_STR E EN ENO _INT g_bool1 g_bool3 g_string1 61 auIno ml jsi uoqouny INQ OO uoN onSUOD uojoun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 pJepue s syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 14 DINT TO STR _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts double word signed data into string data and outputs the data obtained by conversion 1 F
38. OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 1 15 INT_TO_WORD _E PROVO FXO oyo po j op ojojojo Outline This function converts word signed data into word unsigned bit string 16 bit data and outputs the data obtained by conversion 1 Format Expression in each language Function name sT INT_TO_WORD _INT INT_TO_WORD INT_TO_ WORD Example y _INT D10 INT_TO_WORD DO INT_TO_WORD_E EN _INT INT_TO WORD_ Output label E Example INT_TO_WORD_E X000 D0 D10 1 Output variable 2 Set data 64 Input Execution condition Bit variable INT G Conversion source word signed data Word signed Execution status Bit Output Word unsigned variable E 1 DD Word unsigned Bit String 16 bit data after conversion Bit String 16 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into word unsigned bit string 16 bit data and outputs the data obtained by conversion to a device specified in Cd gt 22136 gt 5678H i Word signed data Word unsigned bit string 16 bit data Cautions Use the function having _E in its name to connect a bus 5 Applied Funct
39. Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this example BCD data stored in a device specified in is converted into word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO BCD_TO_INT Structured ladder BCD TO_INT g_word1 16 1234 BCD g_int1 1234 ST g_int BCD_TO_INT g_word1 2 Function with EN ENO BCD_TO_INT_E Structured ladder g_bool1 BCD_TO INT _E ENO ST g_bool3 BCD_TO_INT_E g_bool1 g_word1 g_int1 119 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk sr uoqouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 PJEPUe S syoo g uonoun4 gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 42 BCD TO _DINT _E PRUE FROG oo o o o o o o Outline This function converts BCD data into double word signed data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST BCD_TO_DINT _BCD BCD TO DINT BCD_TO DINT Example Label 1 _BCD 4 _ Label 2 Label 2 BCD_TO_DINT Label 1 BCD TO_DINT_E EN BCD X BCD_TO _ DINT_E Output label BCD_TO_DINT_E EN ENO Example BCD 4 BCD_TO_DINT_E X000 Label 1 Label 2 1 Output vari
40. String In explanation of functions I O variables inside are described 2 Set data Explanation of function and operation 1 This function converts word signed data stored in a device specified in into string data and outputs the data obtained by conversion to a device specified in Cd High order byte Low order byte ASCII code for ten thousands place Sign data i 1st word A ASCII code for hundreds placeiASCII code for thousands place 2nd word ASCII code for ones place ASCII code for tens place 3rd word 4th word Word signed data Automatically stored at the end of the character string 2 In Sign data 20H space is stored when the input value is positive and 2DH is stored when the input value is negative 3 20H space is stored in high order digits when the number of significant figures is small Example When 123 is input High order byte Low order byte 20H space 2DH String 1st word 31H 1 20H space 2nd word a 33H 3 32H 2 3rd word Word signed data 0000H 4th word 4 00H is automatically stored at the end 4th word of the character string Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data Use global labels when specifying labels 60 FXCPU Structured Programming
41. bit operation or 2 147 483 647 32 bit operation melee sary OFF When the operation result is 32 767 16 bit operation or less or 2 147 483 647 32 bit operation or less Zero fl Zero flag Zero flag Vax we 2 1 0 32 768 No CAA OE 0 1 2 Pt tall eee Borrow flag The most The most Carry flag significant bit significant bit of data is 1 of data is 0 Zero flag Zero flag 2 1 0 2 147 483 648 lt OT 1 arar ac 0 1 2 KAA Je Borrow flag Zero flag Carry flag Program example In this program subtraction Cs1 Cs2 is performed using time data stored in devices specified in and s2 and the operation result expressed as time data is output to devices specified in Cd 1 Function without EN ENO SUB_ TIME Structured ladder SUB_TIME g_time1 _IN1 g_time2 _IN2 ST g_time3 SUB_TIME g_time1 g_time2 2 Function with EN ENO SUB_TIME_E Structured ladder g_bool1 SUB_TIME E EN ENO _IN1 _IN2 ST g_ bool3 SUB_TIME_E g_bool1 g_time1 g_time2 g_time3 201 auIno ml jsi uoqouny INQ OO UON OnNSUOD uoljoun4 suoljoun jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types 5 9 3 MUL _TIME _E PRUE FROG oo o o o jo o o Outline This function performs multiplication of
42. byte of the 6th word of the character string 62 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data and 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels Error An operation error occurs in the following case The error flag M8067 turns ON and D8067 stores the error code 1 When the number of points occupied by the string data storage destination device specified in Cd gt exceeds the range of the corresponding device Error code K6706 Program example In this program double word signed data stored in a device specified in is converted into string data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DINT_ TO STR Structured ladder DINT TO STR g_dint1 12345678 DINT g_string1 12345678 ST g_string1 DINT_TO_STR g_dint1 2 Function with EN ENO DINT_TO_STR_E Structured ladder g_bool1 DINT TO_STR_E g_bool3 g_string1 ST g_bool3 DINT_TO_STR_E g_bool1 g_dint1 g_stringl 63 UNO ml ys uoyouny INQ OO uoN
43. eo AND_E Obtains the logical product Y Y Y Y v Y Y eee S a s 5 5 1 a oD oe 5 n c oO Subsection oe n 2 6 Standard Selection Functions 6 ae Applicable PLC ae o 2 Function name gt y gt lt x ul e TI se Reference C 2 Z Z Z ul 2 gt Sloj laal rl 8 2 i B ae aa O SEL _E Selects data in accordance with the input y Subsection A condition 5 6 1 DO as Q gt qo Judges whether data is located within the range Subsection LIMITATION _E between the upper limit value and the lower limit 564 value a eea 010 0101010 25 2 Function List FXCPU Structured Programming Manual Application Functions 2 7 Standard Comparison Functions 2 Standard Comparison Functions ApplicablePLE i O PLC _ aap Ppa o pe entes lr le ala ter Compares data with regard to larger or Subsection GE E equal 5 7 2 n Subsection FQ E Compares data with regard to equal 573 Compares data with regard to lt smaller or Subsection LE E a equal 5 7 4 n n Subsection LT_E Compares data with regard to lt smaller 575 n ii Subsection NE_E Compares data with regard to unequal Y Y Y Y Y 576 2 8 Standard Character String Functions nexs 9 X4 N XA NX SILX4 NOXx4 s ox4 9 9 9 3z Applicable PLC Function name Reference Obtains a character string from a specified Subsection MID _E position 5 8 1 Subsection CONCAT _E Connects character strings Y 582 A
44. er targ 09R720 special adapter FX1S FX1N FX2N FX1NC FX2NC PLCs Manual name Manual number Sly tt produci Contents EE or Additional Manual name code PLC main unit FX1S HARDWARE MANUAL JY992D83901 FX1N HARDWARE MANUAL JY992D89301 Details about the hardware including I O FX2N HARDWARE MANUAL JY992D66301 Additional Manual specifications wiring installation and 09R508 maintenance of the FX2N PLC main unit FX1NC HARDWARE MANUAL JY992D92101 FX2NC HARDWARE MANUAL JY992D76401 Programming FX Series User s Manual Data JY997D16901 Communication Edition FX Series User s Manual Data Communication Edition Details about the hardware including I O specifications wiring installation and maintenance of the FX1S PLC main unit Additional Manual Details about the hardware including I O specifications wiring installation and maintenance of the FX1N PLC main unit Additional Manual Details about the hardware including I O specifications wiring installation and maintenance of the FX1NC PLC main unit Japanese only Additional Manual O9R505 Details about the hardware including I O specifications wiring installation and maintenance of the FX2Nc PLC main unit Additional Manual O9R509 Details about simple N N link parallel link computer link and no protocol communication RS instruction and FX2N 232IF Additional Manual 09R715
45. function block 2 For the function block the automatic allocation device needs to be set as the counter numbers are allocated automatically 224 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 10 TIMER_10_FB_M 6 10 TIMER _10 FB M o PKU FXO oyo jyopopojyojojo Outline gt This function block generates an output when the condition continues for the specified time 2 The initial value and setting value of the timer is multiplied by 10 ms 1 Format Oo Expression in each language Function name Structured ladder ST Om 23 Instance name 5 TIMER_10 FB _ M l TIMER_10_FB_M Coil ValueOut aa oo id E Preset Status Valueln 4 amI os O 1 Refer to Cautions a a 339 238 2 Set data 2 Execution condition Bit 5 sa wd ed z variable ss Initial timer value Word signed oo 07 Output ValueOut Current timer value ANY16 variable Timer output contact Bit Function and operation explanation 1 When the execution condition of the input argument Coil turns ON counting the current value starts So The timer starts counting from Valueln x 10 ms When it counts up to Preset x 10 ms the output E argument Status turns ON E The current measurement value is outputted into ValueOut 2 When the execution condition of the input argument Coil turns OFF the current value takes on the value of Valueln and the output argument Status also t
46. function converts word unsigned bit string 16 bit data storeds in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in CdD 5678H E gt 22136 O YY O ll Word unsigned Double word signed data bit string 16 bit data 5678H A lt 7 Data conversion 22136 ooo OTOL TOOTS A A A A A AA AK K A AR Each of high order 16 bits becomes 0 after data conversion syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 93 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word unsigned bit string 16 bit data stored in a device specified in is converted into double word signed data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO WORD_TO_DINT Structured ladder WORD TO_DINT g_word1 16 1234 WORD g_dint1 4660 ST g_dint1 WORD_TO_DINT g_ word 2 Function with EN ENO WORD_TO_DINT_E Struc
47. functions I O variables inside are described 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 195 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Explanation of function and operation 1 This function searches a character string stored in devices specified in from the beginning of a character string stored in devices specified in Cs1 and outputs the search result to devices specified in Cd This function outputs the head character position of the searched character string detected first as the search result 2 Acharacter string data stored in devices specified in indicates the data until OOH is detected first in units of byte in the range starting from the specified device 3 Ifa character string stored in devices specified in cannot be detected in a character string stored in devices specified in Cs this function outputs 0 Input value to Output value ABCD1234567 gt 5 High order byte Low order byte Word signed 1st word 42H B 41H A 2nd word 44H D i 43H C 3rd word 32H 2 1 31H 1 athword 34H 4 33H 3 5th word 36H 6 35H 5 6th word OOH 37H 7 Search of Input value to character string 1234 High order byte Low order byte 1st word 32H 2 31H 1 2nd word 34H 4 33H 3 3rd word 0000H Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character
48. g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 131 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 48 TIME TO DWORD E PRUE FROG oo o o o yo o o Outline This function converts time data into double word unsigned bit string 32 bit data and outputs the data obtained by conversion 1 Format Expression in each language Structured ladder ST TIME_TO_DWORD _TIME TIME_TO_DWOR TIME_TO_ DWORD Example D Label 1 _TIME 1 Label 2 Label 2 TIME_TO_DWORD Label 1 TIME_TO_DWORD_E EN _TIME Output label Example Label 2 TIME_TO_DWORD_E X000 Label 1 Label 2 Function name TIME_TO_DWOR D E 1 Output variable 2 Set data Input Y Execution condition it variable _TIME Conversion source time data Time ENO i Execution status status Output Double Word unsigned variable SS A Double word unsigned bit string 32 bit data after conversion Bit string 32 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into double word unsigned bit string 32 bit data and outputs the data obtained by conversion to a device specified in Cd gt 12m34s567ms gt 1234567 Time data Double word unsigned bit string 32 bit data Cautions
49. g_word1 WORD g_time1 ST g_time1 WORD_TO_TIME g_word1 2 Function with EN ENO WORD_TO_TIME E Structured ladder g_bool1 WORD TO TIME E ST g_bool3 WORD_TO_TIME_E g_bool1 g_word1 g time 104 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 35 DWORD TO_TIME _E o PROVO FXO oyo yop ojojyjojojo Outline 2 This function converts double word unsigned bit string 32 bit data into time data and outputs the data 3 obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST OO Om DWORD_TO_TIME _DWORD 2 DWORD_TO_TIM DWORD_TO_TIME Example al ej E Label 1 DWORD 1 L Label 2 Label 2 e DWORD_TO_TIME Label 1 DWORD_TO_TIME_E EN DWORD TO TIM DWORD Output label 4 EE Example Label 2 DWORD_TO_TIME_E X000 cag 5 Label 1 Label 2 29 gt O O 2270 1 Output variable SS a 2 Set data En Execution condition so condition pe peronon ble Word d variable ouble Word unsigne _DWORD Conversion source double word unsigned bit string 32 bit data Bit 32 bit Output ENO ere status status variable a a Time data after conversion Time In explanation of functions I O variables inside are described 6 pJepues Explanation of function and operation This function converts double word unsigned bit string 32 bit data
50. in Cs2 and the character string obtained by replacement is output to devices specified in Cd gt 1 194 Function without EN ENO REPLACE Structured ladder REPLACE g_string1 ABCDEFGH _IN1 g_string3 AB012345 g_string2 012345678 g_inti 6 g_int2 3 ST g_string3 REPLACE g_string1 g_string2 g_int1 g_int2 Function with EN ENO REPLACE E Structured ladder g_bool1 REPLACE E EN ENO g_bool3 g_string1 _IN1 g_string3 ST g_bool3 REPLACE E g_bool1 g_string1 g_string2 g_int1 g_int2 g_string3 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions 5 8 6 FIND _E o PSO FXO o Outline This function searches a character string 3 2 1 Format a Expression in each language Function name Structured ladder ST Oo FIND _IN1 _IN2 GTN FIND Example E z FIND Label 1 _1N1 iy D20 of Label 2 _IN2 FIND Label 1 Label 2 2 7 FIND_E EN _IN1 IN2 Output label FIND E Example 4 Label 1 aaa aad 1 Label 2 nmr Label 2 225 S2 noD 50 o o 1 Output variable 2 Set data Execution condition Bit ee _IN1 GD Head word device which stores a character string to get search String _IN2 GD Head word device which stores a character string to be searched String Output Execution status Bit variaoie 1 C amp D Head word device which will store the search result Word signed In explanation of
51. in aD the number of characters of a character string stored in devices specified in is regarded as the value specified in aD gt Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling character string data Use global labels when specifying labels s ss ppy pue s dl q USamjaq a9uapuodsa o7 193 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Error An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error code 1 When 00H does not exist in the corresponding device range after the devices specified in and Error code K6706 When the value specified in exceeds the number of characters of a character string stored in devices specified in Error code K6706 When the value specified in is negative Error code K6706 When the value specified in is 2 or less Error code K6706 When the value specified in exceeds the number of characters of a character string stored in devices specified in Error code K6706 Program example In this program specified number of characters starting from an arbitrary position of a character string stored in devices specified in are replaced with a character string stored in devices specified
52. in with a character string stored in devices specified in s2 gt and outputs the character string obtained by replacement to devices specified in Cd gt The value specified in specifies the number of characters to be replaced 2 The value specified in specifies the position from which specified number of characters are replaced Example When 5 is specified in and a O Input value to gt Output value ABCDEFGH123 ABCD1234523 a High order byte Low order byte High order byte Low order byte 3 1st word 42H B 41H A 42H B 41H A 1st word DA 2nd word 44H D 43H C 44H D 43H C 2nd word 23 3rd word 46H F 45H E lt Replacement start 32H 2 31H 1 3rd word S position 4th word 48H H AUG ll Sei character 34H 4 33H 3 4th word 5th word 32H 2 35H 5 5th word 4 6th word OOH 33H 3 6th word a cxXKO 20 Zz So Input value to Number of characters sn 123456 to be replaced 5 NS S O High order byte Low order byte 1st word 32H 2 31H 1 2nd word 34H 4 33H 3 3rd word 36H 6 35H 5 4th word OOOOH 2 Acharacter string data stored in devices specified in indicates the data until OOH is detected first in units of byte in the range starting from the specified device 6 3 When n1 n2 exceeds the number of characters of a character string stored in devices specified in GD excessive characters are not output to devices specified in Cd gt syoo g uonoun4 pJepuejs 4 When 1 is specified
53. into BCD data and outputs the data obtained by conversion 1 Format Expression in each language Structured ladder ST DINT_TO_BCD _DINT DINT_TO BCD DINT_TO_BCD Sonne Label 1 DINT 4 Label 2 Label 2 DINT_TO_BCD Label 1 DINT_TO_BCD_E EN _DINT X DINT TO BCD E Output label DINT_TO_BCD_E Example Label 1 Label 2 DINT_TO_BCD_E X000 Label 1 Label 2 Function name 1 Output variable 2 Set data is Data type Input a alii Double Word signed Output 1 sele analy In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word signed data stored in a device specified in into BCD data and outputs the data obtained by conversion to a device specified in Cd gt 99999999 gt 99999999H ll Double word signed data ANY_BIT data oO O0QO RMN O LOY49 4MMANASOOCOONMN O WO FON TH CO OO OL AYN NNN NANANA N o oco oeo eoe IA e e O N OW FTO N T O NNN NNN N N N A N A A A NN NN A A A AN A NON NN NN NON ON ON os oJoJo O o Ei Make sure to set them to 0 Jl Conversion into BCD data N LO Y 92 N O O O O O O x x x x x x x OFNTOTNATADADTFTNTOTN ST OTN TOTNATOTN TT OTA 99999999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 4 1 0 0 1 Ten millions Millions Hundred Ten Thousands Hundreds Tens Ones place place thousands thousands place place place place plac
54. name O 2 Indicates PLCs which support the function Item Description O The PLC Series supports the function from its first product The supporting status varies on the version A Applicable versions are explained in Cautions 2 X The PLC Series does not support the function 3 3 Indicates the expression of each function S Item Description A Structured ladder Indicates the instruction expression in the structured ladder language ST Indicates the instruction expression in the ST language 3 4 Indicates the input variable name and output variable name of the function as well as the contents and SS data type of each variable q 3 Refer to the following for detailed data types 2 7 Q FX Structured Programming Manual Fundamentals 5 Explanation of function and operation The function executed by this function is explained In explanation the structured ladder language is used as the representative jes l 383 6 Cautions 2S fed Cautions on using the function are described DEE 50 o o 7 Program example Program examples are explained in each language paddy Qi suonoun y O plepuejs syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 35 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 9 Applied Functions This chapter explains the operation outline of each applied function symbols I O
55. part ASCII code for ones place of exponent part 00H 7th word Automatically stored at the end of the character string FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 2 The string data obtained by conversion is output to a device specified in Cd_ as follows 2 a The number of digits is fixed respectively for the integer part decimal part and exponent part as 3 follows Integer part 1 decimal part 5 exponent part 2 2EH is automatically stored in the 3rd byte and 45H E is automatically stored in the 9th byte Total number of digits 12 digits 2 a NaM TI Integer part Decimal part Exponent part 5 1 digit 5 digits 2 digits e rt E ees 12 3456 gt fo NTH 2S 4 POO RENE O WT j EE Float single precision ash E is stored 3 data 2EH is stored nae b In Sign data integer part 20H space is stored when the input value is positive and 2DH is 2 stored when the input value is negative al o c The 6th and later digits of the decimal part are rounded S Total number of digits 12 digits A fo Ny a A ats PHA 2314151877 8 EN 011 E 345678 gt 41h 2134151877 8 ELH ONT E Float single precision Number of digits 2 These digits are rounded 3 D data of decimal part 5 d 30H 0 is stored in the decimal part when the number of significant figures is small Total number of digits 12 digits A _A2 A O Sp
56. space or OOH NULL Error code K6706 3 When the value stored in to Cs 5 is outside the following range 2 147 483 648 to 2 147 483 647 Error code K6706 4 When any of devices to Cs 5 exceeds the device range Error code K6706 Program example In this program string data stored in a device specified in is converted into double word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO STR_TO_DINT Structured ladder STR_TO_DINT g_string1 _ 65000 _ STRING g_dint1 65000 ST g_dint1 STR_TO_DINT g_string1 2 Function with EN ENO STR_TO_DINT_E Structured ladder g_bool1 STRETOSDIN TEE ENO g_bool3 g_dint1 g_stringl _STRING ST g_bool3 STR_TO_DINT_E g_bool1 g_string1 g_dint1 112 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 39 STR TO REAL E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts string data into float single precision data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST STR_TO_REAL _STRING STR_TO REAL STR_TO_REAL Example Label 1 _STRING 4 Label 2 Label 2 STR_TO_REAL Label 1 STR_TO_REAL_E EN STRING X STR_TO_REAL_E Output label STR_TO_REAL_E EN ENO Example
57. structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels Program example In this program the contents of devices specified in and are compared and the operation result is output to a device specified in Cd Structured ladder ST g_bool3 LT_E g_bool1 g_int1 g_int2 g_bool2 178 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions 1 57 6 NEE o PRU OT oyo po o o o o o Outline 2 This function compares data with regard to unequal 3 2 1 Format a Expression in each language Function name Structured ladder ST NE_E EN _IN1 _IN2 Output label Oo Om Example z NE_E X000 D0 D10 M0 39 NEE aS O 1 Output variable ene 552 2 AA 2 Set data 333 oD Execution condition Bit pene IN1 GD Compared data or word device which stores such data ANY_SIMPLE variable _IN2 GD Compared data or word device which stores such data ANY_ SIMPLE Output Execution status Bit variable 1 CdD Device which will store the comparison result Bit In explanation of functions I O variables inside are described 6 Explanation of function and operation This function compares the contents of devices specified in and s2 gt and outputs the oper
58. time data 1 Format Expression in each language Structured ladder ST MUL_TIME _IN1 _IN2 MUL_TIME Example MUL_TIME Label 1 _IN1 1 _ Label 3 Label 3 Label 2 _IN2 MUL_TIME Label 1 Label 2 Function name MUL TIME E EN IN1 IN2 X MUL_TIME_E Output label EN ENO Example ae 1 IN1 4 Label 3 MUL_TIME_E X000 Label 1 z Label 2 Label 3 MUL TIME E Label 2 _IN2 1 Output variable 2 Set data Execution condition Bit see IN1 GD Head word device which stores time data to get multiplication Time variable _IN2 GD Multiplication data or head word device which stores such data ANY_NUM Output Execution status Bit 2 variable Head word device which will store the operation result Time In explanation of functions I O variables inside are described Explanation of function and operation This function performs multiplication Cst gt xCs2 gt using time data stored in devices specified in and Cs2 and outputs the operation result expressed as time data to devices specified in CdD Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Even if underflow or overflow occurs in t
59. word signed data stored in devices specified in and Cs2 and the operation result is output to a device specified in Cd Structured ladder g_bool1 ST g_bool3 SUB_E g_bool1 g_int1 g_int2 g_int3 139 suoloun 4 jo voneuejdx3 SosseJppy pue Sedlneq USIMJSA UOONISUOS auIno mk jsi uoqouny NS OO peay 0 moH a uonouny 6 syoo g uonoun4 PJEPUe S gt a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions 9 3 3 MULE 140 PRUE FROG oo o o o jo o o Outline This function performs multiplication using two values A x B C and outputs the operation result 1 Format Expression in each language Structured ladder ST MUL_E EN _IN IN Output label Example MUL_E X000 D0 D10 D20 Function name MUL_E 1 Output variable 2 Set data beta Data type Input Execution condition Bit variable IN GD Data for multiplication or word device which stores such data ANY_NUM output Execution status Bit ae 41 wm Word device which will store the operation result ANY_NUM In explanation of functions I O variables inside are described Explanation of function and operation 1 This function performs multiplication Cs xCD using word signed double word signed float single precision data stored in devices specified in and s2 and outputs the operation result to a device specified in Cd_
60. word unsigned bit string 16 bit data is stored in a device specified in Cs gt and 8 is specified in O mm jo a Word unsigned Cd Word unsigned bit string 16 bit data bit string 16 bit data 270FH ojo 1fojoj1 1f1tfofojojoj1j1 1 1 a OS uv a a 27H 0 o jo o o ojo jojojo 1 o o 1 1ija OH nw These bits become 0 2 n bits from the most significant bit become 0 152 FXCPU Structured Programming Manual Application Functions 5 4 Standard Bit Shift Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 2 Use global labels when specifying labels Program example S In this program word unsigned bit string 16 bit data stored in a device specified in is shifted rightward by n bits and the obtained data is output to a device specified in Cd gt using the data type of data stored in a device specified in Cs gt OO 1 Function without EN ENO SHR SS 22 Structured ladder S S O SHR g_word1 16 EEEE _IN g_word2 16 03BB g_const_word1 16 0006 k 4 ams ST SE o 0 g_word2 SHR g_word1 g_const_word1 z SE o o 2 Function with EN ENO SHR_E Structured ladder g_bool1
61. 0 D0 D10 D20 MINIMUM_E EN ENO MINIMUM_E 1 Output variable 2 Set data bake Data type Input Execution condition Bit variable IN GD Compared data or word device which stores such data ANY_SIMPLE Output Execution status Bit valiadle 1 D Word device which will store the minimum value ANY_ SIMPLE In explanation of functions I O variables inside are described Explanation of function and operation 1 This function outputs the minimum value among ANY_SIMPLE type data stored in devices specified in and to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Example When the data type is word signed MINIMUM Word signed data IN IN Word signed data Word signed data 2 The number of pins in can be changed Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 166 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions Program example O In this program the minimum value among word signed data stored in devices specified in and IS J output to a device specified in CdD using the data ty
62. 1 g_dint1 g dword 71 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk sr uoqouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo o o o o o o Outline This function converts word signed data into BCD data and outputs the data obtained by conversion 5 1 19 INT_TO_BCD _E 1 Format Expression in each language Structured ladder ST INT_TO _BCD _INT INT_TO BCD INT_TO_BCD Example Function name INT_TO_BCD_E EN _ INT Output label Example INT TO BCD_E X000 D0 D10 INT TO BCD E 1 Output variable 2 Set data Input Execution condition Bit variable INT ES Conversion source word signed data Word signed Execution status Bit Output variable 4 ED BCD data after conversion Mi pel AR In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into BCD data and outputs the data obtained by conversion to a device specified in Cd 9999 E gt 9999H Word signed data Word unsigned bit string 16 bit data 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1 9999 ojo 1jojoj1 l1 j1ijo ofjojo l1ij1ij1l1 ae
63. 11 FXCPU Structured Programming Manual Application Functions F X0 F Xos F Xon FXu FX2c PLCs whose production is finished Manual name Manual number Sipe ett proauci Contents akei or Additional Manual name code PLC main unit FXo FXoN HARDWARE MANUAL JY992D47501 Details about the hardware including I O FXos HARDWARE MANUAL JY992D55301 Supplied with product specifications wiring installation and maintenance of the FXos PLC main unit FX FX2c HARDWARE MANUAL JY992D47401 Programming JY997D16901 Manuals of models whose production is finished Production is finished for FXo FXos FXoN FXU FX2C PLCs Details about the hardware including I O specifications wiring installation and maintenance of the FXo FXoN PLC main unit Supplied with product Details about the hardware including I O specifications wiring installation and maintenance of the FXU FX2c PLC main unit Supplied with product Details about simple N N link parallel link computer link and no protocol communication RS instruction and FX2N 232IF FX Series User s Manual Data Communication Edition Additional Manual 09R715 12 FXCPU Structured Programming Manual Application Functions Generic Names and Abbreviations Used in Manuals Abbreviation generic name MOS FX3U Series or FX3U PLC FX3UC Series or FX3uc PLC FX3G Series or FX3G PLC FX2N Series or FX2N PLC FX2NC Series or
64. 16 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into word unsigned bit string 16 bit data and outputs the data obtained by conversion to a device specified in Cd gt 18234ms gt 1234 Time data Word unsigned bit string 16 bit data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 130 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is converted into word unsigned bit string 16 3 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO TIME_TO WORD Structured ladder 2 a TIME _TO WORD 2 g_time1 _TIME g_word1 5 ST g_word1 TIME_TO_WORD g_time1 Oo oe 2 Function with EN ENO TIME_TO_ WORD E 23 cs Structured ladder S g_bool1 TIME_TO WORD E mm x E xo 25 eu EE 2 oD g_bool3 TIME_TO_WORD_E g_bool1 g_time1 g_word1 aa 6 syoo
65. 3 2 Function with EN ENO NOT_E 55 Structured ladder g_bool1 g_bool3 4 g_word2 x 9 285 je sT ER o g_bool3 NOT_E g_bool1 g_word1 g_word2 6 syoo g uonoun4 puepuels gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 161 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions 5 6 Standard Selection Functions 5 6 1 SEL _E PRUE FROG oj o o o o o o o Outline This function selects either one between two data in accordance with the input condition and outputs the selection result 1 Format Expression in each language Structured ladder ST SEL _G _INO _IN1 Function name D20 SEL M0 D0 D10 SEL SEL_E EN G INO IN1 Output label Example SEL_E SEL_E X000 M0 D0 D10 D20 1 Output variable 2 Set data sareboe 1 D or eco wich wit sere the selecione ANY In explanation of functions I O variables inside are described Explanation of function and operation This function outputs either one between the values stored in devices specified in and in accordance with the value stored in a device specified in to a device specified in Cd gt using the data type of data stored in a device specified in and s3 When the value stored in a device specified in is FALSE this function outputs the value stored in a device specified in to a device specified in Cd When the value stored in a device specified i
66. 5 Subsection 5 1 36 Subsection 5 1 37 Subsection 5 1 38 Subsection 5 1 39 Subsection z y y y y y Subsection 5 1 41 BCD TO DINT _E Converts BCD data into double word signed gt y y y P y y P Subsection data 5 1 42 TIME_TO_BOOL _E Converts time data into bit data secu TIME_TO_INT _E Converts time data into word signed data a TIME_TO_DINT _E Converts time data into double word signed y y y y y y y y Subsection data 5 1 45 TIME_TO_STR _E Converts time data into string data ef fo fof fp fp oo Converts time data into word unsigned bit y y 7 y P y r Subsection TME TOWAR DCE string 16 bit data 5 1 47 TIME_TO DWORD Converts time data into double word unsigned y y y y y y y Subsection _E bit string 32 bit data 5 1 48 1 The function is provided in the FX3G Series Ver 1 10 or later paddy OW Converts word unsigned bit string 16 bit data into time data DWORD_TO_TIME Converts double word unsigned bit string 32 _E bit data into time data WORD_TO_TIME _E Y suonoun y Y O STR_TO_BOOL _E Converts string data into bit data STR_TO_INT _E Converts string data into word signed data pJepuels Converts string data into double word signed data Y syoo g uonoun4 STR_TO_DINT _E Converts string data into float single precision data x STR_TO_REAL E gt STR_TO_TIME _E Converts string data into time data BCD_TO_INT _E Converts BCD data into
67. 8 Intelligent function unit Ux Gn MW14 x n U0 G09 device MD14 x n U0 G09 MW2 n R32766 Extension register MD2 n e o Extension file register ER No No correspondence Pointer A en NULL character E Nesting MW7 n Index register MD7 n State No correspondence Example of correspondence between device and address Address MX0 499 MX3 191 MX5 191 A MD3 190 MX4 99 MX6 99 MW4 99 MD4 98 MWO 199 MDO 198 MW14 0 10 MD14 0 9 MW2 32767 MD2 32766 No correspondence A 7 MD7 6 229 auIno ml jsi uoqouny INQ OO uoN OnNSUOD uoljoun4 suoljoun4 jo uoneue dxy peay 0 moH a paddy Qi suoloun4 O plepuejs TI 2 gt O 5 Ww O gt w s ss ppy pue s dl q USamjaq a9uapuodsao7 FXCPU Structured Programming Manual Application Functions Warranty Warranty 230 Please confirm the following product warranty details before using this product 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 However if repairs are required onsite at domestic or overseas location expenses to send an engineer will be solely at the customer s discretion Mitsubishi sh
68. A eee aio ence eink 1 3 5 Handling of operation error flaQ oococccoocccncoconnnnnononnnnnnononononnonnnnnonnancnnnnnnnnnnnnnos 2 Function List 2 1 Type Conversion FUNCUOA Sd ea dd ecaeec te 2 2 Standard Functions Of One Numeric Variable cooccoccccnnncocnonnconncnanoncnnnnnnnnnos 2 3 Standard Arithmetic FUNCTIONS o oooconcccccccnccnccncnononcnononannnnnnnnonnnnnoncnnnnn non nonanna na nnnnn 2 4 Standard Bit Shift FUNCHtIONS 0 cccccccccseceecc ese seccenseseseeeesevesseceececesseceeceveseecusaaes 2 5 Standard Bitwise Boolean FUNCTIONS 0 0 0 0 ce cec cece ecceeeeeeeeeeeeeeeseeeeeeeeeeeeensaueaeeaeeaes 2 6 Standard Selection FUNCTIONS coocconccocncocncocncnnnoncnonnonnnnnnnnnnonnronnrnnnnonanonnonanenanenanons 2 7 Standard Comparison FUNC IONS oocccoccncccccnconcncconnnonnnnononnnnnnnnonnnnnnonnnonnnnnnnnnnnnnons 2 8 Standard Character String FUNC IONS cccoonccnccncccnconoccncnnncononnnnononnnnnnconanonconaninnnnos 2 9 Functions Of Time Data Type S idas soda ada 2 10 Standard FUNCION BIOCKS iio arenas 3 Function Construction 3 1 Applied Function Expression and Execution Typ oocccocccoccncoccconcnconncnncnconcnnnononoss SN EE 0 AN A A E E en TE S E ae ee 3 9 Device and AGOKCSS cuota vet E EE Sd ENANA ENO nu sts Secs ce ace eae AE 4 How to Read Explanation of Functions FXCPU Structured Programming Manual Application Functions Table of Contents 5 Applied Func
69. ADD TIME _E PETC FXO oyo po j op ojyjojpojo Outline This function adds time data 1 Format Expression in each language Function name ADD TIME ADD TIME Label 1 _IN1 a Label 2 _IN2 xX ADD TIME E ADD TIME E a DF 2n Label 1 _IN1 e Label 2 _IN2 1 Output variable Structured ladder ST ADD_TIME _IN1 _IN2 Example Label 3 ADD_TIME Label 1 Label 2 ADD_TIME_E EN _IN1 _IN2 Output label Example ADD_TIME_E X000 Label 1 Label 3 Label 2 Label 3 2 Set data varado 1 CD pene word device hin wil tre the opeatonresut Tin In explanation of functions I O variables inside are described Explanation of function and operation This function performs addition GD s of time data stored in devices specified in and s2 and outputs the operation result expressed as time data to devices specified in CdD 198 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Even if underflow or overflow occurs in the operation result it is not regarded as an operation error However no
70. AL DINT_TO_REAL Example Label 1 a_Dint 4 Label 2 Label 2 DINT_TO_REAL Label 1 DINT_TO_REAL_E EN a_Dint DINT_TO_REAL Output label E gt Example Label 2 DINT_TO_REAL_E X000 Label 1 Label 2 1 Output variable 2 Set data Input Execution condition Bit variable a_Dint Cs Conversion source double word signed data Double Word signed Output Execution status Bit variable 4 Cd Float single precision data after conversion FLOAT Single Precision In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word signed data stored in a device specified in into float single precision data and outputs the data obtained by conversion to a device specified in Cd 16543521 gt 16543521 0 K A AA l Double word signed data Float single precision data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 The function is provided in the FX3G Series Ver 1 10 or later 58 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example
71. Changes for the Better e MITSUBISHI i PROGRAMMABLE CONTROLLERS MIELSE GAP FXCPU Structured Programming Manual Application Functions FXCPU Structured Programming Manual Application Functions FXCPU Structured Programming Manual Application Functions 7 2009 Foreword This manual contains text diagrams and explanations which will guide the reader through the safe and correct installation use and operation of the FX Series function for structured programs It should be read and understood before attempting to install or use the unit Store this manual in a safe place so that you can take it out and read it whenever necessary Always forward it to the end user 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 2009 MITSUBISHI ELECTRIC CORPORATION FXCPU Structured Programming Manual Application Functions Outline Precautions e This manual provides information for the use of the FX Series Programmable Controllers The manual has been written to be used by trained and competent personnel The definition of such a person or persons is as follows a Any engineer who is responsible for the planning design and construction of automatic e
72. E o yo po o o o o o Outline 1 2 This function performs division using two values A B C remainder and outputs the quotient Format Barc Expression in each language unction name Structured ladder ST DIV_E EN _IN1 _IN2 Output label DIV E Example 7 DIV_E X000 D0 D10 D20 1 Output variable Set data N Execution condition Bit Input abl _IN1 GD Data to be divided or word device which stores such data ANY _NUM variable _IN2 G2 Data for division divisor or word device which stores such data ANY_NUM Output ENO Execution status Bit variable Word device which will store the operation result ANY_NUM In explanation of functions I O variables inside are described Explanation of function and operation This function performs division Cs1 Cs2 using word signed double word signed float single precision data stored in devices specified in and s2 and outputs the operation result to a device specified in Cd using the data type of data stored in devices specified in and s2 Example When the data type is word signed Quotient E UA ll e MM _ ee Word Word Cd Word signed data signed data signed data Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 b
73. ENO CTUD Structured ladder CTUD_Instance g_bool1 g_bool2 g_bool3 g_bool4 g_int1 ST CTUD_Instance CU g_bool1 CD g_bool2 RESET g_bool3 LOAD g_bool4 PV g_int1 g_ bool5 CTUD_Instance QU g_ bool6 CTUD_Instance QD g_int2 CTUD_Instance CV 2 Function with EN ENO CTUD E Structured ladder CTUD E Instance MO M10 g_bool1 g_bool5 g_bool2 g_bool6 g_bool3 g_int2 g_bool4 g_int1 ST CTUD_E Instance EN M0 CU g_bool1 CD g_bool2 RESET g_bool3 LOAD g_bool4 PV g_int1 M10 CTUD_E Instance ENO g_bool5 CTUD_E Instance QU g_bool6 CTUD_E Instance QD g_int2 CTUD E Instance CV FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 6 TP _E 1 6 6 TP _E o PKU FRO o otof ot otot x x 2 Outline gt This function block keeps ON a signal for specified duration z 1 Format A Expression in each language Structured ladder ST Function name Oo TP IN PT 1 On Instance name Example aa TP Instance name IN M0 o M10 PT Label 1 e Label 1 Label 2 M10 Instance name Q Label 2 Instance name ET TP_E EN IN PT 1 4 XO Example mmx TPE Instance name EN X000 38 2 T IN M0 PT Label 1 Sa 3 MO M10 M10 Instance name Q ga e Label 1 Label 2 Label 2 Instance name ET ga 1 Refer to caution points 5 T1 2 Set data 53 0 Variable Description Data type p Execution condition Bit Jan N Cs ON start
74. ER 10 PB Monica 225 0 11 TIMER CONT FB Merca a e o oa O 226 6 12 TIMER_100 FB M c ccceccccssescccessesessercecerseceecerceceusaeeevausarcrvaversaueasausasersveasnitareesersaversnneeeeeenes 228 Appendix A Correspondence between Devices and Addresses 229 A Eaa PP AP aaaea 230 REVISION ISO leido 231 FXCPU Structured Programming Manual Application Functions Positioning of This Manual This manual explains application functions for structured programs provided by GX Works2 Refer to other manuals for devices parameters and sequence instructions Refer to each corresponding manual for analog communication positioning control and special units and blocks 1 When using FX3uU FX3uc FX3G PLCs QCPU FXCPU Structured Programming Manual Fundamentals Additional Manual Q FX Structured This manual explains programming methods specifications functions etc required to create structured programs FX Structured FX Structured This manual FX Structured Special unit block FXCPU Structured Programming Manual Device amp Common Additional Manual This manual explains devices and parameters for structured programs provided by GX Works2 FXCPU Structured Programming Manual Basic amp Applied Instruction Additional Manual This manual explains sequence instructions for structured programs provided by GX Works2 FXCPU Structured Programming Manual Application Functions Addi
75. Error code K6706 4 When the number of devices after the device number specified in Cd is smaller than the number of devices required for storing an extracted character string In this case 00H cannot be stored after all character strings and the final character Error code K6706 5 When the value specified in is negative Error code K6706 6 When the value specified in is 2 or less Error code K6706 7 When the value specified in exceeds the number of characters of a character string stored in devices specified in Error code K6706 182 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Program example O In this program specified number of characters are extracted from an arbitrary position of a character string 3 stored in devices specified in Cs gt and the obtained data is output to devices specified in Cd 1 Function without EN ENO MID Structured ladder 2 MID E g_string1i ABCDEF12345 _IN g_string2 EF123 e g_intl 5 L E g_int2 5 p ST 3 g_string2 MID g_string1 g_int1 g_int2 S5 2 Function with EN ENO MID_E S Structured ladder 4 g_bool1 amI 2 2 g_string1 S 2 o 258 Sl a ST g_bool3 MID_E g_bool1 g_string1 g_int1 g_int2 g_string2 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 183 FXCPU Structured Programming Manual Application Functions 5 8 Standard
76. IME g_time1 _IN1 g_time2 _IN2 ST g_time3 ADD_TIME g_time1 g_time2 2 Function with EN ENO ADD_TIME_E Structured ladder g_bool1 ADD TIME E EN ENO _IN1 _IN2 ST g_bool3 ADD_TIME_E g_bool1 g_time1 g_time2 g_time3 199 auIno ml jsi uoqouny INQ OO UON OnNSUOD uoljoun4 suoljoun jo voneuejdx3 peay 0 moH a 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types PRUE FROG oo o o o jo o o Outline This function performs subtraction of time data 5 9 2 SUB_TIME _E 1 Format Expression in each language Function name Structured ladder ST SUB_TIME _IN1 _IN2 SUB_TIME Example SUB_TIME Label 1 _IN1 1 Label 3 Label 3 Label 2 _IN2 SUB_TIME Label 1 Label 2 SUB_TIME_E EN _IN1 _IN2 X SUB _TIME_E Output label EN ENO Example PUB TME E Labeli IN Label 3 SUB_TIME_E X000 Label 1 Label 2 Label 3 Label 2 _IN2 1 Output variable 2 Set data Execution condition Bit see IN1 GD Head word device which stores time data to get subtraction Time variable _IN2 G amp D Head word device which stores subtraction data Time Output Execution status Bit variaoie 1 C amp D Head word device which will store the operation result Time In explanation of functions I O variables inside are descri
77. Label 1 STRING 4 _ Label 2 STR_TO_REAL_E X000 Label 1 Label 2 1 Output variable 2 Set data Input Execution condition Bit variable _STRING Cs Conversion source string data String Output Execution status Bi variable CM Float single precision data after conversion FLOAT Single Precision In explanation of functions I O variables inside are described Explanation of function and operation 1 This function converts string data in the decimal format or exponent format stored in a device specified in into float single precision data and outputs the data obtained by conversion to a device specified in Ed High order byte Low order byte String 1stword ASCII code for 1st character Sign data 2nd word ASCII code for 3rd character ASCII code for 2nd character 3rd word ASCII code for 5th character ASCII code for 4th character 4th word ASCII code for 7th character ASCII code for 6th character E gt 5th word ASCII code for 9th character ASCII code for 8th character PENO AS 6th word ASCII code for 11th character ASCII code for 10th character Float single precision data 7th word 0000H Indicates the end of the character string 2 The conversion source string data can be in the decimal format or exponent format a In the case of decimal format High order byte Low order byte String 1st word 2nd word 3rd word 4th word gt aa E Sth word o eee Float single precision data
78. N ENO Example ae q IN1 Fl Label 3 DIV_TIME_E X000 Label 1 z Label 2 Label 3 DIV_TIME_E Label 2 _IN2 1 Output variable 2 Set data Execution condition Bit see IN1 GD Head word device which stores time data to get division Time variable E _IN2 GD Division data or head word device which stores such data ANY_NUM Output Execution status Bit 2 variable Head word device which will store the operation result Time In explanation of functions I O variables inside are described Explanation of function and operation 1 This function performs division Cs1 Cs2 using time data stored in devices specified in and s2 and outputs the operation result expressed as time data to devices specified in Cd gt 2 The contents of devices specified in are ANY _NUM type data except 0 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels Error 1 An operation error occurs when the divisor stored in devices specified in is O and the function is not executed 2 An operation error occurs when the operation result exceeds 2 147 483 647 204 FXCPU Structured Programming Manual Application Fun
79. NT TO DWORD 2 g_intt 10 INT g_dword1 16 0000000A 5 ST g_dword1 INT_TO_DWORD g_int1 Oo og 2 Function with EN ENO INT_TO_DWORD_E BS Structured ladder S g_bool1 INT_TO_DWORD_E ENO l g_bool3 4 g_dword1 amI cxo 2a o gt Oo ST S e g_bool3 INT_TO_DWORD_E g_bool1 g_int1 g_dword1 9 2 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 69 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 18 DINT_TO DWORD E 70 PRUE FROG oo o o o o o o Outline This function converts double word signed data into double word unsigned bit string 32 bit data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST DINT_TO_DWORD _DINT DINT_TO_DWOR DINT_TO_DWORD Example D Label 1 _DINT 1 Label 2 Label 2 DINT_TO_DWORD Label 1 DINT_TO_DWORD_E EN _DINT Output label Example Label 2 DINT_TO_DWORD_E X000 Label 1 Label 2 DINT_TO_DWOR DE 1 Output variable 2 Set data Input TS Execution condition it variable _DINT Conversion source double word signed data Double Word signed ENO f Execution status status Output Double Word unsigned variable A ae Double word unsigned bit string 32 bit data after conversion Bit string 32 bit In explanation of fun
80. O In this program double word signed data stored in a device specified in is converted into float single 2 precision data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DINT_TO_REAL Structured ladder 2 o DINT TO REAL 2 g_dint1 65000 a Dint g_real1 65000 0 ST g_real1 DINT TO REAL g_dint1 Oo SS 2 Function with EN ENO DINT_TO_REAL_E 28 Structured ladder S g_bool1 DINT_TO REAL E 4 awe 2a ST S e g_bool3 DINT_TO_REAL E g_bool1 g_dint1 g_real1 9 2 6 pJepues syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 59 5 Applied Functions 5 1 Type Conversion Functions FXCPU Structured Programming Manual Application Functions 5 1 13 INT_TO_STR _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts word signed data into string data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST INT_TO_STR _INT INT_TO_STR INT_TO_STR Sample DO _INT 4 Label Label INT_TO_STR DO INT_TO_STR E ra ER INT_TO_STR E EN ENO Lanoe _INT INT_TO_STR_E X000 DO Label 1 Output variable Input lt Execution condition it variable Conversion source word signed data Word signed Output ENO o Execution status status Bit variable SS String data after conversion
81. OL_TO_ DWORD Structured ladder 2 a g_bool1 BOOL_TO DWORD a _BOOL g_dword1 S ST g_dword1 BOOL_TO _DWORD g_bool1 Oo Om oc 2 Function with EN ENO BOOL_TO_DWORD_E 28 Structured ladder S g_bool1 BOOL_TO DWORD E g_bool3 4 g_dword1 amI Cx oO 2p en SE g_bool3 BOOL_ TO DWORD E g_bool1 g bool2 g_dword1 3 S 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 45 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo o o o o o o Outline This function converts bit data into time data and outputs the data obtained by conversion 5 1 6 BOOL TO TIME _E 1 Format Expression in each language Function name Structured ladder ST BOOL_TO_TIME _BOOL BOOL_TO_TIME Example Label BOOL_TO_TIME MO BOOL_TO_TIME_E EN BOOL Output label Example BOOL_TO_TIME_E X000 MO Label BOOL TO TIME BOOL_TO_TIME_ E 1 Output variable 2 Set data In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd gt raise gt 0 RUE gt ts FH _Y SS ll Bit data Time data Cautions 1 Use the function having _E in its name to connect a bus 2 When handl
82. OOL E g_bool3 g_bool2 ST g_bool3 WORD_TO_BOOL E g_bool1 g word1 g_bool2 88 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 27 DWORD_TO BOOL _E o PROVO FXO oyo yop ojojyjojojo Outline 2 This function converts double word unsigned bit string 32 bit data into bit data and outputs the data 3 obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST Oo OTI DWORD TO BOOL DWORD i DWORD_TO BO DWORD TO_ g Example Ja OL Label DWORD MO MO S DWORD_TO_BOOL Label DWORD TO BOOL E EN NORTA _DWORD Output label 4 OL E Example DWORD_TO BOOL_E X000 oxo Label MO D Si 2 ee 1 Output variable a a 2 Set data En Execution condition so condition pe peronon ble Word d variable ouble Word unsigne _DWORD Conversion source double word unsigned bit string 32 bit data Bit 32 bit Output ENO Execution status status variable n a Bit data after conversion In explanation of functions I O variables inside are described 6 pJepues Explanation of function and operation This function converts double word unsigned bit string 32 bit data stored in a device specified in into bit data and outputs the data obtained by conversion to a device specified in Cd gt gt FALSE 12345678H gt TRUE l 1 r mV Double word
83. ORD DINT_TO_WORD E 1 Output variable 2 Set data Input TS Execution condition it variable _DINT Conversion source double word signed data Double Word signed ENO i Execution status status Output Word unsigned variable Se eee Word unsigned bit string 16 bit data after conversion Bit String 16 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word signed data stored in a device specified in into word unsigned bit string 16 bit data and outputs the data obtained by conversion to a device specified in CdD 12345678 gt 614EH a q Double word signed data Word unsigned bit string 16 bit data 12345678 ojojojojojo ofo 1 0 1 1 1 j0J0 0 1 1ofojojof1 o 4 Joo 1 4 1 0 614E Sf of sf fofof offs ol loola 0 auaa The information stored in high order 16 bits is discarded Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 66 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example
84. RIG g_ bool1 _CLK QtL g_bool2 ST R_TRIG_Instance _CLK g_bool1 g_ bool2 R_TRIG_Instance Q 2 Function with EN ENO R_TRIG_E Structured ladder R_TRIG_E_ Instance X000 R TRIG E ST R_TRIG_E Instance EN X000 CLK g_bool1 Y010 R_TRIG_E Instance ENO g_bool2 R_TRIG_E Instance Q 207 auIno mk sr uoqouny INQ Oo UOoN OnNSUOD uojoun4 suoljoun4 jo voneuejdx3 peay 0 moH a paddy OW TI Q z O N pJepues syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 2 F_TRIG _E 6 2 F_TRIG _E PRUE Z o olol olo lololo Outline This function block detects the falling edge of a signal and outputs pulse signal 1 Format Expression in each language Structured ladder ST F_TRIG _CLK 1 Instance name Example F_TRIG F_TRIG Instance name _CLK MO MO _CLK M10 M10 Instance name Q Function name Instance name F_TRIG_E EN _CLK 1 Example IG E F_TRIG_E a O Instance name EN X000 _CLK MO _CLK Q M10 Instance name Q 1 Refer to caution points 2 Set data Variable Description Data type Input Execution condition Bit variable CLK Input signal whose falling edge is to be detected Bit Output ENO Execution status Bit variable Q 1D Output signal Bit In explanation of functions I O variables inside ar
85. This function converts BCD data into word signed data and outputs the data obtained by conversion 5 1 41 BCD_TO_INT _LE 1 Format Expression in each language Structured ladder ST BCD_TO_INT _BCD BCD_TO_INT BCD_TO_INT ell BCD_TO_INT DO BCD_TO_INT_E EN BCD Output label Example BCD_TO_INT_E X000 D0 D10 Function name BCD TO INT E ENO 1 Output variable 2 Set data Execution condition Input variable BCD D Conversion source BCD data va are Output ENO o Execution status status Bit variable DEM Word signed data after conversion Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts BCD data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd 9999H E gt 9999 Word unsigned Word signed data bit string 16 bit data 8000 4000 2000 1000 800 400 200 100 80 ooo To Lol 1 1 folol1 1 0 0 1 1 olo 1 1 __ ni pm I Imm a mam AV Thousands place Hundreds place Tens place Ones place g Conversion into word a data 3276516354 8192 4095 2048 1024 512 256 128 64 9999 olol1folol lilio oTo To TTA ys becomes 0 Cautions Use the function having _E in its name to connect a bus Error When the source data is not BCD decimal number M8067 operation error turns ON 118 FXCPU Structured
86. Variable Description Data type p Execution condition Bit Input Bit le NY IL PT QD ENO a GD ET d2 PT QD ON start time data Time Execution status Bit a Output 59 variable O J ET ED ON start time current value Time o O Q In explanation of functions I O variables inside are described gt Explanation of function and operation When a device specified in turns ON this function block turns ON a device specified in after the time specified in Cn The delay elapsed time until a device specified in turns ON is set to a device specified in Cd2 When a device specified in turns OFF this function block turns OFF a device specified in and resets the delay elapsed time s ss ppy pue s dl q Sama a9uapuodsao7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 219 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 7 TON _E Program example In this progr
87. _E 222 Program example In this program when bit data stored in a device specified in turns ON bit data stored in a device specified in turns ON When bit data stored in a device specified in turns OFF bit data stored ina device specified in turns OFF 10 seconds later 1 Function without EN ENO TOF Structured ladder TOF_Instance TOF g_bool1 IN Q g_bool2 T 10s PT ET g_time1 ST TOF_Instance IN g_bool1 PT T 10s g_bool2 TOF_Instance Q g_time1 TOF_Instance ET Function with EN ENO TOF E Structured ladder TOF_E_Instance MO M10 g_bool2 g_time1 ST TOF_E Instance EN MO IN g_bool1 PT T 410s8 M10 TOF_E Instance ENO g_bool2 TOF_E Instance Q g_time1 TOF_E Instance ET FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 9 COUNTER_FB_M 6 9 COUNTER_FB_M PUC FXO oyo jyopojpojyojojo Outline gt This counter starts counting when the condition turns ON from OFF and generates an output when counting 2 up to the set value A counter initial value can be set 2 1 Format 3 i Expression in each language on Function name oc Structured ladder ST ae COUNTER FB_M Coil Preset 5 3 Valueln 1 S Instance name Example COUNTER FB M Instance name 4 COUNTER FB_M Coil ValueOut Coil X000 Preset DO ETa Valueln D10 502 D20 Instance name 28 ValueQut a D MO Instance name 5 Status 1 Refer to Cautions
88. a and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO INT_TO_TIME Structured ladder ST INT TO_TIME g_time1 INT _TO_TIME g_int1 g_intl _INT g_time1 2 Function with EN ENO INT_TO_TIME_E Structured ladder ST INT_TO_TIME_E g_bool3 INT_TO_TIME_E g_bool1 g_int1 g_time1 77 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk jsi uoqouny NS OO UON OnNSUOD uoljoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo o o o o o o Outline This function converts double word signed data into time data and outputs the data obtained by conversion 5 1 22 DINT_TO_TIME _E 1 Format Expression in each language Function name Structured ladder ST DINT_TO_TIME _DINT DINT TO TIME Example Label 1 DINT 4 Label 2 Label 2 DINT_TO_TIME Label 1 DINT_TO TIME E EN DINT DINT_TO TIME X DINT_TO TIME E Output label DINT_TO_TIME E Example Label 1 DINT_TO_TIME_E X000 Label 1 Label 2 1 Output variable 2 Set data is Data type Input 1 alii Double Word signed Output al sele ulus In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word s
89. able 2 Set data variable Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts BCD data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd gt 99999999H lt 99999999 FS YY AY ANY_BIT data Double word signed data N LO t mM N o O O O O O O O O x x x x x x x x A gt gt SS gt SH OFNTOTFNTOTN TT OTFN KT OTN TOTFTNATOTAN ST OTN 99999999H 1 o 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 o o 1 14 0 0 1 1 JoJo 1 Ten Millions Hundred Ten Thousands Hundreds Tens Ones millions place thousands thousands place place place place place place place Conversion into DINT data OMRmAnROHON TMA Yr ODON AN TYAN T OC ao oa aa AN AA ON AA eS STS OS D Kou tO AN O NNNNNNNNNNN N N N NN N NNN NN NNN NNN NON ON ON 99999999 o o o o o 1 0 0 1 0 l Always becomes 0 Cautions Use the function having _E in its name to connect a bus Error When the source data is not BCD decimal number M8067 operation error turns ON 120 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this example BCD data stored in a device specified in is converted into double word signed data and the data
90. all not be held responsible for any re commissioning maintenance or testing on site that involves replacement of the failed module Gratis Warranty Term The gratis warranty term of the product shall be for one year after the date of purchase or delivery to a designated place Note that after manufacture and shipment from Mitsubishi the maximum distribution period shall be six 6 months and the longest gratis warranty term after manufacturing shall be eighteen 18 months The gratis warranty term of repair parts shall not exceed the gratis warranty term before repairs Gratis Warranty Range 1 The range shall be limited to normal use within the usage state usage methods and usage environment etc which follow the conditions and precautions etc given in the instruction manual user s manual and caution labels on the product 2 Even within the gratis warranty term repairs shall be charged for in the following cases a Failure occurring from inappropriate storage or handling carelessness or negligence by the user Failure caused by the user s hardware or software design b Failure caused by unapproved modifications etc to the product by the user c When the Mitsubishi product is assembled into a user s device Failure that could have been avoided if functions or structures judged as necessary in the legal safety measures the user s device is subject to or as necessary by industry standards had been provided
91. alue handled by this function is 2147483647 Cautions Use the function having _E in its name to connect a bus 134 FXCPU Structured Programming Manual Application Functions 5 2 Standard Functions Of One Numeric Variable Program example o In this program the absolute value is obtained for word signed data stored in a device specified in Cs gt and 3 the operation result is output to a device specified in Cd using the data type same as the data stored ina device specified in Cs gt 1 Function without EN ENO ABS 2 Structured ladder ABS g_intt 5923 _IN g_int2 5923 a ST 3 g_int2 ABS g_int1 on 2 Function with EN ENO ABS E a2 Structured ladder g_bool1 4 aus age ogo a D ST SS g_bool3 ABS_E g_bool1 g_int1 g_int2 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 135 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions 5 3 Standard Arithmetic Functions 5 3 1 ADD E PRUE FROG Outline This function performs addition using two values A B C and outputs the operation result 1 Format i Expression in each language Function name Structured ladder ST ADD_E EN _IN _IN Output label Example ADD_E ADD_E X000 D0 D10 D20 1 Output variable 2 Set data hd Data type Input Execution condition Bit lis _IN Gs Data for addition or word device which store
92. am when bit data stored in a device specified in turns ON bit data stored in a device specified in turns ON 10 seconds later 1 Function without EN ENO TON Structured ladder TON_ Instance TON g_ bool IN Q g_bool2 T 10s ET g_time1 ST TON_Instance IN g_bool1 PT T 10s g_bool2 TON_Instance Q g_time1 TON_Instance ET 2 Function with EN ENO TON_E Structured ladder TON_E_Instance MO M10 g_bool2 g_bool1 T 10s g_time ST TON_E Instance EN MO IN g_bool1 PT T 108 M10 TON_E Instance ENO g_bool2 TON_E Instance Q g_time1 TON_E Instance ET 220 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 8 TOF _E 6 8 TOF _E o POUC FXS ol lo oj jo oj oj x x Outline gt When the input signal turns OFF this function block turns OFF the output signal after the specified time 2 1 Format A Expression in each language Structured ladder ST Function name Oo TOF IN PT 1 on Instance name Example 23 TOF Instance name IN MO o M10 PT Label 1 S Label 1 Label 2 M10 Instance name Q Label 2 Instance name ET TON_F EN IN PT 1 4 Example mmx TOE E Instance name EN X000 38 2 T IN MO PT Label 1 Sa 3 M10 Instance name Q a e 2 Label 1 Label 2 Instance name ET a 1 Refer to caution points 5 m1 gt 2 Set data 33 O Variable Description Data type p Execution condition Bit
93. am component 2 le O f wean 509 VAR CONSTANT Constant available within declared program components and gt y y as not available in any other program component eal VAR INPUT Label which receives a value and cannot be changed in NN y gt program components 5 VAR_OUTPUT Label output from a function block i ae Y 7 7 l oz VAR IN OUT Local label which receives a value outputs it from a program y ag component and can be changed in program components oa n Label definition It is necessary to define a label to use the label 6 An error will occur when a program in which labels are not defined is converted compiled Ss e When defining a global label set the label name class and data type and assigns a device 2 2 e a e When defining a local label set the label name class and data type a You do not have to specify devices for local labels Assignment of devices is automatically executed E during compiling gt In the example below the label VAR_D10 is set for the function BOOL_TO_STR_E s ss ppy pue s dl q USamjaq a9uapuodsa o7 e When using VAR_D10 as a global label Set the class label name data type and device or address El Global Label Setting Global Class Label Name Data Type Constant Device Address VAR_GLOBAL i oA e When using VAR_D10 as a local label Set the class label name and data type Constant Device 29 FXCPU Structured Programming Manual 3 Function Constructi
94. anguage 144 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Error 1 An operation error occurs when the divisor stored in a device specified in is 0 and the function is not executed 2 An operation error occurs when the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation 2 a Program example 3 In this program division is performed using double word signed data stored in devices specified in and Cs2 and the remainder is output to a device specified in Cd gt using the data type of data stored in devices specified in and s2 1 Function without EN ENO MOD OO OTI ac Structured ladder a 2 a MOD O g dint1 5678 IN1 g_dint3 742 g_dint2 1234 IN2 4 ai omg dint3 g_dint1 MOD g_dint2 2 05 g_dint3 g_din g_dint2 535 238 50 o oa 2 Function with EN ENO MOD_E Structured ladder g_bool1 g_dint1 g_dint2 ST g_bool3 MOD_E g_bool1 g_dint1 g_dint2 g_dint3 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 145 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions 5 3 6 EXPT _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function obtains raised result and outputs it 1 Format Expression in each language Function name Structured ladder ST EXPT In1 I
95. annot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they have 32 bit length Use global labels when specifying devices When 32 bit data is handled two consecutive 16 bit data registers D are combined For example when data register DO is defined as an argument of a 32 bit instruction by a label 32 bit data stored in D1 and DO is handled D1 offers high order 16 bits and DO offers low order 16 bits When the current value register of a timer or counter is used as a general data register it is handled in the same way 28 FXCPU Structured Programming Manual 3 Function Construction Application Functions 3 2 Labels 3 2 Labels 2 Label types Labels are classified into two types global and local 2 e Global labels can be used in program components and function blocks gt e Local labels can be used only in declared program blocks 3 Label class The label class indicates how each label can be used from which program component The table below shows label classes Om oc Applicable program component D a er aio Class Description Program Function 27 block block S VAR_GLOBAL Common label available in all program components a a Y VAR_GLOBAL_CONSTANT Common constant available in all program components RE 4 4 VAR Label available within declared program components and not J y z my T available in any other progr
96. anual Application Functions 2 When using FX1S FX1N FXU FX1NC FX2NC PLCs QCPU FXCPU Structured Programming Manual Fundamentals Additional Manual Q FX This manual explains programming methods specifications functions etc required to create structured programs Structured FXCPU Structured Programming Manual Device amp Common Additional Manual FX This manual explains devices and parameters for structured programs provided by GX Works2 Structured FXCPU Structured Programming Manual Basic amp Applied Instruction Additional Manual This manual explains sequence instructions for structured programs provided by GX Works2 FX Structured This manual FXCPU Structured Programming Manual Application Functions EX Additional Manual This manual explains application functions for structured programs provided by GX Works2 Structured FX Series User s Manual Data Communication Edition Additional Manual FX This manual explains details of simple N N link parallel link computer link no protocol communication RS instruction programming communication and inverter communication for FX PLCs Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX PCS WIN Individual manuals Manual supplied with product or additional Manual Special unit block This manual explains details of each special unit block Explanation of instructions and instructio
97. are 32 bit devices Use global labels when specifying labels 101 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word unsigned bit string 32 bit data stored in a device specified in is converted into word unsigned bit string 16 bit data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO WORD_TO_DWORD Structured ladder DWORD TO WORD g_dword1 16 12345678 DWORD g_word1 16 5678 ST g_word1 DWORD_TO WORD g_dword1 2 Function with EN ENO WORD_TO DWORD E Structured ladder g_ bool DWORD_TO WORD E ST g_bool3 DWORD_TO WORD E g_bool1 g dword1 g_word1 102 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 34 WORD _TO_TIME _E o PROVO FXO oyo po j op ojojojo Outline 2 This function converts word unsigned bit string 16 bit data into time data and outputs the data obtained by 3 conversion S 1 Format i Expression in each language Function name Structured ladder ST Oo OTI WORD _TO_TIME WORD i WORD_TO TIME WORD_TO_TIME eee 52 aT o WORD_TO_TIME DO z WORD TO TIME E EN WORD WORD_TO_TIME ae 4 2 WORD_TO TIME E X000 DO oe Label 2D gt O O 32 vs 1 Output variable Za 2 Set data EN Execution condition o condition Input
98. ary position counted from the head of a character string stored in devices specified in st and outputs the character string obtained by insertion to devices specified in Cd gt The value specified in specifies the position from which the character string stored in devices specified in is inserted After inserting a character string stored in devices specified in into a character string stored in devices specified in Cs this function ignores OOH which indicates the end of a character string stored in devices specified in GD Example When 4 is specified in Input value to s1 gt E gt Output value ABCDE ABC123456DE High order byte Low order byte High order byte Low order byte 1st word 42H B i 41H A 42H B i 41H A 1st word eee pay a 2nd word 44H D 43H C position 31H 1 43H C 2nd word 3rd word OOH 45H E 4th character 33H 3 1 32H 2 3rd word tala 35H 5 34H 4 Ath word nput value to s2 OOH 45H E 6th word High order byte Low order byte A character string data stored in devices specified in indicates the data until OOH is detected first in units of byte in the range starting from the specified device Cautions Error 188 1 2 Use the function having _E in its name to connect a bus When handling character string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling character string data Use gl
99. ata and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO BOOL_TO_ WORD Structured ladder ST g_bool1 BOOL _TO WORD g_word1 BOOL_TO WORD g_bool1 _BOOL g_word1 2 Function with EN ENO BOOL_TO_WORD E Structured ladder ST g_bool3 BOOL TO WORD E g _bool1 g bool2 g_wordl1 g_bool3 BOOL TO WORD E ENO g_bool1 g_word1 43 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk jsi uoqouny NS OO uoN onSUOD uojoun4 peay 0 moH a 6 PJEPUe S syoo g uonoun4 gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo ooo yo o o Outline This function converts bit data into double word unsigned bit string 32 bit data and outputs the data obtained by conversion 5 1 5 BOOL TO DWORD E 1 Format Expression in each language Function name Structured ladder ST BOOL_TO_DWORD _BOOL BOOL_TO DWO BOOL TO DWORD Example RD _BOOL od Label Label BOOL_TO_DWORD MO BOOL_TO_ DWORD _E EN BOOL TO DWORD _E _BOOL Output label Example BOOL_TO DWORD_E X000 MO Label BOOL_TO_DWO RD E 1 Output variable 2 Set data Input Execution condition it variable _BOOL Conversion source bit data ENO ere status status Output Double Word unsigned variable A a Double word unsigne
100. ation result expressed as the bit type data to a device specified in Cd This function executes comparison Cs1 Cs2 a This function outputs TRUE when in the case of s1 Cs2 b This function outputs FALSE when in the case of s1 s2 gt syoo g uonoun4 pJepuejs gt Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels s ss ppy pue s dl q USamjaq a9uapuodsa o7 179 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions Program example In this program the contents of devices specified in and are compared and the operation result is output to a device specified in Cd_ Structured ladder ST g_bool3 NE_E g_bool1 g_int1 g_int2 g_bool2 180 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions 5 8 Standard Character String Functions 2 5 8 1 MID _E PRO my 2 Outline This function obtains a character string from a specified position OO 1 Format Og Expression in each language 22 Function name ao Structured ladder ST eye O MID _IN L P s Example MID Label 2 4 MID Label 1 D10 D20 ane a MID_E EN IN L P Output label
101. bed Explanation of function and operation This function performs subtraction Cs1 Cs2 of time data stored in devices specified in and Cs2 and outputs the operation result expressed as time data to devices specified in Cd gt 200 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Even if underflow or overflow occurs in the operation result it is not regarded as an operation error However note that the accurate operation result cannot be obtained in this case SUB_TIME_E outputs TRUE from ENO Either of the flags shown in the table below turns ON or OFF in accordance with the operation result Device Name Description ON When the operation result is 0 jon Elo OFF When the operation result is any other than 0 ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit operation Meee BONON OFF When the operation result is 32 768 16 bit operation or more or 2 147 483 648 32 bit operation or more ON When the operation result exceeds 32 767 16
102. bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 99 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word unsigned bit string 16 bit data stored in a device specified in is converted into double word unsigned bit string 32 bit data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO WORD_TO_DWORD Structured ladder WORD_TO DWORD g_word1 16 1234 WORD g_dword1 16 00001234 ST g_dword1 WORD_TO_DWORD g_ word 2 Function with EN ENO WORD_TO DWORD E Structured ladder g_ bool WORD_TO DWORD E ST g_bool3 WORD_TO_DWORD E g_bool1 g_word1 g_dword1 100 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 33 DWORD_TO_WORD _E o PROVO FXO oyo po j op ojojojo Outline 2 This function converts double word unsigned bit string 32 bit data into word unsigned bit string 16 bit 3 data and outputs the data obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST Oo OTI DWORD TO WORD DWORD i DWORD_TO_WO DWORD_TO WORD Example E RD Label DWORD 4 D10 5 DWORD_TO_WORD Label DWORD TO WORD E EN NORTON _DWORD Output label 4
103. ble below shows the ENO status corresponding to the EN status and the operation result EN Operation result TRUE Operation error did not occur Operation output value TRUE Executes operation FALSE Operation error occurred Indefinite value FALSE Stops operation FALSE Indefinite value ENOL M1 VAR_D10 In the above example the function BOOL_TO_STR_E is executed only when X000 is TRUE When the function is executed normally TRUE is output to M1 33 suoljoun4 jo uoneue dxy s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml TI gt O O ls n UON ONSUOD uojoun4 peay 0 moH a paddy Qi suoloun4 O pJepuels syoo g uonoun4 gt FXCPU Structured Programming Manual 4 How to Read Explanation of Functions Application Functions 4 How to Read Explanation of Functions Function explanation pages have the following configuration POUC FROG FRAN FRING PRIS PRUFRAGT FXON FROG 2 6 6 6 6 o 6 Outline This function compares data with regard to gt larger or equal 3 1 Format Expression in each language Structured ladder GE_E EN _IN _IN Output label Example GE_E X000 D0 D10 MO Function name 4 Output variable 4 2 Set data Neviabie Data type Input EN Execution condition variable _IN GD Compared data or word device which stores such data ANY_SIMPLE Output ENO Execution
104. conversion 5 1 44 TIME_TO_INT _E 1 Format Expression in each language Function name Structured ladder ST TIME_TO_INT _TIME TIME_TO_INT TIME_TO_INT Sample Label TIME a D10 010 TIME_TO_INT Label TIME_TO_INT_E EN TIME Output label Example TIME_TO_INT_E X000 Label D10 TIME_TO_INT_E 1 Output variable 2 Set data In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd gt 15234ms gt 1234 S ll _ _ Time data Word signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 124 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is converted into word signed data and the 3 data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO TIME_TO_INT Structu
105. cted such as in aircraft medical applications incineration and fuel devices manned transportation equipment for recreation and amusement and safety devices shall also be excluded from the programmable logic controller range of applications However in certain cases some applications may be possible providing the user consults their local Mitsubishi representative outlining the special requirements of the project and providing that all parties concerned agree to the special circumstances solely at the users discretion FXCPU Structured Programming Manual Application Functions Revision History Revision History Date of preparation Revision Description 1 2009 A First Edition e Equivalent circuits are deleted e Following instructions are not supported in FXo FXos and FXON PLCs CTD _E CTU _E CTUD _E TOF _E TON _E TP _E e Function blocks SR _E RS _E are deleted 7 2009 231 FXCPU Structured Programming Manual Application Functions Revision History MEMO 232 FXCPU Structured Programming Manual Application Functions a MITSUBISHI ELECTRIC CORPORATION HEAD OFFICE TOKYO BUILDING 2 7 3 MARUNOUCHI CHIYODA KU TOKYO 100 8310 JAPAN HIMEJI WORKS 840 CHIYODA CHO HIMEJI JAPAN 09R927 JY997D34801B Effective Jul 2009 MEE Specifications are subject to change without notice
106. ctions 1 3 Cautions on Creation of Fundamental Programs 1 3 5 Handling of operation error flag When there is an error in the instruction construction target device or target device number range and an error occurs while operation is executed the following flag turns ON and the error information is stored 1 Operation error Device which stores error occurrence step Error flag See E FX0 FX0S FXON FXU FX2C FX1S error code IFX1N FX2N FX1NC FX2NC FX3G PUTUT M8067 D8067 D8069 1 D8315 D8314 1 When an error occurs in a step up to the step No 32767 in the FX3U FX3uc PLC you can check the error occurrence step also in D8069 16 bits Tl Q O E 1 OO 9T e When an operation error has occurred M8067 turns ON D8067 stores the operation error code and the a specified device shown in the table above stores the error occurrence step gt e When another error occurs in another step the stored data is updated in turn to the error code and step number of the new error These devices are set to OFF when errors are cleared 4 e When the PLC mode changes from STOP to RUN these devices are cleared instantaneously and then cag turn ON again if errors have not been cleared Soe D eee 2 Operation error latch 3 2 Device which stores error occurrence step 5 Error flag id FX0 FX0S FXON FXU FX2C FX1S d T gt 2 When an error occurs in a step up to the step No 32767 in the FX3U FX3uc PLC you can check th
107. ctions 5 9 Functions Of Time Data Types Program example o In this program division Cs1 Cs2 is performed using time data stored in devices specified in and 2 Cs2 and the operation result expressed as time data is output to devices specified in Cd 1 Function without EN ENO DIV_TIME Structured ladder 2 DIV_TIME 3 g_time1 _IN1 o g_intt _IN2 a ST g_time2 DIV_TIME g_time1 g_int1 Oo Om oc 2 2 2 Function with EN ENO DIV_TIME_E cS z Structured ladder z g_bool1 DIV_TIME_E 4 EN ENO _IN1 cag _IN2 Soe oes ST Sal g_bool3 DIV_TIME_E g_bool1 g _time1 g_int1 g_time2 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 205 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 1 R_TRIG _E 6 Standard Function Blocks 6 1 R_TRIG _E PRUE FROG oo o o o o o o Outline This function block detects the rising edge of a signal and outputs pulse signal 1 Format Expression in each language Function name Structured ladder ST R_TRIG _CLK 1 Instance name Example R_TRIG R_TRIG Instance name _CLK MO MO _CLK M10 M10 Instance name Q R_TRIG_E EN CLK 1 Example R_TRIG_E Instance name EN X000 EN ENO CLK M0 CLK Q M10 Instance name Q Instance name R_TRIG_E 1 Refer to caution points 2 Set data Variable Description Data type Input Ex
108. ctions I O variables inside are described Explanation of function and operation This function converts double word signed data stored in a device specified in into double word unsigned bit string 32 bit data and outputs the data obtained by conversion to a device specified in Cd gt 12345678 gt BC614EH crc a Double word signed data Double word unsigned bit string 32 bit data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word signed data stored in a device specified in is converted into double word unsigned bit string 32 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DINT_TO_DWORD Structured ladder DINT_TO_ DWORD g_dint1 74565 _DINT g_dword1 16 00012345 ST g_dword1 DINT_TO_DWORD g_dint1 2 Function with EN ENO DINT_TO_DWORD_E Structured ladder g_bool1 DINT TO DWORD E g_bool3 g_dword1 ST g_bool3 DINT TO DWORD_E g_bool
109. cts Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 The function is provided in the FX3G Series Ver 1 10 or later 4 In the data obtained by conversion the portion after the decimal point of the float single precision data source data is rounded off 80 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program float single precision data stored in a device specified in is converted into word 2 signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO REAL_TO_INT Structured ladder 2 a REAL _TO_INT a g_real1 5923 5 a real g_int1 5923 5 ST g_int1 REAL_TO_INT g_real1 Oo Om Ss 2 Function with EN ENO REAL_TO_INT_E SS 2 O Structured ladder g_bool1 REAL TO INT E g_bool3 4 g_int as a5 ST 325 de 338 0 o a g_bool3 REAL_TO_INT_E g_bool1 g reali g_int1 6 plepuejs syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 81 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 24 REAL TO _DINT _E Pano ZE op a o x x x x x Outline This function converts float single precision data into double wor
110. d Failure that could have been avoided if consumable parts battery backlight fuse etc designated in the instruction manual had been correctly serviced or replaced e Relay failure or output contact failure caused by usage beyond the specified Life of contact cycles f Failure caused by external irresistible forces such as fires or abnormal voltages and failure caused by force majeure such as earthquakes lightning wind and water damage g Failure caused by reasons unpredictable by scientific technology standards at time of shipment from Mitsubishi h Any other failure found not to be the responsibility of Mitsubishi or that admitted not to be so by the user 2 Onerous repair term after discontinuation of production 1 Mitsubishi shall accept onerous product repairs for seven 7 years after production of the product is discontinued Discontinuation of production shall be notified with Mitsubishi Technical Bulletins etc 2 Product supply including repair parts is not available after production is discontinued Overseas service Overseas repairs shall be accepted by Mitsubishi s local overseas FA Center Note that the repair conditions at each FA Center may differ Exclusion of loss in opportunity and secondary loss from warranty liability Regardless of the gratis warranty term Mitsubishi shall not be liable for compensation of damages caused by any cause found not to be the responsibility of Mitsubishi
111. d bit string 32 bit data after conversion Bit string 32 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data stored in a device specified in into double word unsigned bit string 32 bit data and outputs the data obtained by conversion to a device specified in Cd gt When the input value is FALSE this function outputs OH as the double word unsigned bit string 32 bit data value When the input value is TRUE this function outputs 1H as the double word unsigned bit string 32 bit data value FASE gt LH E gt AA FH Yr FS v Y Bit data Double Word unsigned Bit string 32 bit data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 44 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program bit data stored in a device specified in is converted into double word unsigned bit string 2 32 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO BO
112. d signed data and outputs the data obtained by conversion 1 Format Expression in each language Structured ladder ST REAL_TO_DINT a_real REAL TO DINT REAL_TO_DINT Example Label 1 a real 4 Label 2 Label 2 REAL_TO_DINT Label 1 REAL TO DINT E EN a real Function name REAL_TO_DINT a REAL_TO_DINT_E Output label E o p Example Label 1 REAL_TO_DINT_E X000 Label 1 Label 2 1 Output variable 2 Set data siti Data type Input Execution condition Bit variable a_real Cs_ Conversion source float single precision data FLOAT Single Precision Output Execution status Bit variable 4 Cd_ Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts float single precision data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd 16543521 0 E gt 16543521 O ll ir A FLOAT single precision data Double word signed data The portion after the decimal point is rounded off Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they ar
113. d signed data into bit data ete DINT_TO_BOOL _E Converts double word signed data into bit data reel INT_TO_REAL _E Converts word signed data into float single y Subsection precision data 5 1 11 DINT_TO_REAL E Converts double word signed data into float E Subsection single precision data 5 1 12 INT_TO_STR E Converts word signed data into string data AS er DINT_TO_STR _E Converts double word signed data into string r Subsection data 5 1 14 Converts word signed data into word y e J y r y P Subsection DTO WORDLE unsigned bit string 16 bit data ES 5 1 15 Converts double word signed data into word e P y y J y y y Subsection A a unsigned bit string 16 bit data Ea 5 1 16 Converts word signed data into double word a P z y y y y 7 Subsection MO DWORD HE unsigned bit string 32 bit data Ka 5 1 17 DINT_TO_DWORD Converts double word signed data into double yi y r P y y vi y Subsection E word unsigned bit string 32 bit data 5 1 18 INT_TO_BCD E Converts word signed data into BCD data dl DINT_TO BCD E Converts double word signed data into BCD y y 7 z y y y y Subsection data 5 1 20 INT_TO_TIME _E Converts word signed data into time data rc DINT_TO_TIME _E i double word signed data into time o 1 The function is provided in the FX3G Series Ver 1 10 or later FXCPU Structured Programming Manual 2 Function List Application Functions 2 1 Type Conversion Functions Applicabl
114. d Functions Application Functions 5 1 Type Conversion Functions 5 1 9 INT_TO_BOOL _E THUG ROS oyo po j op ojyjojpojo Outline 92 1 2 This function converts word signed data into bit data and outputs the data obtained by conversion Format Expression in each language Function name Structured ladder ST INT_TO_BOOL _ INT INT_TO BOOL INT_TO_BOOL Example DO _INT MO INT_TO_BOOL DO INT_TO BOOL E aaa INT_TO_BOOL_E EN ENO a i Example _INT 1 INT_TO_BOOL_E X000 DO MO 1 Output variable Set data arabe y GD __ Bisaleaterconverion OOOO O In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into bit data and outputs the data obtained by conversion to a device specified in Cd gt When the input value is 0 this function outputs FALSE When the input value is any value other than 0 this function outputs TRUE A gt SE 867 gt RE FH YY ll Word signed data Bit data Cautions Use the function having _E in its name to connect a bus FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word signed data stored in a device specified in is converted into bit data and the data obtained by conversion is output to a device spec
115. data type equivalent circuit in sequence instructions target models cautions and program examples Refer to the following manual for variables operators data types and program languages gt Q FX Structured Programming Manual Fundamentals 5 1 Type Conversion Functions PRUE PROS oJ o o o o o o o Outline This function coverts bit data into word signed data and outputs the data obtained by conversion 5 1 1 BOOL TO INT _E 1 Format Expression in each language Function name Structured ladder ST BOOL_TO_INT _BOOL BOOL_TO_INT BOOL_TO_INT Axa mple MO BOOL IN DO DO BOOL_TO_INT MO BOOL_TO_INT_E EN BOOL BOOL_TO_INT_E Output label BOOL_TO_INT_E EN ENO Example BOOL 4 BOOL_TO_INT_E X000 MO DO 1 Output variable 2 Set data bibi Data type Input Execution condition Bit variable _BOOL Conversion source bit data Bit Output Execution status Bit variable 1 0D Word signed data after conversion Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd gt When the input value is FALSE this function outputs 0 as the word signed data value When the input value is TRUE this function outputs 1 as the word signed data value ras gt
116. device specified in turns ON FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 5 CTUD _E This function block resets the count value of a device specified in when a device specified in turns ON This function block sets the value stored in to a device specified in when a device specified in turns ON Cautions 1 Use the function having _E in its name to connect a bus 2 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 215 auIno mk sr uoqouny INQ Oo UOoN OnNSUOD uojoun4 suoljoun4 jo voneuejdx3 peay 0 moH a paddy OW TI gt Q r O Mm plepuejs syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 5 CTUD _E 216 Program example In this program the number of times the bit data stored in a device specified in turns ON from OFF is counted up added by 1 When the value stored in a device specified in reaches the value specified in Cn a device specified in turns ON At the same time the number of times the bit data stored in a device specified in turns ON from OFF is counted down subtracted by 1 When the value stored in a device specified in becomes 0 a device specified in turns ON 1 Function without EN
117. does not occur MUX_E outputs FALSE from ENO 3 The number of pins in can be changed 170 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 2 Use global labels when specifying labels Program example S In this example either one among values stored in devices specified in IS output to a device specified in CdD in accordance with the value specified in using the data type of data stored in devices specified in OO 1 Function without EN ENO MUL SS 2 2 Structured ladder 58 O MUX g int1 2 K g_int4 5678 g_int2 1234 IN 4 g_int3 5678 _IN am 2 O20 g_int4 MUX g_int1 g_int2 g_int3 a gt 2 Function with EN ENO MUL_E Structured ladder g_bool1 6 TO 35 SS ST i g_bool3 MUX_E g_bool1 g_int1 g_int2 g_int3 g_int4 E gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 171 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions 5 7 Standard Comparison Functions 5 7 1 GTE PRUE FROG Outline This function compares data with regard to gt larger
118. e Structured ladder ST OO OTI WORD _ TO DWORD WORD E WORD_TO_DWO a Example E RD DO _WORD 1 Label Label WORD_TO DWORD DO WORD TO DWORD E EN WORD_TO_DWO e 4 RD_E WORD_TO_DWORD_E X000 DO cag Label 2D gt 70 7 O 1 Output variable Za 2 Set data Execution condition Bit Input ere Word unsigned variable _ WORD Cs Conversion source word unsigned bit string 16 bit data Bit String 16 bit Execution status Bit Output TIEPE Double Word unsigned variable Double word unsigned bit string 32 bit data after conversion Bit string 32 bit 6 TY In explanation of functions I O variables inside are described 5 H Explanation of function and operation 3J This function converts word unsigned bit string 16 bit data stored in a device specified in into double word unsigned bit 32 bit data and outputs the data obtained by conversion to a device specified in Cd gt Each of high order 16 bits becomes 0 after data conversion 5678H E gt 00005678H gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 ll Fr AAA Word unsigned Double word unsigned bit string 16 bit data bit string 82 bit data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32
119. e error occurrence step also in D8068 16 bits 6 e When an operation error has occurred M8068 turns ON and the device shown in the table above stores So the error occurrence step SS e Even if another error occurs in another step the stored data is not updated and remains held until these S devices are forcibly set to OFF or until the power is turned OFF i gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 21 FXCPU Structured Programming Manual 2 Function List Application Functions 2 1 Type Conversion Functions 2 Function List This chapter introduces a list of functions available in programming 2 1 Type Conversion Functions Applicable PLC Function name ras u y Reference g gt x lt z N N O BOOL_TO_INT _E Converts bit data into word signed data es BOOL_TO_DINT _E Converts bit data into double word signed data al BOOL_TO_STR _E Converts bit data into string data pa MOS oe Converts bit data into word unsigned bit string y 7 y Subsection POOE MA WORDE 16 bit data 5 1 4 BOOL_TO_DWORD Converts bit data into double word unsigned bit P y P Subsection _E string 82 bit data 5 1 5 BOOL TO TIME _E Converts bit data into time data eae INT_TO_DINT _E Converts word signed data into double word y y y Subsection aA signed data 5 1 7 DINT_TO_INT _E Converts double word signed data into word y s y Subsection signed data 5 1 8 INT TO BOOL _E Converts wor
120. e 32 bit devices Use global labels when specifying labels 3 The function is provided in the FX3G Series Ver 1 10 or later 4 In the data obtained by conversion the portion after the decimal point of the float single precision data source data is rounded off 82 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program float single precision data stored in a device specified in is converted into double word 2 signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO REAL_TO_DINT Structured ladder 2 o REAL TO DINT 2 g_real1 65000 5 a real g_dint1 65000 5 ST g_dint1 REAL_TO_DINT g_real1 Oo Om gS 2 Function with EN ENO DINT_TO_TIME_E FE QJ O Structured ladder g_bool1 REAL_TO_DINT_E 4 ca ST 32 S g_bool3 REAL_TO_DINT_E g_bool1 g _real1 g_dint1 6 plepuejs syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 83 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 25 REAL TO STR _E 84 FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts float single precision data into string data and outputs the data obtained by conversion 1 Format Expression in each language S
121. e PLC O 49 Function name Reference Subsection 5 1 23 Subsection 5 1 24 Subsection Converts float single precision data into word signed data REAL _TO_INT _E Converts float single precision data into double word signed data REAL _TO_DINT _E S17 uoyoun4 REAL TO STR _E Converts float single precision data into string data 5 1 25 WORD_TO BOOL E Converts word unsigned bit string 16 bit data a Subsection into bit data 5 1 26 3 DWORD_TO_BOOL Converts double word unsigned bit string 32 y Subsection om E bit data into bit data 5 1 27 25 E E y r 30 WORD_TO_INT _E Converts word unsigned bit string 16 bit data r Subsection 33 into word signed data 5 1 28 e WORD_TO_DINT _E Converts word unsigned bit string 16 bit data r Subsection into double word signed data 5 1 29 4 DWORD_TO_INT E Converts double word unsigned bit string 32 Subsection bit data into word signed data 5 1 30 amo 1S DWORD_TO_DINT Converts double word unsigned bit string 32 y Subsection D E bit data into double word signed data 5 1 31 D WORD_TO DWORD _ Converts word unsigned bit string 16 bit data Subsection 9 a _E into double word unsigned bit string 32 bit 5 1 32 Converts double word unsigned bit string 32 bit data into word unsigned bit string 16 Subsection 5 1 33 DWORD_TO_WORD E bit data Subsection 5 1 34 Subsection 5 1 3
122. e described Explanation of function and operation This function block sets to ON a device specified in Cd when a device specified in turns OFF and keeps ON the device specified in Cd only for 1 operation cycle Cautions 1 Use the function having _E in its name to connect a bus 2 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block Error 1 When an output number is specified in Cd and the specified output number does not exist due to indexing M8316 I O inexistence error turns ON Applicable to the FX3U and FX3uc PLCs only 2 When a device M T or C other than I O number is specified in Cd and the specified device number does not exist due to indexing an operation error Error code 6706 occurs 208 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 2 F_TRIG _E Program example In this program a device specified in Cd gt turns ON when the bit data stored in a device specified in turns OFF from ON and the device specified in Cd remains ON only for 1 operation cycle 1 Function without EN ENO F_TRIG Structured ladder F_ TRIG_Instance F_TRIG g_bool1 _CLK QtL g_bool2 ST F_TRIG_Instance _ CLK g_bool1 g bool2 F_TRIG_Instance Q 2 Function with EN ENO F_TRIG_E Structured ladder F TRIG _E Instance X000 Res ST F_TRIG_E I
123. e error 5 code 1 When 00H does not exist in the corresponding device range after the device specified in Error code K6706 OO 2 When the number of characters of a character string stored in devices specified in is 32768 or more SS Error code K6706 ao 3 When the number of devices after the device number specified in Cd is smaller than the number of S devices required for storing the character string remaining after deletion of specified number of characters 4 Error code K6706 ue 4 When the value specified in is negative 235 Error code K6706 7 SE Program example In this program specified number of characters are deleted from an arbitrary position of a character string stored in devices specified in Cs and the character string remaining after deletion is output to devices specified in Cd 1 Function without EN ENO DELETE Structured ladder 6 DELETE g_string1 ABCDEF12345 _IN g_string2 AB12345 es g intt 4 L 2 5393 9 int2 3 p y 3 5 A ST g_string2 DELETE g_string1 g_int1 g_int2 2 Function with EN ENO DELETE E s ss ppy pue s dl q USamjaq a9uapuodsa o7 Structured ladder g_bool1 DELENTEME ENO 9_bool3 g_string1 g_string2 g_int1 g_int2 ST g_bool3 DELETE_E g_bool1 g_string1 g_int1 g_int2 g_string2 191 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions 5 8 5 REPLACE _E FX3U C
124. e is outputted into ValueOut 2 When the execution condition of the input argument Coil turns OFF the current value takes on the value of Valueln and the output argument Status also turns OFF Structured ladder timing chart Instance name ON TIMER 100 FB M Var Mo Var_MO Coil ValueOut Var D10 10 10 Preset Status Var M102 V e ae alue of Var_D10 1 i 1 Valueln 7 Es FR ST Instance name Coil Var_MO Preset 10 Valueln 1 Var_M10 ON Var_D10 Instance name ValueOut Var_M10 Instance name Status 1 Var_D10 is a global label and is defined as D10 2 Var_M10 is a global label and is defined as M10 Cautions 1 Expression in each language of function block 1 Set the instance when using the function block Describe the instance name when programming the function block 2 For the function block the automatic allocation device needs to be set as the timer numbers are allocated automatically 228 FXCPU Structured Programming Manual Application Functions Appendix A Correspondence between Devices and Appendix A Correspondence between Devices and Addresses The table below shows the correspondence between devices and addresses Input relay Output relay Device Timer Counter CI IO IO i Col pT MA n TC191 ee MD3 1 n T190 Contact Cn HMX4N n CS99 a r n e E OO DA n Current value MD4 n C98 Data register ones ee 9 MDO n D19
125. e labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 2 Even if underflow or overflow occurs in the operation result it is not regarded as an operation error TRUE is output from ENO However note that the obtained operation result is not accurate in this case Either of the flags shown in the table below turns ON or OFF in accordance with the operation result Device Name Description ON When the operation result is 0 nee eap OFF When the operation result is any other than 0 ON When the operation result is less than 32 768 16 bit operation or less than M8021 2 147 483 648 32 bit operation OFF When the operation result is 32 768 16 bit operation or more or 2 147 483 648 32 bit operation or more ON When the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation meee sany OFF When the operation result is 32 767 16 bit operation or less or 2 147 483 647 32 bit operation or less Zero flag Zero flag Zero flag LN O 2 1 O 32 768 E UAA TN 0 1 2 KAS VLA Borrow flag The most The most Carry flag significant bit significant bit of data is 1 of data is 0 Pa Zero flag 2 1 0 2 147 483 648 PR ON 2 147 483647 0 1 2 EM VLA Borrow flag Zero flag Carry flag Program example In this program subtraction is performed using
126. e place Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 74 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error An operation error occurs when the value stored in a device specified in is outside the range from 0 to 99 999 999 Program example In this program double word signed data stored in a device specified in is converted into BCD data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DINT TO BCD Structured ladder DINT_TO_BCD g_dint1 20000 DINT g_dword1 16 00020000 ST g_dword1 DINT_TO_BCD g_dint1 2 Function with EN ENO DINT_TO_BCD E Structured ladder g_bool3 g_dword1 ST g_bool3 DINT TO BCD_E g_bool1 g_dint1 g dword1 75 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk jsi uoqouny NS OO uoN onSUOD uojoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo
127. e specified in when a device specified in turns ON When the count value reaches a value specified in Cn_ a device specified in turns ON When a device specified in turns ON this function block turns OFF a device specified in dD and resets the count value of a device specified in dD Cautions 1 Use the function having _E in its name to connect a bus 2 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 210 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 3 CTU _E Program example o In this program the number of times the bit data stored in a device specified in turns ON from OFF is 3 counted and the count value is output to a device specified in d2 1 Function without EN ENO CTU Structured ladder 2 a CTU_Instance a Oo ST Oe CTU_Instance CU g_bool1 RESET g_bool2 PV g_int1 g_bool3 CTU_Instance Q 2 7 g_int2 CTU_Instance CV a 2 Function with EN ENO CTU_E 4 aus Structured ladder 2 Z CTU_E Instance BA 0 M10 ga g_bool1 g_bool2 3 g_int1 Sa S2 ST CTU_E Instance EN M10 CU g_bool1 RESET g_bool2 PV g_int1 M11 CTU_E Instance ENO g_bool3 CTU_E Instance Q g_int2 CTU_E Instance CV pJepuels syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 211 FXCPU Structured Programming Manua
128. ected data 5 6 5 MUX _E 1 Format Expression in each language Structured ladder ST MUX K _ IN IN Example D30 MUX DO D10 D20 Function name MUX MUX_E EN K IN IN Output label Example MUX_E MUX_E X000 D0 D10 D20 D30 1 Output variable 2 Set data N Execution condition Bit seem Selection data or word device which stores such data Word signed variable IN GD Selectable data or word device which stores such data ANY Output ENO Execution status Bit ANY variable Word device which will store the selected data de mM y In explanation of functions I O variables inside are described Explanation of function and operation 1 This function outputs either one among values stored in devices specified in to a device specified in CdD in accordance with the value specified in using the data type of data stored in devices specified in eo a When the value specified in is 1 this function outputs the value stored in a device specified in to a device specified in CdD b When the value specified in is n this function outputs the value stored in a device specified in to a device specified in Cd gt Example When the data type is word signed Word signed data Word signed data Word signed data 2 When a value input to is outside the pin number range for this function outputs an indefinite value to a device specified in Cd gt An operation error
129. ecution condition Bit variable CLK 6 Input signal whose rising edge is to be detected Bit Output ENO Execution status Bit variable Q C amp D Output signal Bit In explanation of functions I O variables inside are described Explanation of function and operation This function block sets to ON a device specified in Cd when a device specified in turns ON and keeps ON the device specified in Cd only for 1 operation cycle Cautions 1 Use the function having _E in its name to connect a bus 2 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block Error 1 When an output number is specified in Cd and the specified output number does not exist due to indexing M8316 I O inexistence error turns ON Applicable to the FX3U and FX3uc PLCs only 2 When a device M T or C other than I O number is specified in Cd and the specified device number does not exist due to indexing an operation error Error code 6706 occurs 206 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 1 R_TRIG _E Program example In this program a device specified in CdD turns ON when the bit data stored in a device specified in turns ON from OFF and the device specified in Cd remains ON only for 1 operation cycle 1 Function without EN ENO R_TRIG Structured ladder R_TRIG_Instance R_T
130. ecution status Bit variable D Word device which will store the output data ANY_SIMPLE In explanation of functions I O variables inside are described Explanation of function and operation This function outputs data whose type is same as the data stored in devices specified in GD and to a device specified in Cd gt in accordance with ANY_SIMPLE type data stored in devices specified in GD and s3 1 In the case of Contents of a device specified in gt Contents of a device specified in GJ this function outputs the contents of a device specified in to a device specified in Cd gt 2 In the case of Contents of a device specified in lt Contents of a device specified in GD this function outputs the contents of a device specified in to a device specified in Cd gt 3 In the case of Contents of a device specified in lt Contents of a device specified in lt Contents of a device specified in Cs3 this function outputs the contents of a device specified in to a device specified in Cd Example When the data type is word signed Output value LIMITATION Word signed data _MN Minimum input value IN Word signed data Sa Word signed data _MX nput value PA Maximum input value Word signed data 168 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handli
131. ed by conversion S 1 Format Expression in each language Function name Structured ladder ST Oo 7a WORD_TO_INT _WORD i WORD_TO_INT WORD_TO_INT P o 55S i o WORD_TO_INT DO 7 WORD TO_INT_E EN WORD WORD TO_INT_ ae 4 a WORD_TO_INT_E X000 D0 oe D10 am O O D J de ES 1 Output variable Za 2 Set data EN Execution condition o condition Input E E unsigned variable _ WORD Conversion source word unsigned bit string 16 bit data Bit 16 bit Output EN Execution status status variable n e a a a a a a u Word signed data after conversion Word signed In explanation of functions I O variables inside are described 6 PJEPUe S Explanation of function and operation This function converts word unsigned bit string 16 bit data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd gt 5678H gt 22136 Word unsigned Word signed data bit string 16 bit data syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions Use the function having _E in its name to connect a bus 91 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word unsigned bit string 16 bit data stored in a device specified in is converted into word signed data and
132. ed in GSD lt 2128 Error code K6706 2 When the range of a device which will store the character string obtained by conversion device specified in Cd_ exceeds the range of the corresponding device Error code K6706 3 When the conversion result exceeds the specified total number of digits Error code K6706 Program example In this program float single precision data stored in a device specified in is converted into string data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO REAL_TO_ STR Structured ladder REAL_TO_STR g real1 12 34567 REAL g_string1 1 23457E 01 ST g_string1 REAL_TO_STR g_real1 2 Function with EN ENO REAL_ TO STR_E Structured ladder g_bool1 REAL TO STR_E g_bool3 g_string1 ST g_bool3 REAL_TO_STR_E g_bool1 g_real1 g_string1 86 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 26 WORD TO BOOL _E o PROVO FXO oyo po jopojojojo Outline 2 This function converts word unsigned bit string 16 bit data into bit data and outputs the data obtained by 3 conversion S 1 Format i Expression in each language Function name Structured ladder ST Oo Om WORD_TO _BOOL _WORD E WORD_TO BOO WORD TO BOOL Example 5 L MO WORD_TO_BOOL DO di WORD_TO_BOOL_E EN ORD TOES _WORD Output label 4 LE Example ae
133. ed ladder ST TIME_TO STR _TIME TIME TO STR TIME_TO STR Svample Label 1 _ TIME 1 Label 2 Label 2 TIME_TO_STR Label 1 TIME_TO_STR_E EN TIME X TIME_TO_STR_E Output label TIME_TO_STR_E Example Label 1 Label 2 TIME_TO_STR_E X000 Label 1 Label 2 1 Output variable 2 Set data In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into string data and outputs the data obtained by conversion to a device specified in Cd gt 20m34s567ms_ gt 1234567 Kae _ Time data String data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels Error An operation error occurs in the following case The error flag M8067 turns ON and D8067 stores the error code 1 When the number of points occupied by the device specified in Cd exceeds the range of the corresponding device 128 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is co
134. ement vehicles consult with Mitsubishi Electric This product has been manufactured under strict quality control However when installing the product where major accidents or losses could occur if the product fails install appropriate backup or failsafe functions in the system When combining this product with other products please confirm the standard and the code or regulations with which the user should follow Moreover please confirm the compatibility of this product to the system machine and apparatus with which a user is using If in doubt at any stage during the installation of the product always consult a professional electrical engineer who is qualified and trained to the local and national standards If in doubt about the operation or use please consult the nearest Mitsubishi Electric distributor Since the examples indicated by this manual technical bulletin catalog etc are used as a reference please use it after confirming the function and safety of the equipment and system Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples This manual content specification etc may be changed without a notice for improvement The information in this manual has been carefully checked and is believed to be accurate however you have noticed a doubtful point a doubtful error etc please contact the nearest Mitsubishi Electric distributor Registration Microsoft and Wi
135. ers directly however because they are 32 bit devices a 3 o o Use global labels when specifying labels Program example In this program the exclusive logical sum is obtained using each bit of word unsigned bit string 16 bit data stored in devices specified in and s2 gt and the operation result is output to a device specified in Cd using the data type of data stored in devices specified in and s2 Structured ladder 6 g_bool1 g_bool3 g_word3 16 B15A plepuejs g_word1 16 AAAA g_word2 16 1BFO syoo g uonoun4 ST gt g_bool3 XOR_E g_bool1 g_word1 g_word2 g_word3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 159 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions PRUE FROG oo o o o jo o o Outline This function obtains the logical negation of bits and outputs it 5 5 4 NOT _E 1 Format Expression in each language Function name Structured ladder ST NOT _IN Example M10 NOT MO NOT NOT_E EN _IN Output label Example NOT E NOT_E X000 M0 M10 1 Output variable 2 Set data Variable Description Data type Input Execution condition Bit varoe Device used to obtain the logical negation ANY BIT ouput Execution status Bit IN O variable 1 DD Device which will store the operation result ANY_BIT In explanation of functions I O variables inside are described
136. es specified in Cs gt and outputs the character string remaining after deletion to devices specified in Ed The value specified in specifies the number of characters to be deleted The value specified in specifies the position from which specified number of characters are deleted Example When 5 is specified in and ABCDEF 12345 E gt ABCD45 High order byte Low order byte High order byte Low order byte 1st word 42H B 41H A 42H B 41H A 1st word 2nd word 44H D 43H C Deletion start 44H D 3 43H C 2nd word 3rd word 46H F 1 45H E position n2 35H 5 34H 4 3rd word Ath word 32H 2 31H 1 oth character 0000H 4th word 5th word 34H 4 33H 3 6th word OOH 35H 5 Number of characters to be deleted 5 2 Acharacter string data stored in devices specified in indicates the data until OOH is detected first in units of byte in the range starting from the specified device 190 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handling character string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling character string data Use global labels when specifying labels 2 a Error 2 An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores th
137. es specified in GD T After two character strings are connected OOH is automatically added at the end 3 ABCDE T 123456 gt ABCDE123456 High order byte Low order byte High order byte Low order byte High order byte Low order byte 1st word 42H B 41H A 1st word 32H 2 31H 1 1st word 42H B 41H A 2nd word 44H D i 43H C 2nd word 34H 4 33H 3 2nd word 44H D i 43H C OO Om 3rd word 00H 45H E 3rdword 36H 6 35H 5 3rd word 23 4th word 0000H 4th word as 5th word j 6th word 4 2 A character string data stored in devices specified in indicates the data until OOH is detected first mmx in units of byte in the range starting from the specified device 2 5 S 3 For direct specification up to 32 characters can be specified input a SE When word devices are specified in and s2 this restriction up to 32 characters is not applicable 4 When both a character string stored in devices specified in and a character string stored in devices specified in begin with OOH when character 0 this function stores OOOOH in devices specified in Ed Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data in structured programs you cannot specify 16 bit devices directly 6 different from simple projects Use labels when handling character string data So Use global labels when specifying labels 38 S Error 5 An operation error occurs in the followin
138. eso ti as s o aida Pe of 5a Ww S ay gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 27 FXCPU Structured Programming Manual 3 Function Construction Application Functions 3 1 Applied Function Expression and Execution Type 3 Function Construction This chapter explains the construction of applied functions 3 1 Applied Function Expression and Execution Type Applied function and argument e The name expressing the contents is given to each function For example the function name SHL bit shift left is given e Each function consists of arguments which indicate I O data used in the function D10 _IN Gs An argument whose contents do not change even if the function is executed is called source and expressed in this symbol 1 CdD An argument whose contents change when the function is executed is called destination and expressed in this symbol K1 nD Arguments not regarded as source or destination are expressed in m n etc Argument target devices e The input variable label or device specifies the target e Bit device themselves such as X Y M and S may be handled e Bit devices may be combined in a way KnX KnY KnM and KnS to express numeric data FX Structured Programming Manual Device amp Common e Current value registers of data registers D timers T and counters C may be handled e When handling 32 bit data in structured programs you c
139. ever the image memory is set to El OFF because the input X002 is OFF As a result the actual output to the outside is Y003 OFF YO04 4 ON aus ass ops 38 Output processing Y003 0FF Y004 0N 5 oz 2 Countermeasures against double outputs 32 Double outputs double coils do not cause an illegal input error program error but the operation is p complicated as described above Change the program as shown in the example below O yq sa A B YO00 yooo y y e ao 35 C E F 9 Ignored D Y000 A H A B M100 I o s ss ppy pue s dl q USamjaq a9uapuodsa o7 C E M101 H D M100 YO00 H M101 The SET and RST instructions or jump instruction can be used instead or a same output coil can be programmed at each state using step ladder instructions STL and RET When you use the step ladder instructions STL and RET note that the PLC regards it as double coils if you program inside the state an output coil located outside the RET instruction from another program block or the STL instruction 17 FXCPU Structured Programming Manual 1 Outline Application Functions 1 3 Cautions on Creation of Fundamental Programs 1 3 3 Circuits not available in structured ladder programs and countermeasures 1 3 4 1 Bridge circuit A circuit in which the current flows in both directions should be changed as shown in the right figure so that a circuit without D and a circuit without
140. g 16 bit data is stored in a device specified in Cs gt and 8 is specified in 270FH gt FOOH AA AY AAA Word unsigned Cd Word unsigned bit string 16 bit data bit string 16 bit data 27r0oFH ofo 1 fofol1 j1j1jojojojoj1j1 1 1 AA lt _ _ __ o A ees FOOH 0 O olo 1 1 1 1 o o lolojojojojo Sj SY These bits become 0 2 n bits from the least significant bit become 0 150 FXCPU Structured Programming Manual Application Functions 5 4 Standard Bit Shift Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 2 Use global labels when specifying labels Program example S In this program word unsigned bit string 16 bit data stored in a device specified in is shifted leftward by n bits and the obtained data is output to a device specified in Cd gt using the data type of data stored in a device specified in Cs gt OO 1 Function without EN ENO SHL SS 22 Structured ladder 55 O SHL g_word1 16 F30F _IN g_word2 16 0F00 g_const_word1 16 0008 N 4 A ula ST SE S36 g_word2 SHL g_word1 g_const_word1 aS 2 o o 2 Function with EN ENO SHL_E Structured ladder
141. g cases The error flag M8067 turns ON and D8067 stores the error A code 1 When the number of devices after the device number specified in Cd is smaller than the number of devices required for storing the character string obtained by connection In this case OOH cannot be stored after all character strings and final character Error code K6706 2 When devices which store character strings specified in and overlap device numbers specified in Cd which will store the character string obtained by connection Error code K6706 3 When 00H does not exist in the corresponding device range after devices specified in and Error code K6706 s ss ppy pue SadlAeg Sama a9uapuodsa o7 185 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Program example In this program a character string stored in devices specified in is connected after a character string stored in devices specified in GD and the character string obtained by connection is output to devices specified in Cd 1 Function without EN ENO CONCAT Structured ladder CONCAT g_string1 ABCDEF _IN g_string3 ABCDEF 12345 g_string2 12345 _IN ST g_string3 CONCAT g_string1 g_string2 2 Function with EN ENO CONCAT_E Structured ladder CONCAT_E ENO 9_bool3 g_string3 ST g_ bool3 CONCAT_E g_booli g_string1 g_string2 g_string3 186 FXCPU Structured Programming Manual
142. g structuring of a Sequence program Advantages of hierarchical program e You can examine the outline of a program at first and then design its details gradually e Program blocks located at the lowest level in the hierarchy are extremely simple and highly independent Advantages of program consisting of program blocks e Because the processing of each block is clear the entire program is easy to understand e The entire program can be divided into several blocks that are created by several people e The program reusability is improved and the development efficiency is improved accordingly 2 Improved reusability of programs You can save program blocks in a library Program resources in the library can be shared and often used again FXCPU Structured Programming Manual 1 Outline Application Functions 1 2 PLC Series and Programming Software Version 1 1 2 Programming languages The following programming languages can be used in each program block Graphic languages 1 Structured ladder language This graphic language is created based on the relay circuit design technology Any circuit always starts from the bus line located on the leftmost The structured ladder language consists of contacts coils functions and function blocks These components are connected with vertical lines and horizontal lines TI gt O O ES n x000 X001 Yo00 3 Output Y000 Output Y000 on Y000 Ze Q gt S EN 4 mue
143. ge Function name Structured ladder ST BOOL_TO_WORD _BOOL BOOL_TO_WOR BOOL TO WORD Example D AE DO BOOL_TO_WORD MO BOOL_TO_WORD_E EN _BOOL Output label Example BOOL_TO_WORD_E X000 MO DO BOOL_TO_WOR D E 1 Output variable 2 Set data Input Execution condition Bit variable _BOOL Gs Conversion source bit data Bit Execution status Bit Output EN sd Word unsigned variable E 1 CD Word unsigned bit string 16 bit data after conversion Bit String 16 bit In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data stored in a device specified in into word unsigned bit string 16 bit data and outputs the data obtained by conversion to a device specified in Cd gt When the input value is FALSE this function outputs OH as the word unsigned bit string 16 bit data value When the input value is TRUE this function outputs 1H as the word unsigned bit string 16 bit data value Fase gt Co RE gt AM SS SY SS ll Bit data Word unsigned bit string 16 bit data Cautions Use the function having _E in its name to connect a bus 42 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program bit data stored in a device specified in is converted into word unsigned bit string 16 bit d
144. gramming Manual 6 Standard Function Blocks Application Functions 6 6 TP _E Program example In this program when bit data stored in a device specified in turns ON bit data stored in a device specified in turns ON and remains ON for 10 seconds 1 Function without EN ENO TP Structured ladder TP_Instance TP g_bool1 IN Q g_bool2 TH10s PT ET g_time1 ST TP_Instance IN g_bool1 PT T 10s g_bool2 TP_Instance Q g_time1 TP_Instance ET 2 Function with EN ENO TP_E Structured ladder TP_E_Instance MO M10 g_bool1 g_bool2 T 10s g_ time ST TP_E_Instance EN MO0 IN g_bool1 PT T 10s M10 TP_E_Instance ENO g_ bool2 TP_E_Instance Q g_time1 TP_E Instance ET 218 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 7 TON _E 1 6 7 TON _E o PUC FRO oyo yop ojyojojpxos 2 Outline gt This function block turns ON after specified time z 1 Format T Expression in each language Function name Structured ladder ST Oo TON IN PT 1 oa Instance name Example 23 Instance name IN MO ao en M10 PT Label 1 S Label 1 Label 2 M10 Instance name Q Label 2 Instance name ET TON_E EN IN PT 1 4 XO Example amI ONE Instance name EN X000 383 IN MO PT Label 1 3309 M10 M10 Instance name Q ga e Label 1 Label 2 Label 2 Instance name ET oS 1 Refer to caution points 5 T1 2 Set data 33 0
145. he following cases The error flag M8067 turns ON and D8067 stores the error 3 code 1 When any character other than 30H 0 to 39H 9 exists in the integer or decimal part Error code K6706 2 2 When 2EH exists in two or more positions inside the character string specified in n Error code K6706 3 3 When any character other than 45H E 2BH or 2DH exists in the exponent part or when two or more exponent parts exist Error code K6706 Oo 4 When the number of characters after is 0 or any value larger than 24 Error code K6706 a Program example In this program string data stored in a device specified in is converted into float single precision data and the data obtained by conversion is output to a device specified in Cd gt 4 1 Function without EN ENO STR_TO_REAL aus 2p Structured ladder 3235 STR_TO REAL g_string1 _ STRING g_real1 ST g_reall STR_TO_REAL g_string1 2 Function with EN ENO STR_TO_REAL_E Structured ladder 6 g_bool1 STR_TO REAL E e ENO g_bool3 5 oe g_stringi STRING g_real1 33 UU o ST J g_bool3 STR_TO REAL _E g_bool1 g_string1 g_real1 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 115 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 40 STR _TO TIME _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o
146. he operation result it is not regarded as an operation error However note that the accurate operation result cannot be obtained in this case MUL_TIME_E outputs TRUE from ENO 202 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types Program example O In this program multiplication GD xG is performed using time data stored in devices specified in J and Cs2 and the operation result expressed as time data is output to devices specified in CdD 1 Function without EN ENO MUL_TIME Structured ladder 2 MUL_TIME 3 g_time1 _IN1 S g_intl _IN2 a ST g_time2 MUL TIME g_time1 g_int1 Oo Om oc 22 2 Function with EN ENO MUL_TIME_E cs Structured ladder z g_bool1 MUL_TIME_E 4 EN ENO _IN1 aes IN2 255 OD O EF ST 2 g_bool3 MUL_TIME_E g_bool1 g_time1 g_int1 g_time2 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 203 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types PRUE FROG oo o o o o o o Outline This function performs division using time data 5 9 4 DIV_TIME _E 1 Format Expression in each language Function name Structured ladder ST DIV_TIME _IN1 _IN2 DIV_ TIME Example DIV_TIME Label 1 _1N1 al Label 3 Label 3 Label 2 _IN2 DIV_TIME Label 1 Label 2 DIV_TIME_E EN _IN1 _IN2 X DIV_TIME_E Output label E
147. i 105 TSO STR TO BOOLE iane E eE ei REEE TEE RAN 107 EA A a R 109 IIS STR TO DINT E je a E A ER E 111 Sgt TOREA EJren ceca 113 SAA STR TO MEE a a a a a A a 116 A ANA A asiana a aan 118 142 BCDC TO DIN TL a ere 120 51 439 TIME TO BOO ario 122 Dada TIME TOINI Bis sd A A A a 124 BAS TIME TO DINT E ti ca 126 5 146 TIME OSA a Besar eee A E SEEN 128 5147 TIME TO WORD E Jerina A T a a E EE A ERER 130 S148 TME TO DWORD e Seeder 132 FXCPU Structured Programming Manual Application Functions Table of Contents 5 2 Standard Functions Of One Numeric Varlable oocooccccccccncnccnccncnncnnnoncnncnnrnnroncnnrnnannnnnnnn 134 Dz ABS Eta a ES A ee ee ee ee ee 134 5 3 otandard Aglae SALCA re UMC ONS usin aaa 136 A A 136 A A A ROEDER 138 SE O A See a 2 aot NPs NOSE ER ee een E reo Ren ERE Seem 140 O O A OA 142 A A PCI PCE POP O un bactee a use tne et acdnlnes T 144 A AR eau N 146 ES AAA en hrc ered A ANA A 148 5 4 Standard BISAN CI CUINA sd abs 150 A A ne ET ETC er mee a ena oer renee ee eee 150 DA 2 SHR E ri ntak o add ncaa esa ene chads G 152 5 5 standard Bitwise Boolean Functions wiccisein dic icteb eve dees eaves ctavieve dens versa puaie ok atauis abode bes eeeeadaveus 154 AA o A A 154 POA OR Era oleo 156 AAA A Ce ee ee eee 158 SoA NOTCE atest chance A ac 160 50 Standard Selection FUNCHONS iaa it tato 162 SA 6 Pl I A E er eee nee ee ne here eee 162 2 MAMMA bra 164 A CAE crseratitet derenaetiarae sacauteanaecan a A a a
148. ices specified in and are compared and the operation result is z output to a device specified in CoD Structured ladder 9 a 3 e So Oo ST g_bool3 GT E g_ bool1 g_int1 g int2 g bool2 uoN OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 173 FXCPU Structured Programming Manual Application Functions 5 7 2 GEE PRUE FROG Outline 1 2 This function compares data with regard to gt larger or equal Format Barc Expression in each language unction name Structured ladder ST GE_E EN _IN _IN Output label Example E E x D0 D10 MO GE E GE_E X000 D0 D10 M0 1 Output variable Set data Input Execution condition Bit variable _IN GD Compared data or word device which stores such data ANY_SIMPLE Output Execution status Bit variable 1 0 Device which will store the comparison result Bit In explanation of functions I O variables inside are described Explanation of function and operation 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Cd This function executes comparison GD gt GD amp GD G3 4 amp Gnm 1 gt Gn a This function outputs TRUE when all comparison results are Cs n 1 gt Cs n b This function outputs FALSE when any c
149. ified in Cd gt 1 Function without EN ENO INT_TO_BOOL Structured ladder ST INT_TO_BOOL g_bool1 INT_TO_BOOL g_int1 g_int1 5923 INT g_bool1 2 Function with EN ENO INT_TO_BOOL_E Structured ladder ST g_bool3 INT TO _ BOOL E g_bool1 g_int1 g bool2 INT_TO BOOL E EN ENO _INT g_bool1 g_bool3 g_bool2 93 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk jsi uoqouny NS OO uoN onSUOD uojoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 10 DINT_TO_BOOL _E PET ZE ofotot otot totltotlo Outline 1 2 This function converts double word signed data into bit data and outputs the data obtained by conversion Format Functi Expression in each language unction name Structured ladder ST DINT_TO_BOOL _DINT DINT TO BOOL DINT_TO_BOOL Example a Label DINT 1L MO MO DINT_TO_BOOL Label DINT_TO BOOL_E EN _DINT DINT_TO BOOL_ ae s DINT_TO_BOOL_E X000 Label MO 1 Output variable Set data Input 1 alii Double Word signed Output 1 i id In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word signed data stored in a device specified in into bit data and outputs the data obtained by c
150. igned data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO INT_TO_DINT Structured ladder ST INT_TO_DINT g_dint1 INT _TO_DINT g_int1 g_int1 5923 INT g_dint1 5923 2 Function with EN ENO INT_TO_DINT_E Structured ladder ST INT_TO DINT E g_bool3 INT_TO_DINT_E g_bool1 g_int1 g_dint1 g_bool3 g_dint1 49 suooun y jo voneue dx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml sr uoqouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 psepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo o o o jo o o Outline This function converts double word signed data into word signed data and outputs the data obtained by conversion 5 1 8 DINT_TO_INT _E 1 Format Expression in each language Function name Structured ladder ST DINT_TO INT _DINT DINT_TO_INT DINT_TO_INT Example o Label _DINT A Dio 210 DINT_TO_INT Label DINT_TO_INT_E EN DINT Output label Example DINT_TO_INT_E X000 Label D10 DINT_TO_INT_E 1 Output variable 2 Set data idad Data type Input 1 lic Double Word signed Output al sele A In explanation of functions I O variables inside are described Explanation of function and operation This function converts double word
151. igned data stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd gt TFFFFFFFh E 24d20h31m23s647ms A ll oOo AH Double word signed data Time data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 78 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word signed data stored in a device specified in is converted into time data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DINT_TO_TIME Structured ladder ST DINT_TO_TIME g_time1 DINT_TO_TIME g_dint1 g_dint1 DINT g_time1 2 Function with EN ENO DINT_TO_TIME_E Structured ladder ST DINT_TO_TIME_E g_bool3 DINT_TO_TIME_E g_bool1 g_dint1 g_time1 g_bool3 g_time1 79 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk jsi uoqouny NS OO uoN onSUOD uojoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Fu
152. ils about the hardware including I O Additional Manual specifications wiring installation and 09R519 maintenance of the FX3Uc PLC main unit FX3UC Series User s Manual Hardware Edition J 997D28701 I O specifications wiring and installation of the PLC main unit FX3G extracted from the FX3G Supplied with product Series User s Manual Hardware Edition For detailed explanation refer to the FX3G Series User s Manual Hardware Edition FX3G Series Hardware Manual JY997D33401 Details about the hardware including I O Additional Manual specifications wiring installation and 09R521 maintenance of the FX3G PLC main unit FX3G Series User s Manual Hardware Edition JY997D31301 FXCPU Structured Programming Manual Application Functions Manual name Manual number apio att produci Contents Hee or Additional Manual name code Programming Detaileds about the analog special function block FX3G FX3U FX3UC User s Manual FX3U 4AD FX3U 4DA FX3UC 4AD and analog JY997D16701 Additional Manual 09R619 Analog Control Edition special adapter FX3U ADP Details about simple N N link parallel link JY997D16901 Additional Manual computer link and no protocol communication O9R715 RS instruction and FX2N 232IF FX3G FX3U FX3UC Series User s on Details about the positioning function built in the Manual Positioning Edition rage TOSSA meelonal Manual FX3G FX3U FX3UC Series oenee FX3u CF ADP User s Manual e da Pr
153. ing 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 46 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program bit data stored in a device specified in is converted into time data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO BOOL_TO_ TIME Structured ladder ST g_bool1 BOOL_TO_ TIME g_time1 BOOL_TO _TIME g_bool1 BOOL g_time1 2 Function with EN ENO BOOL_TO_TIME_E Structured ladder ST BOOL_TO_TIME_E g_bool3 BOOL_TO_TIME_E g_bool1 g_bool2 g_time1 g_bool1 g_bool3 g_time1 47 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno mk sr uoqouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions POUC FROG oo o o o o o o Outline This function converts word signed data into double word signed data and outputs the data obtained by conversion 5 1 7 INT_TO_DINT _E 1 Format Expression in each language Functi
154. input signal Bit PT Cn ENO Q GD ET 2 PT QD ON duration data Time Execution status Bit a Output 59 variable O J ET ED ON duration current value Time m In explanation of functions I O variables inside are described gt Explanation of function and operation When a device specified in turns ON this function block turns ON a device specified in Cd and keeps it ON for duration specified in Cn The elapsed time while a device specified in remains ON is set to a device specified in dD A device specified in turns OFF when the elapsed time reaches the set value Even if a device specified in turns OFF this function block does not reset the elapsed time When a device specified in turns ON from OFF next time this function block resets the elapsed time and turns ON again a device specified in dD s ss ppy pue s dl q Sama a9uapuodsao7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 217 FXCPU Structured Pro
155. instruction execution complete flag M8029 If you program the instruction execution complete flag M8029 twice or more together for two or more sequence instructions which actuate the flag M8029 you cannot judge easily by which sequence instruction the flag M8029 is controlled In addition the flag M8029 does not turn ON or OFF correctly for each corresponding sequence instruction Refer to the next page when you would like to use the flag M8029 in any position other than the position just under the corresponding sequence instruction Good example M8000 Y010 DO M8029 works as a flag to indicate that execution of DSW is completed Execution is Number of output pulses completed X000 1000 Number of output pulses M8029 works as a flag to indicate that execution of DPLSY is completed Execution is completed Bad example M8029 works as R a flag to indicate RH Program for DPLSY on the upper side that execution of Execution is DPLSY on the completed lower side is completed M8000 X010 Y010 M8029 works as 1 DO a flag to indicate that execution of DSW is completed X000 MO k S DPLSY on the upper side 1000 Number of output pulses Yo00 M8029 works as a flag to indicate that execution of DPLSY on the upper side is completed Program for DSW Execution is Number of output pulses completed DPLSY on the l
156. int2 g bool2 uoN OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 177 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions 5 7 5 LTE PRUE FROG Outline This function compares data with regard to lt smaller 1 Format Expression in each language Function name Structured ladder ST LT_E EN _IN IN Output label Example LT_E X000 D0 D10 M0 TE _E X000 D0 D10 M0 1 Output variable 2 Set data eee Data type Input EN A Execution condition Bit EN variable _IN GD Compared data or word device which stores such data ANY_SIMPLE Output Execution status Bit variable 1 Cd Device which will store the comparison result Bit In explanation of functions I O variables inside are described Explanation of function and operation 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Ca This function executes comparison GD lt GD amp G2 lt GD amp amp Gm 1 lt Gn a This function outputs TRUE when all comparison results are Cs n 1 lt Cs n b This function outputs FALSE when any comparison result is Cs n 1 gt Cs n 2 The number of pins in can be changed Cautions When handling 32 bit data in
157. ions 5 1 Type Conversion Functions FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program word signed data stored in a device specified in is converted into word unsigned bit 2 string 16 bit data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO INT_TO_WORD Structured ladder 2 o INT TO WORD 2 g_int1 5923 INT g_word1 16 1723 ST g_word1 INT_TO_WORD g_int1 Oo SS 2 Function with EN ENO INT_TO_WORD E 2 2 Structured ladder S g_bool1 INT_TO_WORD_E g_bool3 4 g_word1 amI cxo 2 Oo Oo ST S e g_bool3 INT_TO_WORD_E g_bool1 g_int1 g_word1 9 2 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 65 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo o o o o o o Outline This function converts double word signed data into word unsigned bit string 16 bit data and outputs the data obtained by conversion 5 1 16 DINT TO WORD E 1 Format Expression in each language Function name Structured ladder ST DINT_TO_WORD _DINT DINT_ TO WORD Example Label DINT 1 D10 DINT_TO_WORD Label DINT_TO_WORD_E EN _DINT Output label Example DINT_TO_WORD_E X000 Label D10 DINT_TO_W
158. it devices Use global labels when specifying labels Error 142 1 An operation error occurs when the divisor stored in a device specified in is 0 and the function is not executed 2 An operation error occurs when the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Program example O In this program division is performed using double word signed data stored in devices specified in and J Cs2 and the operation result is output to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Structured ladder 2 g_bool1 3 Oo ST g_bool3 DIV_E g_bool1 g_dint1 g_dint2 g_dint3 uonon suog uonoun y suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 143 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions 5 3 5 MOD _E PRUE FROG lo lololo Jolo o Outline This function performs division using two values A B C remainder and outputs the remainder 1 Format Expression in each language Function name Structured ladder ST _IN1 MOD _IN2 2 Example MOD Label 1 1 Label 3 Label 3 Label 2 _ Label 1 MOD Label 2 MOD_E EN _IN1 IN2 Output X label 2 MOD E Exam
159. itional Manual 1 Special unit block This manual explains details of each special unit block Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX PCS WIN 1 Detailed explanation may be provided by a separate manual in some products FXCPU Structured Programming Manual Application Functions Related Manuals This manual explains devices and parameters for structured programs provided by GX Works2 Refer to other manuals for sequence instructions and applied functions This chapter introduces only reference manuals for this manual and manuals which describe the hardware information of PLC main units Manuals not introduced here may be required in some applications Refer to the manual of the used PLC main unit and manuals supplied together with used products Contact the distributor for acquiring required manuals Common among FX PLCs structured Manual name Manual number ia proguct Contents mode or Additional Manual name code QCPU FXCPU Structured SH 080782 Additional Manual Programming methods specifications functions 13JW06 Programming Manual Fundamentals etc required to create structured programs FXCPU Structured Programming T Devices parameters etc provided in structured Manual Device amp Common did pedtonabwantal projects of GX Works2 DAISS20 FXCPU Structured Programming oe Sequence instructions provided in structured Manual Basic amp Applied
160. l 6 Standard Function Blocks Application Functions 6 4 CTD _E 6 4 CTD _E PRUE PROS opo o jojojo x x Outline This function block counts down the number of times of rising of a signal 1 Format Expression in each language Structured ladder ST CTD CD LOAD PV 1 Example Instance name CD MO LOAD M10 PV DO0 M20 Instance name Q D10 Instance name CV Function name Instance name CTD CTD_E EN CD LOAD PV 1 Example Instance name EN X000 CD M0 LOAD M10 PV D0 M20 Instance name Q D10 Instance name CV CTD E 1 Refer to caution points 2 Set data Execution condition Bit Input CD an Count source signal Bit variable LOAD G2 Reset input signal MI Counter set value Word signed ENO sf Execution status status Output ENO _ e as signal which turns ON when the current counter value variable Ca becomes 0 or less Number of times of rising Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function block counts down subtracts 1 from the value stored in a device specified in when a device specified in turns ON The value specifies the initial value for subtraction This function block turns ON a device specified in when the count value becomes 0 When a device specified in turns ON this function block turns OFF a device specified in aD and sets the initial value for subtrac
161. l1 BOOL_TO_DINT g_dint1 BOOL_TO_DINT g_bool1 _BOOL g_dint1 2 Function with EN ENO BOOL_TO_DINT_E Structured ladder ST BOOL TO DINT E g_bool3 BOOL_TO_DINT_E g_bool1 g_bool2 g_dint1 g_bool1 g_bool3 g_dint1 39 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml sr uoyouny INQ OO uoN ONSUOD uoljoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 3 BOOL TO STR _E 40 FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts bit data into string data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST BOOL_TO_STR _BOOL BOOL_TO_STR Example 1 Label Label BOOL_TO_STR MO BOOL_TO_STR_E EN _BOOL Output label Example BOOL_TO_STR_E X000 MO Label BOOL TO STR BOOL TO STR_ E 1 Output variable 2 Set data variable String data after conversion String In explanation of functions I O variables inside are described Explanation of function and operation This function converts bit data input to a deice specified in into string data and outputs the data obtained by conversion to a device specified in Cd gt O ne gt o gt me gt a E AA ll ll Bit data String da
162. loss in opportunity lost profits incurred to the user or third person by Failures of Mitsubishi products special damages and secondary damages whether foreseeable or not compensation for accidents and compensation for damages to products other than Mitsubishi products replacement by the user maintenance of on site equipment start up test run and other tasks Changes in product specifications The specifications given in the catalogs manuals or technical documents are subject to change without prior notice Product application 1 In using the Mitsubishi MELSEC programmable logic controller the usage conditions shall be that the application will not lead to a major accident even if any problem or fault should occur in the programmable logic controller device and that backup and fail safe functions are systematically provided outside of the device for any problem or fault 2 The Mitsubishi programmable logic controller has been designed and manufactured for applications in general industries etc Thus applications in which the public could be affected such as in nuclear power plants and other power plants operated by respective power companies and applications in which a special quality assurance system is required such as for Railway companies or Public service purposes shall be excluded from the programmable logic controller applications In addition applications in which human life or property that could be greatly affe
163. n is TRUE this function outputs the value stored in a device specified in to a device specified in Cd gt Example When the data type of input variables and is word signed Bit data Word signed data Word signed data Word signed data 162 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions Cautions O 1 Use the function having _E in its name to connect a bus 3 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 2 Use global labels when specifying labels Program example S In this program either one between the values stored in devices specified in and is output in accordance with the value stored in a device specified in to a device specified in Cd gt using the data type of data stored in devices specified in and s3 OO 1 Function without EN ENO SEL SS QS Structured ladder 5 S S SEL g_booll 7 G g_word3 g_word1 _INO 4 g_word2 _IN1 am T 25 ST EE noD 0 o a g_word3 SEL g_bool1 g_word1 g_word2 2 Function with EN ENO SEL_E Structured ladder g_bool1 g_bool2 g_word1 6 g_word2 no 58 ST 25 Ww g_ bool3 SEL_E g_bool1 g bool2 g word1 g word2 g_word3 gt gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 163
164. n2 EXPT EXPT Label 1 In1 va Label 2 D10 4In2 Example Label 2 EXPT Label 1 D10 EXPT_E EN In1 In2 Output X label EXPT E Example T Label 1 Label 2 EXPT_E X000 Label 1 D10 D10 Label 2 1 Output variable 2 Set data Variable Description Data type Execution condition Bit Bo In1 GD Data to be raised or word device which stores such data FLOAT Single Precision In2 G amp D Power data or word device which stores such data ANY_NUM Output ENO Execution status Bit variable 1 C amp D Word device which will store the operation result FLOAT Single Precision In explanation of functions I O variables inside are described Explanation of function and operation This function raises float single precision data stored in a device specified in to the power of the value stored in a device specified in GD and outputs the operation result to a device specified in Cd 40 Word SD wore nd ee GD Fed ame Float single signed data CD Float singi Float single precision data precision data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 146 FXCPU Structured Programming Manual
165. nal 1 Format Pana ROS o poo j ojojpfojxj x Expression in each language Function name CTUD CTUD E Structured ladder ST CTUD CU CD RESET LOAD PV Instance name 4 Example Instance name CU MO CD M10 RESET M20 LOAD M30 PV D0 M40 Instance name QU M50 Instance name QD D10 Instance name CV CTUD_E EN CU CD RESET LOA D PV 1 Example Instance name EN X000 CU M0 CD M10 RESET M20 LOAD M30 PV D0 M40 Instance name QU M50 Instance name QD D10 Instance name CV 1 Refer to caution points 2 Set data Input variable Output variable Execution condition Bit PV nD Counter set value Word signed Execution status Bit Bit Count up output signal au aD CN Output signal which turns ON when the current counter value aD D A A o Bit becomes 0 or less So CITI LEI In explanation of functions I O variables inside are described Explanation of function and operation 214 This function block counts up adds 1 to the value stored in a device specified in when a device specified in turns ON This function block counts down subtracts 1 from the value stored in a device specified in when a device specified in turns ON specifies the maximum value of the counter When the value stored in a device specified in reaches the maximum value of the counter a device specified in turns ON When the value stored in a device specified in becomes 0 a
166. nction and operation 6 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Cd S This function executes comparison GD GD 4 GD G3 amp amp Gn 1 Gn 38 a This function outputs TRUE when all comparison results are Cs n 1 Cs n 3 b This function outputs FALSE when any comparison result is Cs n 1 CsD n gt 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels s ss ppy pue s dl q USamjaq a9uapuodsa o7 Program example In this program the contents of devices specified in and are compared and the operation result is output to a device specified in CdD Structured ladder ST g_bool3 EQ_E g_bool1 g_int1 g_int2 g bool2 175 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions 5 7 4 LEE PRUE FROG Outline This function compares data with regard to lt smaller or equal 1 Format Expression in each language Function name Structured ladder ST LE E EN IN IN Output label Example LE E X000 D0 D10 M0 1 Output va
167. nctions Application Functions 5 1 Type Conversion Functions 5 1 23 REAL _TO_INT _E Pano ZE oy a o x x x x x Outline This function converts float single precision data into word signed data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST REAL_TO_INT a_real REAL_TO INT REAL_TO_INT Sample a_real 4 D10 REAL_TO_INT Label REAL_TO_INT_E EN a_ real REAL TO_INT_E Output label Example REAL_TO_INT_E X000 Label D10 REAL _TO_INT_E 1 Output variable 2 Set data siti Data type Input Execution condition Bit variable a_real Cs_ Conversion source float single precision data FLOAT Single Precision Output Execution status Bit Manable 1 Cd Word signed data after conversion Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts float single precision data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd 1234 0 E gt 1234 ZA Y OA Float single precision data Word signed data The portion after the decimal point is rounded off Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple proje
168. ndows are either registered trademarks or trademarks of Microsoft Corporation in the United States and or other countries CompactFlash is a trademark of SanDisk Corporation in the United States and other countries The company name and the product name to be described in this manual are the registered trademarks or trademarks of each company FXCPU Structured Programming Manual Application Functions Table of Contents Table of Contents Positioning OF This Mahal a Related MANU Si Ssdccecaeedss carvewtesba ceca bw doce ieweesusdecduteswat ide etiewedendetebece Generic Names and Abbreviations Used in Manuals ccccccecscececeeeeeeeees 1 Outline 1 1 Outline of Structured Programs and Programming Languages sccceeeseeeeeeees 1 1 1 Outline of structured programS cooooocccnccconccnncnnnonononnnnnnnnonnronnnononcnnnnnnancnnnnnnrrnnnnnnnens WAZ Programming lanqUages ir E aa eaaa eTa EEEa nTa SS 1 2 PLC Series and Programming Software Version ccccccccsseececeeeeeesaeeeesaeeeesaees 1 3 Cautions on Creation of Fundamental Programs ccccccseceeeeeeeeesaeeeeesaeeeeeeaees 1 3 1 I O processing and response delay oooccccocoocccnccconconccnnncononnnnonnnononcnnononcnnnnonanoss 1 3 2 Double output double coil operation and countermeasures ccccoccccccccnccconnncnnno 1 3 3 Circuits not available in structured ladder programs and countermeasures 1 34 Handling of general TAGS
169. ng 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices 2 Use global labels when specifying labels Error ej An operation error occurs when this function is executed in the following setting status The error flag M8067 turns ON and D8067 stores the error code K6706 Contents of a device specified in gt Contents of a device specified in OO Lower limit data Upper limit data ae Program example 53 In this program data whose type is same as the data stored in devices specified in GD and IS 5 output to a device specified in Cd in accordance with ANY_SIMPLE type data stored in devices specified in GD GD and GD 4 1 Function without EN ENO LIMITATION cag Structured ladder 3 22 LIMITATION g_inti 500 _MN g_int4 1300 g_int2 1300 _IN g_int3 5000 _ MX ST g_int4 LIMITATION g_int1 g_int2 g_int3 6 2 Function with EN ENO LIMITATION_E la Structured ladder el a 12 a 30 g bool LIMITATION E y ENO 5 gt ST g_bool3 LIMITATION_E g_bool1 g_int1 g_int2 g_int3 g_int4 s ss ppy pue s dl q USamjaq a9uapuodsa o7 169 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions PRUE FROG oo o o o jo o o Outline This function selects data and outputs the sel
170. ng Manual 3 Function Construction Application Functions 3 2 Labels e The universal data type indicates data type of a label which combines several basic data types O The data type name begins with ANY ANY Om Ss Word 22 ANY_REAL ANY_INT unsigned 7 55 Bit String The ANY type on a higher layer contains types aj FLOAT 16 bit on the lower layer Sinal Word The ANY type on the top layer contains all types Single signed Double Word Precision unsigned 4 FLOAT Bit String yes Double a 32 bit EE Precision g 9392 238 50 o a a s 2 0O Q of a Word Word Double Word Double word unsigned signed unsigned signed 6 Bit String Bit String 16 bit 32 bit Tu 35 a of 3d Y 3 a gt 1 Refer to the following manual for details Q FX Structured Programming Manual Fundamentals s ss ppy pue s dl q USamjaq a9uapuodsa o7 31 FXCPU Structured Programming Manual 3 Function Construction Application Functions 3 3 Device and Address 3 3 Device and Address 32 Devices can be described in two methods device method and address method Device method In this method a device is described using the device name and device number XO D 100 Device name Device number Address method This method is defined in IEC61131 3 and used as shown in the table below Head 1El character 2nd character Size sra ano rater cnaracters Number Position Clas
171. non 166 SoA UIA MON CCE td A peek ea tecotlcubinsedie dt ncdiad seed veataees 168 AA A A AA eaten td tostintn nae A E AEEA 170 5 7 Standard Comparison FUNCIONS ce coda 172 A A A 172 EAS OGE a cette es ce ce sce A sceseracinmas wucaktegise T E E ness 174 CST A cre A T E ES TSOP SES CREE o 175 SrA TE AP O 176 SO A A A A ENON eT 178 oN A RA 179 5 8 Standard Character String FUNC ONS occcccooccncccoccnconononcononnnnnnnnnnnononnnnononrnnonnnrnnnnnnrnnnnnnrnnnnnaness 181 Did MID E sta e iaa lados 181 39 2 CONCA TC aro eta 184 A A e pad E GU E A 187 TOA DELETE pu iia 190 BO REPLACE NE Mudo e e N a ean ted ion Get deete 192 A GL c ee A Ee eee eee ee 195 5 9 Functions OF Time Data TYPE dado Des 198 591 AD DE TIME taa ide loa 198 332 SUB ME Bss a 200 59 3 MUL TIME CO ds 202 oe DPN AME E aea OO 204 FXCPU Structured Programming Manual Application Functions Table of Contents 6 Standard Function Blocks 206 A C1 O cage ada faeces asec ec ci cca ache epi ace eae epi A 206 A o cate ercar cetam eating eeaeane capensis enencaeeranantasenoncaeeranaetaseeoneraseantsseoneeeeeeeeee 208 OS A a ae ee nee ene ee en eee eee Rene eee eae 210 6 4 CTD _E cecccececccccceccscececescecececesvececeecevacecevevaceecevavaesevavaversevavercevavavessevaceusevavverveveeneavisinersevenseeneess 212 A A oe ee ore ee Ome an See ey ee ee a ee 214 A AAN 217 T TON al ere a re Dee ne ee eT een 219 6 8 TO Brin eee 221 OO COUNTERS Misa ba lucas 223 6 10 TIM
172. ns used in program examples are expressed for GX Developer and FX PCS WIN 1 Detailed explanation may be provided by a separate manual in some products FXCPU Structured Programming Manual Application Functions 3 When using FXo0 FXos FXoN FXu FX2C PLCs QCPU FXCPU Structured Programming Manual Fundamentals Additional Manual Q FX This manual explains programming methods specifications functions etc required to create structured programs Structured FXCPU Structured Programming Manual Device amp Common Additional Manual FX This manual explains devices and parameters for structured programs provided by GX Works2 Structured FXCPU Structured Programming Manual Basic amp Applied Instruction FX Additional Manual This manual explains sequence instructions for structured programs provided by GX Works2 Structured This manual FXCPU Structured Programming Manual Application Functions FX Additional Manual This manual explains application functions for structured programs provided by GX Works2 Structured FX Series User s Manual Data Communication Edition Additional Manual FX This manual explains details of parallel link computer link no protocol communication RS instruction and programming communication for FX PLCs Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX PCS WIN Individual manuals Manual supplied with product or add
173. nsigned Word signed data bit string 32 bit data BC614EH ojojojojojojojo 1jo 1 1 J1JojoJo 1H tojofojo 1fo 1fojoJ1 1 1 0 24910 4 4 000 0 4f0 4 ojo 4 1 4 JO The information stored in high order 16 bits is discarded syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 95 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word unsigned bit string 32 bit data stored in a device specified in is converted into word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DWORD_TO_INT Structured ladder DWORD_TO_INT g_dword1 16 00012345 DWORD g_int1 9029 ST g_int1 DWORD_TO_INT g_dword1 2 Function with EN ENO DWORD_TO_INT_E Structured ladder g_bool1 DWORD TO INT E ST g_bool3 DWORD_TO_INT_E g _bool1 g_dword1 g_int1 96 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Func
174. nstance EN X000 CLK g _bool1 Y010 F_TRIG_E Instance g_bool2 F_TRIG_E Instance Q 209 auIno mk sr uoqouny INQ Oo UOoN OnNSUOD uojoun4 suoljoun4 jo voneuejdx3 peay 0 moH a paddy OW TI Q z O N pJepues syoo g uonoun4 gt s ss ppy pue s dl q Sama a9uapuodsao7 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 3 CTU _E 6 3 CTU _E PRUE PROS o olodo lod o x x Outline This function block counts up the number of times of rising of a signal 1 Format Expression in each language Function name Structured ladder ST CTU CU RESET PV 1 Example Instance name CU MO RESET M10 PV D0 M20 Instance name Q D10 Instance name CV Instance name CTU CTU_E EN CU RESET PV 1 Example Instance name EN X000 CU M0 RESET M10 PV D0 M20 Instance name Q D10 Instance name CV CTU_E 1 Refer to caution points 2 Set data Execution condition Bit ipui CU GD Count source signal Bit variable RESET GD Reset input signal Bit PV Cn Counter set value Word signed Execution status Bit Output t tput Bit a Q aD Count up output signa i CV Cd2 Number of times of rising Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function block counts up adds 1 to the value stored in a devic
175. nversion when the sign is set to 2DH 6 When 20H space or 30H 0 exists between the sign and the first number except 0 in string data 20H space or 30H 0 is ignored during conversion a In the case of decimal format aH HOW TH SHS LOWS A 1 35034 A gt A Y Ignored Float single precision data b In the case of exponent format aH HOUT ASHE HONS HAT EN NAO 1 35034E 10 SR Yya__ O_O OA Ignored Float single precision data 7 When 30H 0 exists between E and a number in character string data in the exponent format 30H 0 is ignored during conversion Ignored Float single precision data 8 When 20H space is contained in character string 20H space is ignored during conversion 9 Up to 24 characters can be input as string data Each of 20H space and 30H 0 contained in string is counted as 1 character respectively Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data and 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 114 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error O An operation error occurs in t
176. nverted into string data and the data 2 obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO TIME_TO_STR Structured ladder 2 a TIME _TO STR a g_time1 _TIME g_string1 5 ST g_string1 TIME_TO_STR g_time1 Oo Oa 2 Function with EN ENO TIME_TO_STR_E 23 SS Structured ladder S g_bool1 TIME_TO STR E EN ENO g_bool3 4 _ TIME g_string1 E TE ST S25 DED g_bool3 TIME_TO_STR_E g_bool1 g_time1 g_stringl io 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 129 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo ooo yo o o Outline This function converts time data into word unsigned bit string 16 bit data and outputs the data obtained by conversion 5 1 47 TIME_TO_WORD _E 1 Format Expression in each language Function name Structured ladder ST TIME_TO_WORD _ TIME TIME_TO WORD TIME_TO_ WORD Sample Label _TIME 5 D10 TIME_TO_WORD Label TIME_TO_WORD E EN TIME Output label Example TIME_TO_WORD_E X000 Label D10 TIME_TO_WORD E 1 Output variable 2 Set data Input Y Execution condition it variable _TIME Conversion source time data Time ENO i Execution status status Output Word unsigned variable A Ia Word unsigned bit string 16 bit data after conversion Bit String
177. o rv gt a Ss ll e a IS Bit data Word signed data Cautions Use the function having _E in its name to connect a bus 36 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program bit data stored in a device specified in is converted into word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO BOOL_TO_INT Structured ladder ST g_bool1 BOOL_TO_INT g_intl BOOL_TO_INT g_bool1 _BOOL a guint 2 Function with EN ENO BOOL_TO_INT_E Structured ladder ST g_bool3 BOOL_TO_INT _E g_bool1 g bool2 g_int1 BOOL_TO INT E EN ENO BOOL g_bool1 g_bool3 g_int1 37 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml jsi uoqouny NS OO uoN onSUOD uojoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 9 1 2 BOOL_TO_DINT _E 38 THUG ZE o yo po o o o o o Outline 1 2 This function converts bit data into double word signed data and outputs the data obtained by conversion Format Expression in each language Function name Structured ladder ST BOOL_TO_DINT _BOOL BOOL_TO_DINT Example zd Label Label BOOL_TO_DINT MO
178. obal labels when specifying labels An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error code 1 When the number of devices after the device number specified in Cd is smaller than the number of devices required for storing the output data obtained by insertion Error code K6706 When devices which store character strings specified in and overlap device numbers specified in Cd which will store the character string obtained by connection Error code K6706 When 00H does not exist in the corresponding device range after devices specified in and Error code K6706 When the number of characters of a character string stored in devices specified in is 32 68 or more Error code K6706 When the value specified in is negative Error code K6706 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Program example O In this program a character string stored in devices specified in is inserted into an arbitrary position J counted from the head of a character string stored in devices specified in GD and the character string obtained by insertion is output to devices specified in Cd 1 Function without EN ENO INSERT 2 Structured ladder a INSERT S g_string1 ABCDEF _IN1 g_string3 AB12345CDEF a g_string2 12345 g_int1 3 3 st 23 g_string3 INSERT g_string1 g_string2 g_int1 S S 2 2 Function with EN ENO INSERT_E
179. obtained by conversion is output to a device specified in Cd 1 Function without EN ENO BCD_TO_DINT Structured ladder BCD_TO_DINT g_word1 16 0000 _BCD g_dint1 0 ST g_dint1 BCD_TO_DINT g_word1 2 Function with EN ENO BCD_TO_DINT_E Structured ladder g_bool1 BCD _ TO DINTTE ENO ST g_bool3 BCD_TO_DINT_E g_bool1 g_word1 g_dint1 121 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml sr uoyouny INQ Oo uoN OnSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions PRUE FROG oo o o o o o o Outline This function converts time data into bit data and outputs the data obtained by conversion 5 1 43 TIME_TO_BOOL E 1 Format Expression in each language Function name Structured ladder ST TIME_TO_BOOL _TIME TIME_TO BOOL TIME TO BOOL Sample Label TIME 4 MO MO TIME_TO_BOOL Label TIME_TO_BOOL_E EN _ TIME Output label Example TIME_TO_BOOL_E X000 Label MO TIME_TO BOOL_ E 1 Output variable 2 Set data In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into bit data and outputs the data obtained by conversion to a device specified in Cd gt
180. oe ATA Subsection DELETE _E Deletes a character string Y 584 Subsection REPLACE _E Replaces a character string Y 585 mo O T 2 9 Functions Of Time Data Types ApplicablePLCE i O PLC nn ADAAENDD apaa o O ADD_TIME _E Adds imeda time data assim e raid A ee o nexs 9 XJ D NZXA D NLXA SL XA E ZX4 NX4 NOX4 s ox4 nexs D XA N XA N XA SLXJ NOx 9 9 9 z 26 FXCPU Structured Programming Manual 2 Function List Application Functions 2 10 Standard Function Blocks 2 10 Standard Function Blocks Applicable PLC Function name Reference Detects the rising edge of a signal and outputs y R_TRIG _E pulse signal Section 6 1 O D zcXd4 NX4 s17 uoyoun xi nix ixin ai 2 A gt lt os gt zZ ES a 6 s6 a Z F TRIG _E Detects the falling edge of a signal and outputs Section 6 2 pulse signal CTU E Counts up the number of times of rising of a ATAR Section 6 3 3 signal 9T CTD _E Counts down the number of times of rising of a erre e Section 6 4 A 3 signal ala a gt CTUD E Counts up down the number of times of rising of leelo po Sinas 5 a signal e 5 06 E EI CI duration TON _E Keeps OFF a signal during specified time Section 6 7 ae duration oe O20 Turns OFF the output signal at specified time 2270 TORGE after the input signal turned OFF SEENON Dig S D Sa COUNTER_FB_M Counter drive aaa drive Section 6 9
181. ogramming Manual Device amp Common 1 3 1 1 0 processing and response delay 1 Operation timing of I O relays and response delay FX PLCs execute the I O processing by repeating the processing 1 to processing 3 1 Accordingly the control executed by PLCs f The ON OFF status of input Input processing terminals is received at one time Input image memory is read Input image is read and contains not only the drive time of input filters and output devices but also the response Scan operation is executed delay caused by the operation cycle time Program processing according to program operation Image memory of Acquiring the latest I O information cycle SSI pee For acquiring the latest input information or Output processing Output immediately outputting the operation result in devices the middle of the operation cycle shown Batch I O method output latch memory are driven above the I O refresh instruction REF is Refresh method available 2 Short pulses cannot be received The ON duration and OFF duration of inputs in PLCs require longer time than PLC cycle time Input filter response delay When the response delay 10 ms of the input filter is considered and the cycle time is supposed as 10 ms the ON duration and OFF duration should be at least 20 ms respectively Accordingly PLCs cannot handle input pulses at 25 Hz 1000 20 20 or more However the situation can be imp
182. omparison result is Cs n 1 lt Cs n 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels Program example 174 In this program the contents of devices specified in and are compared and the operation result is output to a device specified in Cd Structured ladder ST g_ bool3 GE_E g_bool1 g_int1 g_int2 g bool2 5 7 Standard Comparison Functions FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions 1 5 7 3 EQ E O PRU OT ofoto otot otleotlo Outline 2 This function compares data with regard to equal 3 2 1 Format a Expression in each language Function name Structured ladder ST EQ E EN _IN _IN Output label Oo Om Example S 5 EQ E EQ_E X000 D0 D10 M0 3 3 2 1 Output variable 4 ame 2 Set data TE sas vaniecle Data type 3 o o Input Execution condition Bit variable _IN GD Compared data or word device which stores such data ANY_SIMPLE Output Execution status Bit variable 1 D Device which will store the comparison result Bit In explanation of functions I O variables inside are described Explanation of fu
183. on Application Functions 3 2 Labels 30 Constant description method The table below the description method required to set a constant to a label Constant type Description method Example Bit Input TRUE or FALSE Or input 0 or 1 TRUE FALSE Binary number Add 2 before a binary number 2 0010 2401101010 Octal number Add 8 before an octal number 8 0 84337 Input a decimal number directly Or add K before a decimal Decimal number 123 K123 number Hexadecimal number Add 16 or H before a hexadecimal number 16 FF HFF Real number Input a real number directly Or add E before a real number 2 34 E2 34 Character string Surround a character string with single quotations or double ABC ABC quotations Data type The label data type is basic or universal e The table below shows a list of basic data types Bit Boolean data O FALSE 1 TRUE 1 bit Word signed 32768 to 32767 16 bits O 2147483648 to Double Word signed Double precision integer 2147483647 32 bits Word unsignedV BIt String 6 ni data 0 to 65535 16 bits 16 bit Double Word unsigned Bit 55 Hit data 0 to 4294967295 32 bits String 32 bit E 1 175495 to FLOAT Single Precision Real number E 3 402823 38 32 bits Number of significant figures 6 String Character string 50 characters maximum Variable aa A T 24d 0h31m23s648 00ms to DN HR E T 24d20h31m23s647 00ms FXCPU Structured Programmi
184. on name Structured ladder ST INT_TO_DINT _INT INT_TO_DINT Example Label INT_TO_DINT DO INT TO _DINT_E EN _INT INT TO DINT_E Output label INT TO _DINT_E EN ENO Example 4 INT_TO_DINT_E X000 DO Label INT_TO_DINT 1 Output variable 2 Set data its Data type Input Execution condition Bit variable INT G Conversion source word signed data Word signed Output Execution status Bit variable 4 0D Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd O a gt A i ee AAA Word signed data Double word signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 48 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word signed data stored in a device specified in is converted into double word s
185. onversion to a device specified in Cd When the input value is 0 this function outputs FALSE When the input value is any value other than 0 this function outputs TRUE 0 gt E E C a TRUE ZAYAS A A Y Double word signed data Bit data Cautions 94 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program double word signed data stored in a device specified in is converted into bit data and 2 the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DINT_TO_BOOL Structured ladder 2 a DINT TO BOOL 2 g_dint1 0 DINT g_bool1 ST g_bool1 DINT TO BOOL g_ dint1 Oo 9T 2 Function with EN ENO DINT_TO_BOOL_E 2 2 Structured ladder S g_bool1 DINT_TO_BOOL _E g_bool3 4 g_dint1 _DINT g_bool2 E cxXKO 25 o gt Oo ST S E p g_bool3 DINT_TO_BOOL_E g_bool1 g_dint1 g_bool2 92 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 55 FXCPU Structured P
186. ormat Expression in each language Structured ladder ST DINT_TO_STR _DINT DINT TO STR DINT_TO_STR anne Label 1 _DINT 1 Label 2 Label 2 DINT_TO_STR Label 1 DINT_TO_STR_E EN _DINT Output label Example DINT_TO_STR_E X000 Label 1 Label 2 Function name DINT_TO STR E 1 Output variable 2 Set data Input El alain Double Word signed Output al sele ste In explanation of functions I O variables inside are described Explanation of function and operation 1 This function converts double word signed data stored in a device specified in into string data and outputs the data obtained by conversion to a device specified in Cd gt High order byte Low order byte String 1st word PY EES 2nd word y 3rd word 4th word Sth word ASCII code for ones place 6th word Double word signed data Automatically stored at the end of the character string 2 In Sign data 20H space is stored when the input value is positive and 2DH is stored when the input value is negative 3 20H space is stored in high order digits when the number of significant figures is small Example When 123456 is input High order byte Low order byte 20H space 2DH i 1st word 20H space 20H space 2nd word 31H 1 20H space 3rd word Double word signed data 33H 3 32H 2 ewer 35H 5 34H 4 5th word OOH 36H 6 6th word 4 00H is automatically stored at the end high order
187. ower side 1000 Number of output pulses2 Y001 19 suooun y jo voneue dx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 TI gt O O ES n OO UON ONSUOD uoloun4 peay 0 moH a paddy Qi suoloun4 O plepuejs syoo g uonoun4 gt FXCPU Structured Programming Manual 1 Outline Application Functions 1 3 Cautions on Creation of Fundamental Programs 2 Introduction of a method to use flags in any positions other than positions just under sequence instructions If two or more sequence instructions are programmed general flags turn ON or OFF when each corresponding instruction is executed Accordingly when using a general flag in any position other than a position just under a sequence instruction set to ON or OFF another device variable just under the sequence instruction and then use the contact of such device variable as the command contact M8000 YO10 DO DSW execution complete flag M8029 is changed to M100 Execution is completed MO 1060 Number of output pulses DPLSY execution complete flag M8029 is changed to M200 Execution is completed e d ae It works as the DSW NE execution complete flag o o e M100 a a DO It works as the DPLSY 10 execution complete flag Number of output pulses 20 FXCPU Structured Programming Manual 1 Outline Application Fun
188. pe of data stored in devices specified in and s2 1 Function without EN ENO MINIMUM Structured ladder 2 MINIMUM 3 9_int1 5678 _IN g_int3 1234 S g_int2 1234 _IN ST g_int3 MINIMUM g_int1 g_int2 Oo uoN OnSUOD uoloun4 2 Function with EN ENO MINIMUM_E Structured ladder MINIMUM_E suoljoun4 jo voneuejdx3 peay 0 moH a ST g_bool3 MINIMUM_E g_bool1 g_int1 g_int2 g_int3 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 167 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions 5 6 4 LIMITATION _E PRUE FROG oo o o o jo o o Outline This function judges whether data is located within the range between the upper limit value and the lower limit value 1 Format Expression in each language Structured ladder ST LIMITATION _MN _IN MX Function name LIMITATION MN Example LIMITATION E D30 _IN LIMITATION DO D10 D20 _MXx LIMITATION_E EN _MN _IN MX LIMITATION E Output label EN ENO Example LIMITATION_E _MN z LIMITATION_E X000 D0 D10 D20 IN D30 MX 1 Output variable 2 Set data Execution condition Bit Input _MN GD Lower limit data or word device which stores such data ANY_SIMPLE variable IN Input data or word device which stores such data ANY_SIMPLE _MX D Upper limit data or word device which stores such data ANY_ SIMPLE Upu Ex
189. peration result is 0 nee eap OFF When the operation result is any other than 0 ON When the operation result is less than 32 768 16 bit operation or less than M8021 mo 2 147 483 648 32 bit operation OFF When the operation result is 32 768 16 bit operation or more or 2 147 483 648 32 bit operation or more ON When the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation menes sany OFF When the operation result is 32 767 16 bit operation or less or 2 147 483 647 32 bit operation or less Zero flag Zero flag Zero flag V N N 2 1 0 32 768 A E CO ay 2 SN VLA Borrow flag The most The most Carry flag significant bit significant bit of data is 1 of data is 0 2 1 0 2 147 483 648 lt SEGA 2 147 483 647 0 1 2 NAA Nr Borrow flag Zero flag Carry flag Program example In this program addition is performed using double word signed data stored in devices specified in and Cs2 and the operation result is output to a device specified in Cd Structured ladder g_bool1 ST g_bool3 ADD_E g_bool1 g dint1 g dint2 g dint3 137 auIno mk jsi uoqouny NS OO UON OnNSUOD uoljoun4 suoljoun jo voneuejdx3 peay 0 moH a 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions
190. ple Label 1 _ Label 3 MOD_E X000 Label 1 Label 2 _ Label 2 Label 3 1 Output variable 2 Refer to the Cautions 2 Set data EN O OO OO OoOO Execution condition Bit T Data to be divided or word device which stores such data ANY_INT variable EN _IN1 GD _IN2 G amp D Data for division divisor or word device which stores such data ANY_INT Output Execution status Bit variable 1 Cad Word device which will store the operation result ANY_INT In explanation of functions I O variables inside are described Explanation of function and operation This function performs division Cs1 Cs2 using word signed double word signed data stored in devices specified in and s2 and outputs the remainder to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Example When the data type is word signed Quotient Remainder ES Word Word Not output Cd Word signed data signed data signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 Note that the MOD description method is different from other function description methods in the ST l
191. quipment using the product associated with this manual should be of a competent nature trained and qualified to the local and national standards required to fulfill that role These engineers should be fully aware of all aspects of safety with regards to automated equipment b Any commissioning or service engineer must be of a competent nature trained and qualified to the local and national standards required to fulfill that job These engineers should also be trained in the use and maintenance of the completed product This includes being completely familiar with all associated documentation for the said product All maintenance should be carried out in accordance with established safety practices c All operators of the completed equipment should be trained to use that product in a safe and coordinated manner in compliance to established safety practices The operators should also be familiar with documentation which is connected with the actual operation of the completed equipment Note the term completed equipment refers to a third party constructed device which contains or uses the product associated with this manual This product has been manufactured as a general purpose part for general industries and has not been designed or manufactured to be incorporated in a device or system used in purposes related to human life Before using the product for special purposes such as nuclear power electric power aerospace medicine or passenger mov
192. ra sure to set them to 0 j Conversion into BCD data 8000 4000 2000 1000 800 400 200 100 8 0 40 20 10 8 4 2 1 9999H 1 o o 1j1lolo l1l1iflololij1flolol1 w a o o o Thousands place Hundreds place Tens place Ones place Cautions Use the function having _E in its name to connect a bus Error An operation error occurs when the value stored in a device specified in is outside the range from 0 to 9 999 72 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program word signed data stored in a device specified in is converted into BCD data and the 2 data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO INT_TO_BCD Structured ladder 2 o INT_TO_BCD a g_int1 5923 INT g_word 16 5923 5 ST g_word1 INT_TO_BCD g_int1 Oo 9 2 Function with EN ENO INT TO BCD_E a Structured ladder a g_bool1 INT_TO_BCD_E EN ENO g_bool3 4 _INT g_word1 532 225 ST S 27 g_bool3 INT_TO _BCD E g _bool1 g_int1 g word 9 a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 73 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 20 DINT_TO BCD _E PRUE FROG oo o o o jo o o Outline This function converts double word signed data
193. red Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program string data stored in a device specified in is converted into bit data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO STR_TO_BOOL Structured ladder STR_TO_BOOL g_string1 _ STRING g_bool1 ST g_bool1 STR_TO_BOOL g_stringl 2 Function with EN ENO STR_TO_BOOL_E Structured ladder STR TO BOOL E ENO g_bool1 g_bool3 g_string1 _STRING g_bool2 ST g_bool3 STR_TO _BOOL E g _bool1 g_string1 g_bool2 108 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 37 STR_TO_INT _E o PUC FXO Outline 2 This function converts string data into word signed data and outputs the data obtained by conversion 3 1 Format z Expression in each language Function name Structured ladder ST STR_TO_INT _STRING Oo OTI STR_TO_INT STR_TO_INT PKampie 3 3 7 Label STRING 4 D10 D10 23 STR_TO_INT Label 2 STR_TO_INT_E EN STRING gt XO STR_TO INT E Output label STR_TO_INT_E EN ENO Example 4 STRING 4 STR_TO_INT_E X000 Label D10 ais ai 4 Output variable Sag oD 2a 2 Set data Input Execution condition Bit variable _STRING C amp D Conversion source string data String Output Execution status Bit
194. red ladder 2 a TIME TO INT 2 g_time1 _TIME g_int1 5 ST g_int1 TIME_TO_INT g_time1 Oo ga 2 Function with EN ENO TIME_TO_INT_E 23 cs Structured ladder S g_bool1 TIME_TO INT E mmTI 302 ST 335 DSS g_bool3 TIME_TO_INT_E g_bool1 g_time1 g_int1 p 6 plepuejs syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 125 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 45 TIME_TO_DINT _E THUG ROS oyo po j op ojojojo Outline 1 2 This function converts time data into double word signed data and outputs the data obtained by conversion Format Expression in each language Structured ladder ST TIME_TO_DINT _TIME TIME_TO_DINT TIME_TO_DINT campy Label 1 TIME 4 Label 2 Label 2 TIME_TO_DINT Label 1 TIME_TO_DINT_E EN TIME Output label Example Label 2 TIME_TO_DINT_E X000 Label 1 Label 2 Function name TIME_TO_DINT_ E 1 Output variable Set data In explanation of functions I O variables inside are described Explanation of function and operation This function converts time data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd gt 20m34s567ms gt 1234567 Y Time data Double word signed data Cautions 126 1 Use the function having _E in it
195. riable 2 Set data Input Execution condition Bit variable _IN GD Compared data or word device which stores such data ANY_SIMPLE Output Execution status Bit variable 1 0 Device which will store the comparison result Bit In explanation of functions I O variables inside are described Explanation of function and operation 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Cd This function executes comparison GD lt GD 4 GD lt GD 4 amp Gn 1 lt Gm a This function outputs TRUE when all comparison results are Cs n 1 lt Cs n b This function outputs FALSE when any comparison result is Cs n 1 gt Cs n 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 176 FXCPU Structured Programming Manual Application Functions 5 7 Standard Comparison Functions Program example O In this program the contents of devices specified in and are compared and the operation result is z output to a device specified in Cd gt Structured ladder 9 a 3 e So Oo ST g_bool3 LE_E g_bool1 g_inti g
196. rogramming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 11 INT_TO REAL E Pano ZE oy a o x x x x x Outline This function converts word signed data into float single precision data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST INT_TO_REAL a_Int INT TO REAL INT_TO_REAL Example a a Int a Label INT_TO_REAL DO INT TO REAL E ia INT TO REAL E EN ENG Example a_Int 1 INT_TO_REAL_E X000 DO Label 1 Output variable 2 Set data blind Data type Input Execution condition Bit variable a_Int Cs Conversion source word signed data Word signed Output Execution status Bit variable 4 Ca Float single precision data after conversion FLOAT Single Precision In explanation of functions I O variables inside are described Explanation of function and operation This function converts word signed data stored in a device specified in into float single precision data and outputs the data obtained by conversion to a device specified in Cd 1234 gt 1234 0 FF ll Word signed data Float single precision data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can
197. rom simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions Program example O In this program the maximum value among word signed data stored in devices specified in and IS J output to a device specified in CdD using the data type of data stored in devices specified in and s2 1 Function without EN ENO MAXIMUM Structured ladder 2 MAXIMUM 3 9_int1 5678 _IN g_int3 5678 S g_int2 1234 _IN ST g_int3 MAXIMUM g_int1 g_int2 Oo uoN OnSUOD uoloun4 2 Function with EN ENO MAXIMUM_E Structured ladder MAXIMUM_E suoljoun4 jo voneuejdx3 peay 0 moH a ST g_bool3 MAXIMUM_E g_bool1 g_int1 g_int2 g_int3 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 165 FXCPU Structured Programming Manual Application Functions 5 6 Standard Selection Functions PRUE FROG oo o o o jo o o Outline This function searches the minimum value among data and outputs the minimum value 5 6 3 MINIMUM _E 1 Format Expression in each language Function name Structured ladder ST MINIMUM _IN _IN MINIMUM Example MINIMUM IN 4 D20 at MINIMUM DO D10 MINIMUM_E EN _IN IN Output label Example MINIMUM_E X00
198. roved by PLC special functions and applied instructions Convenient functions for Improvement This input ON can be received By using the following functions PLCs Input ON cannot This input OFF cannot can receive pulses shorter than the be received Y be received operation cycle OFF ON ON OFF e High speed counter function A Program Program Program 4 Program y processing N processing Y processing y processing Y e Input interrupt function e Pulse catch function TE input processing Output processing gt Time Operation cycle e Input filter value adjustment function 16 FXCPU Structured Programming Manual 1 Outline Application Functions 1 3 Cautions on Creation of Fundamental Programs 1 3 2 Double output double coil operation and countermeasures This subsection explains the double output double coil operation and countermeasures 1 Operation of double outputs When a coil output variable is used twice double coils in another program block to be executed or in the 2 same program block the PLC gives priority to the latter coil i Suppose that the same coil Y003 is used in two positions as S shown in the right figure Input processing a For example suppose that X001 is ON and X002 is OFF X001 ON X002 OFF Oo In the first coil YOO3 the image memory is set to ON and the output Y004 is also set to ON because the input X001 is ON on In the second coil YOO3 how
199. s 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 97 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word unsigned bit string 32 bit data stored in a device specified in is converted into double word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DWORD_TO_DINT Structured ladder DWORD_TO_DINT g_dword1 16 00012345 DWORD g_dint1 74565 ST g_dint1 DWORD_TO_DINT g_dword1 2 Function with EN ENO DWORD_TO_DINT_E Structured ladder g_bool1 DWORD TO DINT E ST g_bool3 DWORD_TO_DINT_E g_bool1 g dword1 g_dint1 98 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 32 WORD _TO DWORD _E o PROVO FXO oyo po j opojyjojpojo Outline 2 This function converts word unsigned bit string 16 bit data into double word unsigned bit string 32 bit 3 data and outputs the data obtained by conversion S 1 Format Expression in each language Function nam
200. s name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example O In this program time data stored in a device specified in is converted into double word signed data and 3 the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO TIME_TO_DINT Structured ladder 2 o TIME_TO_DINT 2 g_time1 _TIME g_dint1 ST g_dint1 TIME_TO_DINT g_timet Oo 9 2 Function with EN ENO TIME_TO_DINT_E 23 cs Structured ladder S g_bool1 TIME_TO_DINT_E mmTI cxo 2a eu ga 2 oD g_bool3 TIME_TO_DINT_E g_bool1 g_time1 g_dint1 aa 6 syoo g uonoun4 plepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 127 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 46 TIME TO STR _E FX3U C FX3G FX2N C FX1N C FXU FX2C FX0 S o Outline This function converts time data into string data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structur
201. s such data ANY NUM Output Execution status Bit variable 1 00D Word device which will store the operation result ANY_NUM In explanation of functions I O variables inside are described Explanation of function and operation 1 This function performs addition GD G using word signed double word signed float single precision data stored in devices specified in and s2 gt and outputs the operation result to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Example When the data type is word signed 1234 5678 gt 6912 MA l all all Word Word Cd Word signed data signed data signed data 136 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Cautions 1 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 2 Even if underflow or overflow occurs in the operation result it is not regarded as an operation error TRUE is output from ENO However note that the obtained operation result is not accurate in this case Either of the flags shown in the table below turns ON or OFF in accordance with the operation result Device Name Description ON When the o
202. sification put Omitted f Bit This number is provided for This decimal number a Output fox Bt detailed classification corresponds to the device Period is used to delimit number M Internal W Word 16 bits the subsequent Number OD Double word 32 bits is abra an classification may be omitted Long Word 64 bits i X 0 M X 1 863 Memory area Size Classification Number position Memory area position The memory area position in which data is assigned is classified into input output or internal X X Device method I Input Y Y Device method Q Output Any other device M Internal Size The principle of the description method corresponding to the device method MELSEC description method is as follows Bit device X Bit Word device W Word 16 bits D Double word 32 bits Classification The 3rd and later characters indicate the device type which cannot be specified only by the position and size explained above The classification is not required for devices X and Y Refer to the following for the device description method gt 7 3 Appendix A FXCPU Structured Programming Manual 3 Function Construction Application Functions 3 4 EN and ENO 3 4 EN and ENO Execution of an instruction can be controlled when the instruction contains EN in its name e EN inputs the instruction execution condition e ENO outputs the instruction execution status e The ta
203. signed data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd gt A gt A oS or Double word signed data Word signed data Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 50 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word signed data stored in a device specified in is converted into word signed data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DINT_TO_INT Structured ladder ST DINT_TO_INT g_int1 DINT_TO_INT g_ dint1 g_dint1 5923 DINT g_int1 5923 2 Function with EN ENO DINT_TO_INT_E Structured ladder ST DINT_TO_INT E g_bool3 DINT_TO_INT_E g_bool1 g_dint1 g_int1 g_bool3 g_int1 91 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno jsi uoqouny INQ OO uoN onSUOD uojoun4 peay 0 moH a 6 syoo g uonoun4 psepuejs gt FXCPU Structured Programming Manual 5 Applie
204. sion Functions 5 1 36 STR _TO BOOL _E o PRU FXO o Outline 2 This function converts string data into bit data and outputs the data obtained by conversion 3 1 Format z Expression in each language Function name Structured ladder ST STR_TO_BOOL _STRING Oo Om STR TO BOOL STR_TO_BOOL Example a3 Label _STRING 1H Mo MO eS STR_TO_BOOL Label STR_TO_BOOL_E EN _STRING XO SIR TO BOOL E Output label STR_TO_BOOL_ a SU oe 4 STRING 4 STR_TO_BOOL_E X000 Label MO ais 25 4 Output variable SRI S S o a 2 Set data Input Execution condition Bit variable _STRING Gs Conversion source string data String Output Execution status Bit variable ii GD Bit data after conversion Bit In explanation of functions I O variables inside are described 6 Explanation of function and operation So This function converts string data stored in a device specified in into bit data and outputs the data Sa obtained by conversion to a device specified in Cd 8 oe rs 7 ae gt RE _ _ A lA AAA ll String data Bit data gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data Use global labels when specifying labels 107 FXCPU Structu
205. specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 3 The function is provided in the FX3G Series Ver 1 10 or later 56 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program word signed data stored in a device specified in is converted into float single precision data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO INT_TO_ REAL Structured ladder ST INT_TO_REAL g_real1 INT_TO_REAL g_int1 g_int1 5923 a Int g_real1 5923 0 2 Function with EN ENO INT_TO REAL _E Structured ladder ST INT_TO_REAL_E g_bool3 INT _TO REAL E g_bool1 g_int1 g_ real 57 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml sr7 uoyouny INQ Oo UON ONSUOD uoloun4 peay 0 moH a 6 syoo g uonoun4 psepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 12 DINT TO REAL E Pano ZE oy a o x x x x x Outline This function converts double word signed data into float single precision data and outputs the data obtained by conversion 1 Format Expression in each language Function name Structured ladder ST DINT_TO_REAL a_Dint DINT_TO RE
206. status variable 4 0 Device which will store the comparison result i In explanation of functions I O variables inside are described 5 Explanation of function and operation 1 This function compares the contents of devices specified in and outputs the operation result expressed as the bit type data to a device specified in Ca This function executes comparison GD gt GD amp G2 6D 4 4 Gm 1 gt Gn a This function outputs TRUE when all comparison results are Cs n 1 gt Cs n b This function outputs FALSE when any comparison result is Cs n 1 lt Cs n 2 The number of pins in Cs can be changed 6 Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 7 Program example In this program the contents of devices specified in GD and are compared and the operation result is output to a device specified in Cd Structured ladder g_bool3 GE_E g_bool1 g_int1 g_int2 g_bool2 The above page is prepared for explanation and is different from the actual page 34 FXCPU Structured Programming Manual 4 How to Read Explanation of Functions Application Functions 1 1 Indicates the chapter section subsection number and instruction
207. stored in 3 devices specified in and s2 gt and the operation result is output to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Structured ladder 2 g_bool1 g_bool3 2 g_word1 16 5F03 g_word3 16 DFCF g_word2 16 9CCC Oo ST g_ bool3 OR_E g_bool1 g word1 g_ word2 g_word3 uoN OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 157 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions 5 5 3 XORE PRUE FROG oo o o o jo o o Outline This function obtains the exclusive logical sum of two or more bits and outputs it 1 Format Expression in each language Function name Structured ladder ST XOR_E EN _IN _IN Output label XOR E Example XOR_E X000 M0 M10 M20 1 Output variable 2 Set data pane Data type Input Bit a ANY_BIT Output Bit variable Ca Device which will store the operation result ANY_BIT In explanation of functions I O variables inside are described Explanation of function and operation 1 This function obtains the exclusive logical sum using each bit of bit word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in devices specified in and s2 and outputs the operation result to a device specified in Cd g
208. stored in a device specified in into time data and outputs the data obtained by conversion to a device specified in Cd gt C e gt 1234567 L gt 20m34s567ms l 2 AAA Double word unsigned Time data bit string 82 bit data syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 105 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word unsigned bit string 32 bit data stored in a device specified in is converted into time data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO DWORD_TO_TIME Structured ladder DWORD_TO_TIME g_dword1 DWORD g_time1 ST g_time1 DWORD_TO_TIME g_dword1 2 Function with EN ENO DWORD_TO_TIME_E Structured ladder g_bool1 DWORD TO TIME E ST g_bool3 DWORD_TO_TIME_E g_bool1 g_dword1 g_time1 106 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conver
209. string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling character string data Use global labels when specifying labels Error 196 An operation error occurs in the following cases The error flag M8067 turns ON and D8067 stores the error code 1 2 When OOH NULL does not exist in the corresponding device range specified in Error code K6706 When 00H NULL does not exist in the corresponding device range specified in Error code K6706 FXCPU Structured Programming Manual Application Functions 5 8 Standard Character String Functions Program example O In this program a character string stored in devices specified in is searched from the beginning of a J character string stored in devices specified in GD and the search result is output to devices specified in Cd 1 Function without EN ENO FIND 2 Structured ladder a FIND g_string1 ABCDEFGHIJK _IN1 g_int1 5 a g_string2 EFGHIJK _IN2 ST 3 ST g_int1 FIND g_string1 g_string2 23 2 Function with EN ENO FIND_E a Structured ladder 4 aus ase ogo 38 ST g_bool3 FIND_E g_bool1 g_string1 g_string2 g_int1 6 pJepuels syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 197 FXCPU Structured Programming Manual Application Functions 5 9 Functions Of Time Data Types 5 9 Functions Of Time Data Types 5 9 1
210. t using the data type of data stored in devices specified in and s2 Example When the data type is word unsigned bit string 16 bit 1pfoj1foj1fjof1fo 1jo 1fo 1jo 1jo Exclusive logical sum jojojof 1 1joj1f 1j1j1 1 1jOjoO OjO0 y COp 1top1j1pojofol1rjo j1joj1 1foj1 j0 2 The number of pins in can be changed 158 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions 3 If there are 3 or more Cs gt the exclusive logical sum is obtained using the exclusive logical sum of 2 and GD and GD If there is Cs4 the exclusive logical sum is obtained using the exclusive logical sum of exclusive logical sum of and Cs2 and GD and s4 In this way the exclusive logical sum is obtained the required number of times for all input labels ee 2 Example When the data type is bit When the number When the number When the number 3 of IN is 3 of IN is 4 of IN is 5 o FALSE TRUE FALSE TRUE a XOR i XOR XOR XOR l l l TRUE l TRUE l TRUE i TRUE 3 l l After that the exclusive JE J l j I iji I Lt logical sum is obtained 2 2 i i the required number of 3 3 Result TRUE 4 Result FALSE 4 Result TRUE 4 Result FALSE times S Cautions 4 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from cag simple projects Use labels when handling 32 bit data Soe You can specify 32 bit count
211. ta Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data Use global labels when specifying labels FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program bit data stored in a deice specified in is converted into string data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO BOOL_TO_STR Structured ladder ST g_bool1 BOOL TO STR g_string1 BOOL_TO_STR g_bool1 _BOOL g_string1 2 Function with EN ENO BOOL_TO_STR_E Structured ladder ST BOOM TOLSiIRIE g_bool3 BOOL_TO_STR_E g_bool1 g_bool2 g_string1 g_bool1 g_bool3 g_string1 41 suoloun4 jo voneuejdx3 s ss ppy pue s dl q USamjaq a9uapuodsa o7 auIno ml sr uoyouny INQ OO uoN ONSUOD uoljoun4 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 4 BOOL TO WORD E PRUE FROG oo o o o o o o Outline This function converts bit data into word unsigned bit string 16 bit data and outputs the data obtained by conversion 1 Format Expression in each langua
212. te that the accurate operation result cannot be obtained in this case ADD_TIME_E outputs TRUE from ENO Either of the flags shown in the table below turns ON or OFF in accordance with the operation result Device Name Description ON When the operation result is 0 jo ERIO OFF When the operation result is any other than 0 ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit operation aia BONON OFF When the operation result is 32 768 16 bit operation or more or 2 147 483 648 32 bit operation or more ON When the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation di sany OFF When the operation result is 32 767 16 bit operation or less or 2 147 483 647 32 bit operation or less Zero flag Zero flag Zero flag YN aN aN 2 1 0 32 768 lt _ 1 0 1 32 767 0 1 2 Borrow flag The most The most Carry flag significant bit significant bit of data is 1 of data is 0 Zero flag Zero flag CYN 2 1 0 2 147 483 648 PE EA 1 __ 2 147 483 647 0 1 2 LIST Nee Borrow flag Zero flag Carry flag Program example In this program addition GD G is performed using time data stored in devices specified in and Cs2 and the operation result expressed as time data is output to devices specified in Cd 1 Function without EN ENO ADD_TIME Structured ladder ADD_T
213. the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO WORD_TO_INT Structured ladder WORD_TO_INT g_word1 16 000A WORD g_inti 10 ST g_int1 WORD_TO_INT g_word1 2 Function with EN ENO WORD_TO_INT_E Structured ladder g_bool1 WORD_TO_INT_E g_word1 ST g_bool3 WORD_TO_INT_E g _bool1 g_word1 g_int1 92 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 29 WORD _TO_DINT _E o PROVO FXO oyo yop ojojyjojojo Outline 2 This function converts word unsigned bit string 16 bit data into double word signed data and outputs the 3 data obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST OO OTI WORD_TO_DINT _ WORD 2 WORD_TO_DINT WORD_TO_DINT ees 52 a o WORD_TO_DINT DO z WORD TO DINT E EN WORD WORD_TO_DINT ae 4 2 WORD TO_DINT_E X000 D0 oe Label 2D S8 oD 1 Output variable Za 2 Set data EN Execution condition o condition Input E E unsigned variable _ WORD Conversion source word unsigned bit string 16 bit data Bit 16 bit Output ENO Execution status status variable E RR a a Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described 6 pJepues Explanation of function and operation This
214. tion specified in to the count value of a device specified in dD Cautions 1 Use the function having _E in its name to connect a bus 2 Expression of function blocks in each language 1 Set the instance when using a function block Describe the instance name when programming a function block 212 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 4 CTD _E Program example O In this program the number of times the bit data stored in a device specified in turns ON from OFF is 3 counted and a device specified in turns ON when the value stored in a device specified in becomes 0 1 Function without EN ENO CTD 2 Structured ladder CTD_Instance S g_bool1 g_bool2 g_int1 3 eS ST 2S CTD _Instance CD g_bool1 LOAD g_bool2 PV g_int1 g_bool3 CTD_Instance Q g_int2 CTD_Instance CV 2 Function with EN ENO CTD_E mx 2a Structured ladder el D aa CTD _E Instance 3 4 M10 g_bool1 9 TID g_bool2 33 g_int1 Es ST CTD_E Instance EN M10 CD g_bool1 LOAD g_bool2 PV g_int1 M11 CTD_E Instance ENO g_bool3 CTD_E _Instance Q ID g_int2 CTD E Instance CV a a e o 3 gt s ss ppy pue s dl q Sama a9uapuodsao7 213 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 5 CTUD _E 6 5 CTUD _E Outline This function block counts up down the number of times of rising of a sig
215. tional Manual This manual explains application functions for structured programs provided by GX Works2 FX3G FX3u FX3uc User s Manual Analog Control Edition Additional Manual This manual explains details of analog special function blocks and analog special adapters for FX3u FX3uc FX3G PLCs and PID instruction Explanation of instructions and instructions used in program examples are expressed for GX Developer FX Series User s Manual Data Communication Edition Additional Manual This manual explains details of simple N N link parallel link computer link no protocol communication RS and RS2 instructions programming communication and inverter communication for FX PLCs Explanation of instructions and instructions used in program examples are expressed for GX Developer FX3G FX3u FX3uc Series User s Manual Positioning Edition Additional Manual This manual explains details of wiring instructions and operations of the positioning function built in FX3u FX3uc FX3G PLC main units Explanation of instructions and instructions used in program examples are expressed for GX Developer Individual manuals Manual supplied with product or additional Manual This manual explains details of each special unit block Explanation of instructions and instructions used in program examples are expressed for GX Developer 1 Detailed explanation may be provided by a separate manual in some products FXCPU Structured Programming M
216. tions 5 1 31 DWORD_ TO _DINT _E o PROVO FXO ofoto otot otlotlo Outline 2 This function converts double word unsigned bit string 32 bit data into double word signed data and 3 outputs the data obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST Oo Om DWORD_TO_DINT _DWORD 33 DWORD_TO_DIN DWORD_TO_DINT Example 33 T Label 1 _ DWORD 4 Label 2 Label 2 S DWORD_TO_DINT Label 1 DWORD_TO_DINT_E EN E Example 7 Label 2 DWORD_TO_DINT_E X000 eke Label 1 Label 2 2 2 gt Sao DSO 1 Output variable SE a 2 Set data En Execution condition so condition pe peronon ble Word d variable ouble Word unsigne _DWORD Conversion source double word unsigned bit string 32 bit data Bit 32 bit Output ENO ere status status variable E esn Double word signed data after conversion Double Word signed In explanation of functions I O variables inside are described 6 plepuejs Explanation of function and operation This function converts double word unsigned bit string 32 bit data stored in a device specified in into double word signed data and outputs the data obtained by conversion to a device specified in Cd gt BC614EH E gt 12345678 SSS J Double word unsigned Double word signed data bit string 82 bit data syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Caution
217. tions 36 5 1 Type Conversion FUNCIONS 666 ac ai shee ide 36 ete dt BOOL FONTE toe carta ida ticos 36 91 2 BOOL MO DING Ey sesenta oros 38 Sko BOOL TO STROE Laa ene em ee ee ee a 40 SA BOOL TO WV ORD LE te al eae 42 5 10 BOOL TO DWORD Eli ads 44 So BOL TO TIMEC E ses a E d 46 SAS INT TO DINTO E ai A id 48 AN A A o 50 BALD INT TO BOOLEANA N I Mes Aol Ae ose 52 SAO UD INGO sR o A ace edeeenteas 54 A A ne ee eee eee een eee cee 56 Diz DINF TOUREAL Escrito libelar 58 A a snaesncycasboneeketaeants 60 MTA DNT TO STROE aid tates ce a ence atacand nido Mae Sana 62 SO UNE Af Ot E PR RP ee cn Ee ee ce de dto 64 21 10 DIINO WORDE Ey sass sc cts ens ad au ella gta 66 SATA INT TO DWORD E aria goer utente du dean ds Minpduanies Bat ydocee dee endesa 68 3118 DINT TO DWORD Ec o a eh a Ae Niel laren a o nd 70 SE IS A renee re ree ere te 72 91 20 DINT TO BED E J raana Pee haar TO 74 54121 INT TOME CE ane n a e becca Je duane ida 76 122 DINT T7O TIME E Jesin a R e loa 78 01 23 REAL TO INTE aiii eiii 80 91 24 REAL TO DINTWEi a Ein 82 A A A ree emer eee eee eee ee eee ee 84 91 20 WORD 1O BOOLE Jtesii oblidat 87 91 27 DWORD TO BOOLLElisssi deidad ia 89 51 26 WORD TOINTE ete ontario 91 51 29 WORD TO DIN TE A e at aot k onl ial 93 31 30 DWORD INTE oi dd bodies 95 51 31 DWORD TO DINU JE it tt a 97 5 32 WORD TO DWORD El ita 99 5139 DWORD TO WORD Elia A A 101 51 34 WORD TOCTIMECTE Puscatoraanis il iii 103 5 185 DWORD TO TIME Bie
218. tput label Example OR_E X000 M0 M10 M20 Function name OR E 1 Output variable 2 Set data aliado Data type Input Bit a ANY_BIT Output Bit variable 4 Ca Device which will store the operation result ANY_BIT In explanation of functions I O variables inside are described Explanation of function and operation 1 This function obtains the logical sum using each bit of bit word unsigned bit string 16 bit double word unsigned bit string 32 bit data stored in devices specified in and s2 gt and outputs the operation result to a device specified in Cd using the data type of data stored in devices specified in and Cs2 Example When the data type is word unsigned bit string 16 bit 1p1rjojoj1 1f1 1jojojofjof1 1 1 1 Logical sum jojojofojojo 1fojojo 1 1jo 1 ojo0 y CH l 1ii1rfojoj1aprijiirjojofijajipaijaijas 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 156 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions Program example O In this program the logical sum is obtained using each bit of word unsigned bit string 16 bit data
219. tructured Programming Manual Basic amp Applied Instruction Abbreviation of FXCPU Structured Programming Manual Application Functions Abbreviation of FX Series User s Manual DATA COMMUNICATION CONTROL EDITION Abbreviation of FX3G FX3U FX3UC Series User s Manual ANALOG CONTROL EDITION Abbreviation of FX3G FX3U FX3UC Series User s Manual POSITIONING CONTROL EDITION 13 FXCPU Structured Programming Manual 1 Outline Application Functions 1 1 Outline of Structured Programs and Programming 1 Outline This manual explains applied functions for structured programs provided by GX Works2 Refer to a different manual for devices parameters and sequence instructions Refer to the following manual for labels data types and programming languages for structured programs Q FX Structured Programming Manual Fundamentals 1 1 Outline of Structured Programs and Programming Languages 1 1 1 Outline of structured programs You can construct two or more programs program blocks into one program Because you can divide the entire machine processing into small sub processes and create a program for each sub process you can efficiently create a program for a large system 1 Structured program Program structuring is a technique to divide the contents of control executed by the PLC CPU into hierarchical small units blocks of processing and then construct a program By using this technique you can design a program while recognizin
220. tructured ladder ST REAL_TO_STR _REAL REAL_TO_STR REAL_TO_STR Example Label 1 REAL 1 _ Label 2 Label 2 REAL_TO_STR Label 1 REAL_TO STR_E EN REAL Function name X REAL_TO_STR_E Output label REAL TO STR_E EN ENO Example Label 1 REAL 4 Label 2 REAL_TO_STR_E X000 Label 1 Label 2 1 Output variable 2 Set data siti Data type Input Execution condition Bi t variable REAL Gs Conversion source float single precision data FLOAT Single Precision Output Execution status Bit variable 4 Cd_ String data after conversion String In explanation of functions I O variables inside are described Explanation of function and operation 1 This function converts float single precision data stored in a device specified in into string exponent data and outputs the data obtained by conversion to a device specified in Cd gt Float High order byte Low order byte singe i 20H space i 1st word precision O Sign data integer part String data ASCII code 2EH ASCII code 2nd word j for decimal point for integer part e ASCII code ASCII code 3rd word ail for 2nd decimal place for 1st decimal place ASCII code ASCII code 4th word race E Sign exponent part for 4th decimal place for 3rd decimal place integer part Added ASCII code Sth word 45H E ee automatically for 5th decimal place ASCII code for tens Sign data Biwerd place of exponent part exponent
221. tured ladder g_boolt WORD TO DINT E ST g_bool3 WORD_TO_DINT_E g_bool1 g_word1 g_dint1 94 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 30 DWORD_TO_INT _E o PROVO FXO oyo yop ojojyjojojo Outline 2 This function converts double word unsigned bit string 32 bit data into word signed data and outputs the 3 data obtained by conversion S 1 Format Expression in each language Function name Structured ladder ST Oo OTI DWORD _TO_INT DWORD i Woo E DWORD _TO 8 Example 5 3 Label _ DWORD D10 D10 e DWORD_TO_INT Label DWORD TO INT E EN DWORD_TO_INT See Outpevlaley 4 DWORD_TO_INT_E X000 Label oe D10 a5 S25 a Sp 1 Output variable Sl 2 Set data En Execution condition so condition pe peronon ble Word d variable ouble Word unsigne _DWORD Conversion source double word unsigned bit string 32 bit data Bit i 32 bit Output ENO Execution status status variable D Word signed data after conversion Word signed In explanation of functions I O variables inside are described 6 PJEPUe S Explanation of function and operation This function converts double word unsigned bit string 32 bit data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cd gt BC614EH C gt 24910 FS Double word u
222. ue Word signed Output ValueOut Current timer value ANY 16 variable Timer output contact Bit Function and operation explanation 1 This is a retentive timer that counts the time when the variable is ON It starts counting the current value when the execution condition of the input argument Coil turns ON The timer starts counting from Valueln x 1 to 1000 ms When it counts up to Preset x 1 to 1000 ms the output argument Status turns ON The current measurement value is outputted into ValueOut 2 The condition of measurement ValueOut and output argument ON OFF status is maintained even if the execution condition of the input argument Coil turns OFF When the execution condition of the input argument Coil turns ON the timer resume counting from the measurement it holds Structured ladder timing chart Instance name TIMER CONT FB M Var MO ON ON Var_M0 Coil ValueOut Var D10 200 Preset Status Var M10 2 0 Valueln Value of Var_D10 0 ST Instance name Coil Var_MO Preset 10 Valueln 1 Var_M10 ON Var_D10 Instance name ValueOut Var_M10 Instance name Status 1 Var_D10 is a global label and is defined as D10 2 Var_M10is a global label and is defined as M10 226 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 11 TIMER_CONT_FB_M Cautions O 1 Expression in each language of function block 3 1 Set the instance when using the function block
223. unsigned Bit data bit string 32 bit data syoo g uonoun4 gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 89 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Program example In this program double word unsigned bit string 32 bit data stored in a device specified in is converted into bit data and the data obtained by conversion is output to a device specified in Cd 1 Function without EN ENO DWORD_TO_BOOL Structured ladder DWORD_TO_BOOL g dword1 16 00000001 DWORD g_bool1 ST g_bool1 DWORD_TO_BOOL g_dword1 2 Function with EN ENO DWORD TO _ BOOL E Structured ladder g_bool1 DWORD _TO BOOL E ST g_bool3 DWORD_TO_BOOL_E g_bool1 g_dword1 g_bool2 90 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 28 WORD _TO_INT _E o POUC FXO oyo yop ojojyjojojo Outline 2 This function converts word unsigned bit string 16 bit data into word signed data and outputs the data 3 obtain
224. urns OFF gt Structured ladder timing chart Instance name ON TIMER_10 FB M Var_MO_ _ Var_MO i ValueOut Var_D10 10 Var_M10 2 Value of Var D10 1i mo a s ss ppy pue s dl q USamjaq a9uapuodsao7 ST Instance name Coil Var_MO Preset 10 Valueln 1 Var_M10 ON Var_D10 Instance name ValueOut Var_M10 Instance name Status 1 Var_D10 is a global label and is defined as D10 2 Var_M10 is a global label and is defined as M10 Cautions 1 Expression in each language of function block 1 Set the instance when using the function block Describe the instance name when programming the function block 2 For the function block the automatic allocation device needs to be set as the timer numbers are allocated automatically 225 FXCPU Structured Programming Manual 6 Standard Function Blocks Application Functions 6 11 TIMER_CONT_FB_M 6 11 TIMER CONT FB M PRUE PROS oJ o o o x o x x Outline This function block counts the period of time while the condition is satisfied and generates an output when the timer counts up the specified time 1 Format Expression in each language Structured ladder ST Instance name TIMER_CONT_FB_M Coil ValueOut Function name TIMER CONT FB _M TIMER_CONT_FB_M Coil Preset Valueln 1 Preset Status Valueln 1 Refer to Cautions 2 Set data Execution condition Bit pu Word ened variable Initial timer val
225. using the data type of data stored in devices specified in and s2 Example When the data type is word signed 100 x gt __ 1500 Word Word Cd Word signed data signed data signed data Cautions 1 When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 2 Even if underflow or overflow occurs in the operation result it is not regarded as an operation error TRUE is output from ENO However note that the obtained operation result is not accurate in this case FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions Program example O In this program multiplication is performed using double word signed data stored in devices specified in 2 and s2 and the operation result is output to a device specified in Cd Structured ladder g_bool1 2 g_bool3 al g_dint1 g_dint3 g_dint2 S ST g_bool3 MUL_E g_bool1 g_dint1 g_dint2 g_dint3 Oo uoN OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 141 FXCPU Structured Programming Manual Application Functions 5 3 Standard Arithmetic Functions 9 3 4 DIV_E THUG Z
226. utside the following range 32768 to 32767 Error code K6706 4 When any of devices to Cs 2 exceeds the device range Error code K6706 Program example In this program string data stored in a device specified in is converted into word signed data and the data obtained by conversion is output to a device specified in Cd gt 1 Function without EN ENO STR_TO_INT Structured ladder STR_TO_INT g_string1 12345 _ STRING g_int1 12345 ST g_int STR_TO_INT g_string1 2 Function with EN ENO STR_TO_INT_E Structured ladder STR TO INT E ENO g_bool1 g_bool3 g_stringl _STRING g_int1 ST g_bool3 STR_TO_INT_E g_bool1 g_string1 g_int1 110 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions 5 1 38 STR_TO_DINT _E o PEIC FXO o Outline 2 This function converts string data into double word signed data and outputs the data obtained by 3 conversion S 1 Format i Oo Expression in each language Function name Structured ladder ST ST STR_TO_DINT _STRING 32 STR_TO_DINT STR_TO_DINT Sample cs 7 Label 1 _STRING 1 Label 2 Label 2 si STR_TO_DINT Label 1 STR_TO_DINT_E EN STRING x STR_TO DINT E Output label 4 STR_TO DINT _E EN ENO Example Label 1 _STRING 41 Label 2 STR_TO_DINT_E X000 Label 1 cag Label 2 2D 5 S8 2 OO 1 Output variable 2 Set data Input E
227. variable 4 CD Word signed data after conversion Word signed In explanation of functions I O variables inside are described 6 Explanation of function and operation So This function converts string data 3 words stored in a device specified in into word signed data and Sa outputs the data obtained by conversion to a device specified in CdD 8 High order byte Low order byte String 1st word ASCII code for ten thousands place Sign data 2nd word ASCII code for hundreds place ASCII code for thousands place gt 3rd word ASCII code for ones place ASCII code for tens place A O O OA O O O Word signed data gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data Use global labels when specifying labels 109 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error 1 When the sign data low order byte of the 1st word stored in a device specified in is any other than 20H space or 2DH Error code K6706 2 When the ASCII code for each place digit stored in to Cs 2 is any other than 30H to 39H 20H space or OOH NULL Error code K6706 3 When the value stored in to Cs 2 is o
228. word signed data Y Y s ss ppy pue s dl q USamjaq a9uapuodsa o7 23 FXCPU Structured Programming Manual 2 Function List Application Functions 2 2 Standard Functions Of One Numeric Variable 2 2 Standard Functions Of One Numeric Variable Applicable PLC Function name Reference a 2 3 Standard Arithmetic Functions EJ EJ EJ E gt lt wo O Applicable PLC Function name Reference Subsection 5 3 1 Subsection 5 3 2 Subsection 5 3 3 Subsection 5 3 4 Subsection 5 3 5 Subsection 5 3 6 Subsection 5 3 7 ADD E Adds data SUB_E Subtracts data MUL_E Multiplies data EERE EERE EERE lt lt a DIV_E Divides data and outputs the quotient MOD _E Divides data and outputs the remainder EXPT _E Obtains the raised result et ye MOVE _E Transfers data 24 FXCPU Structured Programming Manual 2 Function List Application Functions 2 4 Standard Bit Shift Functions 2 4 Standard Bit Shift Functions O D Applicable PLC Function name x u x Reference 8 Z S 3 T 2 SHL _E Shifts bits leftward y IA Y erpseciion ej 5 4 1 mn SHR _E Shifts bits rightward ye a a a O Tl 2 5 Standard Bitwise Boolean Functions S 5 n r 58 S Applicable PLC Function name X ul y X ul x u TN Reference 4 aN E gt lt os gt zZ a Ti S O O O 2 v amI eS 532
229. xecution condition Bit In explanation of functions I O variables inside are described 6 IQ Explanation of function and operation 38 This function converts string data 6 words stored in a device specified in into double word signed 3 data and outputs the data obtained by conversion to a device specified in Cd gt High order byte Low order byte Sting 1st word 2nd word ASCII cde for ten mios place ASCH code unes lc gt m 3rd word ath word Double word signed data 5th word ASCII code for tens place ASCII code for hundreds place 6th word ASCII code for ones place s ss ppy pue s dl q USamjaq a9uapuodsa o7 Ignore Cautions 1 Use the function having _E in its name to connect a bus 2 When handling string data and 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 111 FXCPU Structured Programming Manual 5 Applied Functions Application Functions 5 1 Type Conversion Functions Error 1 When the sign data low order byte of the 1st word stored in a device specified in is any other than 20H space or 2DH Error code K6706 2 When the ASCII code for each place digit stored in to Cs 5 is any other than 30H to 39H 20H
230. y C ojofoj1jofoj1fojojojojojo 1jojo 2 The number of pins in can be changed Cautions When handling 32 bit data in structured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels 154 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions Program example In this program the logical product is obtained using each bit of word unsigned bit string 16 bit data stored in devices specified in and s2 and the operation result is output to a device specified in Cd gt using the data type of data stored in devices specified in and s2 Structured ladder g_bool1 g_bool3 g_word3 16 1204 g_word1 16 FFOF g_word2 16 1234 ST g_bool3 AND E g_bool1 g_word1 g_word2 g_word3 155 auIno ml sr uoqouny INQ Oo uoN OnSUOD uoloun4 suoljoun4 jo voneuejdx3 peay 0 moH a 6 syoo g uonoun4 pJepuejs gt s ss ppy pue s dl q USamjaq a9uapuodsa o7 FXCPU Structured Programming Manual Application Functions 5 5 Standard Bitwise Boolean Functions 5 5 2 ORE PRUE FROG Outline This function obtains the logical sum of two or more bits and outputs it 1 Format Expression in each language Structured ladder ST OR_E EN _IN _IN Ou
Download Pdf Manuals
Related Search
Related Contents
User`s Manual - ACTi Corporation small eq - Henry Schein AEDの設置者等が行うべき事項等について Manual Guilhotina Semi-Industrial 51cm SouthernX-AM English Manual Ascotel Office 35 Bedienungsanleitung Ascotel こちら - ケーブルテレビ富山 Copyright © All rights reserved.
Failed to retrieve file