background image

Programmable Controllers

Structured Programming Manual

[Application Functions]

FXCPU

MITSUBISHI ELECTRIC

MITSUBISHI ELECTRIC

01 07 2009
JY997D34801
Version B

INDUSTRIAL AUTOMATION

Summary of Contents for 09R927

Page 1: ...Programmable Controllers Structured Programming Manual Application Functions FXCPU MITSUBISHI ELECTRIC MITSUBISHI ELECTRIC 01 07 2009 JY997D34801 Version B INDUSTRIAL AUTOMATION ...

Page 2: ......

Page 3: ...tempting 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 2009 MITSUBISHI ELECTRIC CORPORATION Manual number JY997D34801 Manual revision B Date 7 2009 This manual confers no industrial property rights or any rights of any other kind nor does it confer any patent licenses Mitsubishi Electric Cor...

Page 4: ... to human life Before using the product for special purposes such as nuclear power electric power aerospace medicine or passenger movement 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 th...

Page 5: ...res 17 1 3 3 Circuits not available in structured ladder programs and countermeasures 18 1 3 4 Handling of general flags 18 1 3 5 Handling of operation error flag 21 2 Function List 22 2 1 Type Conversion Functions 22 2 2 Standard Functions Of One Numeric Variable 24 2 3 Standard Arithmetic Functions 24 2 4 Standard Bit Shift Functions 25 2 5 Standard Bitwise Boolean Functions 25 2 6 Standard Sele...

Page 6: ...0 5 1 19 INT_TO_BCD _E 72 5 1 20 DINT_TO_BCD _E 74 5 1 21 INT_TO_TIME _E 76 5 1 22 DINT_TO_TIME _E 78 5 1 23 REAL_TO_INT _E 80 5 1 24 REAL_TO_DINT _E 82 5 1 25 REAL_TO_STR _E 84 5 1 26 WORD_TO_BOOL _E 87 5 1 27 DWORD_TO_BOOL _E 89 5 1 28 WORD_TO_INT _E 91 5 1 29 WORD_TO_DINT _E 93 5 1 30 DWORD_TO_INT _E 95 5 1 31 DWORD_TO_DINT _E 97 5 1 32 WORD_TO_DWORD _E 99 5 1 33 DWORD_TO_WORD _E 101 5 1 34 WOR...

Page 7: ...4 5 5 1 AND_E 154 5 5 2 OR_E 156 5 5 3 XOR_E 158 5 5 4 NOT _E 160 5 6 Standard Selection Functions 162 5 6 1 SEL _E 162 5 6 2 MAXIMUM _E 164 5 6 3 MINIMUM _E 166 5 6 4 LIMITATION _E 168 5 6 5 MUX _E 170 5 7 Standard Comparison Functions 172 5 7 1 GT_E 172 5 7 2 GE_E 174 5 7 3 EQ_E 175 5 7 4 LE_E 176 5 7 5 LT_E 178 5 7 6 NE_E 179 5 8 Standard Character String Functions 181 5 8 1 MID _E 181 5 8 2 CO...

Page 8: ... 1 R_TRIG _E 206 6 2 F_TRIG _E 208 6 3 CTU _E 210 6 4 CTD _E 212 6 5 CTUD _E 214 6 6 TP _E 217 6 7 TON _E 219 6 8 TOF _E 221 6 9 COUNTER_FB_M 223 6 10 TIMER_10_FB_M 225 6 11 TIMER_CONT_FB_M 226 6 12 TIMER_100_FB_M 228 Appendix A Correspondence between Devices and Addresses 229 Warranty 230 Revision History 231 ...

Page 9: ...dition 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 This manual explains details of simple N N link parallel link computer link no protocol communication RS ...

Page 10: ...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 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 b...

Page 11: ...tion 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 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 p...

Page 12: ... Hardware Manual JY997D18801 Supplied with product I O specifications wiring and installation of the PLC main unit FX3U extracted from the FX3U Series User s Manual Hardware Edition For detailed explanation refer to the FX3U Series User s Manual Hardware Edition FX3U Series User s Manual Hardware Edition JY997D16501 Additional Manual Details about the hardware including I O specifications wiring i...

Page 13: ...onal Manual Details about the hardware including I O specifications wiring installation and maintenance of the FX1S PLC main unit FX1N HARDWARE MANUAL JY992D89301 Additional Manual Details about the hardware including I O specifications wiring installation and maintenance of the FX1N PLC main unit FX2N HARDWARE MANUAL JY992D66301 Additional Manual Details about the hardware including I O specifica...

Page 14: ...ons wiring installation and maintenance of the FX0 FX0N PLC main unit FX0S HARDWARE MANUAL JY992D55301 Supplied with product Details about the hardware including I O specifications wiring installation and maintenance of the FX0S PLC main unit FX FX2C HARDWARE MANUAL JY992D47401 Supplied with product Details about the hardware including I O specifications wiring installation and maintenance of the ...

Page 15: ...ies or FX0 PLC Generic name of FX0 Series PLCs Special adapters CF card special adapter Generic name of CF card special adapters CF ADP FX3U CF ADP Programming language ST Abbreviation of structured text language Structured ladder Abbreviation of ladder diagram language Manuals Q FX Structured Programming Manual Fundamentals Abbreviation of QCPU FXCPU Structured Programming Manual Fundamentals FX ...

Page 16: ...tem 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 recognizing structuring of a sequence program Advantages of hierarchical program You can examine the outline of a program at first and then design ...

Page 17: ...horizontal lines Text language 1 ST Structured text language The ST language can describe control achieved by syntax using selective branches with conditional statements and repetition by repetitive statements in the same way as high level languages such as C language By using the ST language you can create simple programs easy to understand 1 2 PLC Series and Programming Software Version PLC Seri...

Page 18: ... 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 improved...

Page 19: ...N and the output Y004 is also set to ON because the input X001 is ON In the second coil Y003 however the image memory is set to OFF because the input X002 is OFF As a result the actual output to the outside is Y003 OFF Y004 ON 2 Countermeasures against double outputs Double outputs double coils do not cause an illegal input error program error but the operation is complicated as described above Ch...

Page 20: ...uctions Examples M8020 Zero flag M8021 Borrow flag M8022 Carry flag M8029 Instruction execution complete flag M8090 Block comparison signal 1 M8328 Instruction non execution flag 1 M8329 Instruction execution abnormal complete flag 2 M8304 Zero flag 1 M8306 Carry flag 1 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 P...

Page 21: ...rresponding sequence instruction M8000 M8029 Execution is completed M8029 works as a flag to indicate that execution of DSW is completed Good example D0 10 Bad example M8029 works as a flag to indicate that execution of DPLSY on the upper side is completed M8029 works as a flag to indicate that execution of DPLSY on the lower side is completed M8000 X000 M0 M8029 M8029 M1 Program for DPLSY on the ...

Page 22: ...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 M8029 M0 M8029 DSW execution complete flag M8029 is changed to M100 M100 It works as the DSW execution complete flag M200 M100 D0 M200 Y030 M0 R X010 1 DSW EN s1 ENO d1 Y010 s2 d2 1000 Y000 DPLSY EN s1 ...

Page 23: ...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 When the PLC mode changes from STOP to RUN these devices are cleared instantaneously and then turn ON again if errors have not been cleared 2 Operation error latch 2 When an error occurs in a step up to the step No 32767 in the FX3U FX3UC PLC yo...

Page 24: ...O_BOOL _E Converts double word signed data into bit data 3 3 3 3 3 3 3 3 Subsection 5 1 10 INT_TO_REAL _E Converts word signed data into float single precision data 3 1 3 Subsection 5 1 11 DINT_TO_REAL _E Converts double word signed data into float single precision data 3 1 3 Subsection 5 1 12 INT_TO_STR _E Converts word signed data into string data 3 Subsection 5 1 13 DINT_TO_STR _E Converts doub...

Page 25: ...erts double word unsigned bit string 32 bit data into word unsigned bit string 16 bit data 3 3 3 3 3 3 3 3 Subsection 5 1 33 WORD_TO_TIME _E Converts word unsigned bit string 16 bit data into time data 3 3 3 3 3 3 3 3 Subsection 5 1 34 DWORD_TO_TIME _E Converts double word unsigned bit string 32 bit data into time data 3 3 3 3 3 3 3 3 Subsection 5 1 35 STR_TO_BOOL _E Converts string data into bit ...

