Mitsubishi Electronics FXCPU User Manual

FXCPU
Structured Programming Manual [Application Functions]
FXCPU Structured Programming Manual (Application Functions)
FXCPU Structured Programming Manual
(Application Functions)

Manual number JY997D34801

Manual revision B
Date 7/2009
Foreword
Store this manual in a safe place so that you can take it out and read it whenever necessary. Always forward it to the end user.
This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses. Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a result of using the contents noted in this manual.
© 2009 MITSUBISHI ELECTRIC CORPORATION
1
FXCPU Structured Programming Manual (Application Functions)
Outline Precautions
• This manual provides information for the use of the FX Series Programmable Controllers. The manual has been written to be used by trained and competent personnel. The definition of such a person or persons is as follows;
a) Any engineer who is responsible for the planning, design and construction of automatic equipment
using the product associated with this manual should be of a competent nature, trained and qualified to the local and national standards required to fulfill that role. These engineers should be fully aware of all aspects of safety with regards to automated equipment.
b) Any commissioning or service engineer must be of a competent nature, trained and qualified to the
local and national standards required to fulfill that job. These engineers should also be trained in the use and maintenance of the completed product. This includes being completely familiar with all associated documentation for the said product. All maintenance should be carried out in accordance with established safety practices.
c) All operators of the completed equipment should be trained to use that product in a safe and
coordinated manner in compliance to established safety practices. The operators should also be familiar with documentation which is connected with the actual operation of the completed equipment.
Note: the term 'completed equipment' refers to a third party constructed device which contains or uses
the product associated with this manual
• This product has been manufactured as a general-purpose part for general industries, and has not been designed or manufactured to be incorporated in a device or system used in purposes related to human life.
• Before using the product for special purposes such as nuclear power, electric power, aerospace, medicine or passenger 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 the system.
• When combining this product with other products, please confirm the standard and the code, or regulations with which the user should follow. Moreover, please confirm the compatibility of this product to the system, machine, and apparatus with which a user is using.
• If in doubt at any stage during the installation of the product, always consult a professional electrical engineer who is qualified and trained to the local and national standards. If in doubt about the operation or use, please consult the nearest Mitsubishi Electric distributor.
• Since the examples indicated by this manual, technical bulletin, catalog, etc. are used as a reference, please use it after confirming the function and safety of the equipment and system. Mitsubishi Electric will accept no responsibility for actual use of the product based on these illustrative examples.
• This manual content, specification etc. may be changed without a notice for improvement.
• The information in this manual has been carefully checked and is believed to be accurate; however, you have noticed a doubtful point, a doubtful error, etc., please contact the nearest Mitsubishi Electric distributor.
Registration
•Microsoft® and Windows® are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
• CompactFlash is a trademark of SanDisk Corporation in the United States and other countries.
• The company name and the product name to be described in this manual are the registered trademarks or trademarks of each company.
2
FXCPU Structured Programming Manual (Application Functions)

Table of Contents

Positioning of This Manual....................................................................................................... 7
Related Manuals...................................................................................................................... 10
Generic Names and Abbreviations Used in Manuals .......................................................... 13
1. Outline 14
1.1 Outline of Structured Programs and Programming Languages .................................................... 14
1.1.1 Outline of structured programs...................................................................................................... 14
1.1.2 Programming languages ............................................................................................................... 15
1.2 PLC Series and Programming Software Version .......................................................................... 15
1.3 Cautions on Creation of Fundamental Programs.......................................................................... 16
1.3.1 I/O processing and response delay ............................................................................................... 16
1.3.2 Double output (double coil) operation and countermeasures........................................................ 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
Table of Contents
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 Selection Functions ....................................................................................................... 25
2.7 Standard Comparison Functions................................................................................................... 26
2.8 Standard Character String Functions............................................................................................ 26
2.9 Functions Of Time Data Types ..................................................................................................... 26
2.10 Standard Function Blocks ........................................................................................................... 27
3. Function Construction 28
3.1 Applied Function Expression and Execution Type........................................................................ 28
3.2 Labels............................................................................................................................................ 29
3.3 Device and Address...................................................................................................................... 32
3.4 EN and ENO ................................................................................................................................. 33
4. How to Read Explanation of Functions 34
3
FXCPU Structured Programming Manual (Application Functions)
5. Applied Functions 36
5.1 Type Conversion Functions .......................................................................................................... 36
5.1.1 BOOL_TO_INT(_E)....................................................................................................................... 36
5.1.2 BOOL_TO_DINT(_E) .................................................................................................................... 38
5.1.3 BOOL_TO_STR(_E)......................................................................................................................40
5.1.4 BOOL_TO_WORD(_E) ................................................................................................................. 42
5.1.5 BOOL_TO_DWORD(_E)...............................................................................................................44
5.1.6 BOOL_TO_TIME(_E) .................................................................................................................... 46
5.1.7 INT_TO_DINT(_E).........................................................................................................................48
5.1.8 DINT_TO_INT(_E)......................................................................................................................... 50
5.1.9 INT_TO_BOOL(_E)....................................................................................................................... 52
5.1.10 DINT_TO_BOOL(_E) .................................................................................................................. 54
5.1.11 INT_TO_REAL(_E)......................................................................................................................56
5.1.12 DINT_TO_REAL(_E)................................................................................................................... 58
5.1.13 INT_TO_STR(_E)........................................................................................................................ 60
5.1.14 DINT_TO_STR(_E) ..................................................................................................................... 62
5.1.15 INT_TO_WORD(_E)....................................................................................................................64
5.1.16 DINT_TO_WORD(_E)................................................................................................................. 66
5.1.17 INT_TO_DWORD(_E)................................................................................................................. 68
5.1.18 DINT_TO_DWORD(_E) .............................................................................................................. 70
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 WORD_TO_TIME(_E)............................................................................................................... 103
5.1.35 DWORD_TO_TIME(_E) ............................................................................................................ 105
5.1.36 STR_TO_BOOL(_E).................................................................................................................. 107
5.1.37 STR_TO_INT(_E)...................................................................................................................... 109
5.1.38 STR_TO_DINT(_E) ................................................................................................................... 111
5.1.39 STR_TO_REAL(_E) ..................................................................................................................113
5.1.40 STR_TO_TIME(_E)................................................................................................................... 116
5.1.41 BCD_TO_INT(_E) ..................................................................................................................... 118
5.1.42 BCD_TO_DINT(_E)................................................................................................................... 120
5.1.43 TIME_TO_BOOL(_E) ................................................................................................................ 122
5.1.44 TIME_TO_INT(_E) .................................................................................................................... 124
5.1.45 TIME_TO_DINT(_E).................................................................................................................. 126
5.1.46 TIME_TO_STR(_E)................................................................................................................... 128
5.1.47 TIME_TO_WORD(_E)............................................................................................................... 130
5.1.48 TIME_TO_DWORD(_E) ............................................................................................................ 132
Table of Contents
4
FXCPU Structured Programming Manual (Application Functions)
5.2 Standard Functions Of One Numeric Variable............................................................................ 134
5.2.1 ABS(_E)....................................................................................................................................... 134
5.3 Standard Arithmetic Functions .................................................................................................... 136
5.3.1 ADD_E......................................................................................................................................... 136
5.3.2 SUB_E......................................................................................................................................... 138
5.3.3 MUL_E......................................................................................................................................... 140
5.3.4 DIV_E .......................................................................................................................................... 142
5.3.5 MOD(_E) .....................................................................................................................................144
5.3.6 EXPT(_E) .................................................................................................................................... 146
5.3.7 MOVE(_E) ................................................................................................................................... 148
5.4 Standard Bit Shift Functions........................................................................................................ 150
5.4.1 SHL(_E)....................................................................................................................................... 150
5.4.2 SHR(_E) ...................................................................................................................................... 152
5.5 Standard Bitwise Boolean Functions .......................................................................................... 154
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 CONCAT(_E)............................................................................................................................... 184
5.8.3 INSERT(_E)................................................................................................................................. 187
5.8.4 DELETE(_E)................................................................................................................................ 190
5.8.5 REPLACE(_E)............................................................................................................................. 192
5.8.6 FIND(_E) .....................................................................................................................................195
5.9 Functions Of Time Data Types ................................................................................................... 198
5.9.1 ADD_TIME(_E)............................................................................................................................ 198
5.9.2 SUB_TIME(_E)............................................................................................................................ 200
5.9.3 MUL_TIME(_E)............................................................................................................................ 202
5.9.4 DIV_TIME(_E) ............................................................................................................................. 204
Table of Contents
5
FXCPU Structured Programming Manual (Application Functions)
6. Standard Function Blocks 206
6.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
Table of Contents
6
FXCPU Structured Programming Manual (Application Functions)