Page 26: ... 3 3 3 3 Subsection 5 2 1 Function name Function Applicable PLC Reference FX 3U C FX 3G FX 2N C FX 1N C FX 1S FX U FX 2C FX 0N FX 0 S ADD_E Adds data 3 3 3 3 3 3 3 3 Subsection 5 3 1 SUB_E Subtracts data 3 3 3 3 3 3 3 3 Subsection 5 3 2 MUL_E Multiplies data 3 3 3 3 3 3 3 3 Subsection 5 3 3 DIV_E Divides data and outputs the quotient 3 3 3 3 3 3 3 3 Subsection 5 3 4 MOD _E Divides data and outputs...

Page 27: ...U C FX 3G FX 2N C FX 1N C FX 1S FX U FX 2C FX 0N FX 0 S AND_E Obtains the logical product 3 3 3 3 3 3 3 3 Subsection 5 5 1 OR_E Obtains the logical sum 3 3 3 3 3 3 3 3 Subsection 5 5 2 XOR_E Obtains the exclusive logical sum 3 3 3 3 3 3 3 3 Subsection 5 5 3 NOT _E Obtains the logical not 3 3 3 3 3 3 3 3 Subsection 5 5 4 Function name Function Applicable PLC Reference FX 3U C FX 3G FX 2N C FX 1N C ...

Page 28: ...5 7 5 NE_E Compares data with regard to unequal 3 3 3 3 3 3 3 3 Subsection 5 7 6 Function name Function Applicable PLC Reference FX 3U C FX 3G FX 2N C FX 1N C FX 1S FX U FX 2C FX 0N FX 0 S MID _E Obtains a character string from a specified position 3 Subsection 5 8 1 CONCAT _E Connects character strings 3 Subsection 5 8 2 INSERT _E Inserts a character string 3 Subsection 5 8 3 DELETE _E Deletes a ...

Page 29: ...gnal 3 3 3 3 3 3 3 3 Section 6 2 CTU _E Counts up the number of times of rising of a signal 3 3 3 3 3 3 Section 6 3 CTD _E Counts down the number of times of rising of a signal 3 3 3 3 3 3 Section 6 4 CTUD _E Counts up down the number of times of rising of a signal 3 3 3 3 3 3 Section 6 5 TP _E Keeps ON a signal during specified time duration 3 3 3 3 3 3 Section 6 6 TON _E Keeps OFF a signal durin...

Page 30: ...he input variable label or device specifies the target Bit device themselves such as X Y M and S may be handled Bit devices may be combined in a way KnX KnY KnM and KnS to express numeric data FX Structured Programming Manual Device Common Current value registers of data registers D timers T and counters C may be handled When handling 32 bit data in structured programs you cannot specify 16 bit de...

Page 31: ...e You do not have to specify devices for local labels Assignment of devices is automatically executed during compiling In the example below the label VAR_D10 is set for the function BOOL_TO_STR_E When using VAR_D10 as a global label Set the class label name data type and device or address When using VAR_D10 as a local label Set the class label name and data type Class Description Applicable progra...

Page 32: ...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 quotations ABC ABC Data type Description Value range Bit length Bit Boolean data 0 FALSE 1 TRUE 1 bit Word signed Integer 32768 to 32767 16 bits Double Word signed Double precision in...

Page 33: ...ata type name begins with ANY ANY ANY_SIMPLE Word unsigned Bit String 16 bit Double Word unsigned Bit String 32 bit Bit Word signed FLOAT Single Precision FLOAT Double Precision Word unsigned Bit String 16 bit Word signed Array Structure ANY_NUM ANY_BIT Time String ANY_REAL ANY_INT ANY16 Double Word unsigned Bit String 32 bit Double word signed ANY32 1 1 The ANY type on a higher layer contains typ...

Page 34: ...C 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 7 3 Appendix A Head 1st character Position 2nd...

Page 35: ...n its name EN inputs the instruction execution condition ENO outputs the instruction execution status The table below shows the ENO status corresponding to the EN status and the operation result EN ENO Operation result TRUE Executes operation TRUE Operation error did not occur Operation output value FALSE Operation error occurred Indefinite value FALSE Stops operation FALSE Indefinite value BOOL_T...

Page 36: ...U Structured Programming Manual Application Functions 4 How to Read Explanation of Functions Function explanation pages have the following configuration 1 2 3 4 The above page is prepared for explanation and is different from the actual page 6 7 5 ...

Page 37: ...riable Refer to the following for detailed data types 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 6 Cautions Cautions on using the function are described 7 Program example Program examples are explained in each language Item Des...

Page 38: ...unction 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 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 Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C ...

Page 39: ...es and Addresses 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 1 Function without EN ENO BOOL_TO_INT 2 Function with EN ENO BOOL_TO_INT_E Structured ladder ST Structured ladder ST s d BOOL_TO_INT g_int1 g_bool1 _BOOL g_int1 BOOL_TO_INT g_bool1 BOOL_TO_INT_E EN ENO g_...

Page 40: ...red 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST BOOL_TO_DINT BOOL_TO_DINT _BOOL Example ...

Page 41: ...dresses 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 1 Function without EN ENO BOOL_TO_DINT 2 Function with EN ENO BOOL_TO_DINT_E Structured ladder ST Structured ladder ST s d BOOL_TO_DINT g_dint1 g_bool1 _BOOL g_dint1 BOOL_TO_DINT g_bool1 BOOL_TO_DINT_E EN E...

Page 42: ...nect 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST BOOL_TO_STR BOOL_TO_STR _BOOL Example Label BOOL_TO_STR M0 BOOL_TO_STR_ ...

Page 43: ...and Addresses 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 1 Function without EN ENO BOOL_TO_STR 2 Function with EN ENO BOOL_TO_STR_E Structured ladder ST Structured ladder ST s d BOOL_TO_STR g_string1 g_bool1 _BOOL g_string1 BOOL_TO_STR g_bool1 BOOL_TO_STR_E EN ENO g_str...

Page 44: ...signed 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 Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST BOOL_TO_WOR D BOOL_TO_WORD _BOOL Example D0 BOOL_TO_WORD M0 BOOL_TO_WOR D_E BOOL_...

Page 45: ...s Program example In this program 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 1 Function without EN ENO BOOL_TO_WORD 2 Function with EN ENO BOOL_TO_WORD_E Structured ladder ST Structured ladder ST s d BOOL_TO_WORD g_word1 g_bool1 _BOOL g_word1 BOOL_TO_WORD g_bool1 BOOL_TO_WORD...

Page 46: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Functio...

Page 47: ... example In this program 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 1 Function without EN ENO BOOL_TO_DWORD 2 Function with EN ENO BOOL_TO_DWORD_E Structured ladder ST Structured ladder ST s d BOOL_TO_DWORD g_dword1 g_bool1 _BOOL g_dword1 BOOL_TO_DWORD g_bool1 BOOL_TO_...

Page 48: ...tructured 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST BOOL_TO_TIME BOOL_TO_TIME _BOOL Ex...

Page 49: ... and Addresses 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 1 Function without EN ENO BOOL_TO_TIME 2 Function with EN ENO BOOL_TO_TIME_E Structured ladder ST Structured ladder ST s d BOOL_TO_TIME g_time1 g_bool1 _BOOL g_time1 BOOL_TO_TIME g_bool1 BOOL_TO_TIME_E EN ENO g_ti...

Page 50: ...ructured 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_DINT INT_TO_DINT _INT Exampl...

Page 51: ...sses Program example In this program word signed 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 1 Function without EN ENO INT_TO_DINT 2 Function with EN ENO INT_TO_DINT_E Structured ladder ST Structured ladder ST s d INT_TO_DINT g_dint1 5923 g_int1 5923 _INT g_dint1 INT_TO_DINT g_int1 INT_TO_DINT...

Page 52: ...red 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DINT_TO_INT DINT_TO_INT _DINT Example D1...

Page 53: ...ses 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 1 Function without EN ENO DINT_TO_INT 2 Function with EN ENO DINT_TO_INT_E Structured ladder ST Structured ladder ST s d DINT_TO_INT g_int1 5923 g_dint1 5923 _DINT g_int1 DINT_TO_INT g_dint1 DINT_TO_INT...

Page 54: ...ut value is 0 this function outputs FALSE When the input value is any value other than 0 this function outputs TRUE Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_BOOL INT_TO_BOOL _INT Example M0 INT_TO_BOOL D0 INT_TO_BOOL_E INT_TO_BOOL_E EN _INT Output label E...

Page 55: ... and Addresses 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 specified in 1 Function without EN ENO INT_TO_BOOL 2 Function with EN ENO INT_TO_BOOL_E Structured ladder ST Structured ladder ST s d INT_TO_BOOL g_bool1 g_int1 5923 _INT g_bool1 INT_TO_BOOL g_int1 INT_TO_BOOL_E EN ENO ...

Page 56: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language ...

Page 57: ...resses Program example In this program double 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 specified in 1 Function without EN ENO DINT_TO_BOOL 2 Function with EN ENO DINT_TO_BOOL_E Structured ladder ST Structured ladder ST s d DINT_TO_BOOL g_bool1 g_dint1 0 _DINT g_bool1 DINT_TO_BOOL g_dint1 DINT_TO_BOOL_E EN ...

Page 58: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_R...

Page 59: ... 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 1 Function without EN ENO INT_TO_REAL 2 Function with EN ENO INT_TO_REAL_E Structured ladder ST Structured ladder ST s d g_real1 5923 0 INT_TO_REAL g_int1 5923 a_Int g_real1 INT_TO_REAL g_int1 INT_TO_R...

Page 60: ...erent 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DINT_TO_REAL DINT_TO_REAL a_Dint Exa...

Page 61: ...xample In this program double 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 1 Function without EN ENO DINT_TO_REAL 2 Function with EN ENO DINT_TO_REAL_E Structured ladder ST Structured ladder ST s d g_real1 65000 0 DINT_TO_REAL g_dint1 65000 a_Dint g_real1 DINT_TO_REAL g_dint1 DI...

Page 62: ...uctured programs you cannot specify 16 bit devices directly different from simple projects Use labels when handling string data Use global labels when specifying labels FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_STR INT_TO_STR _INT Example Label INT_TO_STR D0 INT_TO_STR_E INT_TO_STR_E EN _INT Output label Example INT_TO_...

Page 63: ...mber of points occupied by the string data storage destination device specified in 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 1 Function without EN ENO INT_TO_STR 2 Function with EN ENO INT_TO_STR_E...

Page 64: ...d ladder ST DINT_TO_STR DINT_TO_STR _DINT Example Label 2 DINT_TO_STR Label 1 DINT_TO_STR_E DINT_TO_STR_E EN _DINT Output label Example DINT_TO_STR_E X000 Label 1 Label 2 Variable Description Data type Input variable EN Execution condition Bit _DINT Conversion source double word signed data Double Word signed Output variable ENO Execution status Bit 1 String data after conversion String DINT_TO_ST...

Page 65: ... 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 exceeds the range of the corresponding device Error code K6706 Program example In this program double word signed data stored in a device ...

Page 66: ...by conversion to a device specified in Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_WORD INT_TO_WORD _INT Example D10 INT_TO_WORD D0 INT_TO_WORD_ E INT_TO_WORD_E EN _INT Output label Example INT_TO_WORD_E X000 D0 D10 Variable Description Data type Input varia...

Page 67: ...gram example In this program 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 1 Function without EN ENO INT_TO_WORD 2 Function with EN ENO INT_TO_WORD_E Structured ladder ST Structured ladder ST s d g_word1 16 1723 INT_TO_WORD g_int1 5923 _INT g_word1 INT_TO_WORD g_int1 INT...

Page 68: ...en handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DINT_TO_WORD DINT_TO_WORD _DINT Example D10 DINT_TO_WORD Label DINT_TO_WORD _E DINT_TO_WORD_E EN _DINT Output label Example DINT_TO_WORD_E X...

Page 69: ...e 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 1 Function without EN ENO DINT_TO_WORD 2 Function with EN ENO DINT_TO_WORD_E Structured ladder ST Structured ladder ST s d g_word1 16 614E DINT_TO_WORD g_dint1 12345678 _DINT g_word1 DINT_TO_WORD g_di...

Page 70: ...cts Use labels when handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_DWORD INT_TO_DWORD _INT Example Label INT_TO_DWORD D0 INT_TO_DWORD _E INT_TO_DWORD_E EN _INT Output label Example INT_TO_DWORD_E X000 D0 Label Variable Descr...

Page 71: ...ple In this program 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 1 Function without EN ENO INT_TO_DWORD 2 Function with EN ENO INT_TO_DWORD_E Structured ladder ST Structured ladder ST s d g_dword1 16 0000000A INT_TO_DWORD g_int1 10 _INT g_dword1 INT_TO_DWORD g_in...

Page 72: ...it 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DINT_TO_DWOR D DINT_TO_DWORD _DINT Example Label 2 DINT_TO_DWORD Label 1 DIN...

Page 73: ... 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 1 Function without EN ENO DINT_TO_DWORD 2 Function with EN ENO DINT_TO_DWORD_E Structured ladder ST Structured ladder ST s d g_dword1 16 00012345 DINT_TO_DWORD g_dint1 74565 _DINT g_dword1 DINT_TO_DWORD...

Page 74: ...999 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_BCD INT_TO_BCD _INT Example D10 INT_TO_BCD D0 INT_TO_BCD_E INT_TO_BCD_E EN _INT Output label Example INT_TO_BCD_E X000 D0 D10 Variable Description Data type Input variable EN Execution condition Bit _INT Conversion source word signed data Word signed Output variable ENO Exec...

Page 75: ... and Addresses Program example In this program 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 1 Function without EN ENO INT_TO_BCD 2 Function with EN ENO INT_TO_BCD_E Structured ladder ST Structured ladder ST s d g_word 16 5923 INT_TO_BCD g_int1 5923 _INT g_word1 INT_TO_BCD g_int1 INT_TO_BCD_E EN EN...

Page 76: ... name Expression in each language Structured ladder ST DINT_TO_BCD DINT_TO_BCD _DINT Example Label 2 DINT_TO_BCD Label 1 DINT_TO_BCD_E DINT_TO_BCD_E EN _DINT Output label Example DINT_TO_BCD_E X000 Label 1 Label 2 Variable Description Data type Input variable EN Execution condition Bit _DINT Conversion source double word signed data Double Word signed Output variable ENO Execution status Bit 1 BCD...

Page 77: ...vice 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 1 Function without EN ENO DINT_TO_BCD 2 Function with EN ENO DINT_TO_BCD_E Structured ladder ST Structured ladder ST s s d g_dword1 16 00020000 DINT_TO_BC...

Page 78: ...n 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST INT_TO_TIME INT_TO_TIME _INT Ex...

Page 79: ...es and Addresses Program example In this program 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 1 Function without EN ENO INT_TO_TIME 2 Function with EN ENO INT_TO_TIME_E Structured ladder ST Structured ladder ST s d g_time1 INT_TO_TIME g_int1 _INT g_time1 INT_TO_TIME g_int1 INT_TO_TIME_E EN ENO g_...

Page 80: ...ot 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DINT_TO_TIME DINT_TO_TIME _DINT Example Label 2 DINT_TO_TIME ...

Page 81: ...dresses 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 1 Function without EN ENO DINT_TO_TIME 2 Function with EN ENO DINT_TO_TIME_E Structured ladder ST Structured ladder ST s d g_time1 DINT_TO_TIME g_dint1 _DINT g_time1 DINT_TO_TIME g_dint1 DINT_TO_TIME_E EN ...

Page 82: ...n 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each l...

Page 83: ...Program example In this program float single precision 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 1 Function without EN ENO REAL_TO_INT 2 Function with EN ENO REAL_TO_INT_E Structured ladder ST Structured ladder ST s d g_int1 5923 REAL_TO_INT g_real1 5923 5 a_real g_int1 REAL_TO_INT g_real1 REAL_TO_...