Positioning of This Manual

This manual explains application functions for structured programs provided by GX Works2. Refer to other manuals for devices, parameters and sequence instructions. Refer to each corresponding manual for analog, communication, positioning control and special units and blocks.
1. When using FX3U/FX3UC/FX3G PLCs
QCPU/FXCPU Structured Programming Manual (Fundamentals)
Q/FX
Structured
This manual explains programming methods, specifications, functions, etc. required to create structured programs.
(Additional Manual)
FX
Structured
FX
Structured
(This manual)
FX
Structured
FX
3U
FX
3UC
FX
3G
FXCPU Structured Programming Manual (Device & Common)
This manual explains devices and parameters for structured programs provided by GX Works2.
(Additional Manual)
FXCPU Structured Programming Manual (Basic & Applied Instruction)
(Additional Manual)
This manual explains sequence instructions for structured programs provided by GX Works2.
FXCPU Structured Programming Manual (Application Functions)
(Additional Manual)
This manual explains application functions for structured programs provided by GX Works2.
FX3G/FX3U/FX
This manual explains details of analog special function blocks and analog special adapters for FX Explanation of instructions and instructions used in program examples are expressed for GX Developer.
3UC
User's Manual- Analog Control Edition
3U
/FX
3UC
/FX3G PLCs and PID instruction.
(Additional Manual)
FX
FX
3U
FX
3UC
FX
3G
Special
unit/block
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 and RS2 instructions), programming communication and inverter communication for FX PLCs. Explanation of instructions and instructions used in program examples are expressed for GX Developer.
FX3G/FX3U/FX
This manual explains details of wiring, instructions and operations of the positioning function built in FX Explanation of instructions and instructions used in program examples are expressed for GX Developer.
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.
*1. Detailed explanation may be provided by a separate manual in some products.
3UC
Series User's Manual -Positioning Edition
3U
/FX
3UC
/FX3G PLC main units.
(Manual supplied with product or additional Manual )
(Additional Manual)
(Additional Manual)
*1
7
FXCPU Structured Programming Manual (Application Functions)
2. When using FX1S/FX1N/FXU/FX1NC/FX2NC PLCs
Q/FX
Structured
QCPU/FXCPU Structured Programming Manual (Fundamentals)
This manual explains programming methods, specifications, functions, etc. required to create structured programs.
(Additional Manual)
FXCPU Structured Programming Manual (Device & Common)
FX
Structured
This manual explains devices and parameters for structured programs provided by GX Works2.
FXCPU Structured Programming Manual (Basic & Applied Instruction)
FX
This manual explains sequence instructions for structured programs provided
Structured
by GX Works2.
(This manual)
FXCPU Structured Programming Manual (Application Functions)
FX
This manual explains application functions for structured programs provided
Structured
by GX Works2.
(Additional Manual)
(Additional Manual)
(Additional Manual)
FX
Special
unit/block
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 instruction), programming communication and inverter communication for FX PLCs. Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX-PCS/WIN.
Individual manuals
This manual explains details of each special unit/block. Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX-PCS/WIN.
*1. Detailed explanation may be provided by a separate manual in some products.
(Manual supplied with product or additional Manual )
(Additional Manual)
*1
8
FXCPU Structured Programming Manual (Application Functions)
3. When using FX0/FX0S/FX0N/FXU/FX2C PLCs
Q/FX
Structured
QCPU/FXCPU Structured Programming Manual (Fundamentals)
This manual explains programming methods, specifications, functions, etc. required to create structured programs.
(Additional Manual)
FXCPU Structured Programming Manual (Device & Common)
FX
Structured
This manual explains devices and parameters for structured programs provided by GX Works2.
FXCPU Structured Programming Manual (Basic & Applied Instruction)
FX
This manual explains sequence instructions for structured programs provided
Structured
by GX Works2.
(This manual)
FXCPU Structured Programming Manual (Application Functions)
FX
This manual explains application functions for structured programs provided
Structured
by GX Works2.
(Additional Manual)
(Additional Manual)
(Additional Manual)
FX
Special
unit/block
FX Series User's Manual -Data Communication Edition
This manual explains details of parallel link, computer link, no-protocol communication (RS instruction) and programming communication for FX PLCs. Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX-PCS/WIN.
Individual manuals
This manual explains details of each special unit/block. Explanation of instructions and instructions used in program examples are expressed for GX Developer and FX-PCS/WIN.
*1. Detailed explanation may be provided by a separate manual in some products.
(Manual supplied with product or additional Manual )
(Additional Manual)
*1
9
FXCPU Structured Programming Manual (Application Functions)