Page 84: ...rs 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladd...

Page 85: ...xample In this program float single precision 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 1 Function without EN ENO REAL_TO_DINT 2 Function with EN ENO DINT_TO_TIME_E Structured ladder ST Structured ladder ST s d g_dint1 65000 REAL_TO_DINT g_real1 65000 5 a_real g_dint1 REAL_TO_DINT g_real1 RE...

Page 86: ...ut label Example REAL_TO_STR_E X000 Label 1 Label 2 Variable Description Data type Input variable EN Execution condition Bit _REAL Conversion source float single precision data FLOAT Single Precision Output variable ENO Execution status Bit 1 String data after conversion String REAL_TO_STR _REAL 1 Label 2 Label 1 REAL_TO_STR_E EN ENO 1 Label 2 X000 Label 1 _REAL s d s d Float single precision data...

Page 87: ...he input value is negative f 30H 0 is stored in the tens place of the exponent part when the exponent part consists of 1 digit 3 00H is automatically stored at the end 7th word of the character string 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 fr...

Page 88: ...d in 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 1 Function without EN ENO REAL_TO_STR 2 Function...

Page 89: ...6 bit data stored in a device specified in into bit data and outputs the data obtained by conversion to a device specified in Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST WORD_TO_BOO L WORD_TO_BOOL _WORD Example M0 WORD_TO_BOOL D0 WORD_TO_BOO L_E WORD_TO_BOOL_E EN _...

Page 90: ...ied in is converted into bit data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_BOOL 2 Function with EN ENO WORD_TO_BOOL_E Structured ladder ST Structured ladder ST s d g_bool1 WORD_TO_BOOL g_word1 16 0001 _WORD g_bool1 WORD_TO_BOOL g_word1 WORD_TO_BOOL_E EN ENO g_bool2 g_bool1 g_word1 _WORD g_bool3 g_bool3 WORD_TO_BOOL_E g_bool1 g_word1 g...

Page 91: ... _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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each...

Page 92: ...in is converted into bit data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO DWORD_TO_BOOL 2 Function with EN ENO DWORD_TO_BOOL_E Structured ladder ST Structured ladder ST s d g_bool1 DWORD_TO_BOOL g_dword1 16 00000001 _DWORD g_bool1 DWORD_TO_BOOL g_dword1 DWORD_TO_BOOL_E EN ENO g_bool2 g_bool1 g_dword1 _DWORD g_bool3 g_bool3 DWORD_TO_BOOL_E g_bool...

Page 93: ...data stored in a device specified in into word signed data and outputs the data obtained by conversion to a device specified in Cautions Use the function having _E in its name to connect a bus FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST WORD_TO_INT WORD_TO_INT _WORD Example D10 WORD_TO_INT D0 WORD_TO_INT_ E WORD_TO_INT_E EN _WOR...

Page 94: ...ied in is converted into word signed data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_INT 2 Function with EN ENO WORD_TO_INT_E Structured ladder ST Structured ladder ST s d g_int1 10 WORD_TO_INT g_word1 16 000A _WORD g_int1 WORD_TO_INT g_word1 WORD_TO_INT_E EN ENO g_int1 g_bool1 g_word1 _WORD g_bool3 g_bool3 WORD_TO_INT_E g_bool1 g_word1...

Page 95: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST WORD_TO_DINT WORD_TO_DINT _WORD Example Label WORD_T...

Page 96: ...converted into double word signed data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_DINT 2 Function with EN ENO WORD_TO_DINT_E Structured ladder ST Structured ladder ST s d g_dint1 4660 WORD_TO_DINT g_word1 16 1234 _WORD g_dint1 WORD_TO_DINT g_word1 WORD_TO_DINT_E EN ENO g_dint1 g_bool1 g_word1 _WORD g_bool3 g_bool3 WORD_TO_DINT_E g_bool1...

Page 97: ...ms 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DWORD_TO_INT DWORD_TO_INT _DWORD Example D10 DWORD...

Page 98: ... is converted into word signed data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO DWORD_TO_INT 2 Function with EN ENO DWORD_TO_INT_E Structured ladder ST Structured ladder ST s d g_int1 9029 DWORD_TO_INT g_dword1 16 00012345 _DWORD g_int1 DWORD_TO_INT g_dword1 DWORD_TO_INT_E EN ENO g_int1 g_bool1 g_dword1 _DWORD g_bool3 g_bool3 DWORD_TO_INT_E g_bo...

Page 99: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structur...

Page 100: ...rted into double word signed data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO DWORD_TO_DINT 2 Function with EN ENO DWORD_TO_DINT_E Structured ladder ST Structured ladder ST s d g_dint1 74565 DWORD_TO_DINT g_dword1 16 00012345 _DWORD g_dint1 DWORD_TO_DINT g_dword1 DWORD_TO_DINT_E EN ENO g_dint1 g_bool1 g_dword1 _DWORD g_bool3 g_bool3 DWORD_TO_DIN...

Page 101: ...he 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name ...

Page 102: ...ble word unsigned bit string 32 bit data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_DWORD 2 Function with EN ENO WORD_TO_DWORD_E Structured ladder ST Structured ladder ST s d g_dword1 16 00001234 WORD_TO_DWORD g_word1 16 1234 _WORD g_dword1 WORD_TO_DWORD g_word1 WORD_TO_DWORD_E EN ENO g_dword1 g_bool1 g_word1 _WORD g_bool3 g_bool3 WORD_...

Page 103: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DWORD_TO_WO RD DWORD_TO_WORD _DWORD Example D10 DWORD_TO_WORD Label DWORD_...

Page 104: ...to word unsigned bit string 16 bit data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_DWORD 2 Function with EN ENO WORD_TO_DWORD_E Structured ladder ST Structured ladder ST s d g_word1 16 5678 DWORD_TO_WORD g_dword1 16 12345678 _DWORD g_word1 DWORD_TO_WORD g_dword1 DWORD_TO_WORD_E EN ENO g_word1 g_bool1 g_dword1 _DWORD g_bool3 g_bool3 DWOR...

Page 105: ...ction 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expres...

Page 106: ...ecified in is converted into time data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO WORD_TO_TIME 2 Function with EN ENO WORD_TO_TIME_E Structured ladder ST Structured ladder ST s d g_time1 WORD_TO_TIME g_word1 _WORD g_time1 WORD_TO_TIME g_word1 WORD_TO_TIME_E EN ENO g_time1 g_bool1 g_word1 _WORD g_bool3 g_bool3 WORD_TO_TIME_E g_bool1 g_word1 g_ti...

Page 107: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Struct...

Page 108: ...ified in is converted into time data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO DWORD_TO_TIME 2 Function with EN ENO DWORD_TO_TIME_E Structured ladder ST Structured ladder ST s d g_time1 DWORD_TO_TIME g_dword1 _DWORD g_time1 DWORD_TO_TIME g_dword1 DWORD_TO_TIME_E EN ENO g_time1 g_bool1 g_dword1 _DWORD g_bool3 g_bool3 DWORD_TO_TIME_E g_bool1 g_d...

Page 109: ...n to a device specified in 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language ...

Page 110: ...onverted into bit data and the data obtained by conversion is output to a device specified in 1 Function without EN ENO STR_TO_BOOL 2 Function with EN ENO STR_TO_BOOL_E Structured ladder ST Structured ladder ST s d g_bool1 STR_TO_BOOL g_string1 _STRING g_bool1 STR_TO_BOOL g_string1 STR_TO_BOOL_E EN ENO g_bool2 g_bool1 g_string1 _STRING g_bool3 g_bool3 STR_TO_BOOL_E g_bool1 g_string1 g_bool2 ...

Page 111: ...us 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST STR_TO_INT STR_TO_INT _STRING Example D10 STR_TO_INT Label STR_TO_INT_E STR_TO_I...

Page 112: ...de the following range 32768 to 32767 Error code K6706 4 When any of devices to 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 1 Function without EN ENO STR_TO_INT 2 Function with EN ENO STR_TO_INT_E Structured ladder ST ...

Page 113: ...ta and 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST STR_TO_DINT STR_TO_DINT _STRING Example Label 2 STR_TO_DINT Label 1 STR_TO_DINT_E STR_TO_DINT_E EN _STRING Output label Example STR_TO_DINT_E X00...

Page 114: ...ange 2 147 483 648 to 2 147 483 647 Error code K6706 4 When any of devices to 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 1 Function without EN ENO STR_TO_DINT 2 Function with EN ENO STR_TO_DINT_E Structured lad...

Page 115: ...Structured ladder ST STR_TO_REAL STR_TO_REAL _STRING Example Label 2 STR_TO_REAL Label 1 STR_TO_REAL_E STR_TO_REAL_E EN _STRING Output label Example STR_TO_REAL_E X000 Label 1 Label 2 Variable Description Data type Input variable EN Execution condition Bit _STRING Conversion source string data String Output variable ENO Execution status Bit 1 Float single precision data after conversion FLOAT Sing...

Page 116: ...and a number in character string data in the exponent format 30H 0 is ignored during conversion 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 hand...

Page 117: ...e character string specified in Error code K6706 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 4 When the number of characters after is 0 or any value larger than 24 Error code K6706 Program example In this program string data stored in a device specified in is converted into float single precision data and th...

Page 118: ...ou 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST STR_TO_TIME STR_TO_TIME _STRING Exampl...

Page 119: ...II code for each digit of character string data specified in is any other than 30H 0 to 39H 9 20H space or 00H NULL Error code K6706 3 When the numeric value specified in is outside the following range 2 147 483 648 to 2 147 483 647 Error code K6706 Program example In this program string data stored in a device specified in is converted into time data and the data obtained by conversion is output ...

Page 120: ...G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST BCD_TO_INT BCD_TO_INT _BCD Example D10 BCD_TO_INT D0 BCD_TO_INT_E BCD_TO_INT_E EN _BCD Output label Example BCD_TO_INT_E X000 D0 D10 Variable Description Data type Input variable EN Execution condition Bit _BCD Conversion source BCD data Word unsigned Bit String 16 bit Output variable ENO Execut...

Page 121: ... and Addresses 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 1 Function without EN ENO BCD_TO_INT 2 Function with EN ENO BCD_TO_INT_E Structured ladder ST Structured ladder ST s d g_int1 1234 BCD_TO_INT g_word1 16 1234 _BCD g_int1 BCD_TO_INT g_word1 BCD_TO_INT_E EN E...

Page 122: ...l 2 BCD_TO_DINT Label 1 BCD_TO_DINT_E BCD_TO_DINT_E EN _BCD Output label Example BCD_TO_DINT_E X000 Label 1 Label 2 Variable Description Data type Input variable EN Execution condition Bit _BCD Conversion source BCD data ANY_BIT Output variable ENO Execution status Bit 1 Double word signed data after conversion Double Word signed BCD_TO_DINT _BCD 1 Label 2 Label 1 BCD_TO_DINT_E EN ENO 1 Label 2 X0...

Page 123: ...dresses Program example In this example BCD 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 1 Function without EN ENO BCD_TO_DINT 2 Function with EN ENO BCD_TO_DINT_E Structured ladder ST Structured ladder ST s d g_dint1 0 BCD_TO_DINT g_word1 16 0000 _BCD g_dint1 BCD_TO_DINT g_word1 BCD_TO_DINT_E ...

Page 124: ...tured 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIME_TO_BOOL TIME_TO_BOOL _TIME Exampl...

Page 125: ...s and Addresses Program example In this program time 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 1 Function without EN ENO TIME_TO_BOOL 2 Function with EN ENO TIME_TO_BOOL_E Structured ladder ST Structured ladder ST s d g_bool1 TIME_TO_BOOL g_time1 _TIME g_bool1 TIME_TO_BOOL g_time1 TIME_TO_BOOL_E EN ENO g_b...

Page 126: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIME_TO_INT TIME_TO_INT _TIME Exa...

Page 127: ...es and Addresses Program example In this program time 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 1 Function without EN ENO TIME_TO_INT 2 Function with EN ENO TIME_TO_INT_E Structured ladder ST Structured ladder ST s d g_int1 TIME_TO_INT g_time1 _TIME g_int1 TIME_TO_INT g_time1 TIME_TO_INT_E EN ENO g...

Page 128: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIME_TO_DINT TIME_TO_DINT _TIME Example Label 2 TIME_TO_...

Page 129: ...dresses Program example In this program time 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 1 Function without EN ENO TIME_TO_DINT 2 Function with EN ENO TIME_TO_DINT_E Structured ladder ST Structured ladder ST s d g_dint1 TIME_TO_DINT g_time1 _TIME g_dint1 TIME_TO_DINT g_time1 TIME_TO_DINT_E EN ...

Page 130: ...ata 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 exceeds the range of the corresponding device FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0...

Page 131: ...nd Addresses Program example In this program time 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 1 Function without EN ENO TIME_TO_STR 2 Function with EN ENO TIME_TO_STR_E Structured ladder ST Structured ladder ST s d g_string1 TIME_TO_STR g_time1 _TIME g_string1 TIME_TO_STR g_time1 TIME_TO_STR_E EN ENO g_st...

Page 132: ...grams 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIME_TO_WORD TIME_TO_WORD _TIME Example D10 TIM...

Page 133: ...s Program example In this program time 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 1 Function without EN ENO TIME_TO_WORD 2 Function with EN ENO TIME_TO_WORD_E Structured ladder ST Structured ladder ST s d g_word1 TIME_TO_WORD g_time1 _TIME g_word1 TIME_TO_WORD g_time1 TIME_TO_WOR...

Page 134: ...y 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIME_TO_DWOR D TIME_TO_DWORD _TIME Example Label 2 TIME_TO_DWORD Label...

Page 135: ...s Program example In this program time 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 1 Function without EN ENO TIME_TO_DWORD 2 Function with EN ENO TIME_TO_DWORD_E Structured ladder ST Structured ladder ST s d g_dword1 TIME_TO_DWORD g_time1 _TIME g_dword1 TIME_TO_DWORD g_time...

Page 136: ... in is word signed and the stored data is 32768 this function outputs 32768 to a device specified in 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 The maximum absolute value handled by this function is 2147483647 Cautio...

Page 137: ...sses Program example In this program the absolute value is obtained for word signed data stored in a device specified in and the operation result is output to a device specified in using the data type same as the data stored in a device specified in 1 Function without EN ENO ABS 2 Function with EN ENO ABS_E Structured ladder ST Structured ladder ST s d s g_int2 5923 ABS g_int1 5923 _IN g_int2 ABS ...

Page 138: ...outputs the operation result to a device specified in using the data type of data stored in devices specified in and Example When the data type is word signed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST ADD_E ADD_E EN _IN _IN Output label Example ADD_E X000 D0 D10 D20 Variable Description Data type Input variable EN Execution co...

Page 139: ...am addition is performed using double word signed data stored in devices specified in and and the operation result is output to a device specified in Device Name Description M8020 Zero ON When the operation result is 0 OFF When the operation result is any other than 0 M8021 Borrow ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit operation OFF When...

Page 140: ...ng the data type of data stored in devices specified in and Example When the data type is word signed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST SUB_E SUB_E EN _IN1 _IN2 Output label Example SUB_E X000 D0 D10 D20 Variable Description Data type Input variable EN Execution condition Bit _IN1 Data to be subtracted or word device w...

Page 141: ...rogram subtraction is performed using word signed data stored in devices specified in and and the operation result is output to a device specified in Device Name Description M8020 Zero ON When the operation result is 0 OFF When the operation result is any other than 0 M8021 Borrow ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit operation OFF When...

Page 142: ...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 FX3U ...

Page 143: ...tions 6 Standard Function Blocks A Correspondence between Devices and Addresses Program example In this program multiplication is performed using double word signed data stored in devices specified in and and the operation result is output to a device specified in Structured ladder ST s1 s2 d MUL_E EN ENO g_dint3 g_bool1 g_dint1 g_dint2 _IN _IN g_bool3 g_bool3 MUL_E g_bool1 g_dint1 g_dint2 g_dint3...

Page 144: ...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 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX...