Related Manuals

This manual explains devices and parameters for structured programs provided by GX Works2. Refer to other manuals for sequence instructions and applied functions. This chapter introduces only reference manuals for this manual and manuals which describe the hardware information of PLC main units. Manuals not introduced here may be required in some applications. Refer to the manual of the used PLC main unit and manuals supplied together with used products. Contact the distributor for acquiring required manuals.
Common among FX PLCs [structured]
Manual name Manual number
QCPU/FXCPU Structured Programming Manual (Fundamentals)
FXCPU Structured Programming Manual (Device & Common)
FXCPU Structured Programming Manual (Basic & Applied Instruction)
FXCPU Structured Programming Manual (Application Functions)
3U/FX3UC/FX3G PLCs
FX
Manual name Manual number
PLC main unit
FX3U Series Hardware Manual JY997D18801 Supplied with product
FX3U Series User's Manual- Hardware Edition
FX3UC (D, DSS) Series Hardware Manual
FX3UC-32MT-LT-2 Hardware Manual JY997D31601 Supplied with product
FX3UC Series User's Manual ­Hardware Edition
FX3G Series Hardware Manual JY997D33401 Supplied with product
FX3G Series User's Manual- Hardware Edition
SH-080782 Additional Manual
JY997D26001 Additional Manual
JY997D34701 Additional Manual
JY997D34801 Additional Manual
JY997D16501 Additional Manual
JY997D28601 Supplied with product
JY997D28701 Additional Manual
JY997D31301 Additional Manual
Supplied with product
or Additional Manual
Supplied with product
or Additional Manual
Contents
Programming methods, specifications, functions, etc. required to create structured programs
Devices, parameters, etc. provided in structured projects of GX Works2
Sequence instructions provided in structured projects of GX Works2
Application functions provided in structured projects of GX Works2
Contents
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.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX3U PLC main unit.
I/O specifications, wiring and installation of the PLC main unit FX3UC (D, DSS) extracted from the FX3UC Series User’s Manual - Hardware Edition. For detailed explanation, refer to the FX3UC Series User’s Manual - Hardware Edition.
I/O specifications, wiring and installation of the PLC main unit FX3UC-32MT-LT-2 extracted from the FX3UC Series User’s Manual - Hardware Edition. For detailed explanation, refer to the FX3UC Series User’s Manual - Hardware Edition.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX3UC PLC main unit.
I/O specifications, wiring and installation of the PLC main unit FX3G extracted from the FX3G Series User’s Manual - Hardware Edition. For detailed explanation, refer to the FX3G Series User’s Manual - Hardware Edition.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX3G PLC main unit.
Model
name code
13JW06
09R920
09R921
09R922
Model
name code
-
09R516
-
-
09R519
-
09R521
10
FXCPU Structured Programming Manual (Application Functions)
Manual name Manual number
Programming
FX3G/FX3U/FX3UC User's Manual­Analog Control Edition
FX Series User's Manual -Data Communication Edition
FX3G/FX3U/FX3UC Series User's Manual -Positioning Edition
FX3U-CF-ADP User's Manual JY997D35401 Additional Manual
JY997D16701 Additional Manual
JY997D16901 Additional Manual
JY997D16801 Additional Manual
Supplied with product
or Additional Manual
FX1S/FX1N/FX2N/FX1NC/FX2NC PLCs
Manual name Manual number
PLC main unit
FX1S HARDWARE MANUAL JY992D83901 Additional Manual
FX1N HARDWARE MANUAL JY992D89301 Additional Manual
FX2N HARDWARE MANUAL JY992D66301 Additional Manual
FX1NC HARDWARE MANUAL JY992D92101 Additional Manual
FX2NC HARDWARE MANUAL JY992D76401 Additional Manual
Programming
FX Series User's Manual -Data Communication Edition
JY997D16901 Additional Manual
Supplied with product
or Additional Manual
Contents
Detaileds about the analog special function block (FX3U-4AD, FX3U-4DA, FX3UC-4AD) and analog special adapter (FX3U-****-ADP).
Details about simple N : N link, parallel link, computer link and no-protocol communication (RS instruction and FX2N-232IF).
Details about the positioning function built in the FX3G/FX3U/FX3UC Series.
Describes details of the FX3U-CF-ADP CF card special adapter.
Contents
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX1S PLC main unit.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX1N PLC main unit.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX2N PLC main unit.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX1NC PLC main unit. (Japanese only)
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX2NC PLC main unit.
Details about simple N : N link, parallel link, computer link and no-protocol communication (RS instruction and FX2N-232IF).
Model
name code
09R619
09R715
09R620
09R720
Model
name code
-
-
09R508
09R505
09R509
09R715
11
FXCPU Structured Programming Manual (Application Functions)
0/FX0S/FX0N/FXU/FX2C PLCs [whose production is finished]
FX
Manual name Manual number
PLC main unit
FX0/FX0N HARDWARE MANUAL JY992D47501 Supplied with product
FX0S HARDWARE MANUAL JY992D55301 Supplied with product
FX/FX2C HARDWARE MANUAL JY992D47401 Supplied with product
Programming
FX Series User's Manual -Data Communication Edition
JY997D16901 Additional Manual
Supplied with product
or Additional Manual
Manuals of models whose production is finished
Production is finished for FX
0/FX0S/FX0N/FXU/FX2C PLCs.
Contents
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX0/FX0N PLC main unit.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FX0S PLC main unit.
Details about the hardware including I/O specifications, wiring, installation and maintenance of the FXU/FX2C PLC main unit.
Details about simple N : N link, parallel link, computer link and no-protocol communication (RS instruction and FX2N-232IF).
Model
name code
-
-
-
09R715
12
FXCPU Structured Programming Manual (Application Functions)