Page 145: ... A Correspondence between Devices and Addresses Program example In this program division is performed using double word signed data stored in devices specified in and and the operation result is output to a device specified in using the data type of data stored in devices specified in and Structured ladder ST s1 s2 d s1 s2 DIV_E EN ENO g_dint3 g_bool1 g_dint1 g_dint2 _IN1 _IN2 g_bool3 g_bool3 DIV_...

Page 146: ...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 language FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MOD _IN1 MOD _IN2 2 Example Labe...

Page 147: ...en the operation result exceeds 32 767 16 bit operation or 2 147 483 647 32 bit operation Program example In this program division is performed using double word signed data stored in devices specified in and and the remainder is output to a device specified in using the data type of data stored in devices specified in and 1 Function without EN ENO MOD 2 Function with EN ENO MOD_E Structured ladde...

Page 148: ...n handling 32 bit data You can specify 32 bit counters directly however because they are 32 bit devices Use global labels when specifying labels FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST EXPT EXPT In1 In2 Example Label 2 EXPT Label 1 D10 EXPT_E EXPT_E EN In1 In2 Output label Example EXPT_E X000 Label 1 D10 Label 2 Variable Des...

Page 149: ... a device specified in is 0 Error code K6706 3 When the operation result is outside the following range Error code K6706 2 126 Operation result 2128 Program example In this program the value stored in a device specified in is raised to the power of the value stored in a device specified in and the operation result is output to a device specified in using the data type of data stored in a device sp...

Page 150: ...y 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MOVE MOVE _IN Example D10 MOVE D0 MOVE_E MOVE_E EN _IN Output label Ex...

Page 151: ...Function Blocks A Correspondence between Devices and Addresses Program example In this program word signed data stored in a device specified in is transferred to a device specified in 1 Function without EN ENO MOVE 2 Function with EN ENO MOVE_E Structured ladder ST Structured ladder ST s d MOVE g_int1 _IN g_int2 g_int2 MOVE g_int1 MOVE_E EN ENO g_int2 g_bool1 g_int1 _IN g_bool3 g_bool3 MOVE_E g_bo...

Page 152: ... When word unsigned bit string 16 bit data is stored in a device specified in and 8 is specified in 2 n bits from the least significant bit become 0 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST SHL SHL _IN _N Example D10 SHL D0 K1 SHL_E SHL_E EN _IN _N Output label Example SHL_E X000 D0 K1 D10 Variable Description Data type Input...

Page 153: ...it 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 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 using the data type of data stored in a device specified in 1 Function without EN ...

Page 154: ...gned bit string 16 bit data is stored in a device specified in and 8 is specified in 2 n bits from the most significant bit become 0 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST SHR SHR _IN _K Example D10 SHR D0 K1 SHR_E SHR_E EN _IN _N Output label Example SHR_E X000 D0 K1 D10 Variable Description Data type Input variable EN Exe...

Page 155: ...t 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 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 using the data type of data stored in a device specified in 1 Function without EN ...

Page 156: ...tring 16 bit 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Functi...

Page 157: ...Devices and Addresses 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 and the operation result is output to a device specified in using the data type of data stored in devices specified in and Structured ladder ST s1 s2 d s1 s2 AND_E EN ENO g_bool1 g_word1 16 FF0F g_word2 16 1234 g_word3 16 12...

Page 158: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression...

Page 159: ...en Devices and Addresses Program example In this program the logical sum is obtained using each bit of word unsigned bit string 16 bit data stored in devices specified in and and the operation result is output to a device specified in using the data type of data stored in devices specified in and Structured ladder ST s1 s2 d s1 s2 OR_E EN ENO g_bool1 g_word1 16 5F03 g_word2 16 9CCC g_word3 16 DFCF...

Page 160: ... specified in using the data type of data stored in devices specified in and Example When the data type is word unsigned bit string 16 bit 2 The number of pins in can be changed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST XOR_E XOR_E EN _IN _IN Output label Example XOR_E X000 M0 M10 M20 Variable Description Data type Input varia...

Page 161: ...ferent 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 exclusive logical sum is obtained using each bit of word unsigned bit string 16 bit data stored in devices specified in and and the operation result is output to a device specif...

Page 162: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Exp...

Page 163: ...his program the logical negation is obtained using each bit of word unsigned bit string 16 bit data stored in a device specified in and the operation result is output to a device specified in using the data type of data stored in a device specified in 1 Function without EN ENO NOT 2 Function with EN ENO NOT_E Structured ladder ST Structured ladder ST s d s NOT g_word1 16 AAAA _IN g_word2 16 5555 g...

Page 164: ...alue stored in a device specified in is TRUE this function outputs the value stored in a device specified in to a device specified in Example When the data type of input variables and is word signed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST SEL SEL _G _IN0 _IN1 Example D20 SEL M0 D0 D10 SEL_E SEL_E EN _G _IN0 _IN1 Output label...

Page 165: ...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 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 using the data type of data stored in devices specified in and 1 Function without EN ...

Page 166: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MAXIMUM MAXIMUM _IN _IN Example ...

Page 167: ...this program the maximum value among word signed data stored in devices specified in and is output to a device specified in using the data type of data stored in devices specified in and 1 Function without EN ENO MAXIMUM 2 Function with EN ENO MAXIMUM_E Structured ladder ST Structured ladder ST s1 s2 d s1 s2 MAXIMUM g_int1 5678 g_int2 1234 _IN _IN g_int3 5678 g_int3 MAXIMUM g_int1 g_int2 MAXIMUM_E...

Page 168: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MINIMUM MINIMUM _IN _IN Example ...

Page 169: ...this program the minimum value among word signed data stored in devices specified in and is output to a device specified in using the data type of data stored in devices specified in and 1 Function without EN ENO MINIMUM 2 Function with EN ENO MINIMUM_E Structured ladder ST Structured ladder ST s1 s2 d s1 s2 MINIMUM g_int1 5678 g_int2 1234 _IN _IN g_int3 1234 g_int3 MINIMUM g_int1 g_int2 MINIMUM_E...

Page 170: ...s of a device specified in Contents of a device specified in this function outputs the contents of a device specified in to a device specified in Example When the data type is word signed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST LIMITATION LIMITATION _MN _IN _MX Example D30 LIMITATION D0 D10 D20 LIMITATION_E LIMITATION_E EN _...

Page 171: ...ion 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 Contents of a device specified in Lower limit data Upper limit data Program example In this program data whose type is same as the data stored in devices specified in and is output to a device specified in in accordanc...

Page 172: ...pe is word signed 2 When a value input to is outside the pin number range for this function outputs an indefinite value to a device specified in An operation error does not occur MUX_E outputs FALSE from ENO 3 The number of pins in can be changed FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MUX MUX _K _IN _IN Example D30 MUX D0 D...

Page 173: ... 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 example either one among values stored in devices specified in is output to a device specified in in accordance with the value specified in using the data type of data stored in devices specified in 1 Function without EN ENO MUL 2 F...

Page 174: ...arison result is n 1 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX...

Page 175: ...unctions 5 Applied Functions 6 Standard Function Blocks A Correspondence between Devices and Addresses 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 Structured ladder ST s1 s2 d GT_E EN ENO g_bool2 g_bool1 g_int1 g_int2 _IN _IN g_bool3 g_bool3 GT_E g_bool1 g_int1 g_int2 g_bool2 ...

Page 176: ...ces 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S ...

Page 177: ...utions 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 In this program the contents of devices specified in and are compared and the operation result ...

Page 178: ...t is n 1 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function...

Page 179: ...unctions 5 Applied Functions 6 Standard Function Blocks A Correspondence between Devices and Addresses 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 Structured ladder ST s1 s2 d LE_E EN ENO g_bool2 g_bool1 g_int1 g_int2 _IN _IN g_bool3 g_bool3 LE_E g_bool1 g_int1 g_int2 g_bool2 ...

Page 180: ...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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Func...

Page 181: ... in the case of b This function outputs FALSE when in the case of 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0...

Page 182: ...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 Structured ladder ST s1 s2 d NE_E EN ENO g_bool2 g_bool1 g_int1 g_int2 _IN1 _IN2 g_bool3 g_bool3 NE_E g_bool1 g_int1 g_int2 g_bool2 ...

Page 183: ... FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MID MID _IN _L _P Example Label 2 MID Label 1 D10 D20 MID_E MID_E EN _IN _L _P Output label Example MID_E X000 Label 1 D10 D20 Label 2 Variable Description Data type Input variable EN Execution condition Bit _IN Head word device which stores a character string String _L Word device which stores the number of characters...

Page 184: ...en 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 t...

Page 185: ...ecified number of characters are extracted from an arbitrary position of a character string stored in devices specified in and the obtained data is output to devices specified in 1 Function without EN ENO MID 2 Function with EN ENO MID_E Structured ladder ST Structured ladder ST s d MID g_string1 ABCDEF12345 g_int1 5 _IN _L g_string2 EF123 g_int2 5 _P g_string2 MID g_string1 g_int1 g_int2 MID_E EN...

Page 186: ...er ST CONCAT CONCAT _IN _IN Example Label 3 CONCAT Label 1 Label 2 CONCAT_E CONCAT_E EN _IN _IN Output label Example CONCAT_E X000 Label 1 Label 2 Label 3 Variable Description Data type Input variable EN Execution condition Bit _IN _IN Head word device which stores the data character string to be connected or directly specified character string String Output variable ENO Execution status Bit 1 Hea...

Page 187: ...en character 0 this function stores 0000H in devices specified in 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 follo...

Page 188: ...specified in and the character string obtained by connection is output to devices specified in 1 Function without EN ENO CONCAT 2 Function with EN ENO CONCAT_E Structured ladder ST Structured ladder ST s2 s1 d CONCAT g_string1 ABCDEF g_string2 12345 _IN _IN g_string3 ABCDEF12345 g_string3 CONCAT g_string1 g_string2 CONCAT_E EN ENO g_string3 g_bool1 g_string1 g_string2 _IN _IN g_bool3 g_bool3 CONCA...

Page 189: ...e Structured ladder ST INSERT INSERT _IN1 _IN2 _P Example Label 3 INSERT Label 1 Label 2 D20 INSERT_E INSERT_E EN _IN1 _IN2 _P Output label Example INSERT_E X000 Label 1 Label 2 D20 Label 3 Variable Description Data type Input variable EN Execution condition Bit _IN1 Head word device which stores a character string to get insertion String _IN2 Head word device which stores a character string to be...

Page 190: ... 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 the number of devices after the device number specified in is smaller than the number of devices required for storing the output data obtained by insertion Error code K6706 2 When devices which stor...

Page 191: ...erted into an arbitrary position counted from the head of a character string stored in devices specified in and the character string obtained by insertion is output to devices specified in 1 Function without EN ENO INSERT 2 Function with EN ENO INSERT_E Structured ladder ST Structured ladder ST s2 s1 d INSERT g_string1 ABCDEF g_string2 12345 _IN1 _IN2 g_string3 AB12345CDEF g_int1 3 _P g_string3 IN...

Page 192: ...N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST DELETE DELETE _IN _L _P Example Label 2 DELETE Label 1 D10 D20 DELETE_E DELETE_E EN _IN _L _P Output label Example DELETE_E X000 Label 1 D10 D20 Label 2 Variable Description Data type Input variable EN Execution condition Bit _IN Head word device which stores a character string to get deletion String...

Page 193: ...en the number of characters of a character string stored in devices specified in is 32768 or more Error code K6706 3 When the number of devices after the device number specified in is smaller than the number of devices required for storing the character string remaining after deletion of specified number of characters Error code K6706 4 When the value specified in is negative Error code K6706 Prog...

Page 194: ..._E X000 Label 1 Label 2 D20 D30 Label 3 Variable Description Data type Input variable EN Execution condition Bit _IN1 Head word device which stores a character string to be replaced String _IN2 Head word device which stores a replacement character string String _L Word device which stores the number of characters to be replaced Word signed _P Word device which stores the head character position to...

Page 195: ...eds the number of characters of a character string stored in devices specified in excessive characters are not output to devices specified in 4 When 1 is specified in the number of characters of a character string stored in devices specified in is regarded as the value specified in Cautions 1 Use the function having _E in its name to connect a bus 2 When handling character string data in structure...

Page 196: ...haracters 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 in and the character string obtained by replacement is output to devices specified in 1 Function withou...

Page 197: ... FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST FIND FIND _IN1 _IN2 Example D20 FIND Label 1 Label 2 FIND_E FIND_E EN _IN1 _IN2 Output label Example FIND_E X000 Label 1 Label 2 D20 Variable Description Data type Input variable EN Execution condition Bit _IN1 Head word device which stores a character string to get search String _IN2 Head word d...

Page 198: ...puts 0 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 t...

Page 199: ...am a character string stored in devices specified in is searched from the beginning of a character string stored in devices specified in and the search result is output to devices specified in 1 Function without EN ENO FIND 2 Function with EN ENO FIND_E Structured ladder ST Structured ladder ST s2 s1 d FIND g_string1 ABCDEFGHIJK g_string2 EFGHIJK _IN1 _IN2 g_int1 5 g_int1 FIND g_string1 g_string2 ...

Page 200: ... FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST ADD_TIME ADD_TIME _IN1 _IN2 Example Label 3 ADD_TIME Label 1 Label 2 ADD_TIME_E ADD_TIME_E EN _IN1 _IN2 Output label Example ADD_TIME_E X000 Label 1 Label 2 Label 3 Variable Description Data type Input variable EN Execution condition Bit _IN1 Head word device which stores time data to get additio...

Page 201: ...ecified in and and the operation result expressed as time data is output to devices specified in 1 Function without EN ENO ADD_TIME 2 Function with EN ENO ADD_TIME_E Device Name Description M8020 Zero ON When the operation result is 0 OFF When the operation result is any other than 0 M8021 Borrow ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit op...

Page 202: ...C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST SUB_TIME SUB_TIME _IN1 _IN2 Example Label 3 SUB_TIME Label 1 Label 2 SUB_TIME_E SUB_TIME_E EN _IN1 _IN2 Output label Example SUB_TIME_E X000 Label 1 Label 2 Label 3 Variable Description Data type Input variable EN Execution condition Bit _IN1 Head word device which stores time data to get subtraction T...

Page 203: ...pecified in and and the operation result expressed as time data is output to devices specified in 1 Function without EN ENO SUB_TIME 2 Function with EN ENO SUB_TIME_E Device Name Description M8020 Zero ON When the operation result is 0 OFF When the operation result is any other than 0 M8021 Borrow ON When the operation result is less than 32 768 16 bit operation or less than 2 147 483 648 32 bit o...

Page 204: ...es 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 MUL_TIME_E outputs TRUE from ENO FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST MUL_TIME MUL_TIME _IN1 _I...

Page 205: ...e In this program multiplication is performed using time data stored in devices specified in and and the operation result expressed as time data is output to devices specified in 1 Function without EN ENO MUL_TIME 2 Function with EN ENO MUL_TIME_E Structured ladder ST Structured ladder ST s1 s2 s1 s2 d MUL_TIME g_time1 _IN1 g_time2 g_int1 _IN2 g_time2 MUL_TIME g_time1 g_int1 MUL_TIME_E EN ENO g_ti...

Page 206: ...irectly 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 0 and the function is not executed 2 An operation error occurs when the operation result exceeds 2 147 483 647 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST D...

Page 207: ...mple In this program division is performed using time data stored in devices specified in and and the operation result expressed as time data is output to devices specified in 1 Function without EN ENO DIV_TIME 2 Function with EN ENO DIV_TIME_E Structured ladder ST Structured ladder ST s1 s2 s1 s2 d DIV_TIME g_time1 _IN1 g_time2 g_int1 _IN2 g_time2 DIV_TIME g_time1 g_int1 DIV_TIME_E EN ENO g_time2...

Page 208: ...ing a function block Error 1 When an output number is specified in 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 and the specified device number does not exist due to indexing an operation error Error code 6706 occurs FX3U C FX3G FX2N C FX1...