Generic Names and Abbreviations Used in Manuals

Abbreviation/generic name Name
PLCs
FX3U Series or FX3U PLC Generic name of FX3U Series PLCs
FX3UC Series or FX3UC PLC Generic name of FX3UC Series PLCs
FX3G Series or FX3G PLC Generic name of FX3G Series PLCs
FX2N Series or FX2N PLC Generic name of FX2N Series PLCs
FX2NC Series or FX2NC PLC Generic name of FX2NC Series PLCs
FX1N Series or FX1N PLC Generic name of FX1N Series PLCs
FX1NC Series or FX1NC PLC
FX1S Series or FX1S PLC Generic name of FX1S Series PLCs
FXU Series or FXU PLC Generic name of FXU(FX,FX2) Series PLCs
FX2C Series or FX2C PLC Generic name of FX2C Series PLCs
FX0N Series or FX0N PLC Generic name of FX0N Series PLCs
FX0S Series or FX0S PLC Generic name of FX0S Series PLCs
FX0 Series 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)
FX Structured Programming Manual (Device & Common)
FX Structured Programming Manual (Basic & Applied Instruction)
FX Structured Programming Manual (Application Functions)
COMMUNICATION CONTROL EDITION
ANALOG CONTROL EDITION Abbreviation of FX3G/FX3U/FX3UC Series User's Manual-ANALOG CONTROL EDITION
POSITIONING CONTROL EDITION Abbreviation of FX
Generic name of FX1NC Series PLCs These products can only used in Japan.
Abbreviation of QCPU/FXCPU Structured Programming Manual (Fundamentals)
Abbreviation of FXCPU Structured Programming Manual (Device & Common)
Abbreviation of FXCPU Structured Programming Manual (Basic & Applied Instruction)
Abbreviation of FXCPU Structured Programming Manual (Application Functions)
Abbreviation of FX Series User's Manual-DATA COMMUNICATION CONTROL EDITION
3G/FX3U/FX3UC Series User's Manual-POSITIONING CONTROL EDITION
13
FXCPU Structured Programming Manual (Application Functions)
1.1 Outline of Structured Programs and Programming

1. Outline

This manual explains applied functions for structured programs provided by GX Works2. Refer to a different manual for devices, parameters and sequence instructions. Refer to the following manual for labels, data types and programming languages for structured programs:
Q/FX Structured Programming Manual (Fundamentals)

1.1 Outline of Structured Programs and Programming Languages

1.1.1 Outline of structured programs

You can construct two or more programs (program blocks) into one program. Because you can divide the entire machine processing into small sub processes and create a program for each sub process, you can efficiently create a program for a large system.
1. Structured program
Program structuring is a technique to divide the contents of control executed by the PLC CPU into hierarchical small units (blocks) of processing, and then construct a program. By using this technique, you can design a program while recognizing structuring of a sequence program.
1 Outline
Advantages of hierarchical program
• You can examine the outline of a program at first, and then design its details gradually.
• Program blocks located at the lowest level in the hierarchy are extremely simple and highly independent.
Advantages of program consisting of program blocks
• Because the processing of each block is clear, the entire program is easy to understand.
• The entire program can be divided into several blocks that are created by several people.
• The program reusability is improved, and the development efficiency is improved accordingly.
2. Improved reusability of programs
You can save program blocks in a library. Program resources in the library can be shared, and often used again.
14
FXCPU Structured Programming Manual (Application Functions)

1.1.2 Programming languages

The following programming languages can be used in each program block.
Graphic languages
1. Structured ladder language
This graphic language is created based on the relay circuit design technology. Any circuit always starts from the bus line located on the leftmost. The structured ladder language consists of contacts, coils, functions and function blocks. These components are connected with vertical lines and horizontal lines.
1 Outline

1.2 PLC Series and Programming Software Version

1
2
Outline
Function List
1
2
X000 X001 Y000
Y000
X001
D0
When X001 is ON, the contents of D0 are transferred to D2.
MOV
EN ENO sd
Output Y000
D2
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.
Y000:=(X000 OR Y000) AND NOT X001; IF X001 THEN D2:=D0; (When X001 is ON, the contents of D0 are transferred to D2.) END_IF; IF X002 THEN D4:=D4+1; (When X002 is ON, the contents of D4 are added by "1".) ELSE D6:=D6+1; (When X002 is OFF, the contents of D6 are added by "1".) END_IF;
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
1.2 PLC Series and Programming Software Version
PLC Series
FX3U•FX3UC
FX3G
FX2N•FX2NC
FX1N•FX1NC
FX1S
FXU/FX2C
FX0N
FX0•FX0S
Software package name
(model name)
GX Works2
(SW1DNC-GXW2-E)
Ver. 1.08J or later
GX Works2 version
15
FXCPU Structured Programming Manual (Application Functions)

1.3 Cautions on Creation of Fundamental Programs

1.3 Cautions on Creation of Fundamental Programs
This section explains cautions on programming. Refer to the following manual for cautions on structured programs and programming languages:
Q/FX Structured Programming Manual (Fundamentals)
Refer to the following programming manual for detailed operations of and cautions on devices and parameters:
FX Structured Programming Manual (Device & Common)

1.3.1 I/O processing and response delay

1. Operation timing of I/O relays and response delay
FX PLCs execute the I/O processing by repeating the processing (1) to processing (3). Accordingly, the control executed by PLCs contains not only the drive time of input filters and output devices but also the response delay caused by the operation cycle.
Acquiring the latest I/O information
For acquiring the latest input information or immediately outputting the operation result in the middle of the operation cycle shown above, the I/O refresh instruction (REF) is available.
(1)
Scan
time
(operation
cycle)
[Input processing]
Input image memory is read.
(2)
[Program processing]
Image memory of each device is updated.
Batch I/O method (Refresh method)
The ON/OFF status of input terminals is received at one time.
Input image is read, and operation is executed according to program.
(3)
[Output processing]
Result is transferred to output latch memory.
Output devices are driven.
1 Outline
2. Short pulses cannot be received.
The ON duration and OFF duration of inputs in PLCs require longer time than "PLC cycle time + Input filter response delay". When the response delay "10 ms" of the input filter is considered and the cycle time is supposed as "10 ms", the ON duration and OFF duration should be at least 20 ms respectively. Accordingly, PLCs cannot handle input pulses at 25 Hz (= 1000 /(20 + 20)) or more. However, the situation can be improved by PLC special functions and applied instructions.
Convenient functions for improvement
By using the following functions, PLCs can receive pulses shorter than the operation cycle:
• High speed counter function
• Input interrupt function
• Pulse catch function
• Input filter value adjustment function
"Input ON" cannot be received.
ON ON
Program
processing
Input processing
Output processing
This "input ON" can be received.
Program
processing
( Time)
This "input OFF" cannot be received.
OFFOFF
Program
processing
Operation cycle
Program
processing
16
FXCPU Structured Programming Manual (Application Functions)
1.3 Cautions on Creation of Fundamental Programs

1.3.2 Double output (double coil) operation and countermeasures

This subsection explains the double output (double coil) operation and countermeasures.
1. Operation of double outputs
When a coil (output variable) is used twice (double coils) in another program block to be executed or in the same program block, the PLC gives priority to the latter coil.
Suppose that the same coil Y003 is used in two positions as shown in the right figure. For example, suppose that X001 is ON and X002 is OFF.
Input processing X001=ON X002=OFF
1 Outline
1
2
Outline
Function List
In the first coil Y003, the image memory is set to ON 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".
X001
Y003
X002
Output processing Y003=OFF Y004=ON
First
Second
Y003
Y004
Y003
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. Change the program as shown in the example below.
A B
Y000
Ignored
A B
C E
D
Y000
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
C E
D
The SET and RST instructions or jump instruction can be used instead, or a same output coil can be programmed at each state using step ladder instructions STL and RET. When you use the step ladder instructions STL and RET, note that the PLC regards it as double coils if you program, inside the state, an output coil located outside the RET instruction from another program block or the STL instruction.
Y000
Or
A B
C E
D
M100
M101
M100
M101
Y000
A
Correspondence
between Devices
and Addresses
17
FXCPU Structured Programming Manual (Application Functions)
1.3 Cautions on Creation of Fundamental Programs

1.3.3 Circuits not available in structured ladder programs and countermeasures

1. Bridge circuit
A circuit in which the current flows in both directions should be changed as shown in the right figure (so that a circuit without D and a circuit without B are connected in parallel).
A B
F F
C E
B
1 Outline
E
C
D
A
A E
C
D
2. Coil connection position
• You can program a contact on the right side of a coil. In this case, make sure to program a coil (including a
function or function block) at the end of the circuit.
A B D A
C
Or
B D
AB
E
E
CE
D
C

1.3.4 Handling of general flags

The following flags are valid in general sequence instructions: (Examples) M8020:Zero flag M8021:Borrow flag M8022:Carry flag
M8029:Instruction execution complete flag M8090:Block comparison signal
M8328:Instruction non-execution flag
M8304:Zero flag
*1. Supported only in FX3U/FX3UC PLCs.
*2. Supported only in FX
Each of these flags turns ON or OFF every time the PLC executes a corresponding instruction. These flags do not turn ON or OFF when the PLC does not execute a corresponding instruction or when an error occurs. Because these flags are related to many sequence instructions, their ON/OFF status changes every time the PLC executes each corresponding instruction. Refer to examples in the next page, and program a flag contact just under the target sequence instruction.
*1
M8306:Carry flag
3U/FX3UC/FX3G PLCs.
*1
*1
*1
M8329:Instruction execution abnormal complete flag
*2
18
FXCPU Structured Programming Manual (Application Functions)
1. Program containing many flags (Example of instruction execution complete flag M8029)
If you program the instruction execution complete flag M8029 twice or more together for two or more sequence instructions which actuate the flag M8029, you cannot judge easily by which sequence instruction the flag M8029 is controlled. In addition, the flag M8029 does not turn ON or OFF correctly for each corresponding sequence instruction. Refer to the next page when you would like to use the flag M8029 in any position other than the position just under the corresponding sequence instruction.
Good example
1.3 Cautions on Creation of Fundamental Programs
1 Outline
1
2
Outline
Function List
Bad example
M8029 works as a flag to indicate that execution of DSW is completed.
M8029 works as a flag to indicate that execution of DPLSY is completed.
M8029 works as a flag to indicate that execution of DPLSY (on the lower side) is completed.
M8029 works as a flag to indicate that execution of DSW is completed.
M8000
M8029
Execution is completed.
X000
M0
M8029
Execution is completed.
M8029
Execution is completed.
M8000
X000
ENs1ENO
X010
1D0
s2 d2
ENs1ENO
D0
s2
10
M0
S
DPLSY
ENs1ENO
1000 Y000 Number of output pulses
X010
1
s2
M0
R
M0
R
ENs1ENO
s2 d2
M0
S
DSW
d1 Y010
MUL
Number of output pulses
d
d
Program for DPLSY (on the upper side)
DSW
Y010
d1
D0
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
M8029 works as a flag to indicate that execution of DPLSY (on the upper side) is completed.
M0
M8029
Execution is completed.
M1
1000 Y000
Number of output pulses
D0
10
Number of output pulses2
1000 Y001
DPLSY
ENs1ENO
s2
MUL
ENs1ENO
s2
DPLSY
ENs1ENO
s2
DPLSY(on the upper side)
d
Program for DSW
d
Number of output pulses
DPLSY(on the lower side)
d
19
FXCPU Structured Programming Manual (Application Functions)
2. Introduction of a method to use flags in any positions other than positions just under sequence instructions
If two or more sequence instructions are programmed, general flags turn ON or OFF when each corresponding instruction is executed. Accordingly, when using a general flag in any position other than a position just under a sequence instruction, set to ON or OFF another device (variable) just under the sequence instruction, and then use the contact of such device (variable) as the command contact.
1.3 Cautions on Creation of Fundamental Programs
1 Outline
DSW execution complete flag M8029 is changed to M100.
DPLSY execution complete flag M8029 is changed to M200.
M8000
M8029
Execution is completed.
M0
Number of output pulses
M8029
Execution is completed.
It works as the DSW execution complete flag.
M100
It works as the DPLSY execution complete flag.
M200
DSW
ENs1ENO
Y010
M100
DPLSY
M0
R
M200
MUL
Y030
d1
D0
d
d
Number of output pulses
X010
s2 d2
1
ENs1ENO
1000 Y000
s2
ENs1ENO
D0
s2
10
20
FXCPU Structured Programming Manual (Application Functions)

1.3.5 Handling of operation error flag

When there is an error in the instruction construction, target device or target device number range and an error occurs while operation is executed, the following flag turns ON and the error information is stored.
1 Outline
1.3 Cautions on Creation of Fundamental Programs
1
Outline
1. Operation error
Error flag
M8067 D8067
Device which stores
error code
FX0/FX0S/FX0N/FXU/FX2C/FX1S
/FX1N/FX2N/FX1NC/FX2NC/FX3G
*1. When an error occurs in a step up to the step No. 32767 in the FX3U/FX3UC PLC, you can check the
error occurrence step also in D8069 (16 bits).
• When an operation error has occurred, M8067 turns ON, D8067 stores the operation error code, and the
specified device (shown in the table above) stores the error occurrence step.
• When another error occurs in another step, the stored data is updated in turn to the error code and step
number of the new error. (These devices are set to OFF when errors are cleared.)
• 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.
Device which stores error occurrence step
FX3U/FX3UC
D8069
*1
D8315, D8314
2. Operation error latch
Error flag
M8068 -
Device which stores
error code
FX0/FX0S/FX0N/FXU/FX2C/FX1S
/FX1N/FX2N/FX1NC/FX2NC/FX3G
*2. When an error occurs in a step up to the step No. 32767 in the FX3U/FX3UC PLC, you can check the
error occurrence step also in D8068 (16 bits).
• When an operation error has occurred, M8068 turns ON, and the device shown in the table above stores
the error occurrence step.
• Even if another error occurs in another step, the stored data is not updated and remains held until these
devices are forcibly set to OFF or until the power is turned OFF.
Device which stores error occurrence step
FX3U/FX3UC
D8068
*2
D8313, D8312
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
21
FXCPU Structured Programming Manual (Application Functions)

2. Function List

This chapter introduces a list of functions available in programming.
2.1 Type Conversion Functions
2 Function List

2.1 Type Conversion Functions

Applicable PLC
Function name Function
BOOL_TO_INT(_E) Converts bit data into word [signed] data. 33333333
BOOL_TO_DINT(_E) Converts bit data into double word [signed] data. 33333333
BOOL_TO_STR(_E) Converts bit data into string data. 3
BOOL_TO_WORD(_E)
BOOL_TO_DWORD (_E)
BOOL_TO_TIME(_E) Converts bit data into time data. 33333333
INT_TO_DINT(_E)
DINT_TO_INT(_E)
INT_TO_BOOL(_E) Converts word [signed] data into bit data. 33333333
DINT_TO_BOOL(_E) Converts double word [signed] data into bit data. 33333333
INT_TO_REAL(_E)
DINT_TO_REAL(_E)
INT_TO_STR(_E) Converts word [signed] data into string data. 3
DINT_TO_STR(_E)
INT_TO_WORD(_E)
DINT_TO_WORD(_E)
INT_TO_DWORD(_E)
DINT_TO_DWORD (_E)
INT_TO_BCD(_E) Converts word [signed] data into BCD data. 33333333
DINT_TO_BCD(_E)
INT_TO_TIME(_E) Converts word [signed] data into time data. 33333333
DINT_TO_TIME(_E)
Converts bit data into word [unsigned]/bit string [16-bit] data.
Converts bit data into double word [unsigned]/bit string [32-bit] data.
Converts word [signed] data into double word [signed] data
Converts double word [signed] data into word [signed] data.
Converts word [signed] data into float (single precision) data.
Converts double word [signed] data into float (single precision) data.
Converts double word [signed] data into string data.
Converts word [signed] data into word [unsigned]/bit string [16-bit] data.
Converts double word [signed] data into word [unsigned]/bit string [16-bit] data.
Converts word [signed] data into double word [unsigned]/bit string [32-bit] data.
Converts double word [signed] data into double word [unsigned]/bit string[32-bit] data.
Converts double word [signed] data into BCD data.
Converts double word [signed] data into time data.
FX3U(C)
33333333
33333333
33333333
33333333
3 *1 3
3 *1 3
3
33333333
33333333
33333333
33333333
33333333
33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
*1. The function is provided in the FX3G Series Ver.1.10 or later.
Reference
Subsection
5.1.1
Subsection
5.1.2
Subsection
5.1.3
Subsection
5.1.4
Subsection
5.1.5
Subsection
5.1.6
Subsection
5.1.7
Subsection
5.1.8
Subsection
5.1.9
Subsection
5.1.10
Subsection
5.1.11
Subsection
5.1.12
Subsection
5.1.13
Subsection
5.1.14
Subsection
5.1.15
Subsection
5.1.16
Subsection
5.1.17
Subsection
5.1.18
Subsection
5.1.19
Subsection
5.1.20
Subsection
5.1.21
Subsection
5.1.22
22
FXCPU Structured Programming Manual (Application Functions)
Function name Function
FX3U(C)
FX3G
Applicable PLC
FX2N(C)
FX1N(C)
2 Function List
2.1 Type Conversion Functions
FX1S
FX
U
/FX
2C
FX0N
FX0(S)
Reference
1
Outline
REAL_TO_INT(_E)
REAL_TO_DINT(_E)
REAL_TO_STR(_E)
WORD_TO_BOOL(_E)
DWORD_TO_BOOL (_E)
WORD_TO_INT(_E)
WORD_TO_DINT(_E)
DWORD_TO_INT(_E)
DWORD_TO_DINT (_E)
WORD_TO_DWORD (_E)
DWORD_TO_WORD (_E)
WORD_TO_TIME(_E)
DWORD_TO_TIME (_E)
STR_TO_BOOL(_E) Converts string data into bit data. 3
STR_TO_INT(_E) Converts string data into word [signed] data. 3
STR_TO_DINT(_E)
STR_TO_REAL(_E)
STR_TO_TIME(_E) Converts string data into time data. 3
BCD_TO_INT(_E) Converts BCD data into word [signed] data. 33333333
BCD_TO_DINT(_E)
TIME_TO_BOOL(_E) Converts time data into bit data. 33333333
TIME_TO_INT(_E) Converts time data into word [signed] data. 33333333
TIME_TO_DINT(_E)
TIME_TO_STR(_E) Converts time data into string data. 3
TIME_TO_WORD(_E)
TIME_TO_DWORD (_E)
Converts float (single precision) data into word [signed] data.
Converts float (single precision) data into double word [signed] data.
Converts float (single precision) data into string data.
Converts word [unsigned]/bit string [16-bit] data into bit data.
Converts double word [unsigned]/bit string [32­bit] data into bit data.
Converts word [unsigned]/bit string [16-bit] data into word [signed] data.
Converts word [unsigned]/bit string [16-bit] data into double word [signed] data.
Converts double word [unsigned]/bit string [32­bit] data into word [signed] data.
Converts double word [unsigned]/bit string [32­bit] data into double word [signed] data.
Converts word [unsigned]/bit string [16-bit] data into double word [unsigned]/bit string [32-bit].
Converts double word [unsigned]/bit string [32­bit] data into word [unsigned]/bit string [16­bit]data.
Converts word [unsigned]/bit string [16-bit] data into time data.
Converts double word [unsigned]/bit string [32­bit] data into time data.
Converts string data into double word [signed] data.
Converts string data into float (single precision) data.
Converts BCD data into double word [signed] data.
Converts time data into double word [signed] data.
Converts time data into word [unsigned]/bit string [16-bit]data.
Converts time data into double word [unsigned]/ bit string [32-bit] data.
3 *1 3
3 *1 3
3
33333333
33333333
33333333
33333333
33333333
33333333
33333333
33333333
33333333
33333333
3
3
33333333
33333333
33333333
33333333
*1. The function is provided in the FX3G Series Ver.1.10 or later.
Subsection
5.1.23
Subsection
5.1.24
Subsection
5.1.25
Subsection
5.1.26
Subsection
5.1.27
Subsection
5.1.28
Subsection
5.1.29
Subsection
5.1.30
Subsection
5.1.31
Subsection
5.1.32
Subsection
5.1.33
Subsection
5.1.34
Subsection
5.1.35
Subsection
5.1.36
Subsection
5.1.37
Subsection
5.1.38
Subsection
5.1.39
Subsection
5.1.40
Subsection
5.1.41
Subsection
5.1.42
Subsection
5.1.43
Subsection
5.1.44
Subsection
5.1.45
Subsection
5.1.46
Subsection
5.1.47
Subsection
5.1.48
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
23
FXCPU Structured Programming Manual (Application Functions)

2.2 Standard Functions Of One Numeric Variable

2.2 Standard Functions Of One Numeric Variable
2 Function List
Applicable PLC
Function name Function
FX3U(C)
ABS(_E) Obtains the absolute value. 33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)

2.3 Standard Arithmetic Functions

Applicable PLC
Function name Function
FX3U(C)
ADD_E Adds data. 33333333
SUB_E Subtracts data. 33333333
MUL_E Multiplies data. 33333333
DIV_E Divides data (, and outputs the quotient). 33333333
MOD(_E) Divides data (, and outputs the remainder). 33333333
EXPT(_E) Obtains the raised result. 3
MOVE(_E) Transfers data. 33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
Subsection
5.2.1
Reference
Subsection
5.3.1
Subsection
5.3.2
Subsection
5.3.3
Subsection
5.3.4
Subsection
5.3.5
Subsection
5.3.6
Subsection
5.3.7
24
FXCPU Structured Programming Manual (Application Functions)
2.4 Standard Bit Shift Functions
2 Function List

2.4 Standard Bit Shift Functions

1
Outline
Applicable PLC
Function name Function
FX3U(C)
SHL(_E) Shifts bits leftward. 33333333
SHR(_E) Shifts bits rightward. 33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)

2.5 Standard Bitwise Boolean Functions

Applicable PLC
Function name Function
FX3U(C)
AND_E Obtains the logical product. 33333333
OR_E Obtains the logical sum. 33333333
XOR_E Obtains the exclusive logical sum. 33333333
NOT(_E) Obtains the logical not. 33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
Subsection
5.4.1
Subsection
5.4.2
Reference
Subsection
5.5.1
Subsection
5.5.2
Subsection
5.5.3
Subsection
5.5.4
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions

2.6 Standard Selection Functions

Applicable PLC
Function name Function
SEL(_E)
MAXIMUM(_E) Searches the maximum value. 33333333
MINIMUM(_E) Searches the minimum value. 33333333
LIMITATION(_E)
MUX(_E) Selects data, and outputs it. 33333333
Selects data in accordance with the input condition.
Judges whether data is located within the range between the upper limit value and the lower limit value.
FX3U(C)
33333333
33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FX
U
/FX
2C
FX0N
FX0(S)
Reference
Subsection
5.6.1
Subsection
5.6.2
Subsection
5.6.3
Subsection
5.6.4
Subsection
5.6.5
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
25
FXCPU Structured Programming Manual (Application Functions)
2.7 Standard Comparison Functions
2 Function List

2.7 Standard Comparison Functions

Applicable PLC
Function name Function
GT_E Compares data with regard to "> (larger)". 33333333
GE_E
EQ_E Compares data with regard to "= (equal)". 33333333
LE_E
LT_E Compares data with regard to "< (smaller)". 33333333
NE_E Compares data with regard to " (unequal)". 33333333
Compares data with regard to " (larger or equal)".
Compares data with regard to " (smaller or equal)".
FX3U(C)
33333333
33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)

2.8 Standard Character String Functions

Function name Function
Applicable PLC
FX3U(C)
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
Subsection
5.7.1
Subsection
5.7.2
Subsection
5.7.3
Subsection
5.7.4
Subsection
5.7.5
Subsection
5.7.6
Reference
MID(_E)
CONCAT(_E) Connects character strings. 3
INSERT(_E) Inserts a character string. 3
DELETE(_E) Deletes a character string. 3
REPLACE(_E) Replaces a character string. 3
FIND(_E) Searches a character string. 3
Obtains a character string from a specified position.
3

2.9 Functions Of Time Data Types

Applicable PLC
Function name Function
FX3U(C)
ADD_TIME(_E) Adds time data. 33333333
SUB_TIME(_E) Subtracts time data. 33333333
MUL_TIME(_E) Multiplies time data. 33333333
DIV_TIME(_E) Divides time data. 33333333
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Subsection
5.8.1
Subsection
5.8.2
Subsection
5.8.3
Subsection
5.8.4
Subsection
5.8.5
Subsection
5.8.6
Reference
Subsection
5.9.1
Subsection
5.9.2
Subsection
5.9.3
Subsection
5.9.4
26
FXCPU Structured Programming Manual (Application Functions)
2.10 Standard Function Blocks
2 Function List

2.10 Standard Function Blocks

1
Outline
Applicable PLC
Function name Function
R_TRIG(_E)
F_TRIG(_E)
CTU(_E)
CTD(_E)
CTUD(_E)
TP(_E)
TON(_E)
TOF(_E)
COUNTER_FB_M Counter drive 33333333Section 6.9
TIMER_10_FB_M 10ms timer drive 33333333
TIMER_CONT_FB_M Retentive timer drive 3333 3
TIMER_100_M 100ms timer drive 33333333
Detects the rising edge of a signal, and outputs pulse signal.
Detects the falling edge of a signal, and outputs pulse signal.
Counts up the number of times of rising of a signal.
Counts down the number of times of rising of a signal.
Counts up/down the number of times of rising of a signal.
Keeps ON a signal during specified time duration.
Keeps OFF a signal during specified time duration.
Turns OFF the output signal at specified time after the input signal turned OFF.
FX3U(C)
33333333Section 6.1
33333333Section 6.2
333333 Section 6.3
333333 Section 6.4
333333 Section 6.5
333333 Section 6.6
333333 Section 6.7
333333 Section 6.8
FX3G
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
Section
6.10
Section
6.11
Section
6.12
2
Function List
3
Function
Construction
4
How to Read
Explanation of
Functions
5
Applied
Functions
6
Standard
Function Blocks
A
Correspondence
between Devices
and Addresses
27
FXCPU Structured Programming Manual (Application Functions)

3.1 Applied Function Expression and Execution Type

3. Function Construction

This chapter explains the construction of applied functions.
3.1 Applied Function Expression and Execution Type
Applied function and argument
• The name expressing the contents is given to each function.
For example, the function name "SHL (bit shift left)" is given.
• Each function consists of arguments which indicate I/O data used in the function.
SHL_E
EN ENO
D10D0 _IN
*1
_NK1
3 Function Construction
_IN ( ) : An argument whose contents do not change even if the function is executed is called
*1 ( ) : An argument whose contents change when the function is executed is called "destination",
K1 ( ) : Arguments not regarded as source or destination are expressed in "m", "n", etc.
s
"source", and expressed in this symbol.
d
and expressed in this symbol.
n
Argument target devices
• The 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 devices directly, different from
simple projects. Use labels when handling 32-bit data. You can specify 32-bit counters directly, however, because they have 32-bit length. Use global labels when specifying devices. When 32-bit data is handled, two consecutive 16-bit data registers D are combined. For example, when data register D0 is defined as an argument of a 32-bit instruction by a label, 32-bit data stored in D1 and D0 is handled. (D1 offers high-order 16 bits, and D0 offers low-order 16-bits.) When the current value register of a timer or counter is used as a general data register, it is handled in the same way.
28
Loading...
+ 206 hidden pages