Page 209: ...pecified in turns ON when the bit data stored in a device specified in turns ON from OFF and the device specified in remains ON only for 1 operation cycle 1 Function without EN ENO R_TRIG 2 Function with EN ENO R_TRIG_E Structured ladder ST Structured ladder ST d s d R_TRIG R_TRIG_Instance g_bool1 _CLK Q g_bool2 R_TRIG_Instance _CLK g_bool1 g_bool2 R_TRIG_Instance Q R_TRIG_E R_TRIG_E_Instance EN E...

Page 210: ...n block Error 1 When an output number is specified in 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 and the specified device number does not exist due to indexing an operation error Error code 6706 occurs FX3U C FX3G FX2N C FX1N C FX1S FXU ...

Page 211: ... specified in turns ON when the bit data stored in a device specified in turns OFF from ON and the device specified in remains ON only for 1 operation cycle 1 Function without EN ENO F_TRIG 2 Function with EN ENO F_TRIG_E Structured ladder ST Structured ladder ST d s d F_TRIG F_TRIG_Instance g_bool1 _CLK Q g_bool2 F_TRIG_Instance _CLK g_bool1 g_bool2 F_TRIG_Instance Q F_TRIG_E F_TRIG_E_Instance EN...

Page 212: ...ect 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST CTU CTU CU RESET PV 1 Example Instance name CU M0 RESET M10 PV D0 M20 Instance name Q D10 Instance name CV CTU_E CTU_E ...

Page 213: ...n turns ON from OFF is counted and the count value is output to a device specified in 1 Function without EN ENO CTU 2 Function with EN ENO CTU_E Structured ladder ST Structured ladder ST s1 d2 CTU CTU_Instance g_bool1 CU Q g_bool3 g_int2 g_bool2 RESET CV g_int1 PV CTU_Instance CU g_bool1 RESET g_bool2 PV g_int1 g_bool3 CTU_Instance Q g_int2 CTU_Instance CV CTU_E CTU_E_Instance EN ENO Q g_bool3 M11...

Page 214: ...on 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST CTD CTD CD LOAD PV 1 Example Instance name CD M0 LOAD M10 PV D0 M20 Instance name Q D10...

Page 215: ...F is 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 Function with EN ENO CTD_E Structured ladder ST Structured ladder ST s1 d1 d2 CTD CTD_Instance g_bool1 CD Q g_bool3 g_int2 g_bool2 LOAD CV g_int1 PV CTD_Instance CD g_bool1 LOAD g_bool2 PV g_int1 g_bool3 CTD_Instance Q g_int2 CTD_Instance CV CTD_E CTD_E_Instance ...

Page 216: ...X3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST CTUD CTUD CU CD RESET LOAD PV 1 Example Instance name CU M0 CD M10 RESET M20 LOAD M30 PV D0 M40 Instance name QU M50 Instance name QD D10 Instance name CV CTUD_E 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 Instan...

Page 217: ...ices and Addresses 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...

Page 218: ...ecomes 0 a device specified in turns ON 1 Function without EN ENO CTUD 2 Function with EN ENO CTUD_E Structured ladder ST Structured ladder ST s1 d3 n d1 s2 d3 d2 CTUD CTUD_Instance g_bool1 CU QU g_bool5 g_bool6 g_bool2 CD QD g_int2 CV g_bool3 RESET g_bool4 LOAD g_int1 PV 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_in...

Page 219: ...e specified in 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...

Page 220: ...ains ON for 10 seconds 1 Function without EN ENO TP 2 Function with EN ENO TP_E Structured ladder ST Structured ladder ST s d1 TP TP_Instance g_bool1 IN Q ET g_bool2 PT T 10s g_time1 TP_Instance IN g_bool1 PT T 10s g_bool2 TP_Instance Q g_time1 TP_Instance ET TP_E TP_E_Instance EN ENO Q g_bool2 M10 M0 g_bool1 IN T 10s g_time1 PT ET TP_E_Instance EN M0 IN g_bool1 PT T 10s M10 TP_E_Instance ENO g_bo...

Page 221: ...2 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 progr...

Page 222: ...onds later 1 Function without EN ENO TON 2 Function with EN ENO TON_E Structured ladder ST Structured ladder ST s d1 TON TON_Instance g_bool1 IN Q ET g_bool2 PT T 10s g_time1 TON_Instance IN g_bool1 PT T 10s g_bool2 TON_Instance Q g_time1 TON_Instance ET TON_E TON_E_Instance EN ENO Q g_bool2 M10 M0 g_bool1 IN T 10s g_time1 PT ET TON_E_Instance EN M0 IN g_bool1 PT T 10s M10 TON_E_Instance ENO g_boo...

Page 223: ...e 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 ins...

Page 224: ...ta stored in a device specified in turns OFF 10 seconds later 1 Function without EN ENO TOF 2 Function with EN ENO TOF_E Structured ladder ST Structured ladder ST s d1 s d1 TOF TOF_Instance g_bool1 IN Q ET g_bool2 PT T 10s g_time1 TOF_Instance IN g_bool1 PT T 10s g_bool2 TOF_Instance Q g_time1 TOF_Instance ET TOF_E TOF_E_Instance EN ENO Q g_bool2 M10 M0 g_bool1 IN T 10s g_time1 PT ET TOF_E_Instanc...

Page 225: ...tatus turns ON The current count value is stored in the output argument ValueOut 1 Var_D10 is a global label and is defined as D10 2 Var_M10 is a global label and is defined as M10 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST COUNTER_FB_M COUNTER_FB_M Coil Preset ValueIn 1 Example Instance name Coil X000 Preset D0 ValueIn D10 D20...

Page 226: ...nctions 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 counter numbers are allocated automatically ...

Page 227: ...gument Status also turns OFF 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 allo...

Page 228: ...tion 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 1 Var_D10 is a global label and is defined as D10 2 Var_M10 is a global label and is defined as M10 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expression in each language Structured ladder ST TIMER_ CONT_FB_M TIMER_...

Page 229: ...nctions 5 Applied Functions 6 Standard Function Blocks A Correspondence between Devices and Addresses 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 ...

Page 230: ... 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 FX3U C FX3G FX2N C FX1N C FX1S FXU FX2C FX0N FX0 S Function name Expres...

Page 231: ...xiliary relay M Mn MX0 n M499 MX0 499 Timer Contact TS Tn MX3 n TS191 MX3 191 Coil TC Tn MX5 n TC191 MX5 191 Current value TN Tn MW3 n MD3 n TN190 T190 MW3 191 MD3 190 Counter Contact CS Cn MX4 n CS99 MX4 99 Coil CC Cn MX6 n CC99 MX6 99 Current value CN Cn MW4 n MD4 n CN98 C98 MW4 99 MD4 98 Data register D Dn MW0 n MD0 n D198 D198 MW0 199 MD0 198 Intelligent function unit device G Ux Gn MW14 x n M...

Page 232: ...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 ...

Page 233: ...tory Revision History Date of preparation Revision Description 1 2009 A First Edition 7 2009 B Equivalent circuits are deleted Following instructions are not supported in FX0 FX0S and FX0N PLCs CTD _E CTU _E CTUD _E TOF _E TON _E TP _E Function blocks SR _E RS _E are deleted ...

Page 234: ...232 FXCPU Structured Programming Manual Application Functions Revision History MEMO ...

Page 235: ...ODA KU TOKYO 100 8310 JAPAN HIMEJI WORKS 840 CHIYODA CHO HIMEJI JAPAN JY997D34801B MEE Effective Jul 2009 Specifications are subject to change without notice FXCPU Structured Programming Manual Application Functions MODEL FX KP OK E MODEL CODE 09R927 ...

Page 236: ... 463 541 GREECE UTECO 5 Mavrogenous Str GR 18542 Piraeus Phone 30 211 1206 900 Fax 30 211 1206 999 HUNGARY MELTRADE Kft Fertő utca 14 HU 1107 Budapest Phone 36 0 1 431 9726 Fax 36 0 1 431 9727 LATVIA Beijer Electronics SIA Ritausmas iela 23 LV 1058 Riga Phone 371 0 784 2280 Fax 371 0 784 2281 LITHUANIA Beijer Electronics UAB Savanoriu Pr 187 LT 02300 Vilnius Phone 370 0 5 232 3101 Fax 370 0 5 232 ...

Reviews: