Beruflich Dokumente
Kultur Dokumente
Manual number
JY997D34801
Manual revision
Date
5/2013
Foreword
This manual contains text, diagrams and explanations which will guide the reader through the safe and
correct installation, use, and operation of the FX Series programmable controller function for structured
programs. It should be read and understood before attempting to install or use the unit.
Store this manual in a safe place so that you can take it out and read it whenever necessary. Always forward
it to the end user.
This manual confers no industrial property rights or any rights of any other kind, nor does it confer any patent licenses.
Mitsubishi Electric Corporation cannot be held responsible for any problems involving industrial property rights which may occur as a
result of using the contents noted in this manual.
Registration
Microsoft, Windows and Excel 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.
Ethernet is a trademark of Xerox Corporation.
MODBUS is a registered trademark of Schneider Electric SA.
The company name and the product name to be described in this manual are the registered trademarks or
trademarks of each company.
Table of Contents
Table of Contents
Positioning of This Manual....................................................................................................... 8
Related Manuals ...................................................................................................................... 11
Generic Names and Abbreviations Used in Manuals .......................................................... 14
1. Outline
15
2. Function/Operator List
23
3. Function Construction
3.1
3.2
3.3
3.4
29
36
Table of Contents
38
Table of Contents
157
160
175
180
11.1
11.2
11.3
11.4
11.5
11.6
230
213
200
189
Table of Contents
239
Table of Contents
15. Operator
262
280
282
Warranty................................................................................................................................. 289
Revision History .................................................................................................................... 290
This manual explains programming methods, specifications, functions, etc. required to create
structured programs.
Structured
This manual explains devices and parameters for structured programs provided
by GX Works2.
Structured
(Additional Manual)
This manual explains sequence instructions for structured programs provided
by GX Works2.
(This manual)
FX
Structured
FX3S
FX3G
FX3GC
FX3U
FX3UC
FX3S
FX3G
FX3GC
FX3U
FX3UC
Special
unit/block
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.
This manual explains programming methods, specifications, functions, etc. required to create
structured programs.
Structured
This manual explains devices and parameters for structured programs provided
by GX Works2.
Structured
FX
Structured
(This manual)
FX
Structured
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.
This manual explains programming methods, specifications, functions, etc. required to create
structured programs.
Structured
This manual explains devices and parameters for structured programs provided
by GX Works2.
Structured
FX
Structured
(This manual)
FX
Structured
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.
10
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 representative for acquiring required manuals.
Manual number
Contents
Model
name code
MELSEC-Q/L/F Structured
Programming Manual (Fundamentals)
SH-080782
Additional Manual
13JW06
JY997D26001
Additional Manual
09R925
JY997D34701
Additional Manual
09R926
JY997D34801
Additional Manual
09R927
FX3S/FX3G/FX3GC/FX3U/FX3UC PLCs
Manual name
Manual number
Contents
Model
name code
JY997D18801
JY997D16501
Additional Manual
JY997D28601
09R516
JY997D31601
JY997D28701
Additional Manual
JY997D33401
JY997D31301
Additional Manual
JY997D45201
JY997D45401
Additional Manual
09R519
09R521
09R533
11
Manual name
Manual number
Contents
Model
name code
JY997D48301
JY997D48601
Additional Manual
09R535
FX3S/FX3G/FX3GC/FX3U/FX3UC
User's Manual- Analog Control Edition
JY997D16701
Additional Manual
09R619
JY997D16901
Additional Manual
09R715
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
User's Manual- MODBUS Serial
Communication Edition
JY997D26201
Additional Manual
09R626
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
User's Manual -Positioning Edition
JY997D16801
Additional Manual
09R620
JY997D35401
Additional Manual
09R720
Programming
FX1S/FX1N/FX1NC PLCs
FX2N/FX2NC PLCs [whose production is finished]
Manual number
JY992D83901
Additional Manual
JY992D89301
Additional Manual
JY992D66301
Additional Manual
09R508
09R505
Manual name
Contents
Model
name code
JY992D92101
Additional Manual
JY992D76401
Additional Manual
09R509
JY997D16901
Additional Manual
09R715
Programming
FX Series User's Manual -Data
Communication Edition
12
JY992D47501
JY992D55301
JY992D47401
JY997D16901
Additional Manual
09R715
Manual name
Contents
Model
name code
Programming
FX Series User's Manual -Data
Communication Edition
13
Name
PLCs
FX3U Series or FX3U PLC
Special adapters
CF card special adapter
CF-ADP
Ethernet adapter
Programming language
ST
Structured ladder
FBD
Manuals
14
COMMUNICATION CONTROL
EDITION
1 Outline
1.1 Outline of Structured Programs and Programming Languages
1
Outline
1.
Outline
1.1.1
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.
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.
4
How to Read
Explanation of
Functions
1. Structured program
Function
Construction
1.1
2
Function/
Operator List
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/L/F Structured Programming Manual (Fundamentals)
Applied Functions
(Type Conversion
Functions)
You can examine the outline of a program at first, and then design its details gradually.
Because the processing of each block is clear, the entire program is easy to understand.
The program reusability is improved, and the development efficiency is improved accordingly.
Applied Functions
(Standard Functions Of
One Numeric Variable)
The entire program can be divided into several blocks that are created by several people.
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
15
1 Outline
1.1 Outline of Structured Programs and Programming Languages
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.
A circuit always starts from the bus line located on the left side.
The structured ladder language consists of contacts, coils, functions and function blocks. These components
are connected with vertical lines and horizontal lines.
X000
X001
Y000
Output Y000
Y000
2
X001
D0
EN
s
MOV
ENO
d
D2
EQ
D0
D2
X000
When the contents X001
of D0 are equivalent X002
to the contents of
D2, EQ turns ON.
AND
K4X010
INT_TO_WORD_E
EN
ENO
_INT
XOR
D30
D20
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;
16
Outline
1.2
1 Outline
GX Works2 version
FX3UFX3UC
FX3G
FX1NFX1NC
FX1S
FXU/FX2C
GX Works2
(SW1DNC-GXW2-E)
Function/
Operator List
FX2NFX2NC
Ver. 1.08J or later
FX0N
FX0FX0S
Ver.1.77F or later
FX3S
Ver.1.492N or later
Function
Construction
1.3
FX3GC
Scan
time
(operation
cycle)
operation is executed
according to program.
Image memory of
each device is updated.
(3)
(Refresh method)
7
Applied Functions
(Standard Arithmetic
Functions)
(1)
Applied Functions
(Standard Functions Of
One Numeric Variable)
5
Applied Functions
(Type Conversion
Functions)
1.3.1
4
How to Read
Explanation of
Functions
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
Program
processing
Program
processing
Input processing
Output processing
Program
processing
Time)
10
Program
processing
Operation cycle
17
Applied Functions
(Standard Selection
Functions)
OFF
1 Outline
1.3 Cautions on Creation of Fundamental Programs
Input processing
X001=ON X002=OFF
X001
First
Y004
Y003
X002
Y003
Second
Y003
Output processing
Y003=OFF Y004=ON
Y000
Ignored
Y000
Y000
A
M100
M101
D
Or
M100
Y000
M101
The SET and RST instructions or jump instruction can be used instead, or a same output coil can be
programmed at each state using step ladder instructions STL and RET.
When you use the step ladder instructions STL and RET, note that the PLC regards it as double coils if you
program, inside the state, an output coil located outside the RET instruction from another program block or
the STL instruction.
18
Outline
1.3.3
1 Outline
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).
F
A
D
5
Applied Functions
(Type Conversion
Functions)
Or
Applied Functions
(Standard Functions Of
One Numeric Variable)
1.3.4
4
How to Read
Explanation of
Functions
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
Function
Construction
Function/
Operator List
*2.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
8
Applied Functions
(Standard Bit
Shift Functions)
*1.
7
Applied Functions
(Standard Arithmetic
Functions)
10
Applied Functions
(Standard Selection
Functions)
19
1 Outline
1.3 Cautions on Creation of Fundamental Programs
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
M8000
X010
1
EN
s1
s2
D0
10
EN
s1
s2
M8029
M8029 works as
a flag to indicate
that execution of
DSW is completed.
Execution is
completed.
M0
Bad example
M8029 works as
a flag to indicate
that execution of
DPLSY (on the
lower side) is
completed.
1000
Number of
output pulses
Y000
M0
R
M8029
Execution is
completed.
M0
R
M8029
Execution is
completed.
X010
1
EN
s1
s2
DSW
ENO
d1
d2
Y010
D0
M0
S
X000
M0
1000
Number of
M8029 works as a
output pulses
flag to indicate that
execution of DPLSY
(on the upper side) M8029
is completed.
Execution is
D0
completed.
10
M1
1000
Number of
output pulses2
20
MUL
ENO
d
DPLSY
EN
ENO
s1
d
s2
M8000
M8029 works as
a flag to indicate
that execution of
DSW is completed.
Y010
D0
M0
S
X000
M8029 works as
a flag to indicate
that execution of
DPLSY is
completed.
DSW
ENO
d1
d2
DPLSY
EN
ENO
s1
d
s2
EN
s1
s2
MUL
ENO
d
DPLSY
EN
ENO
s1
d
s2
1 Outline
1.3 Cautions on Creation of Fundamental Programs
1
Outline
2. Introduction of a method to use flags in any positions other than positions just under
sequence instructions
M8000
DSW execution
complete flag
M8029 is changed
to M100.
DSW
ENO
d1
d2
Y010
D0
Function
Construction
X010
1
EN
s1
s2
M100
M8029
Execution is
completed.
1000
Number of
output pulses
DPLSY execution
complete flag
M8029 is changed
to M200.
DPLSY
EN
ENO
s1
d
s2
4
How to Read
Explanation of
Functions
M0
Y000
M0
R
M8029
5
Applied Functions
(Type Conversion
Functions)
Execution is
completed.
M200
M200
D0
10
MUL
EN
ENO
s1
d
s2
Applied Functions
(Standard Functions Of
One Numeric Variable)
M100
2
Function/
Operator List
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.
Y030
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
21
1 Outline
1.3 Cautions on Creation of Fundamental Programs
1. Operation error
*1.
Error flag
M8067
D8067
FX3U/FX3UC
D8069*1
D8315, D8314
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.
*2.
Error flag
M8068
FX3U/FX3UC
D8068*2
D8313, D8312
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.
22
2 Function/Operator List
2.1 Type Conversion Functions
1
Outline
2.
Function/Operator List
Function/
Operator List
2.1
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
BOOL_TO_INT(_E)
Section 5.1
BOOL_TO_DINT(_E)
Section 5.2
BOOL_TO_STR(_E)
Function
3
Function
Construction
FX3U(C)
Reference
Function name
Section 5.3
Section 5.4
Section 5.5
Section 5.6
How to Read
Explanation of
Functions
Section 5.7
Section 5.8
Section 5.9
Section 5.10
*1
Section 5.11
*1
Section 5.12
Section 5.14
Applied Functions
(Standard Functions Of
One Numeric Variable)
Section 5.15
Section 5.16
Section 5.17
Section 5.18
Section 5.19
Section 5.20
Section 5.21
Section 5.22
*1
Section 5.23
*1
Section 5.24
REAL_TO_STR(_E)
Section 5.25
Applied Functions
(Standard Bitwise
Boolean Functions)
WORD_TO_BOOL(_E)
Section 5.26
10
BOOL_TO_DWORD
(_E)
BOOL_TO_TIME(_E)
INT_TO_DINT(_E)
DINT_TO_INT(_E)
INT_TO_BOOL(_E)
DINT_TO_BOOL(_E)
INT_TO_REAL(_E)
DINT_TO_REAL(_E)
INT_TO_STR(_E)
Section 5.13
DINT_TO_STR(_E)
INT_TO_WORD(_E)
DINT_TO_WORD(_E)
INT_TO_DWORD(_E)
DINT_TO_DWORD
(_E)
INT_TO_BCD(_E)
DINT_TO_BCD(_E)
INT_TO_TIME(_E)
DINT_TO_TIME(_E)
REAL_TO_INT(_E)
REAL_TO_DINT(_E)
Applied Functions
(Standard Selection
Functions)
*1.
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Arithmetic
Functions)
Applied Functions
(Type Conversion
Functions)
23
2 Function/Operator List
2.1 Type Conversion Functions
Applicable PLC
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
DWORD_TO_BOOL
(_E)
Converts double word [unsigned]/bit string [32bit] data into bit data.
Section 5.27
WORD_TO_INT(_E)
Section 5.28
WORD_TO_DINT(_E)
Section 5.29
DWORD_TO_INT(_E)
Converts double word [unsigned]/bit string [32bit] data into word [signed] data.
Section 5.30
DWORD_TO_DINT
(_E)
Converts double word [unsigned]/bit string [32bit] data into double word [signed] data.
Section 5.31
WORD_TO_DWORD
(_E)
Section 5.32
DWORD_TO_WORD
(_E)
Converts double word [unsigned]/bit string [32bit] data into word [unsigned]/bit string [16-bit]
data.
Section 5.33
WORD_TO_TIME(_E)
Section 5.34
DWORD_TO_TIME
(_E)
Converts double word [unsigned]/bit string [32bit] data into time data.
Section 5.35
STR_TO_BOOL(_E)
Section 5.36
STR_TO_INT(_E)
Section 5.37
STR_TO_DINT(_E)
Section 5.38
STR_TO_REAL(_E)
Section 5.39
STR_TO_TIME(_E)
BCD_TO_INT(_E)
Section 5.41
BCD_TO_DINT(_E)
Section 5.42
TIME_TO_BOOL(_E)
Section 5.43
TIME_TO_INT(_E)
Section 5.44
TIME_TO_DINT(_E)
Section 5.45
TIME_TO_STR(_E)
TIME_TO_WORD(_E)
Section 5.47
TIME_TO_DWORD
(_E)
Section 5.48
BITARR_TO_INT(_E)
Section 5.49
Section 5.50
Section 5.51
Section 5.52
CPY_BITARR(_E)
Section 5.53
Function name
INT_TO_BITARR(_E)
Function
Section 5.40
Section 5.46
Section 5.54
SET_BIT_OF_INT(_E)
Section 5.55
CPY_BIT_OF_INT(_E)
Section 5.56
24
2 Function/Operator List
2.2 Standard Functions Of One Numeric Variable
1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
GET_BOOL_ADDR
Section 5.57
GET_INT_ADDR
Section 5.58
GET_WORD_ADDR
Section 5.59
2.2
Function
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
Section 6.1
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Section 7.1
SUB_E
Subtracts data.
Section 7.2
MUL_E
Section 7.3
DIV_E
Section 7.4
MOD(_E)
Section 7.5
EXPT(_E)
MOVE(_E)
Transfers data.
2.4
Section 7.6
Section 7.7
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Section 8.1
Section 8.2
2.5
8
Applied Functions
(Standard Bit
Shift Functions)
FX3G(C)
Reference
Applied Functions
(Standard Arithmetic
Functions)
FX3U(C)
SHL(_E)
SHR(_E)
Function
7
Applicable PLC
Function name
Applied Functions
(Standard Functions Of
One Numeric Variable)
FX3G(C)
ADD_E
Function
Applied Functions
(Type Conversion
Functions)
FX3U(C)
Reference
Function name
4
How to Read
Explanation of
Functions
2.3
FX3U(C)
ABS(_E)
Function
Function
Construction
Applicable PLC
Function name
2
Function/
Operator List
FX3U(C)
Reference
Function name
Outline
Applicable PLC
Applicable PLC
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
AND_E
Section 9.1
Applied Functions
(Standard Bitwise
Boolean Functions)
OR_E
Section 9.2
10
XOR_E
Section 9.3
NOT_E
Section 9.3
Function
25
Applied Functions
(Standard Selection
Functions)
FX3U(C)
Reference
Function name
2.6
2 Function/Operator List
2.6 Standard Selection Functions
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
SEL(_E)
Section 10.1
MAXIMUM(_E)
Section 10.2
MINIMUM(_E)
Section 10.3
LIMITATION(_E)
Section 10.4
MUX(_E)
Section 10.5
Function name
2.7
Function
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
GT_E
Section 11.1
GE_E
Section 11.2
EQ_E
Section 11.3
LE_E
Section 11.4
LT_E
Section 11.5
NE_E
Section 11.6
FX0(S)
Reference
Function name
2.8
Function
FXU/FX2C
FX1S
FX1N(C)
FX2N(C)
FX3S
FX3G(C)
Function
FX3U(C)
Function name
MID(_E)
Section 12.1
CONCAT(_E)
Section 12.2
INSERT(_E)
Section 12.3
DELETE(_E)
Section 12.4
REPLACE(_E)
Section 12.5
FIND(_E)
Section 12.6
26
Outline
2.9
2 Function/Operator List
Applicable PLC
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
ADD_TIME(_E)
Section 13.1
Section 13.2
Function
SUB_TIME(_E)
MUL_TIME(_E)
Section 13.3
DIV_TIME(_E)
Section 13.4
3
Function
Construction
2.10
2
Function/
Operator List
FX3U(C)
Reference
Function name
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
R_TRIG(_E)
Section 14.1
F_TRIG(_E)
Section 14.2
CTU(_E)
Section 14.3
CTD(_E)
Section 14.4
CTUD(_E)
Section 14.5
Applied Functions
(Type Conversion
Functions)
Section 14.6
TOF_10(_E)
COUNTER_FB_M
Counter drive
TP(_E)
TON(_E)
TON_10(_E)
TOF(_E)
TIMER_CONT_FB_M
TIMER_100_FB_M
3
3
3
3
Section 14.8
Section 14.9
Section 14.7
Section
14.10
Section
14.11
Section
14.12
Applied Functions
(Standard Arithmetic
Functions)
TIMER_10_FB_M
Applied Functions
(Standard Functions Of
One Numeric Variable)
TP_10(_E)
Function
How to Read
Explanation of
Functions
FX3U(C)
Reference
Function name
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
27
2.11
2 Function/Operator List
2.11 Operator
Operator
Applicable PLC
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
ADD
Adds data.
(Number of pins variable)
Section 15.1
SUB
Subtracts data.
Section 15.2
Multiplies data.
(Number of pins variable)
Section 15.3
DIV
Section 15.4
Section 15.5
**
Structured ladder
/FBD
MUL
Function
ST
Section 15.6
Applicable PLC
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Reference
AND
&
AND
Section 15.7
OR
OR
Section 15.8
XOR
XOR
Section 15.9
NOT
Section
15.10
Structured ladder
/FBD
ST
Function
Applicable PLC
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
GT
>
Section
15.11
GE
>=
Section
15.12
EQ
Section
15.13
LE
<=
Section
15.14
LT
<
Section
15.15
NE
<>
Section
15.16
Structured ladder
/FBD
28
ST
Function
Reference
3 Function Construction
3.1 Applied Function Expression and Execution Type
1
Outline
3.
Function Construction
Function/
Operator List
3.1
3
Function
Construction
D10
_IN ( s ) : An argument whose contents do not change even if the function is executed is called
"source", and expressed in this symbol.
d
*1 (
) : An argument whose contents change when the function is executed is called "destination",
and expressed in this symbol.
K1 ( n ) : Arguments not regarded as source or destination are expressed in "m", "n", etc.
How to Read
Explanation of
Functions
D0
K1
SHL_E
EN
ENO
_IN
*1
_N
5
Applied Functions
(Type Conversion
Functions)
Current value registers of data registers (D), timers (T) and counters (C) may be handled.
With certain functions, the number of sources can be changed in the range from 2 to 28.
The functions which can be changed is indicated by "(Number of pins variable)" in the function list table.
Refer to Section 2. Function List
Changing the number of pins
8
Applied Functions
(Standard Bit
Shift Functions)
7
Applied Functions
(Standard Arithmetic
Functions)
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.
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Bit devices may be combined in a way "KnX", "KnY", "KnM" and "KnS" to express numeric data.
FX Structured Programming Manual [Device & Common]
9
Applied Functions
(Standard Bitwise
Boolean Functions)
Increment Pins
10
Applied Functions
(Standard Selection
Functions)
Decrement Pins
29
3.2
3 Function Construction
3.2 Labels
Labels
Label types
Labels are classified into two types, global and local.
Global labels can be used in program components and function blocks.
Local labels can be used only in declared program blocks.
Label class
The label class indicates how each label can be used from which program component.
The table below shows label classes.
Applicable program component
Class
VAR_GLOBAL
Description
Common label available in all program components
Program
block
Function
Function
block
VAR
VAR_CONSTANT
VAR_INPUT
VAR_OUTPUT
VAR_IN_OUT
Label definition
It is necessary to define a label to use the label.
An error will occur when a program in which labels are not defined is converted (compiled).
When defining a global label, set the label name, class and data type, and assigns a device.
When defining a local label, set the label name, class and data type.
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_String1" is set for the function "BOOL_TO_STR_E".
X000
M0
BOOL_TO_STR_E
EN
ENO
_BOOL
Var_String1
30
3 Function Construction
3.2 Labels
1
Outline
Description method
Example
TRUE, FALSE
Binary number
2#0010, 2#01101010
Octal number
8#0, 8#337
Decimal number
16#FF, HFF
Real number
2.34, E2.34
Character string
3
Function
Construction
Hexadecimal number
2
Function/
Operator List
Bit
Data type
The label data type is basic or universal.
Value range
How to Read
Explanation of
Functions
Data type
Bit length
Boolean data
0(FALSE), 1(TRUE)
1 bit
Word [signed]
Integer
-32768 to 32767
16 bits
-2147483648 to
2147483647
32 bits
0 to 65535
16 bits
0 to 4294967295
32 bits
5
Applied Functions
(Type Conversion
Functions)
Bit
E 1.175495-38 to
Real number
E 3.402823+38
(Number of significant figures: 6)
32 bits
String
Character string
Variable
Time
Time value
T#-24d-0h31m23s648.00ms to
T#24d20h31m23s647.00ms
32 bits
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
31
3 Function Construction
3.2 Labels
The universal data type indicates data type of a label which combines several basic data types.
The data type name begins with "ANY".
ANY
Array
ANY_SIMPLE
ANY_NUM
Time
ANY_BIT
*1
Structure
String
Bit
ANY_REAL
ANY_INT
FLOAT
(Single
Precision)
Word
[signed]
FLOAT
(Double
Precision)
Double word
[signed]
Word
[unsigned]/
Bit String
[16-bit]
Double Word
[unsigned]/
Bit String
[32-bit]
ANY16
Word
[unsigned]/
Bit String
[16-bit]
ANY32
Word
[signed]
Double Word
[unsigned]/
Bit String
[32-bit]
Double word
[signed]
32
*1
Outline
3.3
3 Function Construction
Devices can be described in two methods, device method and address method.
Device method
X0
D 100
Device name
Device number
Function/
Operator List
In this method, a device is described using the device name and device number.
3
Function
Construction
Address method
This method is defined in IEC61131-3, and used as shown in the table below.
Head
1st character:
Position
I
Input
(Omitted)
Bit
Output
Bit
Internal
Number
How to Read
Explanation of
Functions
5
X
Memory area
position
Applied Functions
(Type Conversion
Functions)
%I
%M X 1 . 863
Size
Classification
Number
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
8
Applied Functions
(Standard Bit
Shift Functions)
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
7
Applied Functions
(Standard Arithmetic
Functions)
Size
The principle of the description method corresponding to the device method (MELSEC description method)
is as follows:
Bit device : X(Bit)
Word device : W(Word (16 bits)), D(Double word (32 bits))
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
33
3.4
3 Function Construction
3.4 EN and ENO
EN and ENO
Execution of an instruction can be controlled when the instruction contains "EN" in 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
TRUE(Executes operation.)
FALSE(Stops operation.)
X000
ENO
Operation result
Indefinite value
FALSE
Indefinite value
BOOL_TO_STR_E
EN
ENO
_BOOL
M1
VAR_D10
34
3 Function Construction
3.4 EN and ENO
Outline
MEMO
Function/
Operator List
Function
Construction
How to Read
Explanation of
Functions
Applied Functions
(Type Conversion
Functions)
Applied Functions
(Standard Functions Of
One Numeric Variable)
Applied Functions
(Standard Arithmetic
Functions)
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
35
4.
1)
2)
3)
4)
5)
6)
7)
* The above page is prepared for explanation, and is different from the actual page.
36
Item
Outline
2
Function/
Operator List
Description
Structured ladder
/FBD
4) Indicates the input variable name and output variable name of the function as well as the contents and
data type of each variable.
Refer to the following for detailed data types:
Q/L/F Structured Programming Manual (Fundamentals)
Function
Construction
ST
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
7) Program example
Program examples are explained in each language.
In program examples of the structured ladder/FBD language, the structured ladder language is adopted
as the representative.
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
37
5.
Function
Reference
Section 5.1
BOOL_TO_DINT(_E)
Section 5.2
BOOL_TO_STR(_E)
Section 5.3
Section 5.4
Section 5.5
BOOL_TO_INT(_E)
BOOL_TO_WORD(_E)
BOOL_TO_DWORD(_E)
Section 5.6
INT_TO_DINT(_E)
Section 5.7
DINT_TO_INT(_E)
Section 5.8
INT_TO_BOOL(_E)
Section 5.9
Section 5.10
BOOL_TO_TIME(_E)
DINT_TO_BOOL(_E)
INT_TO_REAL(_E)
DINT_TO_REAL(_E)
INT_TO_STR(_E)
Section 5.11
Section 5.12
Section 5.13
DINT_TO_STR(_E)
Section 5.14
INT_TO_WORD(_E)
Section 5.15
DINT_TO_WORD(_E)
Double word [signed] data word [unsigned]/bit string [16-bit] data conversion
Section 5.16
INT_TO_DWORD(_E)
Word [signed] data double word [unsigned]/bit string [32-bit] data conversion
Section 5.17
Section 5.18
DINT_TO_DWORD(_E)
Section 5.19
DINT_TO_BCD(_E)
Section 5.20
INT_TO_TIME(_E)
Section 5.21
INT_TO_BCD(_E)
DINT_TO_TIME(_E)
Section 5.22
REAL_TO_INT(_E)
Section 5.23
REAL_TO_DINT(_E)
Section 5.24
REAL_TO_STR(_E)
Section 5.25
Section 5.26
WORD_TO_BOOL(_E)
DWORD_TO_BOOL(_E)
WORD_TO_INT(_E)
Section 5.27
Section 5.28
WORD_TO_DINT(_E)
Word [unsigned]/bit string [16-bit] data double word [signed] data conversion
Section 5.29
DWORD_TO_INT(_E)
Double word [unsigned]/bit string [32-bit] data Word [signed] data conversion
Section 5.30
Section 5.31
WORD_TO_DWORD(_E)
Section 5.32
DWORD_TO_WORD(_E)
Section 5.33
Section 5.34
DWORD_TO_DINT(_E)
WORD_TO_TIME(_E)
DWORD_TO_TIME(_E)
STR_TO_BOOL(_E)
STR_TO_INT(_E)
STR_TO_DINT(_E)
Section 5.35
Section 5.36
Section 5.37
Section 5.38
STR_TO_REAL(_E)
Section 5.39
STR_TO_TIME(_E)
Section 5.40
Section 5.41
Section 5.42
BCD_TO_INT(_E)
BCD_TO_DINT(_E)
TIME_TO_BOOL(_E)
TIME_TO_INT(_E)
TIME_TO_DINT(_E)
38
Section 5.43
Section 5.44
Section 5.45
1
TIME_TO_WORD(_E)
TIME_TO_DWORD(_E)
BITARR_TO_INT(_E)
INT_TO_BITARR(_E)
DINT_TO_BITARR(_E)
CPY_BITARR(_E)
Reference
Section 5.46
Section 5.47
Section 5.48
Bit array Word [signed] type, word [unsigned]/bit String [16-bit] data conversion
Section 5.49
Bit array
Double word [signed] type, double word [unsigned]/bit string [32-bit] data conversion
Section 5.50
Word [signed] data, word [unsigned]/bit string [16-bit] data bit array conversion
Section 5.51
Double word [signed] data, double word [unsigned]/bit string [32-bit] data
bit array conversion
Section 5.52
Section 5.53
Section 5.54
SET_BIT_OF_INT(_E)
Section 5.55
CPY_BIT_OF_INT(_E)
Section 5.56
GET_BOOL_ADDR
Section 5.57
GET_INT_ADDR
Section 5.58
GET_WORD_ADDR
Section 5.59
3
Function
Construction
GET_BIT_OF_INT(_E)
2
Function/
Operator List
BITARR_TO_DINT(_E)
Function
Time data string data conversion
Outline
Function name
TIME_TO_STR(_E)
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
39
5.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_INT
M0
X000
BOOL_TO_INT_E
M0
*1.
BOOL_TO_INT
_BOOL
*1
BOOL_TO_INT_E
EN
ENO
_BOOL
*1
ST
D0
D0
BOOL_TO_INT(_BOOL);
Example:
D0:=
BOOL_TO_INT(M0);
BOOL_TO_INT_E(EN,_BOOL,
Output_label
Example:
BOOL_TO_INT_E(X000,M0,
D0);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_BOOL ( s )
Output
variable
ENO
Execution status
Bit
*1
Word [signed]
( d )
Execution condition
Bit
Bit
TRUE
Bit data
Cautions
Use the function having "_E" in its name to connect a bus.
40
In this program, bit data stored in a device specified in s is converted into word [signed] data, and the data
obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BOOL_TO_INT)
BOOL_TO_INT
_BOOL
Function/
Operator List
g_bool1
[ST]
[Structured ladder/FBD]
g_int1 := BOOL_TO_INT(g_bool1);
g_int1
g_bool1
g_bool2
BOOL_TO_INT_E
EN
ENO
_BOOL
[ST]
Function
Construction
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
41
5.2
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into double word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_DINT
BOOL_TO_DINT_
E
M0
X000
M0
*1.
ST
BOOL_TO_DINT
_BOOL
*1
BOOL_TO_DINT_E
EN
ENO
_BOOL
*1
Label
Label
BOOL_TO_DINT(_BOOL);
Example:
Label:=
BOOL_TO_DINT(M0);
BOOL_TO_DINT_E(EN,
_BOOL, Output_label);
Example:
BOOL_TO_DINT_E(X000,M0,
Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_BOOL ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
Bit
TRUE
Bit data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
42
In this program, bit data stored in a device specified in s is converted into double word [signed] data, and
the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BOOL_TO_DINT)
BOOL_TO_DINT
_BOOL
Function/
Operator List
g_bool1
[ST]
[Structured ladder/FBD]
g_dint1 := BOOL_TO_DINT(g_bool1);
g_dint1
g_bool2
BOOL_TO_DINT_E
EN
ENO
_BOOL
Function
Construction
g_bool1
3
[ST]
[Structured ladder/FBD]
Outline
Program example
g_dint1
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
43
5.3
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into string data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_STR
BOOL_TO_STR_
E
*1.
M0
X000
M0
BOOL_TO_STR
_BOOL
*1
BOOL_TO_STR_E
EN
ENO
_BOOL
*1
ST
Label
Label
BOOL_TO_STR(_BOOL);
Example:
Label:=
BOOL_TO_STR(M0);
BOOL_TO_STR_E(EN,
_BOOL, Output_label);
Example:
BOOL_TO_STR_E(X000,M0,
Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_BOOL ( s )
Output
variable
ENO
Execution status
Bit
*1
String
( d )
Execution condition
Bit
Bit
"0"
TRUE
"1"
Bit data
String data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling string data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling string data. Use global labels when specifying labels.
44
BOOL_TO_STR
_BOOL
Function/
Operator List
g_bool1
[ST]
[Structured ladder/FBD]
g_string1 := BOOL_TO_STR(g_bool1);
g_string1
g_bool2
BOOL_TO_STR_E
EN
ENO
_BOOL
Function
Construction
g_bool1
[ST]
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
45
5.4
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into word [unsigned]/bit string [16-bit] data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_WOR
D
BOOL_TO_WOR
D_E
M0
X000
M0
*1.
ST
BOOL_TO_WORD
_BOOL
*1
D0
BOOL_TO_WORD_E
EN
ENO
_BOOL
*1
D0
BOOL_TO_WORD(_BOOL);
Example:
D0:=
BOOL_TO_WORD(M0);
BOOL_TO_WORD_E(EN,
_BOOL, Output_label);
Example:
BOOL_TO_WORD_E(X000,
M0,D0);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
Bit
_BOOL ( s )
Bit
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
0H
TRUE
1H
Bit data
Word [unsigned]/
bit string [16-bit] data
Cautions
Use the function having "_E" in its name to connect a bus.
46
In this program, bit data stored in a device specified in s is converted into word [unsigned]/bit string [16-bit]
data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BOOL_TO_WORD)
BOOL_TO_WORD
_BOOL
Function/
Operator List
g_bool1
[ST]
[Structured ladder/FBD]
g_word1 := BOOL_TO_WORD(g_bool1);
g_word1
g_bool2
BOOL_TO_WORD_E
EN
ENO
_BOOL
Function
Construction
g_bool1
[ST]
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
47
5.5
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into double word [unsigned]/bit string [32-bit] data, and outputs the data
obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_DWO
RD
BOOL_TO_DWO
RD_E
M0
X000
M0
*1.
BOOL_TO_DWORD
_BOOL
*1
BOOL_TO_DWORD_E
EN
ENO
_BOOL
*1
ST
Label
BOOL_TO_DWORD(_BOOL);
Example:
Label:=
BOOL_TO_DWORD(M0);
BOOL_TO_DWORD_E(EN,
_BOOL, Output_label);
Example:
Label BOOL_TO_DWORD_E(X000,
M0, Label);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
EN
Data type
Execution condition
Bit
_BOOL ( s )
Bit
ENO
Execution status
Bit
*1
( d )
0H
TRUE
1H
Bit data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
48
In this program, bit data stored in a device specified in s is converted into double word [unsigned]/bit string
[32-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BOOL_TO_DWORD)
BOOL_TO_DWORD
_BOOL
Function/
Operator List
[Structured ladder/FBD]
g_bool1
Outline
Program example
g_dword1
[ST]
g_dword1 := BOOL_TO_DWORD(g_bool1);
Function
Construction
g_bool1
g_bool3
g_dword1
How to Read
Explanation of
Functions
g_bool2
BOOL_TO_DWORD_E
EN
ENO
_BOOL
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
49
5.6
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts bit data into time data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BOOL_TO_TIME
BOOL_TO_TIME_
E
M0
X000
M0
*1.
BOOL_TO_TIME
_BOOL
*1
BOOL_TO_TIME_E
EN
ENO
_BOOL
*1
ST
Label
Label
BOOL_TO_TIME(_BOOL);
Example:
Label:=
BOOL_TO_TIME(M0);
BOOL_TO_TIME_E(EN,_BOOL,
Output_label);
Example:
BOOL_TO_TIME_E(X000,M0,
Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_BOOL ( s )
Bit
Output
variable
ENO
Execution status
Bit
*1
Time
( d )
Execution condition
Bit
TRUE
1ms
Bit data
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
50
BOOL_TO_TIME
_BOOL
Function/
Operator List
g_bool1
[ST]
[Structured ladder/FBD]
g_time1 := BOOL_TO_TIME(g_bool1);
g_time1
g_bool2
BOOL_TO_TIME_E
EN
ENO
_BOOL
Function
Construction
g_bool1
3
[ST]
[Structured ladder/FBD]
Outline
Program example
g_time1
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
51
5.7
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into double word [signed] data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_DINT
D0
X000
INT_TO_DINT_E
D0
*1.
INT_TO_DINT
_INT
*1
INT_TO_DINT_E
EN
ENO
_INT
*1
ST
Label
Label
INT_TO_DINT(_INT);
Example:
Label:=
INT_TO_DINT(D0);
INT_TO_DINT_E(EN,_INT,
Output_label);
Example:
INT_TO_DINT_E(X000,D0,
Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_INT ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
Word [signed]
1234
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.
52
In this program, word [signed] data stored in a device specified in s is converted into double word [signed]
data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(INT_TO_DINT)
INT_TO_DINT
_INT
Function/
Operator List
g_int1=5923
[ST]
[Structured ladder/FBD]
g_dint1 := INT_TO_DINT(g_int1);
g_dint1=5923
g_int1
INT_TO_DINT_E
EN
ENO
_INT
Function
Construction
g_bool1
3
[ST]
[Structured ladder/FBD]
Outline
Program example
g_dint1
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
53
5.8
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into word [signed] data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DINT_TO_INT
Label
X000
DINT_TO_INT_E
Label
*1.
ST
DINT_TO_INT
_DINT
*1
D10
DINT_TO_INT_E
EN
ENO
_DINT
*1
D10
DINT_TO_INT(_DINT);
Example:
D10:=
DINT_TO_INT(Label);
DINT_TO_INT_E(EN,_DINT,
Output_label);
Example:
DINT_TO_INT_E(X000, Label,
D10);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_DINT ( s )
Output
variable
ENO
Execution status
Bit
*1
Word [signed]
( d )
Execution condition
Bit
Double Word [signed]
1234
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.
54
In this program, double word [signed] data stored in a device specified in s is converted into word [signed]
data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DINT_TO_INT)
DINT_TO_INT
_DINT
Function/
Operator List
g_dint1=5923
[ST]
[Structured ladder/FBD]
g_int1 := DINT_TO_INT(g_dint1);
g_int1=5923
g_dint1
DINT_TO_INT_E
EN
ENO
_DINT
Function
Construction
g_bool1
3
[ST]
[Structured ladder/FBD]
Outline
Program example
g_int1
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
55
5.9
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into bit data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_BOOL
D0
X000
INT_TO_BOOL_E
D0
*1.
INT_TO_BOOL
_INT
*1
INT_TO_BOOL_E
EN
ENO
_INT
*1
ST
M0
M0
INT_TO_BOOL(_INT);
Example:
M0:=
INT_TO_BOOL(D0);
INT_TO_BOOL_E(EN,_INT,
Output_label);
Example:
INT_TO_BOOL_E(X000,D0,M0);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_INT ( s )
Word [signed]
Output
variable
ENO
Execution status
Bit
Bit
*1
( d )
FALSE
1567
TRUE
Bit data
Cautions
Use the function having "_E" in its name to connect a bus.
56
INT_TO_BOOL
_INT
Function/
Operator List
g_int1=5923
[ST]
[Structured ladder/FBD]
g_bool1 := INT_TO_BOOL(g_int1);
g_bool1
g_int1
INT_TO_BOOL_E
EN
ENO
_INT
Function
Construction
g_bool1
3
[ST]
[Structured ladder/FBD]
Outline
Program example
g_bool2
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
57
5.10
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into bit data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DINT_TO_BOOL
DINT_TO_BOOL_
E
Label
X000
Label
*1.
DINT_TO_BOOL
_DINT
*1
DINT_TO_BOOL_E
EN
ENO
_DINT
*1
ST
M0
M0
DINT_TO_BOOL(_DINT);
Example:
M0:=
DINT_TO_BOOL(Label);
DINT_TO_BOOL_E(EN,_DINT,
Output_label);
Example:
DINT_TO_BOOL_E(X000, Label,
M0);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_DINT ( s )
Output
variable
ENO
Execution status
Bit
*1
Bit
( d )
Execution condition
Bit
Double Word [signed]
FALSE
12345678
TRUE
Bit data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
58
DINT_TO_BOOL
_DINT
Function/
Operator List
[Structured ladder/FBD]
g_dint1=0
Outline
Program example
g_bool1
[ST]
g_bool1 := DINT_TO_BOOL(g_dint1);
Function
Construction
g_bool1
g_bool3
g_bool2
How to Read
Explanation of
Functions
g_dint1
DINT_TO_BOOL_E
EN
ENO
_DINT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
59
5.11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into float (single precision) data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_REAL
D0
X000
INT_TO_REAL_E
D0
*1.
INT_TO_REAL
a_Int
*1
INT_TO_REAL_E
EN
ENO
a_Int
*1
ST
Label
Label
INT_TO_REAL(a_Int);
Example:
Label:=
INT_TO_REAL(D0);
INT_TO_REAL_E(EN,a_Int,
Output_label);
Example:
INT_TO_REAL_E(X000,D0,Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
a_Int ( s )
Word [signed]
Output
variable
ENO
Execution status
Bit
*1
( d )
1234.0
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) The function is provided in the FX3G Series Ver.1.10 or later.
4) The number of significant figures of FLOAT (Single Precision) data is approximately 7 since the data is
processed in 32-bit single precision. Accordingly, the converted data includes an error (rounding error) if
an integer value is outside the range of -16777216 to 16777215.
60
In this program, word [signed] data stored in a device specified in s is converted into float (single
precision) data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(INT_TO_REAL)
[Structured ladder/FBD]
INT_TO_REAL
a_Int
[ST]
Function/
Operator List
g_int1=5923
g_real1 := INT_TO_REAL(g_int1);
g_real1=5923.0
g_bool1
g_int1
INT_TO_REAL_E
EN
ENO
a_Int
[ST]
Function
Construction
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
61
5.12
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into float (single precision) data, and outputs the data
obtained by conversion.
1. Format
Expression in each language
Function name
DINT_TO_REAL
DINT_TO_REAL_
E
*1.
Structured ladder/FBD
Label1
X000
Label1
DINT_TO_REAL
a_Dint
*1
DINT_TO_REAL_E
EN
ENO
*1
a_Dint
ST
Label2
Label2
DINT_TO_REAL(a_Dint);
Example:
Label2:=
DINT_TO_REAL(Label1);
DINT_TO_REAL_E(EN,a_Dint,
Output_label);
Example:
DINT_TO_REAL_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
a_Dint ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
Double Word [signed]
16543521.0
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) The function is provided in the FX3G Series Ver.1.10 or later.
62
In this program, double word [signed] data stored in a device specified in s is converted into float (single
precision) data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DINT_TO_REAL)
DINT_TO_REAL
a_Dint
Function/
Operator List
[Structured ladder/FBD]
g_dint1=65000
Outline
Program example
g_real1=65000.0
[ST]
g_real1 := DINT_TO_REAL(g_dint1);
Function
Construction
g_bool1
g_bool3
g_real1
How to Read
Explanation of
Functions
g_dint1
DINT_TO_REAL_E
EN
ENO
a_Dint
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
63
5.13
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into string data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_STR
D0
X000
INT_TO_STR_E
D0
*1.
INT_TO_STR
_INT
*1
INT_TO_STR_E
EN
ENO
*1
_INT
ST
Label
Label
INT_TO_STR(_INT);
Example:
Label:=
INT_TO_STR(D0);
INT_TO_STR_E(EN,_INT,
Output_label);
Example:
INT_TO_STR_E(X000, D0, Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_INT ( s )
Word [signed]
Output
variable
ENO
Execution status
Bit
String
*1
( d )
High-order byte
Low-order byte
ASCII code for ten-thousands place
Sign data
String
ASCII code for hundreds place ASCII code for thousands place
ASCII code for ones place ASCII code for tens place
0000H
1st word
2nd word
3rd word
4th word
2) In "Sign data", "20H (space)" is stored when the input value is positive, and "2DH (-)" is stored when the
input value is negative.
3) "20H (space)" is stored in high-order digits when the number of significant figures is small.
Example: When "-123" is input
-123
Word [signed] data
High-order byte
20H (space)
31H (1)
33H (3)
Low-order byte
2DH (-)
20H (space)
32H (2)
0000H
String
1st word
2nd word
3rd word
4th word
4) "00H" is automatically stored at the end (4th word) of the character string.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling string data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling string data.
Use global labels when specifying labels.
64
1
An operation error occurs in the following case. The error flag M8067 turns ON, and D8067 stores the error
code.
d
Program example
In this program, word [signed] data stored in a device specified in s
data obtained by conversion is output to a device specified in d .
g_int1=-12345
INT_TO_STR
_INT
Function
Construction
[ST]
[Structured ladder/FBD]
g_string1 := INT_TO_STR(g_int1);
g_string='-12345'
4
[ST]
[Structured ladder/FBD]
g_int1
INT_TO_STR_E
EN
ENO
_INT
How to Read
Explanation of
Functions
g_bool1
Function/
Operator List
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)
Outline
Error
g_bool3
g_string1
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
65
5.14
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into string data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DINT_TO_STR
Label1
X000
DINT_TO_STR_E
Label1
*1.
DINT_TO_STR
_DINT
*1
DINT_TO_STR_E
EN
ENO
*1
_DINT
ST
Label2
Label2
DINT_TO_STR(_DINT);
Example:
Label2:=
DINT_TO_STR(Label1);
DINT_TO_STR_E(EN,_DINT,
Output_label);
Example:
DINT_TO_STR_E(X000,
Label1, Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_DINT ( s )
Output
variable
ENO
Execution status
Bit
*1
String
( d )
Execution condition
Bit
Double Word [signed]
High-order byte
Low-order byte
ASCII code for billions place
Sign data
String
ASCII code for ten-millions place ASCII code for hundred-millions place
ASCII code for hundred-thousands place ASCII code for millions place
ASCII code for thousands place ASCII code for ten-thousands place
ASCII code for tens place ASCII code for hundreds place
00H
ASCII code for ones place
1st word
2nd word
3rd word
4th word
5th word
6th word
2) In "Sign data", "20H (space)" is stored when the input value is positive, and "2DH (-)" is stored when the
input value is negative.
3) "20H (space)" is stored in high-order digits when the number of significant figures is small.
Example: When "-123456" is input
-123456
Double word [signed] data
High-order byte
20H (space)
20H (space)
31H (1)
33H (3)
35H (5)
00H
Low-order byte
2DH (-)
20H (space)
20H (space)
32H (2)
34H (4)
36H (6)
String
1st word
2nd word
3rd word
4th word
5th word
6th word
4) "00H" is automatically stored at the end (high-order byte of the 6th word) of the character string.
66
An operation error occurs in the following case. The error flag M8067 turns ON, and D8067 stores the error
code.
Function/
Operator List
Outline
Cautions
Error
Program example
In this program, double word [signed] data stored in a device specified in s
and the data obtained by conversion is output to a device specified in d .
DINT_TO_STR
_DINT
How to Read
Explanation of
Functions
[Structured ladder/FBD]
g_dint1=-12345678
3
Function
Construction
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)
g_string1='-12345678'
[ST]
g_string1 := DINT_TO_STR(g_dint1);
Applied Functions
(Type Conversion
Functions)
g_bool1
g_dint1
DINT_TO_STR_E
EN
ENO
_DINT
g_bool3
g_string1
Applied Functions
(Standard Functions Of
One Numeric Variable)
[ST]
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
67
5.15
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into word [unsigned]/bit string [16-bit] data, and outputs the data
obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_WORD
D0
X000
INT_TO_WORD_
E
D0
*1.
INT_TO_WORD
*1
_INT
INT_TO_WORD_E
EN
ENO
_INT
*1
ST
D10
D10
INT_TO_WORD(_INT);
Example:
D10:=
INT_TO_WORD(D0);
INT_TO_WORD_E(EN,_INT,
Output_label);
Example:
INT_TO_WORD_E(X000,D0,D10);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
Bit
_INT ( s )
Word [signed]
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
5678H
Word [unsigned]/
bit string [16-bit] data
Cautions
Use the function having "_E" in its name to connect a bus.
68
In this program, word [signed] data stored in a device specified in s is converted into word [unsigned]/bit
string [16-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(INT_TO_WORD)
INT_TO_WORD
_INT
Function/
Operator List
[Structured ladder/FBD]
g_int1=5923
Outline
Program example
g_word1=16#1723
[ST]
g_word1 := INT_TO_WORD(g_int1);
Function
Construction
g_bool1
g_bool3
g_word1
How to Read
Explanation of
Functions
g_int1
INT_TO_WORD_E
EN
ENO
_INT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
69
5.16
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into word [unsigned]/bit string [16-bit] data, and outputs the
data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DINT_TO_WORD
Label
X000
DINT_TO_WORD
_E
Label
*1.
DINT_TO_WORD
_DINT
*1
DINT_TO_WORD_E
EN
ENO
_DINT
*1
ST
D10
D10
DINT_TO_WORD(_DINT);
Example:
D10:=
DINT_TO_WORD(Label);
DINT_TO_WORD_E(EN,_DINT,
Output_label);
Example:
DINT_TO_WORD_E(X000, Label,
D10);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
EN
Data type
Execution condition
Bit
_DINT ( s )
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
614EH
Word [unsigned]/
bit string [16-bit] data
12345678 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 1 0
614E
0 11 0 0 0 01 01 0 0 1 11 0
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
70
In this program, double word [signed] data stored in a device specified in s is converted into word
[unsigned]/bit string [16-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DINT_TO_WORD)
DINT_TO_WORD
_DINT
Function/
Operator List
[Structured ladder/FBD]
g_dint1=12345678
Outline
Program example
g_word1=16#614E
[ST]
g_word1 := DINT_TO_WORD(g_dint1);
Function
Construction
g_bool1
g_bool3
g_word1
How to Read
Explanation of
Functions
g_dint1
DINT_TO_WORD_E
EN
ENO
_DINT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
71
5.17
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into double word [unsigned]/bit string [32-bit] data, and outputs the
data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_DWORD
D0
X000
INT_TO_DWORD
_E
D0
*1.
INT_TO_DWORD
_INT
*1
INT_TO_DWORD_E
EN
ENO
_INT
*1
ST
Label
Label
INT_TO_DWORD(_INT);
Example:
Label:=
INT_TO_DWORD(D0);
INT_TO_DWORD_E(EN,_INT,
Output_label);
Example:
INT_TO_DWORD_E(X000,D0,
Label);
Output variable
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Data type
Execution condition
Bit
_INT ( s )
Word [signed]
ENO
Execution status
Bit
*1
( d )
0000FEBBH
-325
111 1 1 1 1 0 1 0 1 1 10 1 1
Data conversion
0000FEBBH 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1
Each of high-order 16 bits becomes
"0" after data conversion.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
72
In this program, word [signed] data stored in a device specified in s is converted into double word
[unsigned]/bit string [32-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(INT_TO_DWORD)
INT_TO_DWORD
_INT
Function/
Operator List
[Structured ladder/FBD]
g_int1=10
Outline
Program example
g_dword1=16#0000000A
[ST]
g_dword1 := INT_TO_DWORD(g_int1);
Function
Construction
g_bool1
g_bool3
g_dword1
How to Read
Explanation of
Functions
g_int1
INT_TO_DWORD_E
EN
ENO
_INT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
73
5.18
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into double word [unsigned]/bit string [32-bit] data, and
outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
DINT_TO_DWOR
D
DINT_TO_DWOR
D_E
*1.
Structured ladder/FBD
Label1
X000
Label1
DINT_TO_DWORD
_DINT
*1
DINT_TO_DWORD_E
EN
ENO
*1
_DINT
ST
Label2
DINT_TO_DWORD(_DINT);
Example:
Label2:=
DINT_TO_DWORD(Label1);
DINT_TO_DWORD_E(EN,_DINT,
Output_label);
Example:
Label2 DINT_TO_DWORD_E(X000,
Label1, Label2);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
EN
Data type
Execution condition
Bit
_DINT ( s )
ENO
Execution status
Bit
*1
( d )
BC614EH
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
74
In this program, double word [signed] data stored in a device specified in s is converted into double word
[unsigned]/bit string [32-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DINT_TO_DWORD)
DINT_TO_DWORD
_DINT
Function/
Operator List
[Structured ladder/FBD]
g_dint1=74565
Outline
Program example
g_dword1=16#00012345
[ST]
g_dword1 := DINT_TO_DWORD(g_dint1);
Function
Construction
g_bool1
g_bool3
g_dword1
How to Read
Explanation of
Functions
g_dint1
DINT_TO_DWORD_E
EN
ENO
_DINT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
75
5.19
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into BCD data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_BCD
INT_TO_BCD
_INT
*1
D0
D10
INT_TO_BCD_E
EN
ENO
_INT
*1
X000
INT_TO_BCD_E
D0
*1.
ST
INT_TO_BCD(_INT);
Example:
D10:=
INT_TO_BCD(D0);
INT_TO_BCD_E(EN,_INT,
Output_label);
Example:
INT_TO_BCD_E(X000,D0,D10);
D10
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
Bit
_INT ( s )
Word [signed]
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
9999H
Word [unsigned]/
bit string [16-bit] data
9999
256
128
64
32
16
9999H
Thousands place
400
200
100
80
40
20
10
Hundreds place
Tens place
Ones place
Cautions
Use the function having "_E" in its name to connect a bus.
Error
An operation error occurs when the value stored in a device specified in
"9,999".
76
INT_TO_BCD
_INT
Function/
Operator List
[Structured ladder/FBD]
g_int1=5923
Outline
Program example
g_word=16#5923
[ST]
g_word1 := INT_TO_BCD(g_int1);
Function
Construction
g_bool1
g_bool3
g_word1
How to Read
Explanation of
Functions
g_int1
INT_TO_BCD_E
EN
ENO
_INT
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
77
5.20
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into BCD data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DINT_TO_BCD
DINT_TO_BCD
_DINT
*1
Label1
Label2
DINT_TO_BCD_E
EN
ENO
*1
_DINT
X000
DINT_TO_BCD_E
Label1
*1.
ST
DINT_TO_BCD(_DINT);
Example:
Label2:=
DINT_TO_BCD(Label1);
Label2
DINT_TO_BCD_E(EN,_DINT,
Output_label);
Example:
DINT_TO_BCD_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_DINT ( s )
Output
variable
ENO
Execution status
Bit
*1
ANY_BIT
( d )
Execution condition
Bit
Double Word [signed]
ANY_BIT data
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
29
28
27
26
25
24
23
22
21
20
99999999
0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
101
102
103
105
106
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
107
104
99999999
99999999H
1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
Ten-millions Millions HundredTen- Thousands Hundreds
place
place thousands thousands place
place
place
place
Tens
place
Ones
place
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
78
1
An operation error occurs when the value stored in a device specified in
"99,999,999".
Program example
is converted into BCD data,
DINT_TO_BCD
_DINT
3
g_dword1=16#00020000
Function
Construction
g_dint1=20000
2
Function/
Operator List
Outline
Error
[ST]
g_dword1 := DINT_TO_BCD(g_dint1);
4
How to Read
Explanation of
Functions
g_bool1
g_dint1
DINT_TO_BCD_E
EN
ENO
_DINT
g_bool3
g_dword1
5
Applied Functions
(Type Conversion
Functions)
[ST]
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
79
5.21
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts word [signed] data into time data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INT_TO_TIME
D0
X000
INT_TO_TIME_E
D0
*1.
INT_TO_TIME
_INT
*1
INT_TO_TIME_E
EN
ENO
_INT
*1
ST
Label
Label
INT_TO_TIME(_INT);
Example:
Label:=
INT_TO_TIME(D0);
INT_TO_TIME_E(EN,_INT,
Output_label);
Example:
INT_TO_TIME_E(X000,D0,Label);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_INT ( s )
Word [signed]
Output
variable
ENO
Execution status
Bit
Time
*1
( d )
1m5s535ms
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
80
INT_TO_TIME
_INT
[ST]
Function/
Operator List
g_int1
g_time1 := INT_TO_TIME(g_int1);
g_time1
g_bool1
g_int1
INT_TO_TIME_E
EN
ENO
_INT
[ST]
Function
Construction
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
81
5.22
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts double word [signed] data into time data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
DINT_TO_TIME
DINT_TO_TIME_
E
*1.
Structured ladder/FBD
Label1
X000
Label1
DINT_TO_TIME
_DINT
*1
ST
Label2
DINT_TO_TIME_E
EN
ENO
*1
_DINT
Label2
DINT_TO_TIME(_DINT);
Example:
Label2:=
DINT_TO_TIME(Label1);
DINT_TO_TIME_E(EN,_DINT,
Output_label);
Example:
DINT_TO_TIME_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_DINT ( s )
Output
variable
ENO
Execution status
Bit
*1
Time
( d )
Execution condition
Bit
24d20h31m23s647ms
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
82
DINT_TO_TIME
_DINT
[ST]
Function/
Operator List
g_dint1
g_time1 := DINT_TO_TIME(g_dint1);
g_time1
g_bool1
g_dint1
DINT_TO_TIME_E
EN
ENO
_DINT
[ST]
Function
Construction
[Structured ladder/FBD]
Outline
Program example
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
83
5.23
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts float (single precision) data into word [signed] data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
REAL_TO_INT
Label
X000
REAL_TO_INT_E
Label
*1.
REAL_TO_INT
a_real
*1
REAL_TO_INT_E
EN
ENO
a_real
*1
ST
D10
D10
REAL_TO_INT(a_real);
Example:
D10:=
REAL_TO_INT(Label);
REAL_TO_INT_E(EN,a_real,
Output_label);
Example:
REAL_TO_INT_E(X000, Label,
D10);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Output
variable
ENO
Execution status
Bit
*1
Word [signed]
a_real
( s )
( d )
Execution condition
Bit
1234
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) The function is provided in the FX3G Series Ver.1.10 or later.
4) In the data obtained by conversion, the portion after the decimal point of the float (single precision) data
(source data) is rounded off.
5) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
84
In this program, float (single precision) data stored in a device specified in s is converted into word
[signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(REAL_TO_INT)
REAL_TO_INT
a_real
Function/
Operator List
[Structured ladder/FBD]
g_real1=5923.5
Outline
Program example
g_int1=5923
[ST]
g_int1 := REAL_TO_INT(g_real1);
Function
Construction
g_bool1
g_bool3
g_int1
How to Read
Explanation of
Functions
g_real1
REAL_TO_INT_E
EN
ENO
a_real
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
85
5.24
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts float (single precision) data into double word [signed] data, and outputs the data
obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
REAL_TO_DINT
Label1
X000
REAL_TO_DINT_
E
*1.
Label1
REAL_TO_DINT
a_real
*1
REAL_TO_DINT_E
EN
ENO
*1
a_real
ST
Label2
Label2
REAL_TO_DINT(a_real);
Example:
Label2:=
REAL_TO_DINT(Label1);
REAL_TO_DINT_E(EN,a_real,
Output_label);
Example:
REAL_TO_DINT_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
Output
variable
ENO
Execution status
Bit
*1
a_real
( s )
( d )
Execution condition
Bit
16543521
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) The function is provided in the FX3G Series Ver.1.10 or later.
4) In the data obtained by conversion, the portion after the decimal point of the float (single precision) data
(source data) is rounded off.
5) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
86
In this program, float (single precision) data stored in a device specified in s is converted into double word
[signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(REAL_TO_DINT)
REAL_TO_DINT
a_real
Function/
Operator List
[Structured ladder/FBD]
g_real1=65000.5
Outline
Program example
g_dint1=65000
[ST]
g_dint1 := REAL_TO_DINT(g_real1);
Function
Construction
g_bool1
g_bool3
g_dint1
How to Read
Explanation of
Functions
g_real1
REAL_TO_DINT_E
EN
ENO
a_real
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
87
5.25
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts float (single precision) data into string data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
REAL_TO_STR
Structured ladder/FBD
Label1
X000
REAL_TO_STR_E
Label1
*1.
REAL_TO_STR
_REAL
*1
REAL_TO_STR_E
EN
ENO
*1
_REAL
ST
REAL_TO_STR(_REAL);
Example:
Label2:=
REAL_TO_STR(Label1);
Label2
Label2
REAL_TO_STR_E(EN,_REAL,
Output_label);
Example:
REAL_TO_STR_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_REAL ( s )
Output
variable
ENO
Execution status
Bit
*1
String
( d )
Execution condition
Bit
FLOAT (Single Precision)
Float
(single
precision)
data
.
Sign
(integer part)
20H (space)
E
Sign (exponent part)
Added
automatically
Low-order byte
Sign data (integer part) String
1st word
ASCII code
for integer part
ASCII code
for 1st decimal place
ASCII code
for 3rd decimal place
ASCII code
for 5th decimal place
Sign data
(exponent part)
ASCII code for ones
place of exponent part
2nd word
88
into string
3rd word
4th word
5th word
6th word
7th word
-12.3456
Float (single precision)
data
Decimal part
(5 digits)
Exponent part
(2 digits)
1 . 2 3 4 5 6 E + 0 1
4
How to Read
Explanation of
Functions
- 1 . 2 3 4 5 6 7 8 E + 0 1
Number of digits
of decimal part (5)
d) "30H (0)" is stored in the decimal part when the number of significant figures is small.
Applied Functions
(Type Conversion
Functions)
- 1 . 2 3 4 0 0 E + 0 1
"30H (0)" is stored.
Number of digits of decimal part (5)
Applied Functions
(Standard Arithmetic
Functions)
- 1 . 2 3 4 5 6 E + 0 1
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
e) In "Sign data (exponent part)", "2BH (+)" is stored when the input value is positive, and "2DH (-)" is
stored when the 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.
-12.3456
Function
Construction
b) In "Sign data (integer part)", "20H (space)" is stored when the input value is positive, and "2DH (-)" is
stored when the input value is negative.
c) The 6th and later digits of the decimal part are rounded.
-12.345678
2
Function/
Operator List
Integer part
(1 digit)
Outline
3) "00H" is automatically stored at the end (7th word) of the character string.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Applied Functions
(Standard Bit
Shift Functions)
Cautions
10
Applied Functions
(Standard Selection
Functions)
89
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the value stored in a device specified in s is outside the following range:
0, 2-126 (Value of device specified in s ) 2128
(Error code: K6706)
2) When the range of a device which will store the character string obtained by conversion (device specified
in d ) 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 s
and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(REAL_TO_STR)
[Structured ladder/FBD]
g_real1=-12.34567
REAL_TO_STR
_REAL
g_string1="-1.23457E+01"
[ST]
g_string1 := REAL_TO_STR(g_real1);
g_bool1
g_real1
REAL_TO_STR_E
EN
ENO
_REAL
g_bool3
g_string1
[ST]
90
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
5.26
FX0(S)
2
This function converts word [unsigned]/bit string [16-bit] data into bit data, and outputs the data obtained by
conversion.
1. Format
Structured ladder/FBD
WORD_TO_BOO
L
D0
D0
WORD_TO_BOOL_E
EN
ENO
*1
_WORD
ST
M0
M0
WORD_TO_BOOL(_WORD);
Example:
M0:=
WORD_TO_BOOL(D0);
WORD_TO_BOOL_E(EN,
_WORD, Output_label);
Example:
WORD_TO_BOOL_E(X000,D0,
M0);
How to Read
Explanation of
Functions
X000
WORD_TO_BOO
L_E
WORD_TO_BOOL
_WORD
*1
Function
Construction
Function name
*1.
Function/
Operator List
Outline
Output variable
Variable
Input
variable
Data type
EN
Execution condition
Bit
_WORD ( s )
Word [unsigned]/
Bit String [16-bit]
ENO
Execution status
Bit
*1
Bit
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
FALSE
1567H
TRUE
Word [unsigned]/
bit string [16-bit] data
Bit data
8
Applied Functions
(Standard Bit
Shift Functions)
0H
Applied Functions
(Standard Arithmetic
Functions)
This function converts word [unsigned]/bit string [16-bit] data stored in a device specified in
and outputs the data obtained by conversion to a device specified in d .
Cautions
Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
91
Program example
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in
data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(WORD_TO_BOOL)
[Structured ladder/FBD]
g_word1=16#0001
WORD_TO_BOOL
_WORD
g_bool1
[ST]
g_bool1 := WORD_TO_BOOL(g_word1);
g_bool1
g_word1
WORD_TO_BOOL_E
EN
ENO
_WORD
g_bool3
g_bool2
[ST]
92
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
1
Outline
5.27
FX0(S)
2
This function converts double word [unsigned]/bit string [32-bit] data into bit data, and outputs the data
obtained by conversion.
1. Format
Structured ladder/FBD
DWORD_TO_BO
OL
X000
Label
DWORD_TO_BOOL
_DWORD
*1
DWORD_TO_BOOL_E
EN
ENO
_DWORD
*1
ST
M0
M0
DWORD_TO_BOOL(_DWORD);
Example:
M0:=
DWORD_TO_BOOL(Label);
DWORD_TO_BOOL_E(EN,
_DWORD, Output_label);
Example:
DWORD_TO_BOOL_E(X000,
Label, M0);
How to Read
Explanation of
Functions
DWORD_TO_BO
OL_E
Label
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_DWORD ( s )
ENO
Execution status
Bit
*1
Bit
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
FALSE
12345678H
TRUE
Bit data
into
8
Applied Functions
(Standard Bit
Shift Functions)
0H
Applied Functions
(Standard Arithmetic
Functions)
This function converts double word [unsigned]/bit string [32-bit] data stored in a device specified in
bit data, and outputs the data obtained by conversion to a device specified in d .
Cautions
1) Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
10
Applied Functions
(Standard Selection
Functions)
93
Program example
In this program, double word [unsigned]/bit string [32-bit] data stored in a device specified in
into bit data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DWORD_TO_BOOL)
[Structured ladder/FBD]
g_dword1=16#00000001
DWORD_TO_BOOL
_DWORD
g_bool1
[ST]
g_bool1 := DWORD_TO_BOOL(g_dword1);
g_bool1
g_dword1
DWORD_TO_BOOL_E
EN
ENO
_DWORD
g_bool3
g_bool2
[ST]
94
is converted
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
Outline
5.28
FX0N
FX0(S)
2
This function converts word [unsigned]/bit string [16-bit] data into word [signed] data, and outputs the data
obtained by conversion.
1. Format
Structured ladder/FBD
WORD_TO_INT
D0
D0
WORD_TO_INT_E
EN
ENO
_WORD
*1
ST
D10
D10
WORD_TO_INT(_WORD);
Example:
D10:=
WORD_TO_INT(D0);
WORD_TO_INT_E(EN,_WORD,
Output_label);
Example:
WORD_TO_INT_E(X000,D0,
D10);
How to Read
Explanation of
Functions
X000
WORD_TO_INT_
E
WORD_TO_INT
_WORD
*1
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_WORD ( s )
Word [unsigned]/
Bit String [16-bit]
ENO
Execution status
Bit
*1
Word [signed]
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
5678H
22136
Word [unsigned]/
bit string [16-bit] data
into word
7
Applied Functions
(Standard Arithmetic
Functions)
This function converts word [unsigned]/bit string [16-bit] data stored in a device specified in
[signed] data, and outputs the data obtained by conversion to a device specified in d .
8
Applied Functions
(Standard Bit
Shift Functions)
Cautions
Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
95
Program example
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in s is converted into
word [signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(WORD_TO_INT)
[Structured ladder/FBD]
g_word1=16#000A
WORD_TO_INT
_WORD
g_int1=10
[ST]
g_int1 := WORD_TO_INT(g_word1);
g_bool1
g_word1
WORD_TO_INT_E
EN
ENO
_WORD
g_bool3
g_int1
[ST]
96
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
5.29
FX0(S)
2
This function converts word [unsigned]/bit string [16-bit] data into double word [signed] data, and outputs the
data obtained by conversion.
1. Format
Structured ladder/FBD
WORD_TO_DINT
D0
D0
ST
WORD_TO_DINT
_WORD
*1
WORD_TO_DINT_E
EN
ENO
_WORD
*1
Label
Label
WORD_TO_DINT(_WORD);
Example:
Label:=
WORD_TO_DINT(D0);
WORD_TO_DINT_E(EN,_WORD,
Output_label);
Example:
WORD_TO_DINT_E(X000,D0,
Label);
How to Read
Explanation of
Functions
X000
WORD_TO_DINT
_E
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_WORD ( s )
Word [unsigned]/
Bit String [16-bit]
ENO
Execution status
Bit
*1
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
5678H
22136
Word [unsigned]/
bit string [16-bit] data
5678H
into double
7
Applied Functions
(Standard Arithmetic
Functions)
This function converts word [unsigned]/bit string [16-bit] data storeds in a device specified in s
word [signed] data, and outputs the data obtained by conversion to a device specified in d .
8
Applied Functions
(Standard Bit
Shift Functions)
0 1 0 1 01 1 0 0 1 1 1 1 0 00
Data conversion
22136
Function/
Operator List
Outline
0 0 0 0 0 0 0 0 00 00 0 0 00 01 01 0 1 1 0 01 1 1 1 0 0 0
Each of high-order 16 bits becomes
"0" after data conversion.
97
10
Applied Functions
(Standard Selection
Functions)
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.
Applied Functions
(Standard Bitwise
Boolean Functions)
Cautions
Program example
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in s is converted into
double word [signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(WORD_TO_DINT)
[Structured ladder/FBD]
g_word1=16#1234
WORD_TO_DINT
_WORD
g_dint1=4660
[ST]
g_dint1 := WORD_TO_DINT(g_word1);
g_bool1
g_word1
WORD_TO_DINT_E
EN
ENO
_WORD
g_bool3
g_dint1
[ST]
98
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
5.30
FX0(S)
2
This function converts double word [unsigned]/bit string [32-bit] data into word [signed] data, and outputs the
data obtained by conversion.
1. Format
Structured ladder/FBD
DWORD_TO_INT
X000
Label
DWORD_TO_INT
_DWORD
*1
DWORD_TO_INT_E
EN
ENO
_DWORD
*1
ST
D10
D10
DWORD_TO_INT(_DWORD);
Example:
D10:=
DWORD_TO_INT(Label);
DWORD_TO_INT_E(EN,
_DWORD, Output_label);
Example:
DWORD_TO_INT_E(X000,Label,
D10);
How to Read
Explanation of
Functions
DWORD_TO_INT
_E
Label
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_DWORD ( s )
ENO
Execution status
Bit
*1
Word [signed]
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
BC614EH
24910
0 0 00 0 0 0 01 0 11 11 0 0 0 11 0 0 0 0 1 0 1 0 0 11 1 0
24910
01 1 00 0 0 10 1 0 0 1 1 1 0
into
8
Applied Functions
(Standard Bit
Shift Functions)
BC614EH
Applied Functions
(Standard Arithmetic
Functions)
This function converts double word [unsigned]/bit string [32-bit] data stored in a device specified in
word [signed] data, and outputs the data obtained by conversion to a device specified in d .
99
10
Applied Functions
(Standard Selection
Functions)
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.
Applied Functions
(Standard Bitwise
Boolean Functions)
Cautions
Program example
In this program, double word [unsigned]/bit string [32-bit] data stored in a device specified in s is converted
into word [signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DWORD_TO_INT)
[Structured ladder/FBD]
g_dword1=16#00012345
DWORD_TO_INT
_DWORD
g_int1=9029
[ST]
g_int1 := DWORD_TO_INT(g_dword1);
g_bool1
g_dword1
DWORD_TO_INT_E
EN
ENO
_DWORD
g_bool3
g_int1
[ST]
100
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
1
Outline
5.31
FX0(S)
2
This function converts double word [unsigned]/bit string [32-bit] data into double word [signed] data, and
outputs the data obtained by conversion.
1. Format
DWORD_TO_DIN
T
Label1
X000
Label1
DWORD_TO_DINT
_DWORD
*1
DWORD_TO_DINT_E
EN
ENO
*1
_DWORD
ST
Label2
Label2
DWORD_TO_DINT(_DWORD);
Example:
Label2:=
DWORD_TO_DINT(Label1);
DWORD_TO_DINT_E(EN,
_DWORD, Output_label);
Example:
DWORD_TO_DINT_E(X000,
Label1, Label2);
How to Read
Explanation of
Functions
DWORD_TO_DIN
T_E
Structured ladder/FBD
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_DWORD ( s )
ENO
Execution status
Bit
*1
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
BC614EH
12345678
into
7
Applied Functions
(Standard Arithmetic
Functions)
This function converts double word [unsigned]/bit string [32-bit] data stored in a device specified in s
double word [signed] data, and outputs the data obtained by conversion to a device specified in d .
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
Applied Functions
(Standard Bit
Shift Functions)
Cautions
10
Applied Functions
(Standard Selection
Functions)
101
Program example
In this program, double word [unsigned]/bit string [32-bit] data stored in a device specified in s is converted
into double word [signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DWORD_TO_DINT)
[Structured ladder/FBD]
g_dword1=16#00012345
DWORD_TO_DINT
_DWORD
g_dint1=74565
[ST]
g_dint1 := DWORD_TO_DINT(g_dword1);
g_bool1
g_dword1
DWORD_TO_DINT_E
EN
ENO
_DWORD
g_bool3
g_dint1
[ST]
102
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
1
Outline
5.32
FX0(S)
2
This function converts word [unsigned]/bit string [16-bit] data into double word [unsigned]/bit string [32-bit]
data, and outputs the data obtained by conversion.
1. Format
Structured ladder/FBD
WORD_TO_DWO
RD
X000
D0
WORD_TO_DWORD
_WORD
*1
WORD_TO_DWORD_E
EN
ENO
_WORD
*1
ST
Label
WORD_TO_DWORD(_WORD);
Example:
Label:=
WORD_TO_DWORD(D0);
WORD_TO_DWORD_E(EN,
_WORD, Output_label);
Example:
Label WORD_TO_DWORD_E(X000,D0,
Label);
How to Read
Explanation of
Functions
WORD_TO_DWO
RD_E
D0
Function
Construction
Function name
*1.
Output variable
Variable
Data type
EN
Execution condition
Bit
_WORD ( s )
Word [unsigned]/
Bit String [16-bit]
ENO
Execution status
Bit
*1
( d )
00005678H
Word [unsigned]/
bit string [16-bit] data
8
Applied Functions
(Standard Bit
Shift Functions)
5678H
7
Applied Functions
(Standard Arithmetic
Functions)
This function converts word [unsigned]/bit string [16-bit] data stored in a device specified in s into double
word [unsigned]/bit [32-bit] data, and outputs the data obtained by conversion to a device specified in d .
Each of high-order 16 bits becomes "0" after data conversion.
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
Cautions
1) Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
10
Applied Functions
(Standard Selection
Functions)
103
Program example
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in s is converted into
double word [unsigned]/bit string [32-bit] data, and the data obtained by conversion is output to a device
specified in d .
1) Function without EN/ENO(WORD_TO_DWORD)
[Structured ladder/FBD]
g_word1=16#1234
WORD_TO_DWORD
_WORD
g_dword1=16#00001234
[ST]
g_dword1 := WORD_TO_DWORD(g_word1);
g_bool1
g_word1
WORD_TO_DWORD_E
EN
ENO
_WORD
g_bool3
g_dword1
[ST]
104
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
1
Outline
5.33
FX0(S)
2
This function converts double word [unsigned]/bit string[32-bit] data into word [unsigned]/bit string [16-bit]
data, and outputs the data obtained by conversion.
1. Format
Structured ladder/FBD
DWORD_TO_WO
RD
Label
Label
ST
DWORD_TO_WORD
_DWORD
*1
DWORD_TO_WORD_E
EN
ENO
_DWORD
*1
DWORD_TO_WORD(_DWORD);
Example:
D10:=
DWORD_TO_WORD(Label);
D10
DWORD_TO_WORD_E(EN,
_DWORD, Output_label);
Example:
DWORD_TO_WORD_E(X000,
Label, D10);
D10
How to Read
Explanation of
Functions
X000
DWORD_TO_WO
RD_E
Function
Construction
Function name
*1.
Output variable
Variable
Data type
Execution condition
Bit
_DWORD ( s )
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
Word [unsigned]/
bit string [16-bit] data
8
7
Applied Functions
(Standard Bit
Shift Functions)
5678H
12345678H 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0
5678H
7
Applied Functions
(Standard Arithmetic
Functions)
This function converts double word [unsigned]/bit string [32-bit] data stored in a device specified in s into
word [unsigned]/bit string [16-bit] data, and outputs the data obtained by conversion to a device specified in
d .
12345678H
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
EN
Applied Functions
(Type Conversion
Functions)
2. Set data
Input
variable
Function/
Operator List
Outline
0 1 01 0 1 1 0 0 1 1 1 1 0 00
Applied Functions
(Standard Bitwise
Boolean Functions)
Cautions
1) Use the function having "_E" in its name to connect a bus.
105
10
Applied Functions
(Standard Selection
Functions)
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.
Program example
In this program, double word [unsigned]/bit string [32-bit] data stored in a device specified in s is converted
into word [unsigned]/bit string [16-bit] data, and the data obtained by conversion is output to a device
specified in d .
1) Function without EN/ENO(WORD_TO_DWORD)
[Structured ladder/FBD]
g_dword1=16#12345678
DWORD_TO_WORD
_DWORD
g_word1=16#5678
[ST]
g_word1 := DWORD_TO_WORD(g_dword1);
g_bool1
g_dword1
DWORD_TO_WORD_E
EN
ENO
_DWORD
g_bool3
g_word1
[ST]
106
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
Outline
5.34
FX0N
FX0(S)
2
This function converts word [unsigned]/bit string [16-bit] data into time data, and outputs the data obtained by
conversion.
1. Format
Structured ladder/FBD
WORD_TO_TIME
D0
D0
WORD_TO_TIME_E
EN
ENO
_WORD
*1
ST
Label
Label
WORD_TO_TIME(_WORD);
Example:
Label:=
WORD_TO_TIME(D0);
WORD_TO_TIME_E(EN,_WORD,
Output_label);
Example:
WORD_TO_TIME_E(X000,D0,
Label);
How to Read
Explanation of
Functions
X000
WORD_TO_TIME
_E
WORD_TO_TIME
_WORD
*1
Function
Construction
Function name
*1.
Function/
Operator List
Outline
Output variable
Variable
Input
variable
Data type
EN
Execution condition
Bit
_WORD ( s )
Word [unsigned]/
Bit String[ 16-bit]
ENO
Execution status
Bit
*1
Time
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
0ms
1234
1s234ms
Word [unsigned]/
bit string [16-bit] data
Time data
into time
8
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Arithmetic
Functions)
This function converts word [unsigned]/bit string [16-bit] data stored in a device specified in
data, and outputs the data obtained by conversion to a device specified in d .
Cautions
1) Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
10
Applied Functions
(Standard Selection
Functions)
107
Program example
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in
time data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(WORD_TO_TIME)
[Structured ladder/FBD]
g_word1
WORD_TO_TIME
_WORD
g_time1
[ST]
g_time1 := WORD_TO_TIME(g_word1);
g_bool1
g_word1
WORD_TO_TIME_E
EN
ENO
_WORD
g_bool3
g_time1
[ST]
108
is converted into
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
1
Outline
5.35
FX0(S)
2
This function converts double word [unsigned]/bit string [32-bit] data into time data, and outputs the data
obtained by conversion.
1. Format
DWORD_TO_TIM
E
Label1
X000
Label1
DWORD_TO_TIME
_DWORD
*1
ST
Label2
DWORD_TO_TIME_E
EN
ENO
*1
_DWORD
Label2
DWORD_TO_TIME(_DWORD);
Example:
Label2:=
DWORD_TO_TIME(Label1);
DWORD_TO_TIME_E(EN,_
DWORD, Output_label);
Example:
DWORD_TO_TIME_E(X000,
Label1, Label2);
How to Read
Explanation of
Functions
DWORD_TO_TIM
E_E
Structured ladder/FBD
Function
Construction
Function name
*1.
Function/
Operator List
Outline
Output variable
Variable
Input
variable
Data type
EN
Execution condition
Bit
_DWORD ( s )
ENO
Execution status
Bit
*1
Time
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
0ms
1234567
20m34s567ms
Time data
into
8
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Arithmetic
Functions)
This function converts double word [unsigned]/bit string [32-bit] data stored in a device specified in
time data, and outputs the data obtained by conversion to a device specified in d .
Cautions
1) Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
10
Applied Functions
(Standard Selection
Functions)
109
Program example
In this program, double word [unsigned]/bit string [32-bit] data stored in a device specified in
into time data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(DWORD_TO_TIME)
[Structured ladder/FBD]
g_dword1
DWORD_TO_TIME
_DWORD
g_time1
[ST]
g_time1 := DWORD_TO_TIME(g_dword1);
g_bool1
g_dword1
DWORD_TO_TIME_E
EN
ENO
_DWORD
g_bool3
g_time1
[ST]
110
is converted
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
Outline
5.36
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function converts string data into bit data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
STR_TO_BOOL_
E
Label
X000
*1.
STR_TO_BOOL_E
EN
ENO
*1
_STRING
M0
M0
STR_TO_BOOL_E(EN,_STRING,
Output_label);
Example:
STR_TO_BOOL_E(X000, Label,
M0);
4
How to Read
Explanation of
Functions
Label
STR_TO_BOOL
_STRING
*1
Function
Construction
STR_TO_BOOL
ST
STR_TO_BOOL(_STRING);
Example:
M0:=
STR_TO_BOOL(Label);
Output variable
2. Set data
Variable
Description
Execution condition
Bit
_STRING ( s )
Output
variable
ENO
Execution status
String
Bit
*1
Bit
Applied Functions
(Type Conversion
Functions)
Input
variable
( d )
Data type
EN
'12'
TRUE
String data
Bit data
7
Applied Functions
(Standard Arithmetic
Functions)
'0'
Applied Functions
(Standard Functions Of
One Numeric Variable)
Cautions
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.
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
111
Program example
In this program, string data stored in a device specified in
obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(STR_TO_BOOL)
[Structured ladder/FBD]
g_string1
STR_TO_BOOL
_STRING
g_bool1
[ST]
g_bool1 := STR_TO_BOOL(g_string1);
g_bool1
g_string1
STR_TO_BOOL_E
EN
ENO
_STRING
g_bool3
g_bool2
[ST]
112
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
5.37
FX0(S)
This function converts string data into word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label
X000
STR_TO_INT_E
*1.
STR_TO_INT_E
EN
ENO
_STRING
*1
D10
D10
STR_TO_INT_E(EN,_STRING,
Output_label);
Example:
STR_TO_INT_E(X000, Label,
D10);
4
How to Read
Explanation of
Functions
Label
STR_TO_INT
_STRING
*1
ST
STR_TO_INT(_STRING);
Example:
D10:=
STR_TO_INT(Label);
Function
Construction
STR_TO_INT
Output variable
2. Set data
Variable
Description
Data type
Execution condition
Bit
_STRING ( s )
Output
variable
ENO
Execution status
String
Bit
*1
Word [signed]
Applied Functions
(Type Conversion
Functions)
Input
variable
EN
( d )
1st word
2nd word
3rd word
High-order byte
Low-order byte
Sign data
ASCII code for ten-thousands place
ASCII code for hundreds place ASCII code for thousands place
ASCII code for ones place ASCII code for tens place
Applied Functions
(Standard Arithmetic
Functions)
String
Applied Functions
(Standard Functions Of
One Numeric Variable)
Function/
Operator List
Outline
Cautions
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.
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
113
Error
1) When the sign data (low-order byte) of the 1st word stored in a device specified in
"20H (space)" or "2DH (-)"
(Error code: K6706)
2) When the ASCII code for each place (digit) stored in
"20H (space)" or "00H (NULL)"
(Error code: K6706)
3) When the value stored in
-32768 to +32767
(Error code: K6706)
4) When any of devices
(Error code: K6706)
to
to
to
Program example
In this program, string data stored in a device specified in s is converted into word [signed] data, and the
data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(STR_TO_INT)
[Structured ladder/FBD]
g_string1="-12345"
STR_TO_INT
_STRING
g_int1=-12345
[ST]
g_int1 := STR_TO_INT(g_string1);
g_bool1
g_string1
STR_TO_INT_E
EN
ENO
_STRING
g_bool3
g_int1
[ST]
114
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
Outline
5.38
FX0N
FX0(S)
2
This function converts string data into double word [signed] data, and outputs the data obtained by
conversion.
1. Format
STR_TO_DINT
Structured ladder/FBD
Label1
Label1
STR_TO_DINT_E
EN
ENO
*1
_STRING
ST
Label2
Label2
STR_TO_DINT(_STRING);
Example:
Label2:=
STR_TO_DINT(Label1);
STR_TO_DINT_E(EN,_STRING,
Output_label);
Example:
STR_TO_DINT_E(X000, Label1,
Label2);
How to Read
Explanation of
Functions
X000
STR_TO_DINT_E
STR_TO_DINT
_STRING
*1
Function
Construction
Function name
*1.
Output variable
Variable
Description
Data type
Input
variable
EN
_STRING ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Applied Functions
(Type Conversion
Functions)
2. Set data
Execution condition
Bit
String
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
8
Applied Functions
(Standard Bit
Shift Functions)
1st word
2nd word
3rd word
4th word
5th word
6th word
Applied Functions
(Standard Arithmetic
Functions)
String
Function/
Operator List
Outline
(Ignore)
Cautions
2) When handling string data and 32-bit data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling string data and 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
115
Error
1) When the sign data (low-order byte) of the 1st word stored in a device specified in
"20H (space)" or "2DH (-)"
(Error code: K6706)
2) When the ASCII code for each place (digit) stored in
"20H (space)" or "00H (NULL)"
(Error code: K6706)
to
to
Program example
In this program, string data stored in a device specified in s is converted into double word [signed] data,
and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(STR_TO_DINT)
[Structured ladder/FBD]
g_string1="_ _65000"
STR_TO_DINT
_STRING
g_dint1=65000
[ST]
g_dint1 := STR_TO_DINT(g_string1);
g_bool1
g_string1
STR_TO_DINT_E
EN
ENO
_STRING
g_bool3
g_dint1
[ST]
116
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
5.39
FX0(S)
2
This function converts string data into float (single precision) data, and outputs the data obtained by
conversion.
1. Format
Structured ladder/FBD
STR_TO_REAL
Label1
Label1
STR_TO_REAL_E
EN
ENO
_STRING
*1
ST
Label2
Label2
STR_TO_REAL(_STRING);
Example:
Label2:=
STR_TO_REAL(Label1);
STR_TO_REAL_E(EN,_STRING,
Output_label);
Example:
STR_TO_REAL_E(X000, Label1,
Label2);
How to Read
Explanation of
Functions
X000
STR_TO_REAL_E
STR_TO_REAL
_STRING
*1
Function
Construction
Function name
*1.
Function/
Operator List
Outline
Output variable
Variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
Data type
Input
variable
EN
_STRING ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
String
Applied Functions
(Standard Functions Of
One Numeric Variable)
Low-order byte
High-order byte
ASCII code for 1st character
Sign data
ASCII code for 3rd character ASCII code for 2nd character
ASCII code for 5th character ASCII code for 4th character
ASCII code for 7th character ASCII code for 6th character
ASCII code for 9th character ASCII code for 8th character
ASCII code for 11th character ASCII code for 10th character
0000H (Indicates the end of the character string.)
8
Float (single precision) data
2) The conversion source string data can be in the decimal format or exponent format.
a) In the case of decimal format
1st word
2nd word
3rd word
4th word
5th word
Low-order byte
2DH (-)
2EH (.)
35H (5)
33H (3)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
String
High-order byte
31H (1)
33H (3)
30H (0)
34H (4)
-1.35034
0000H
Float (single precision)
data
117
10
Applied Functions
(Standard Selection
Functions)
- 1 . 3 5 0 3 4
Applied Functions
(Standard Bit
Shift Functions)
1st word
2nd word
3rd word
4th word
5th word
6th word
7th word
7
Applied Functions
(Standard Arithmetic
Functions)
1) This function converts string data (in the decimal format or exponent format) stored in a device specified
in s into float (single precision) data, and outputs the data obtained by conversion to a device specified
in d .
String
High-order byte
31H (1)
33H (3)
30H (0)
34H (4)
2DH (-)
30H (0)
1st word
2nd word
3rd word
4th word
5th word
6th word
7th word
String
0000H
-1.35034E-10
Float (single precision)
data
- 1 . 3 5 0 3 4 E - 1 0
3) With regard to string data, six digits excluding the sign, decimal point and exponent part are valid, and the
7th and later digits are discarded during conversion.
a) In the case of decimal format
- 1 . 3 5 0 3 4 1 2 0 2 3
-1.35034
Float (single precision) data
Discarded
-1.35034E-10
Float (single precision) data
Discarded
4) String data in the decimal format is handled as positive value during conversion when the sign is set to
"2BH (+)" or when the sign is omitted. It is handled as negative value during conversion when the sign is
set to "2DH (-)".
5) String data in the exponent format is handled as positive value during conversion when the sign of the
exponent part is set to "2BH (+)" or when the sign is omitted. It is handled as negative value during
conversion when the sign is set to "2DH (-)".
6) When "20H (space)" or "30H (0)" exists between the sign and the first number except "0" in string data,
"20H (space)" or "30H (0)" is ignored during conversion.
a) In the case of decimal format
-
0 1 . 3 5 0 3 4
-1.35034
Float (single precision) data
Ignored
0 1 . 3 5 0 3 4 E - 1 0
Ignored
7)
-1.35034E-10
When "30H (0)" exists between "E" and a number in character string data (in the exponent format), "30H
(0)" is ignored during conversion.
- 1 . 3 5 0 3 4 E - 0 2
Ignored
-1.35034E-2
Float (single precision) data
8) When "20H (space)" is contained in character string, "20H (space)" is ignored during conversion.
9) Up to 24 characters can be input as string data.
Each of "20H (space)" and "30H (0)" contained in string is counted as 1 character respectively.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling string data and 32-bit data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling string data and 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
118
1
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When any character other than "30H (0)" to "39H (9)" exists in the integer or decimal part
(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)
s
Program example
In this program, string data stored in a device specified in s is converted into float (single precision) data,
and the data obtained by conversion is output to a device specified in d .
[Structured ladder/FBD]
STR_TO_REAL
_STRING
g_real1
5
Applied Functions
(Type Conversion
Functions)
[ST]
g_real1 := STR_TO_REAL(g_string1);
[Structured ladder/FBD]
g_string1
STR_TO_REAL_E
EN
ENO
_STRING
Applied Functions
(Standard Functions Of
One Numeric Variable)
g_bool1
4
How to Read
Explanation of
Functions
g_string1
3
Function
Construction
Function/
Operator List
2) When "2EH (.)" exists in two or more positions inside the character string specified in
(Error code: K6706)
Outline
Error
g_bool3
g_real1
[ST]
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
119
5.40
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts string data into time data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
STR_TO_TIME
Structured ladder/FBD
Label1
X000
STR_TO_TIME_E
Label1
*1.
STR_TO_TIME
_STRING
*1
ST
Label2
STR_TO_TIME_E
EN
ENO
*1
_STRING
Label2
STR_TO_TIME(_STRING);
Example:
Label2:=
STR_TO_TIME(Label1);
STR_TO_TIME_E(EN,_STRING,
Output_label);
Example:
STR_TO_TIME_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_STRING ( s )
String
Output
variable
ENO
Execution status
Bit
*1
Time
( d )
Execution condition
Bit
0ms
'1234567'
20m34s567ms
String data
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling string data and 32-bit data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling string data and 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
120
1
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the sign data of numeric data specified in
(Error code: K6706)
How to Read
Explanation of
Functions
[Structured ladder/FBD]
STR_TO_TIME
_STRING
g_time1
[ST]
Applied Functions
(Type Conversion
Functions)
g_time1 := STR_TO_TIME(g_string1);
g_bool1
g_bool3
Applied Functions
(Standard Functions Of
One Numeric Variable)
g_string1
STR_TO_TIME_E
EN
ENO
_STRING
Function
Construction
Program example
g_string1
2
Function/
Operator List
2) When the ASCII code for each digit of character string data specified in
"39H (9)", "20H (space)" or "00H (NULL)"
(Error code: K6706)
3) When the numeric value specified in
-2,147,483,648 to +2,147,483,647
(Error code: K6706)
Outline
Error
g_time1
[ST]
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
121
5.41
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts BCD data into word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BCD_TO_INT
BCD_TO_INT
_BCD
*1
D0
D10
BCD_TO_INT_E
EN
ENO
_BCD
*1
X000
BCD_TO_INT_E
D0
*1.
ST
BCD_TO_INT(_BCD);
Example:
D10:=
BCD_TO_INT(D0);
BCD_TO_INT_E(EN,_BCD,
Output_label);
Example:
BCD_TO_INT_E(X000,D0,D10);
D10
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
Bit
_BCD ( s )
Word [unsigned]/
Bit String [16-bit]
ENO
Execution status
Bit
Word [signed]
*1
( d )
9999
Word [unsigned]/
bit string [16-bit] data
9999H
80
40
20
10
Tens place
Ones place
Conversion into word [signed] data
9999
64
32
16
Cautions
Use the function having "_E" in its name to connect a bus.
Error
When the source data is not BCD (decimal number), M8067 (operation error) turns ON.
122
BCD_TO_INT
_BCD
Function/
Operator List
[Structured ladder/FBD]
g_word1=16#1234
Outline
Program example
g_int1=1234
[ST]
g_int1 := BCD_TO_INT(g_word1);
Function
Construction
g_bool1
g_bool3
g_int1
How to Read
Explanation of
Functions
g_word1
BCD_TO_INT_E
EN
ENO
_BCD
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
123
5.42
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts BCD data into double word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
BCD_TO_DINT
Label1
X000
BCD_TO_DINT_E
Label1
*1.
BCD_TO_DINT
_BCD
*1
BCD_TO_DINT_E
EN
ENO
*1
_BCD
ST
Label2
Label2
BCD_TO_DINT(_BCD);
Example:
Label2:=
BCD_TO_DINT(Label1);
BCD_TO_DINT_E(EN,_BCD,
Output_label);
Example:
BCD_TO_DINT_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_BCD ( s )
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
ANY_BIT
100
102
103
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
104
ANY_BIT data
106
99999999
107
99999999H
101
99999999H 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
Millions HundredTen- Thousands Hundreds Tens
place thousands thousands place
place
place
place
place
Conversion into DINT data
Ones
place
231
230
229
228
227
226
225
224
223
222
221
220
219
218
217
216
215
214
213
212
211
210
29
28
27
26
25
24
23
22
21
20
Tenmillions
place
99999999 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
Always becomes "0".
Cautions
Use the function having "_E" in its name to connect a bus.
Error
When the source data is not BCD (decimal number), M8067 (operation error) turns ON.
124
In this example, BCD data stored in a device specified in s is converted into double word [signed] data,
and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BCD_TO_DINT)
BCD_TO_DINT
_BCD
Function/
Operator List
[Structured ladder/FBD]
g_word1=16#0000
Outline
Program example
g_dint1=0
[ST]
g_dint1 := BCD_TO_DINT(g_word1);
Function
Construction
g_bool1
g_bool3
g_dint1
How to Read
Explanation of
Functions
g_word1
BCD_TO_DINT_E
EN
ENO
_BCD
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
125
5.43
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into bit data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
TIME_TO_BOOL
TIME_TO_BOOL_
E
Label
X000
Label
*1.
ST
TIME_TO_BOOL
_TIME
*1
M0
TIME_TO_BOOL_E
EN
ENO
_TIME
*1
M0
TIME_TO_BOOL(_TIME);
Example:
M0:=
TIME_TO_BOOL(Label);
TIME_TO_BOOL_E(EN,_TIME,
Output_label);
Example:
TIME_TO_BOOL_E(X000, Label,
M0);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_TIME ( s )
Output
variable
ENO
Execution status
Bit
*1
Bit
( d )
Execution condition
Bit
Time
FALSE
20m34s567ms
TRUE
Time data
Bit data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
126
TIME_TO_BOOL
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
Outline
Program example
g_bool1
[ST]
g_bool1 := TIME_TO_BOOL(g_time1);
Function
Construction
g_bool1
g_bool3
g_bool2
How to Read
Explanation of
Functions
g_time1
TIME_TO_BOOL_E
EN
ENO
_TIME
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
127
5.44
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
TIME_TO_INT
Label
X000
TIME_TO_INT_E
Label
*1.
ST
TIME_TO_INT
_TIME
*1
D10
TIME_TO_INT_E
EN
ENO
_TIME
*1
D10
TIME_TO_INT(_TIME);
Example:
D10:=
TIME_TO_INT(Label);
TIME_TO_INT_E(EN,_TIME,
Output_label);
Example:
TIME_TO_INT_E(X000, Label,
D10);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_TIME ( s )
Output
variable
ENO
Execution status
Bit
*1
Word [signed]
( d )
Execution condition
Bit
Time
1234
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
128
TIME_TO_INT
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
Outline
Program example
g_int1
[ST]
g_int1 := TIME_TO_INT(g_time1);
Function
Construction
g_bool1
g_bool3
g_int1
How to Read
Explanation of
Functions
g_time1
TIME_TO_INT_E
EN
ENO
_TIME
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
129
5.45
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into double word [signed] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
TIME_TO_DINT
TIME_TO_DINT_
E
*1.
Structured ladder/FBD
Label1
X000
Label1
TIME_TO_DINT
_TIME
*1
TIME_TO_DINT_E
EN
ENO
*1
_TIME
ST
Label2
Label2
TIME_TO_DINT(_TIME);
Example:
Label2:=
TIME_TO_DINT(Label1);
TIME_TO_DINT_E(EN,_TIME,
Output_label);
Example:
TIME_TO_DINT_E(X000,Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_TIME ( s )
Time
Output
variable
ENO
Execution status
Bit
*1
( d )
Execution condition
Bit
1234567
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
130
In this program, time data stored in a device specified in s is converted into double word [signed] data, and
the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(TIME_TO_DINT)
TIME_TO_DINT
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
Outline
Program example
g_dint1
[ST]
g_dint1 := TIME_TO_DINT(g_time1);
Function
Construction
g_bool1
g_bool3
g_dint1
How to Read
Explanation of
Functions
g_time1
TIME_TO_DINT_E
EN
ENO
_TIME
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
131
5.46
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into string data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
TIME_TO_STR
Structured ladder/FBD
Label1
X000
TIME_TO_STR_E
Label1
*1.
TIME_TO_STR
_TIME
*1
TIME_TO_STR_E
EN
ENO
*1
_TIME
ST
Label2
Label2
TIME_TO_STR(_TIME);
Example:
Label2:=
TIME_TO_STR(Label1);
TIME_TO_STR_E(EN,_TIME,
Output_label);
Example:
TIME_TO_STR_E(X000, Label1,
Label2);
Output variable
2. Set data
Variable
Description
Data type
Input
variable
EN
_TIME ( s )
Output
variable
ENO
Execution status
Bit
*1
String
( d )
Execution condition
Bit
Time
"1234567"
Time data
String data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
Error
An operation error occurs in the following case. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the number of points occupied by the device specified in
corresponding device.
132
TIME_TO_STR
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
Outline
Program example
g_string1
[ST]
g_string1 := TIME_TO_STR(g_time1);
Function
Construction
g_bool1
g_bool3
g_string1
How to Read
Explanation of
Functions
g_time1
TIME_TO_STR_E
EN
ENO
_TIME
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
133
5.47
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into word [unsigned]/bit string [16-bit] data, and outputs the data obtained by
conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
TIME_TO_WORD
TIME_TO_WORD
_E
Label
X000
Label
*1.
ST
TIME_TO_WORD
_TIME
*1
D10
TIME_TO_WORD_E
EN
ENO
_TIME
*1
D10
TIME_TO_WORD(_TIME);
Example:
D10:=
TIME_TO_WORD(Label);
TIME_TO_WORD_E(EN,_TIME,
Output_label);
Example:
TIME_TO_WORD_E(X000, Label,
D10);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
EN
Data type
Execution condition
Bit
_TIME ( s )
Time
ENO
Execution status
Bit
Word [unsigned]/
Bit String [16-bit]
*1
( d )
1234
Time data
Word [unsigned]/
bit string [16-bit] data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
134
In this program, time data stored in a device specified in s is converted into word [unsigned]/bit string [16bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(TIME_TO_WORD)
TIME_TO_WORD
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
Outline
Program example
g_word1
[ST]
g_word1 := TIME_TO_WORD(g_time1);
Function
Construction
g_bool1
g_bool3
g_word1
How to Read
Explanation of
Functions
g_time1
TIME_TO_WORD_E
EN
ENO
_TIME
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
135
5.48
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts time data into double word [unsigned]/bit string [32-bit] data, and outputs the data
obtained by conversion.
1. Format
Expression in each language
Function name
TIME_TO_DWOR
D
TIME_TO_DWOR
D_E
*1.
Structured ladder/FBD
Label1
X000
Label1
TIME_TO_DWORD
_TIME
*1
TIME_TO_DWORD_E
EN
ENO
*1
_TIME
ST
Label2
Label2
TIME_TO_DWORD(_TIME);
Example:
Label2:=
TIME_TO_DWORD(Label1);
TIME_TO_DWORD_E(EN,_TIME,
Output_label);
Example:
TIME_TO_DWORD_E(X000,
Label1, Label2);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
EN
Data type
Execution condition
Bit
_TIME ( s )
Time
ENO
Execution status
Bit
*1
( d )
1234567
Time data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
136
In this program, time data stored in a device specified in s is converted into double word [unsigned]/bit
string [32-bit] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(TIME_TO_DWORD)
TIME_TO_DWORD
_TIME
Function/
Operator List
[Structured ladder/FBD]
g_time1
g_dword1
[ST]
g_dword1 := TIME_TO_DWORD(g_time1);
Function
Construction
g_bool1
g_bool3
How to Read
Explanation of
Functions
g_time1
TIME_TO_DWORD_E
EN
ENO
_TIME
Outline
Program example
g_dword1
[ST]
g_dword1 := TIME_TO_DWORD(g_time1);
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
137
5.49
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts specified number of bits of a bit array into word [signed] data or word [unsigned]/bit
string [16-bit] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
BITARR_TO_INT
BITARR_TO_INT
Label1[*2]
K4
BitArr
D10
BITARR_TO_INT_E
X000
EN
BITARR_TO_INT_E
*1
Label1[*2]
K4
*1.
Output variable
*2.
BitArr
n
ENO
*1
D10
BITARR_TO_INT(BitArr, n);
Example:
D10:= BITARR_TO_INT
Label1[*2], K4);
BITARR_TO_INT_E(EN,
BitArr, n, Output_label);
Example:
BITARR_TO_INT_E(X000,
Label1[*2], K4, D10);
2. Set data
Variable
Input
variable
Description
Execution condition
Bit
BitArr ( s )
Bit
Word [signed]
Execution status
Bit
Output
variable
Data type
EN
ENO
*1
( d )
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
138
In this program, 8 bits starting from the 0th element of a bit array stored in a device specified in s are
converted into word [signed] data, and the data obtained by conversion is output to a device specified in d .
1) Function without EN/ENO(BITARR_TO_INT)
2
Function/
Operator List
[Structured ladder/FBD]
BITARR_TO_INT
g_bool4[0]
g_int1
BitArr
n
K8
Outline
Program example
[ST]
3
Function
Construction
BITARR_TO_INT_E
g_bool1
K8
EN
BitArr
ENO
How to Read
Explanation of
Functions
g_bool4[0]
g_bool2
g_int1
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
139
5.50
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function converts specified number of bits of a bit array into double word [signed] data or double word
[unsigned]/bit string [32-bit] data, and outputs the data obtained by conversion.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
BITARR_TO_DINT
BITARR_TO_DINT
Label1[*2]
K4
BitArr
Label2
BITARR_TO_DINT_E
X000
EN
BITARR_TO_DINT_E
*1
Label1[*2]
K4
*1.
Output variable
*2.
BitArr
n
ENO
*1
Label2
BITARR_TO_DINT(BitArr, n);
Example:
Label2:=BITARR_TO_DINT
Label1[*2], K4);
BITARR_TO_DINT_E(EN,
BitArr, n, Output_label);
Example:
BITARR_TO_DINT_E(X000,
Label1[*2], K4,
Label2);
2. Set data
Variable
Input
variable
Description
Execution condition
Bit
BitArr ( s )
Bit
Word [signed]
Execution status
Bit
Output
variable
Data type
EN
ENO
*1
( d )
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
140
In this program, 8 bits starting from the 0th element of a bit array stored in a device specified in s are
converted into double word [signed] data, and the data obtained by conversion is output to a device specified
in d .
Function/
Operator List
[Structured ladder/FBD]
BITARR_TO_DINT
g_bool4[0]
g_dint1
BitArr
n
K8
Outline
Program example
[ST]
Function
Construction
[Structured ladder/FBD]
g_bool1
g_bool4[0]
K8
EN
BitArr
ENO
How to Read
Explanation of
Functions
BITARR_TO_DINT_E
g_bool2
g_dint1
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
141
5.51
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function outputs low-order "n" bits of word [signed] data or word [unsigned]/bit string [16-bit] data to a bit
array.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
INT_TO_BITARR
INT_TO_BITARR
D10
K4
D10
K4
*1.
Label2[*1]
INT_TO_BITARR_E
X000
INT_TO_BITARR_E
BitArr
EN
ENO
s
n
BitArr
Label2[*1]
INT_TO_BITARR(s, n);
Example:
Label2[*1]:=
INT_TO_BITARR(D10, K4);
INT_TO_BITARR_E
(EN, s, n, BitArr);
Example:
INT_TO_BITARR_E(X000,
D10, K4, Label2[*1]);
2. Set data
Variable
EN
Input
variable
Data type
Bit
Word [signed]
ENO
Execution status
Bit
BitArr ( d )
Bit
Output
variable
Description
Execution condition
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
142
In this program, low-order 4 bits of word [signed] data stored in a device specified in
device specified in d .
are output to a
2
Function/
Operator List
[Structured ladder/FBD]
INT_TO_BITARR
g_int1
s
n
K4
BitArr
Outline
Program example
g_bool4[0]
[ST]
3
Function
Construction
INT_TO_BITARR_E
g_bool1
K4
ENO
BitArr
g_bool2
How to Read
Explanation of
Functions
g_int1
EN
s
g_bool4[0]
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
143
5.52
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function outputs low-order "n" bits of double word [signed] data or double word [unsigned]/bit string [32bit] data to a bit array.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
DINT_TO_BITARR
DINT_TO_BITARR
Label1
K4
*1.
Label1
K4
Label2[*1]
DINT_TO_BITARR_E
X000
DINT_TO_BITARR_E
BitArr
EN
ENO
s
n
BitArr
Label2[*1]
DINT_TO_BITARR(s, n);
Example:
Label2[*1]:=
DINT_TO_BITARR
(Label1, K4)
DINT_TO_BITARR_E(EN, s, n,
BitArr);
Example:
DINT_TO_BITARR_E(X000,
Label1, K4, Label2[*1]);
2. Set data
Variable
EN
Input
variable
Data type
Bit
Word [signed]
ENO
Execution status
Bit
BitArr ( d )
Bit
Output
variable
Description
Execution condition
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
144
In this program, low-order 4 bits of double word [signed] data stored in a device specified in
a device specified in d .
are output to
2
Function/
Operator List
[Structured ladder/FBD]
DINT_TO_BITARR
g_dint1
s
n
K4
BitArr
Outline
Program example
g_bool4[0]
[ST]
3
Function
Construction
DINT_TO_BITARR_E
g_bool1
K4
ENO
BitArr
g_bool2
How to Read
Explanation of
Functions
g_dint1
EN
s
g_bool4[0]
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
145
5.53
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function copies specified number of bits of a bit array.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
CPY_BITARR
CPY_BITARR
Label1[*1]
K4
BitArrIn
*1.
Label2[*1]
n
CPY_BITARR_E
X000
CPY_BITARR_E
BitArrOut
EN
Label1[*1]
K4
BitArrIn
n
ENO
BitArrOut
Label2[*1]
CPY_BITARR(BitArrIn, n);
Example:
Label2[*1]:= CPY_BITARR
(Label1[*1], K4);
CPY_BITARR_E(EN, BitArrIn,
n, BitArrOut);
Example:
CPY_BITARR_E(X000,
Label1[*1], K4, Label2[*1]);
2. Set data
Variable
Description
EN
Input
variable
BitArrIn
Execution condition
( s )
Output
variable
Data type
Bit
Bit
Word [signed]
ENO
Execution status
Bit
BitArrOut ( d )
Bit
to a device specified in
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
146
In this program, 12 bits starting from the "num1"th element of a bit array stored in a device specified in
are output to the "num2"th element and later of a bit array stored in a device specified in d .
2
Function/
Operator List
[Structured ladder/FBD]
CPY_BITARR
g_bool4[num1]
K12
BitArrIn
n
BitArrOut
Outline
Program example
g_bool5[num2]
[ST]
3
Function
Construction
CPY_BITARR_E
g_bool1
K12
EN
BitArrIn
ENO
BitArrOut
How to Read
Explanation of
Functions
g_bool4[num1]
g_bool2
g_bool5[num2]
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
147
5.54
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function reads a value of a specified bit of word [signed] data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
GET_BIT_OF_INT
GET_BIT_OF_INT
D10
K2
M10
GET_BIT_OF_INT_E
X000
EN
GET_BIT_OF_INT_E
D10
K2
*1.
*1
s
n
ENO
*1
M10
GET_BIT_OF_INT(s, n);
Example:
M10:= GET_BIT_OF_INT
(D10, K2);
GET_BIT_OF_INT_E(EN, s, n,
*1);
Example:
GET_BIT_OF_INT_E(X000,
D10, K2, M10);
Output variable
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Bit
Word [signed]
Word [signed]
ENO
*1
Data type
Execution condition
( d )
Execution status
Bit
Bit
Cautions
1) Use the function having "_E" in its name to connect a bus.
148
2
Function/
Operator List
[Structured ladder/FBD]
GET_BIT_OF_INT
g_int1
g_bool3
s
n
K5
Outline
Program example
[ST]
3
Function
Construction
GET_BIT_OF_INT_E
g_bool1
K5
ENO
g_bool2
How to Read
Explanation of
Functions
g_int1
EN
s
g_bool3
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
149
5.55
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function writes a value to a specified bit of word [signed] data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
SET_BIT_OF_INT
SET_BIT_OF_INT
M0
K4
D10
SET_BIT_OF_INT_E
X000
EN
SET_BIT_OF_INT_E
M0
K4
*1.
*1
s
n
ENO
*1
D10
SET_BIT_OF_INT(s, n);
Example:
D10:= SET_BIT_OF_INT
(M0, K4);
SET_BIT_OF_INT_E(EN, s,
n, *1);
Example:
SET_BIT_OF_INT_E(X000,
M0, K4, D10);
Output variable
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Execution condition
Bit
Word [signed]
ENO
*1
Data type
Bit
( d )
Execution status
Bit
Word [signed]
Cautions
1) Use the function having "_E" in its name to connect a bus.
150
Outline
Program example
1) Function without EN/ENO(SET_BIT_OF_INT)
[Structured ladder/FBD]
g_bool1
g_int3
s
n
K3
Function/
Operator List
SET_BIT_OF_INT
[ST]
Function
Construction
SET_BIT_OF_INT_E
g_bool2
K3
ENO
g_bool3
g_int3
How to Read
Explanation of
Functions
g_bool1
EN
s
[ST]
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
151
5.56
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function copies a specified bit of word [signed] data to a specified bit of another word [signed] data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
CPY_BIT_OF_INT
CPY_BIT_OF_INT
D0
K1
n1
K4
n2
*1.
D10
CPY_BIT_OF_INT_E
X000
CPY_BIT_OF_INT_E
*1
D0
EN
s
K1
n1
K4
n2
ENO
*1
D10
CPY_BIT_OF_INT_E(EN, s,
n1, n2, *1);
Example:
CPY_BIT_OF_INT_E(X000,
D0, K1, K4, D10);
Output variable
2. Set data
Variable
Description
EN
Input
variable
s
n1
n2
Output
variable
Data type
Execution condition
Bit
Word [signed]
Word [signed]
Word [signed]
ENO
Execution status
Bit
*1
Word [signed]
( d )
Cautions
1) Use the function having "_E" in its name to connect a bus.
152
2
Function/
Operator List
[Structured ladder/FBD]
CPY_BIT_OF_INT
g_int1
g_int3
s
n1
n2
K5
K3
[ST]
Function
Construction
[Structured ladder/FBD]
g_int1
EN
s
K5
K3
n1
n2
ENO
How to Read
Explanation of
Functions
CPY_BIT_OF_INT_E
g_bool2
Outline
Program example
g_bool3
g_int3
[ST]
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
153
5.57
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function outputs the start data as bit data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
GET_BOOL_ADDR(s);
Example:
M10:= GET_BOOL_ADDR
(Label);
GET_BOOL_ADDR
GET_BOOL_ADDR
*1.
ST
Label
*1
M10
Output variable
2. Set data
Variable
Input
variable
Description
Output
variable
*1
( d )
Data type
Input data
ANY
Output data
Bit
Cautions
When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may be
generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Program example
In this program, MOV instruction is executed using the start bit of bit array data stored in a device specified in
s .
[Structured ladder/FBD]
GET_BOOL_ADDR
g_array
MOV
EN
g_int1
ENO
[ST]
154
g_int2
FX3G(C)
FX3S
FX2N(C)
Outline
5.58
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function outputs the start data as word [signed] data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
*1.
Label
*1
D10
Function
Construction
GET_INT_ADDR
GET_INT_ADDR
ST
GET_INT_ADDR(s);
Example:
D10:= GET_INT_ADDR
(Label);
Output variable
2. Set data
Output
variable
Description
*1
( d )
How to Read
Explanation of
Functions
Variable
Input
variable
Data type
Input data
ANY
Output data
Word [signed]
Applied Functions
(Type Conversion
Functions)
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
Program example
s
[Structured ladder/FBD]
GET_INT_ADDR
g_dint1
EN
k0
k27
k1
s
n1
n2
n3
TO
ENO
10
Applied Functions
(Standard Selection
Functions)
g_bool1
9
Applied Functions
(Standard Bitwise
Boolean Functions)
In this program, low-order 16-bit data of double word [signed] data specified in
data to buffer memories.
8
Applied Functions
(Standard Bit
Shift Functions)
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Applied Functions
(Standard Arithmetic
Functions)
Cautions
[ST]
155
5.59
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function outputs the start data as word [unsigned]/bit string [16-bit] data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
GET_WORD_ADDR
GET_WORD_ADDR
*1.
ST
Label
*1
D10
GET_WORD_ADDR(s);
Example:
D10:= GET_WORD_ADDR
(Label);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
*1
( d )
Data type
Input data
ANY
Output data
Word [unsigned]/
Bit String [16-bit]
.
Input data type
Cautions
1) When handling 32-bit data and array data in structured programs, you cannot specify 16-bit devices
directly, different from simple projects. Use labels when handling 32-bit data and array data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Program example
In this program, low-order 16-bit data of double word [signed] data specified in
[unsigned]/bit string [16-bit] data to buffer memories.
[Structured ladder/FBD]
GET_WORD_ADDR
g_dint1
g_bool1
EN
k0
k27
k1
s
n1
n2
n3
TO
ENO
[ST]
156
is written as word
Function/
Operator List
Function
Construction
How to Read
Explanation of
Functions
Applied Functions
(Type Conversion
Functions)
Applied Functions
(Standard Functions Of
One Numeric Variable)
Applied Functions
(Standard Arithmetic
Functions)
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Bitwise
Boolean Functions)
Applied Functions
(Standard Selection
Functions)
157
Outline
Section 6.1
Absolute value
ABS(_E)
Reference
Function
Function name
10
6.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function obtains the absolute value, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ABS
ABS
D0
X000
ABS_E
D0
*1.
ST
_IN
*1
ABS_E
EN
ENO
_IN
*1
D10
ABS(_IN);
Example:
D10:=
ABS(D0);
ABS_E(EN,_IN,Output_label);
Example:
ABS_E(X000,D0,D10);
D10
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
_IN ( s )
ENO
Execution status
Bit
*1
ANY_NUM
( d )
Bit
B= A
2) When the data type stored in a device specified in s is word [signed] and the stored data is "-32768",
this function outputs "-32768" to a device specified in d . (The maximum absolute value handled by this
function is "32,767".)
When the data type stored in a device specified in s is double word [signed] and the stored data is "2147483648", this function outputs "-2147483648" to a device specified in d . (The maximum absolute
value handled by this function is "2147483647".)
158
1
Outline
Cautions
1) Use the function having "_E" in its name to connect a bus.
Program example
In this program, the absolute value is obtained for word [signed] data stored in a device specified in s , and
the operation result is output to a device specified in d using the data type same as the data stored in a
device specified in s .
2
Function/
Operator List
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
3
Function
Construction
ABS
g_int1=-5923
g_int2=5923
_IN
4
How to Read
Explanation of
Functions
[ST]
g_int2 := ABS(g_int1);
[Structured ladder/FBD]
g_int1
Applied Functions
(Type Conversion
Functions)
ABS_E
g_bool1
EN
_IN
ENO
g_bool3
g_int2
[ST]
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
159
7.
Function
Reference
ADD_E
Addition
Section 7.1
SUB_E
Subtraction
Section 7.2
MUL_E
Multiplication
Section 7.3
DIV_E
Division
Section 7.4
Modulus operation
Section 7.5
EXPT(_E)
Exponentiation
Section 7.6
MOVE(_E)
Move operation
Section 7.7
MOD(_E)
160
ADD_E / Addition
Outline
7.1
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function performs addition using two values (A + B = C), and outputs the operation result.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ADD_E
*1.
D0
D10
D20
Function
Construction
ADD_E
EN
ENO
_IN
*1
_IN
X000
ST
ADD_E(EN,_IN,_IN,
Output_label);
Example:
ADD_E(X000,D0,D10,D20);
Output variable
How to Read
Explanation of
Functions
2. Set data
Variable
Description
Data type
EN
Execution condition
Bit
_IN ( s1 to s28 )
ANY_NUM
Output
variable
ENO
Execution status
Bit
ANY_NUM
*1
( d )
5
Applied Functions
(Type Conversion
Functions)
Input
variable
1234
6912
s1 (Word
s2 (Word
[signed] data)
[signed] data)
(Word
[signed] data)
Applied Functions
(Standard Arithmetic
Functions)
5678
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) This function performs addition ( s1 + s2 + s28 ) using word [signed]/double word [signed]/float
(single precision) data stored in devices specified in s1 to s28 , and outputs the operation result to a
device specified in d using the data type of data stored in devices specified in s1 to s28 .
Example: When the data type is word [signed]
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
161
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
"TRUE" is output from ENO.
However, note that the obtained operation result is not accurate in this case.
Either of the flags shown in the table below turns ON or OFF in accordance with the operation result.
Device
Name
Description
ON : When the operation result is "0"
OFF: When the operation result is any other than "0"
M8020
Zero
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 the operation result is "-32,768" (16-bit operation) or more or "-2,147,483,648" (32bit operation) or more
Carry
ON : When the operation result exceeds "32,767" (16-bit operation) or "2,147,483,647" (32-bit
operation)
OFF: When the operation result is "32,767" (16-bit operation) or less or "2,147,483,647" (32-bit
operation) or less
M8022
Zero flag
Zero flag
-2 , -1 , 0 ,
-1 , 0 , 1
-32,768
Borrow flag
The most
significant bit
of data is "1".
32,767 ,
The most
significant bit
of data is "0".
Zero flag
-2 , -1 , 0 ,
Zero flag
0, 1, 2
Carry flag
Zero flag
-1 , 0 , 1
-2,147,483,648
Borrow flag
Zero flag
2,147,483,647 ,
0, 1, 2
Carry flag
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Program example
In this program, addition is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
ADD_E
g_bool1
g_dint1
g_dint2
EN
_IN
ENO
g_bool3
g_dint3
_IN
[ST]
g_bool3:=ADD_E(g_bool1,g_dint1,g_dint2,g_dint3);
162
SUB_E / Subtraction
Outline
7.2
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function performs subtraction using two values (A - B = C), and outputs the operation result.
1. Format
Expression in each language
Function name
Structured ladder/FBD
SUB_E
*1.
D0
D10
SUB_E
EN
ENO
_IN1
*1
_IN2
D20
Function
Construction
X000
ST
SUB_E(EN,_IN1,_IN2,
Output_label);
Example:
SUB_E(X000,D0,D10,D20);
Output variable
How to Read
Explanation of
Functions
2. Set data
Variable
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
ANY_NUM
_IN2 ( s2 )
ANY_NUM
ENO
Execution status
Bit
ANY_NUM
*1
( d )
5
Applied Functions
(Type Conversion
Functions)
Output
variable
Description
12345
6789
5556
s2 (Word
[signed] data)
d (Word
[signed] data)
7
Applied Functions
(Standard Arithmetic
Functions)
s1 (Word
[signed] data)
Applied Functions
(Standard Functions Of
One Numeric Variable)
This function performs subtraction ( s1 - s2 ) using word [signed]/double word [signed]/float (single
precision) data stored in devices specified in s1 and s2 , and outputs the operation result to a device
specified in d using the data type of data stored in devices specified in s1 and s2 .
Example: When the data type is word [signed]
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
163
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
"TRUE" is output from ENO.
However, note that the obtained operation result is not accurate in this case.
Either of the flags shown in the table below turns ON or OFF in accordance with the operation result.
Device
Name
Description
ON : When the operation result is "0"
OFF: When the operation result is any other than "0"
M8020
Zero
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 the operation result is "-32,768" (16-bit operation) or more or "-2,147,483,648" (32bit operation) or more
Carry
ON : When the operation result exceeds "32,767" (16-bit operation) or "2,147,483,647" (32-bit
operation)
OFF: When the operation result is "32,767" (16-bit operation) or less or "2,147,483,647" (32-bit
operation) or less
M8022
Zero flag
Zero flag
-2 , -1 , 0 ,
-1 , 0 , 1
-32,768
Borrow flag
The most
significant bit
of data is "1".
32,767 ,
The most
significant bit
of data is "0".
Zero flag
-2 , -1 , 0 ,
Zero flag
0, 1, 2
Carry flag
Zero flag
-1 , 0 , 1
-2,147,483,648
Borrow flag
Zero flag
2,147,483,647 ,
0, 1, 2
Carry flag
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Program example
In this program, subtraction is performed using word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
SUB_E
g_bool1
g_int1
g_int2
EN
_IN1
ENO
g_bool3
g_int3
_IN2
[ST]
g_bool3:=SUB_E(g_bool1,g_int1,g_int2,g_int3);
164
MUL_E / Multiplication
FX3U(C)
Outline
7.3
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
This function performs multiplication using two or more values (A B = C), and outputs the operation result.
1. Format
Expression in each language
Function name
Structured ladder/FBD
MUL_E
*1.
D0
D10
MUL_E
EN
ENO
_IN
*1
_IN
ST
MUL_E(EN,_IN,_IN,
Output_label);
Example:
MUL_E(X000,D0,D10,D20);
D20
Function
Construction
X000
Output variable
How to Read
Explanation of
Functions
2. Set data
Variable
Description
Data type
EN
Execution condition
Bit
_IN ( s1 to s28 )
ANY_NUM
Output
variable
ENO
Execution status
Bit
ANY_NUM
( d )
5
Applied Functions
(Type Conversion
Functions)
Input
variable
*1
15
1500
(Word
[signed] data)
(Word
[signed] data)
(Word
[signed] data)
s2
Applied Functions
(Standard Arithmetic
Functions)
100
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) This function performs multiplication ( s1 s2 s28 ) using word [signed]/double word [signed]/float
(single precision) data stored in devices specified in s1 to s28 , and outputs the operation result to a
device specified in d using the data type of data stored in devices specified in s1 to s28 .
Example: When the data type is word [signed]
s1
Function/
Operator List
Outline
Cautions
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
Applied Functions
(Standard Bit
Shift Functions)
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
10
Applied Functions
(Standard Selection
Functions)
165
Program example
In this program, multiplication is performed using double word [signed] data stored in devices specified in
s1 and s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
MUL_E
g_bool1
g_dint1
g_dint2
EN
_IN
ENO
g_bool3
g_dint3
_IN
[ST]
g_bool3:=MUL_E(g_bool1,g_dint1,g_dint2,g_dint3);
166
DIV_E / Division
Outline
7.4
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function performs division using two values (A / B = C remainder), and outputs the quotient.
1. Format
Expression in each language
Function name
Structured ladder/FBD
DIV_E
*1.
D0
D10
DIV_E
EN
ENO
_IN1
*1
_IN2
D20
Function
Construction
X000
ST
DIV_E(EN,_IN1,_IN2,
Output_label);
Example:
DIV_E(X000,D0,D10,D20);
Output variable
How to Read
Explanation of
Functions
2. Set data
Variable
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
ANY_NUM
_IN2 ( s2 )
Data for division (divisor), or word device which stores such data
ANY_NUM
ENO
Execution status
Bit
ANY_NUM
*1
( d )
5
Applied Functions
(Type Conversion
Functions)
Output
variable
Description
s1 (Word
[signed] data)
2
s2 (Word
[signed] data)
(Quotient)
2
Applied Functions
(Standard Arithmetic
Functions)
Applied Functions
(Standard Functions Of
One Numeric Variable)
This function performs division ( s1 / s2 ) using word [signed]/double word [signed]/float (single precision)
data stored in devices specified in s1 and s2 , and outputs the operation result to a device specified in
d using the data type of data stored in devices specified in s1 and s2 .
Example: When the data type is word [signed]
d (Word
[signed] data)
Cautions
Applied Functions
(Standard Bit
Shift Functions)
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Error
2) An operation error occurs when the operation result exceeds "32,767" (16-bit operation) or
"2,147,483,647" (32-bit operation).
167
10
Applied Functions
(Standard Selection
Functions)
1) An operation error occurs when the divisor stored in a device specified in s2 is "0", and the function is
not executed.
Applied Functions
(Standard Bitwise
Boolean Functions)
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
Program example
In this program, division is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d using the data type of data stored in
devices specified in s1 and s2 .
[Structured ladder/FBD]
DIV_E
g_bool1
g_dint1
g_dint2
EN
_IN1
ENO
g_bool3
g_dint3
_IN2
[ST]
g_bool3:=DIV_E(g_bool1,g_dint1,g_dint2,g_dint3);
168
FX3G(C)
Outline
7.5
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function performs division using two values (A / B = C remainder), and outputs the remainder.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
MOD_E
*1.
Output variable
*2.
Refer to "Cautions".
MOD_E
EN
ENO
_IN1
*1
_IN2
Label3
MOD_E(EN,_IN1,_IN2,
Output_label); *2
Example:
MOD_E(X000,Label1,
Label2,Label3);
Label3
4
How to Read
Explanation of
Functions
Label1
Label2
MOD
_IN1
*1
_IN2
Function
Construction
MOD
ST
_IN1 MOD _IN2; *2
Example:
Label3:=
Label1 MOD Label2;
Variable
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
ANY_INT
_IN2 ( s2 )
Data for division (divisor), or word device which stores such data
ANY_INT
ENO
Execution status
Bit
ANY_INT
*1
( d )
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Output
variable
Description
Applied Functions
(Type Conversion
Functions)
2. Set data
2
s2 (Word
[signed] data)
(Quotient)
2
Not output
(Remainder)
1
8
Applied Functions
(Standard Bit
Shift Functions)
s1 (Word
[signed] data)
7
Applied Functions
(Standard Arithmetic
Functions)
This function performs division ( s1 / s2 ) using word [signed]/double word [signed] data stored in devices
specified in s1 and s2 , and outputs the remainder to a device specified in d using the data type of
data stored in devices specified in s1 and s2 .
Example: When the data type is word [signed]
d (Word
[signed] data)
Cautions
1) Use the function having "_E" in its name to connect a bus.
3) Note that the "MOD" description method is different from other function description methods in the ST
language.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
10
Applied Functions
(Standard Selection
Functions)
169
Error
1) An operation error occurs when the divisor stored in a device specified in s2 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).
Program example
In this program, division is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the remainder is output to a device specified in d using the data type of data stored in devices
specified in s1 and s2 .
1) Function without EN/ENO(MOD)
[Structured ladder/FBD]
MOD
g_dint1=5678
g_dint2=1234
g_dint3=742
_IN1
_IN2
[ST]
MOD_E
g_bool1
g_dint1
g_dint2
EN
_IN1
ENO
g_bool3
g_dint3
_IN2
[ST]
170
EXPT(_E) / Exponentiation
FX3U(C)
Outline
7.6
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function obtains raised result, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
EXPT_E
In1
In2
X000
EXPT_E
EN
ENO
In1
*1
In2
Label1
D10
Label2
*1
Label2
EXPT_E(EN,In1,In2,
Output_label);
Example:
EXPT_E(X000,Label1,D10,
Label2);
4
How to Read
Explanation of
Functions
*1.
Label1
D10
Function
Construction
EXPT
EXPT
ST
EXPT(In1,In2);
Example:
Label2:=
EXPT(Label1,D10);
Output variable
2. Set data
EN
Input
variable
Output
variable
In1
( s1 )
In2
( s2 )
ENO
*1
( d )
Description
Data type
Execution condition
Bit
ANY_NUM
Execution status
Bit
s1 Float (single
precision) data
Word
[signed] data
s2
7
Applied Functions
(Standard Arithmetic
Functions)
2
4.0
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
Applied Functions
(Type Conversion
Functions)
Variable
16.0
d
Float (single
precision) data
9
Applied Functions
(Standard Bitwise
Boolean Functions)
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Applied Functions
(Standard Bit
Shift Functions)
Cautions
10
Applied Functions
(Standard Selection
Functions)
171
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the value stored in a device specified in s1 is negative
(Error code: K6706)
2) When the value stored in a device specified in s1 is "0"
(Error code: K6706)
3) When the operation result is outside the following range:
(Error code: K6706)
2-126Operation result<2128
Program example
In this program, the value stored in a device specified in s1 is raised to the power of the value stored in a
device specified in s2 , and the operation result is output to a device specified in d using the data type of
data stored in a device specified in s1 .
1) Function without EN/ENO(EXPT)
[Structured ladder/FBD]
EXPT
g_real1
g_int1
g_real2
In1
In2
[ST]
g_real2:=EXPT(g_real1,g_int1);
g_bool1
g_real1
g_int1
EN
In1
EXPT_E
ENO
g_bool3
g_real2
In2
[ST]
g_bool3:=EXPT_E(g_bool1,g_real1,g_int1,g_real2);
172
FX3G(C)
Outline
7.7
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function transfers data stored in a device to another device.
1. Format
Expression in each language
Function name
Structured ladder/FBD
D0
X000
MOVE_E
*1.
MOVE_E
EN
ENO
_IN
*1
D10
MOVE_E(EN,_IN,Output_label);
Example:
MOVE_E(X000,D0,D10);
D10
How to Read
Explanation of
Functions
D0
MOVE
_IN
*1
Function
Construction
MOVE
ST
MOVE(_IN);
Example:
D10:=
MOVE(D0);
Output variable
2. Set data
Variable
Description
Execution condition
Bit
_IN ( s )
ANY
Output
variable
ENO
Execution status
Bit
ANY
( d )
Applied Functions
(Type Conversion
Functions)
EN
*1
Data type
Input
variable
Applied Functions
(Standard Functions Of
One Numeric Variable)
to a device specified in
12
d
Applied Functions
(Standard Arithmetic
Functions)
Cautions
1) Use the function having "_E" in its name to connect a bus.
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
8
Applied Functions
(Standard Bit
Shift Functions)
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.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
173
Program example
In this program, word [signed] data stored in a device specified in
d .
1) Function without EN/ENO(MOVE)
[Structured ladder/FBD]
MOVE
g_int1
g_int2
_IN
[ST]
g_int2:=MOVE(g_int1);
g_bool1
g_int1
EN
_IN
MOVE_E
ENO
g_bool3
g_int2
[ST]
g_bool3:=MOVE_E(g_bool1,g_int1,g_int2);
174
SHL(_E)
Left shift
Section 8.1
SHR(_E)
Right shift
Section 8.2
Function
Construction
How to Read
Explanation of
Functions
Applied Functions
(Type Conversion
Functions)
Applied Functions
(Standard Functions Of
One Numeric Variable)
Applied Functions
(Standard Arithmetic
Functions)
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Bitwise
Boolean Functions)
Applied Functions
(Standard Selection
Functions)
175
Function/
Operator List
Reference
Function
Function name
Outline
10
8.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function shifts data of specified bit length leftward by the specified number of bits.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
SHL(_IN,_N);
Example:
D10:=
SHL(D0,K1);
SHL
SHL
D0
K1
_IN
_N
SHL_E
EN
ENO
_IN
*1
_N
X000
SHL_E
*1.
*1
D0
K1
D10
SHL_E(EN,_IN,_N,Output_label);
Example:
SHL_E(X000,D0,K1,D10);
D10
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
_IN ( s )
ANY_BIT
_N ( n )
ANY_BIT
ENO
Execution status
Bit
ANY_BIT
*1
( d )
Bit
F00H
s
(Word [unsigned]/
bit string [16-bit] data)
d (Word [unsigned]/
bit string [16-bit] data)
270FH
F00H
176
Outline
Cautions
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.
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in s is shifted leftward
by "n" bits, and the obtained data is output to a device specified in d using the data type of data stored in a
device specified in s .
Function/
Operator List
Program example
3
Function
Construction
SHL
g_word1=16#F30F
g_const_word1=16#0008
g_word2=16#0F00
_IN
_N
How to Read
Explanation of
Functions
[ST]
g_word2:=SHL(g_word1,g_const_word1);
SHL_E
g_bool1
g_word1
g_const_word1
Applied Functions
(Type Conversion
Functions)
[Structured ladder/FBD]
EN
_IN
ENO
g_bool3
g_word2
_N
[ST]
Applied Functions
(Standard Functions Of
One Numeric Variable)
g_bool3:=SHL_E(g_bool1,g_word1,g_const_word1,g_word2);
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
177
8.2
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function shifts data of specified bit length rightward by the specified number of bits.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
SHR(_IN,_K);
Example:
D10:=
SHR(D0,K1);
SHR
SHR
D0
K1
_IN
_K
SHR_E
EN
ENO
_IN
*1
_N
X000
SHR_E
*1.
*1
D0
K1
D10
SHR_E(EN,_IN,_N,Output_label);
Example:
SHR_E(X000,D0,K1,D10);
D10
Output variable
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Data type
Execution condition
Bit
ANY_BIT
_K,_N ( n )
ANY_BIT
ENO
Execution status
Bit
ANY_BIT
_IN
( s )
*1
( d )
27H
s (Word [unsigned]/
bit string [16-bit] data)
d (Word [unsigned]/
bit string [16-bit] data)
270FH
27H
178
Outline
Cautions
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.
In this program, word [unsigned]/bit string [16-bit] data stored in a device specified in s is shifted rightward
by "n" bits, and the obtained data is output to a device specified in d using the data type of data stored in a
device specified in s .
Function/
Operator List
Program example
3
Function
Construction
SHR
g_word1=16#EEEE
g_const_word1=16#0006
g_word2=16#03BB
_IN
_K
How to Read
Explanation of
Functions
[ST]
g_word2:=SHR(g_word1,g_const_word1);
SHR_E
g_bool1
g_word1
g_const_word1
Applied Functions
(Type Conversion
Functions)
[Structured ladder/FBD]
EN
_IN
ENO
g_bool3
g_word2
_N
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
[ST]
g_bool3:=SHR_E(g_bool1,g_word1,g_const_word1,g_word2);
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
179
9.
180
Function
Logical product
Reference
Section 9.1
Logical sum
Section 9.2
Section 9.3
Logical negation
Section 9.4
Outline
9.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function obtains the logical product of two or more bits, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
AND_E
*1.
M0
M10
AND_E
EN
ENO
*1
_IN
_IN
M20
Function
Construction
X000
ST
AND_E(EN,_IN,_IN,
Output_label);
Example:
AND_E(X000,M0,M10,M20);
Output variable
How to Read
Explanation of
Functions
2. Variable
Variable
Description
Data type
EN
ANY_BIT
Output
variable
ENO
Execution status
Bit
ANY_BIT
*1
Execution condition
( d )
Bit
5
Applied Functions
(Type Conversion
Functions)
Input
variable
s1
Cautions
1) Use the function having "_E" in its name to connect a bus.
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
Applied Functions
(Standard Bit
Shift Functions)
2)
Applied Functions
(Standard Arithmetic
Functions)
Logical product
s2
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) This function obtains the logical product using each bit of bit/word [unsigned]/bit string [16-bit]/double
word [unsigned]/bit string [32-bit] data stored in devices specified in s1 to s28 , and outputs the
operation result to a device specified in d using the data type of data stored in devices specified in
s1 to s28 .
Example: When the data type is word [unsigned]/bit string [16-bit]
10
Applied Functions
(Standard Selection
Functions)
181
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 s1 and s2 , and the operation result is output to a device specified in d using the
data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
AND_E
g_bool1
g_word1
g_word2
EN
_IN
ENO
g_bool3
g_word3
_IN
[ST]
g_bool3:=AND_E(g_bool1,g_word1,g_word2,g_word3);
182
Outline
9.2
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function obtains the logical sum of two or more bits, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
OR_E
*1.
M0
M10
Function
Construction
OR_E
EN
ENO
_IN
*1
_IN
X000
ST
OR_E(EN,_IN,_IN,Output_label);
Example:
OR_E(X000,M0,M10,M20);
M20
Output variable
How to Read
Explanation of
Functions
2. Set data
Variable
Description
Data type
ANY_BIT
Output
variable
ENO
Execution status
Bit
ANY_BIT
*1
Execution condition
( d )
Bit
5
Applied Functions
(Type Conversion
Functions)
Input
variable
EN
s1
Logical sum
0
Cautions
9
Applied Functions
(Standard Bitwise
Boolean Functions)
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
8
Applied Functions
(Standard Bit
Shift Functions)
Applied Functions
(Standard Arithmetic
Functions)
s2
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) This function obtains the logical sum using each bit of bit/word [unsigned]/bit string [16-bit]/double word
[unsigned]/bit string [32-bit] data stored in devices specified in s1 to s28 , and outputs the operation
result to a device specified in d using the data type of data stored in devices specified in s1 to s28 .
Example: When the data type is word [unsigned]/bit string [16-bit]]
10
Applied Functions
(Standard Selection
Functions)
183
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 s1 and s2 , and the operation result is output to a device specified in d using the
data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
OR_E
g_bool1
g_word1
g_word2
EN
_IN
ENO
g_bool3
g_word3
_IN
[ST]
g_bool3:=OR_E(g_bool1,g_word1,g_word2,g_word3);
184
FX3G(C)
Outline
9.3
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function obtains the exclusive logical sum of two or more bits, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
XOR_E
*1.
M0
M10
M20
Function
Construction
XOR_E
EN
ENO
_IN
*1
_IN
X000
ST
XOR_E(EN,_IN,_IN,
Output_label);
Example:
XOR_E(X000,M0,M10,M20);
Output variable
How to Read
Explanation of
Functions
2. .Set data
Variable
Output
variable
ENO
Description
Bit
_IN ( s1
*1
Data type
Execution condition
( d )
ANY_BIT
Execution status
Bit
ANY_BIT
5
Applied Functions
(Type Conversion
Functions)
Input
variable
EN
7
Applied Functions
(Standard Arithmetic
Functions)
s1
Applied Functions
(Standard Bit
Shift Functions)
2)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
1) This function obtains the exclusive logical sum using each bit of bit/word [unsigned]/bit string [16-bit]/
double word [unsigned]/bit string [32-bit] data stored in devices specified in s1 to s28 , and outputs the
operation result to a device specified in d using the data type of data stored in devices specified in
s1 to s28 .
Example: When the data type is word [unsigned]/bit string [16-bit]
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
185
3) If there are 3 or more s , the exclusive logical sum is obtained using the "exclusive logical sum of s1
and s2 " and s3 .
If there is s4 , the exclusive logical sum is obtained using the "exclusive logical sum of "exclusive logical
sum of s1 and s2 " and " s3 "" and s4 . In this way, the exclusive logical sum is obtained the
s6
required number of times for all input labels s5
Example: When the data type is bit
When the number
of "_IN" is 3
s1
s2
FALSE
TRUE
FALSE
TRUE
XOR
XOR
XOR
XOR
TRUE
Result TRUE
s3
TRUE
Result FALSE
s4
TRUE
Result TRUE
s5
TRUE
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
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 s1 and s2 , and the operation result is output to a device specified in d
using the data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
XOR_E
g_bool1
g_word1
g_word2
EN
_IN
ENO
g_bool3
g_word3
_IN
[ST]
g_bool3:=XOR_E(g_bool1,g_word1,g_word2,g_word3);
186
Outline
9.4
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
2
Function/
Operator List
Outline
This function obtains the logical negation of bits, and outputs it.
1. Format
Expression in each language
Function name
Structured ladder/FBD
M0
X000
NOT_E
*1.
*1
M10
NOT_E(EN,_IN,Output_label);
Example:
NOT_E(X000,M0,M10);
NOT_E
EN
ENO
_IN
*1
4
How to Read
Explanation of
Functions
M0
_IN
Function
Construction
NOT
NOT
ST
NOT(_IN);
Example:
M10:=
NOT(M0);
M10
Output variable
2. Set data
Input
variable
EN
Output
variable
Description
Execution condition
Bit
_IN ( s )
ANY_BIT
ENO
Execution status
Bit
ANY_BIT
*1
( d )
Data type
Applied Functions
(Type Conversion
Functions)
Variable
Logical negation
d
7
Applied Functions
(Standard Arithmetic
Functions)
This function obtains the logical negation using each bit of bit/word [unsigned]/bit string [16-bit]/double word
[unsigned]/bit string [32-bit] data stored in a device specified in s , and outputs the operation result to a
device specified in d using the data type of data stored in a device specified in s .
Example: When the data type is word [unsigned]/bit string [16-bit]
Applied Functions
(Standard Functions Of
One Numeric Variable)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
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.
Applied Functions
(Standard Bit
Shift Functions)
Cautions
10
Applied Functions
(Standard Selection
Functions)
187
Program example
In this program, the logical negation is obtained using each bit of word [unsigned]/bit string [16-bit] data stored
in a device specified in s , and the operation result is output to a device specified in d using the data
type of data stored in a device specified in s .
1) Function without EN/ENO(NOT)
[Structured ladder/FBD]
NOT
g_word1
g_word2
_IN
[ST]
g_word2:= NOT(g_word1);
NOT_E
g_bool1
g_word1
EN
_IN
ENO
g_bool3
g_word2
[ST]
g_bool3:=NOT_E(g_bool1,g_word1,g_word2);
188
1
Outline
2
SEL(_E)
MAXIMUM(_E)
MINIMUM(_E)
LIMITATION(_E)
Reference
Section 10.1
Maximum selection
Section 10.2
Minimum selection
Section 10.3
Section 10.4
Multiplexer
Section 10.5
3
Function
Construction
MUX(_E)
Function
Selection
Function/
Operator List
Function name
4
How to Read
Explanation of
Functions
5
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
189
10.1
SEL(_E) / Selection
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function selects either one between two data in accordance with the input condition, and outputs the
selection result.
1. Format
Expression in each language
Function name
Structured ladder/FBD
M0
D0
D10
SEL
X000
SEL_E
*1.
M0
D0
D10
SEL
_G
*1
_IN0
_IN1
SEL_E
EN
ENO
_G
*1
_IN0
_IN1
ST
D20
D20
SEL(_G,_IN0,_IN1);
Example:
D20:=
SEL(M0,D0,D10);
SEL_E(EN,_G,_IN0,_IN1,
Output_label);
Example:
SEL_E(X000,M0,D0,D10,D20);
Output variable
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Data type
Execution condition
Bit
Bit
_IN0 ( s2 )
ANY
_IN1 ( s3 )
ANY
ENO
Execution status
Bit
ANY
_G
*1
( s1 )
( d )
190
SEL
G
_IN0
_IN1
1234
Word [signed] data
Outline
Cautions
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.
In this program, either one between the values stored in devices specified in s2 and s3 is output in
accordance with the value stored in a device specified in s1 to a device specified in d using the data
type of data stored in devices specified in s2 and s3 .
1) Function without EN/ENO(SEL)
4
How to Read
Explanation of
Functions
[Structured ladder/FBD]
SEL
g_bool1
g_word1
_G
g_word2
_IN1
g_word3
_IN0
5
Applied Functions
(Type Conversion
Functions)
[ST]
g_word3:=SEL(g_bool1,g_word1,g_word2);
[Structured ladder/FBD]
Applied Functions
(Standard Functions Of
One Numeric Variable)
SEL_E
g_bool1
g_word2
Function
Construction
Program example
g_bool2
g_word1
Function/
Operator List
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
EN
_G
ENO
g_bool3
g_word3
_IN0
_IN1
7
Applied Functions
(Standard Arithmetic
Functions)
[ST]
g_bool3:=SEL_E(g_bool1,g_bool2,g_word1,g_word2,g_word3);
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
191
10.2
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function searches the maximum value among data, and outputs the maximum value.
1. Format
Expression in each language
Function name
Structured ladder/FBD
MAXIMUM
D0
D10
X000
MAXIMUM_E
*1.
D0
D10
MAXIMUM
_IN
*1
_IN
MAXIMUM_E
EN
ENO
_IN
*1
_IN
ST
D20
D20
MAXIMUM(_IN,_IN);
Example:
D20:=
MAXIMUM(D0,D10);
MAXIMUM_E(EN,_IN,_IN,
Output_label);
Example:
MAXIMUM_E(X000,D0,D10,D20);
Output variable
2. Set data
Variable
Description
Execution condition
Data type
Input
variable
EN
Bit
Output
variable
ENO
Execution status
Bit
*1
ANY_SIMPLE
_IN ( s1 to s28 ) Compared data, or word device which stores such data
( d )
ANY_SIMPLE
MAXIMUM
_IN
_IN
5678
Word [signed] data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
192
In this program, the maximum value among word [signed] data stored in devices specified in s1 and s2 is
output to a device specified in d using the data type of data stored in devices specified in s1 and s2 .
1) Function without EN/ENO(MAXIMUM)
[Structured ladder/FBD]
Function/
Operator List
MAXIMUM
g_int1=5678
g_int2=1234
_IN
Outline
Program example
g_int3=5678
_IN
[ST]
g_int3:=MAXIMUM(g_int1,g_int2);
Function
Construction
g_bool1
g_bool3
How to Read
Explanation of
Functions
g_int1
g_int2
MAXIMUM_E
EN
ENO
_IN
g_int3
_IN
[ST]
g_bool3:=MAXIMUM_E(g_bool1,g_int1,g_int2,g_int3);
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
193
10.3
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function searches the minimum value among data, and outputs the minimum value.
1. Format
Expression in each language
Function name
Structured ladder/FBD
MINIMUM
D0
D10
X000
MINIMUM_E
*1.
D0
D10
MINIMUM
_IN
*1
_IN
MINIMUM_E
EN
ENO
_IN
*1
_IN
ST
D20
D20
MINIMUM(_IN,_IN);
Example:
D20:=
MINIMUM(D0,D10);
MINIMUM_E(EN,_IN,_IN,
Output_label);
Example:
MINIMUM_E(X000,D0,D10,D20);
Output variable
2. Set data
Variable
Description
Execution condition
Data type
Input
variable
EN
Bit
Output
variable
ENO
Execution status
Bit
*1
ANY_SIMPLE
_IN ( s1 to s28 ) Compared data, or word device which stores such data
( d )
ANY_SIMPLE
_IN
_IN
MINIMUM
1234
Word [signed] data
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
194
In this program, the minimum value among word [signed] data stored in devices specified in s1 and s2 is
output to a device specified in d using the data type of data stored in devices specified in s1 and s2 .
1) Function without EN/ENO(MINIMUM)
[Structured ladder/FBD]
Function/
Operator List
MINIMUM
g_int1=5678
g_int2=1234
_IN
Outline
Program example
g_int3=1234
_IN
[ST]
g_int3:=MINIMUM(g_int1,g_int2);
Function
Construction
g_bool1
g_bool3
How to Read
Explanation of
Functions
g_int1
g_int2
MINIMUM_E
EN
ENO
_IN
g_int3
_IN
[ST]
g_bool3:=MINIMUM_E(g_bool1,g_int1,g_int2,g_int3);
Applied Functions
(Type Conversion
Functions)
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
7
Applied Functions
(Standard Arithmetic
Functions)
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
195
10.4
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function judges whether data is located within the range between the upper limit value and the lower limit
value.
1. Format
Expression in each language
Function name
Structured ladder/FBD
D0
D10
D20
LIMITATION
X000
LIMITATION_E
*1.
D0
D10
D20
LIMITATION
_MN
*1
_IN
_MX
LIMITATION_E
EN
ENO
*1
_MN
_IN
_MX
ST
D30
D30
LIMITATION(_MN,_IN,_MX);
Example:
D30:=
LIMITATION(D0,D10,D20);
LIMITATION_E(EN,_MN,_IN,_MX,
Output_label);
Example:
LIMITATION_E(X000,D0,D10,D20,
D30);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
EN
Execution condition
Bit
_MN ( s1 )
ANY_SIMPLE
_IN ( s2 )
ANY_SIMPLE
_MX ( s3 )
ANY_SIMPLE
ENO
Execution status
Bit
*1
ANY_SIMPLE
( d )
s3
", this
s1
", this
196
LIMITATION
_MN
_IN
_MX
Input value
Maximum input value
Outline
Cautions
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.
2
Function/
Operator List
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
3
An operation error occurs when this function is executed in the following setting status. The error flag M8067
turns ON, and D8067 stores the error code K6706.
Contents of a device specified in s1 > Contents of a device specified in s3
(Lower limit data)
(Upper limit data)
In this program, data whose type is same as the data stored in devices specified in s1 , s2 and s3 is
output to a device specified in d in accordance with ANY_SIMPLE type data stored in devices specified in
s1 , s2 and s3 .
1) Function without EN/ENO(LIMITATION)
g_int3=5000
LIMITATION
_MN
Applied Functions
(Type Conversion
Functions)
[Structured ladder/FBD]
g_int1=500
g_int2=1300
g_int4=1300
_IN
_MX
6
Applied Functions
(Standard Functions Of
One Numeric Variable)
[ST]
g_int4:=LIMITATION(g_int1,g_int2,g_int3);
[Structured ladder/FBD]
g_int1
g_int2
g_int3
LIMITATION_E
EN
ENO
_MN
Applied Functions
(Standard Arithmetic
Functions)
g_bool1
4
How to Read
Explanation of
Functions
Program example
Function
Construction
Error
g_bool3
g_int4
_IN
_MX
8
Applied Functions
(Standard Bit
Shift Functions)
[ST]
g_bool3:=LIMITATION_E(g_bool1,g_int1,g_int2,g_int3,g_int4);
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
197
10.5
MUX(_E) / Multiplexer
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function selects data, and outputs the selected data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
MUX(_K,_IN,_IN);
Example:
D30:=
MUX(D0,D10,D20);
MUX
D0
D10
D20
MUX
X000
MUX_E
*1.
D0
D10
D20
_K
_IN
_IN
*1
MUX_E
EN
ENO
*1
_K
_IN
_IN
D30
MUX_E(EN,_K,_IN,_IN,
Output_label);
Example:
MUX_E(X000,D0,D10,D20,D30);
D30
Output variable
2. Set data
Variable
EN
Input
variable
_K
( n )
Description
Bit
Word [signed]
_IN ( s1 to s28 ) Selectable data, or word device which stores such data
Output
variable
Data type
Execution condition
ANY
ENO
Execution status
Bit
*1
ANY
MUX
_K
_IN
_IN
1234
Word [signed] data
5678
Word [signed] data
1234
Word [signed] data
2) When a value input to n is outside the pin number range for s1 to s28 , this function outputs an
indefinite value to a device specified in d .
(An operation error does not occur. "MUX_E" outputs "FALSE" from ENO.)
3) The number of pins for
198
Outline
Cautions
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.
2
Function/
Operator List
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
In this example, either one among values stored in devices specified in s1 and s2 is output to a device
specified in d in accordance with the value specified in n using the data type of data stored in devices
specified in s1 and s2 .
1) Function without EN/ENO(MUL)
4
How to Read
Explanation of
Functions
[Structured ladder/FBD]
MUX
g_int1=2
g_int2=1234
_K
g_int3=5678
_IN
g_int4=5678
_IN
5
Applied Functions
(Type Conversion
Functions)
[ST]
g_int4:=MUX(g_int1,g_int2,g_int3);
[Structured ladder/FBD]
Applied Functions
(Standard Functions Of
One Numeric Variable)
MUX_E
g_bool1
g_int1
g_int2
g_int3
Function
Construction
Program example
EN
_K
ENO
g_bool3
g_int4
_IN
_IN
7
Applied Functions
(Standard Arithmetic
Functions)
[ST]
g_bool3:=MUX_E(g_bool1,g_int1,g_int2,g_int3,g_int4);
8
Applied Functions
(Standard Bit
Shift Functions)
9
Applied Functions
(Standard Bitwise
Boolean Functions)
10
Applied Functions
(Standard Selection
Functions)
199
200
Function
Reference
GT_E
Comparison
Section 11.1
GE_E
Comparison
Section 11.2
EQ_E
Comparison
Section 11.3
LE_E
Comparison
Section 11.4
LT_E
Comparison
Section 11.5
NE_E
Comparison
Section 11.6
11
GT_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.1
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to "> (larger)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
GT_E
ENO
*1
M0
14
Output variable
Standard
Function
Blocks
*1.
D0
D10
EN
_IN
_IN
Applied Functions
(Functions Of Time
Data Types)
X000
GT_E
13
ST
GT_E(EN,_IN,_IN,Output_label);
Example:
GT_E(X000,D0,D10,M0);
2. Set data
Variable
Input variable
Execution condition
Data type
Bit
_IN ( s1 to s28 ) Compared data, or word device which stores such data
ANY_SIMPLE
ENO
Execution status
Bit
Bit
*1
( d )
15
Operator
Output
variable
Description
EN
a) This function outputs "TRUE" when all comparison results are " s n-1 > sn ".
b) This function outputs "FALSE" when any comparison result is " s n-1 sn ".
s
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects.
Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
201
Function/
Operator List
Correspondence
between Devices
and Addresses
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 > s2 ] & [ s2 > s3 ] & & [ s n-1 > sn ].
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
GT_E
g_bool1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_bool2
_IN
[ST]
g_bool3:=GT_E(g_bool1,g_int1,g_int2,g_bool2);
202
11
GE_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.2
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to " (larger or equal)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
GE_E
*1.
D0
D10
EN
_IN
_IN
GE_E
ENO
*1
Applied Functions
(Functions Of Time
Data Types)
X000
13
ST
GE_E(EN,_IN,_IN,Output_label);
Example:
GE_E(X000,D0,D10,M0);
M0
14
Output variable
Variable
Input variable
EN
Execution condition
Data type
Bit
_IN ( s1 to s28 ) Compared data, or word device which stores such data
ANY_SIMPLE
ENO
Execution status
Bit
Bit
*1
( d )
15
Operator
Output
variable
Description
a) This function outputs "TRUE" when all comparison results are " s n-1 sn ".
b) This function outputs "FALSE" when any comparison result is " s n-1 < sn ".
can be changed in the range of 2 to 28.
Refer to Section 3. Function Construction
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
203
B
Function/
Operator List
A
Correspondence
between Devices
and Addresses
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ] & [ s2 s3 ] & & [ s n-1 sn ].
Standard
Function
Blocks
2. Set data
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
GE_E
g_bool1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_bool2
_IN
[ST]
g_bool3:=GE_E(g_bool1,g_int1,g_int2,g_bool2);
204
11
EQ_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.3
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to "= (equal)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
*1.
D0
D10
EN
_IN
_IN
EQ_E
ENO
*1
Applied Functions
(Functions Of Time
Data Types)
X000
EQ_E
13
ST
EQ_E(EN,_IN,_IN,Output_label);
Example:
EQ_E(X000,D0,D10,M0);
M0
14
Output variable
Variable
Description
_IN ( s1 to s28 ) Compared data, or word device which stores such data
ANY_SIMPLE
Output
variable
ENO
Execution status
Bit
Bit
( d )
Bit
15
Operator
Input
variable
*1
Execution condition
Data type
EN
a) This function outputs "TRUE" when all comparison results are " s n-1 = sn ".
b) This function outputs "FALSE" when any comparison result is " s n-1 sn ".
can be changed in the range of 2 to 28.
Refer to Section 3. Function Construction
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
205
B
Function/
Operator List
A
Correspondence
between Devices
and Addresses
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 = s2 ] & [ s2 = s3 ] & & [ s n-1 = sn ].
Standard
Function
Blocks
2. Set data
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
EQ_E
g_bool1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_bool2
_IN
[ST]
g_bool3:=EQ_E(g_bool1,g_int1,g_int2,g_bool2);
206
11
LE_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.4
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to " (smaller or equal)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
LE_E
ENO
*1
M0
14
Output variable
Standard
Function
Blocks
*1.
D0
D10
EN
_IN
_IN
Applied Functions
(Functions Of Time
Data Types)
X000
LE_E
13
ST
LE_E(EN,_IN,_IN,Output_label);
Example:
LE_E(X000,D0,D10,M0);
2. Set data
Variable
Description
_IN ( s1 to s28 ) Compared data, or word device which stores such data
ANY_SIMPLE
Output
variable
ENO
Execution status
Bit
Bit
( d )
Bit
15
Operator
EN
*1
Execution condition
Data type
Input
variable
a) This function outputs "TRUE" when all comparison results are " s n-1 sn ".
b) This function outputs "FALSE" when any comparison result is " s n-1 > sn ".
s
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
207
Function/
Operator List
Correspondence
between Devices
and Addresses
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ] & [ s2 s3 ] & & [ s n-1 sn ].
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
LE_E
g_bool1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_bool2
_IN
[ST]
g_bool3:=LE_E(g_bool1,g_int1,g_int2,g_bool2);
208
11
LT_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.5
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to "< (smaller)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
LT_E
*1.
D0
D10
EN
_IN
_IN
LT_E
ENO
*1
Applied Functions
(Functions Of Time
Data Types)
X000
13
ST
LT_E(EN,_IN,_IN,Output_label);
Example:
LT_E(X000,D0,D10,M0);
M0
14
Output variable
Variable
Description
_IN ( s1 to s28 ) Compared data, or word device which stores such data
ANY_SIMPLE
Output
variable
ENO
Execution status
Bit
Bit
( d )
Bit
15
Operator
Input
variable
*1
Execution condition
Data type
EN
a) This function outputs "TRUE" when all comparison results are " s n-1 < sn ".
b) This function outputs "FALSE" when any comparison result is " s n-1 sn ".
can be changed in the range of 2 to 28.
Refer to Section 3. Function Construction
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
209
B
Function/
Operator List
A
Correspondence
between Devices
and Addresses
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 < s2 ] & [ s2 < s3 ] & & [ s n-1 < sn ].
Standard
Function
Blocks
2. Set data
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
LT_E
g_bool1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_bool2
_IN
[ST]
g_bool3:=LT_E(g_bool1,g_int1,g_int2,g_bool2);
210
11
NE_E / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
11.6
12
Applied Functions
(Standard Character
String Functions)
Outline
This function compares data with regard to " (unequal)".
1. Format
Expression in each language
Function name
Structured ladder/FBD
M0
14
Output variable
Standard
Function
Blocks
*1.
D0
D10
NE_E
EN
ENO
_IN1
*1
_IN2
Applied Functions
(Functions Of Time
Data Types)
X000
NE_E
13
ST
NE_E(EN,_IN1,_IN2,Output_label);
Example:
NE_E(X000,D0,D10,M0);
2. Set data
Variable
Output
variable
Data type
Execution condition
Bit
_IN1 ( s1 )
ANY_SIMPLE
_IN2 ( s2 )
ANY_SIMPLE
ENO
Execution status
Bit
Bit
*1
( d )
15
Operator
Input
variable
Description
EN
This function compares the contents of devices specified in s1 and s2 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ].
a) This function outputs "TRUE" when in the case of " s1 s2 "
Cautions
1) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices. Use global labels
when specifying labels.
2) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
211
B
Function/
Operator List
Correspondence
between Devices
and Addresses
Program example
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
NE_E
g_bool1
g_int1
g_int2
EN
_IN1
ENO
g_bool3
g_bool2
_IN2
[ST]
g_bool3:=NE_E(g_bool1,g_int1,g_int2,g_bool2);
212
11
Applied Functions
(Standard Comparison
Functions)
MID(_E)
Function
Reference
Section 12.1
Section 12.2
INSERT(_E)
String insertion
Section 12.3
DELETE(_E)
String deletion
Section 12.4
String replacement
Section 12.5
Section 12.6
REPLACE(_E)
FIND(_E)
13
Applied Functions
(Functions Of Time
Data Types)
CONCAT(_E)
Applied Functions
(Standard Character
String Functions)
Function name
12
14
Standard
Function
Blocks
15
Operator
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
213
12.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
Outline
This function obtains a character string from a specified position.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
MID
MID
MID_E
*1.
Label1
D10
D20
_IN
_L
_P
X000
MID_E
EN
ENO
_IN
*1
_L
_P
Label1
D10
D20
*1
Label2
Label2
MID(_IN,_L ,_P);
Example:
Label2:=
MID(Label1,D10,D20);
MID_E(EN,_IN,_L ,_P,
Output_label);
Example:
MID_E(X000,Label1,D10,D20,
Label2);
Output variable
2. Set data
Variable
EN
Input
variable
Output
variable
Description
Execution condition
_IN ( s )
String
_L
( n1 )
Word [signed]
_P
( n2 )
ENO
*1
( d )
Execution status
Bit
Head word device which will store the obtained character string
String
214
Data type
Bit
FX0(S)
11
"ABCDEF12345"
"EF123"
2nd word
44H(D)
43H(C)
3rd word
46H(F)
45H(E)
4th word
32H(2)
31H(1)
5th word
34H(4)
33H(3)
6th word
00H
35H(5)
41H(A)
46H(F)
45H(E)
1st word
32H(2)
31H(1)
2nd word
00H
33H(3)
3rd word
13
Applied Functions
(Functions Of Time
Data Types)
1st word
Number of characters to
be extracted n1 = 5
14
3) When the number of characters to be extracted specified in n1 is "0", this function does not execute
processing.
Cautions
1) Use the function having "_E" in its name to connect a bus.
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
2) When the head character position specified in n2 exceeds the number of characters of a character
string stored in devices specified in s
(Error code: K6706)
3) When the number of characters specified in n1 exceeds the range of devices specified in
(Error code: K6706)
4) When the number of devices after the device number specified in d is smaller than the number of
devices required for storing an extracted character string
(In this case, "00H" cannot be stored after all character strings and the final character.)
(Error code: K6706)
5) When the value specified in n2 is negative
(Error code: K6706)
6) When the value specified in n1 is "-2" or less
(Error code: K6706)
7) When the value specified in n1
devices specified in s
(Error code: K6706)
215
B
Function/
Operator List
A
Correspondence
between Devices
and Addresses
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.
15
Operator
4) When the number of characters to be extracted specified in n1 is "-1", this function outputs the final
character of a character string specified in s to devices specified in d .
Standard
Function
Blocks
2) A character string (data) stored in devices specified in s indicates the data until "00H" is detected first
in units of byte in the range starting from the specified device.
1) When "00H" is not set in the corresponding device range after the device specified in
(Error code: K6706)
12
Applied Functions
(Standard Character
String Functions)
1) This function extracts specified number of characters from an arbitrary position of a character string
stored in devices specified in s , and outputs the obtained data to devices specified in d . The value
specified in n1 specifies the number of characters to be extracted.
The value specified in n2 specifies the head character position of characters to be extracted.
Example: When "5" is specified in n1 and n2
Applied Functions
(Standard Comparison
Functions)
Program example
In this program, specified number of characters are extracted from an arbitrary position of a character string
stored in devices specified in s , and the obtained data is output to devices specified in d .
1) Function without EN/ENO(MID)
[Structured ladder/FBD]
MID
g_string1="ABCDEF12345"
g_int1=5
g_int2=5
g_string2="EF123"
_IN
_L
_P
[ST]
g_string2:=MID(g_string1,g_int1,g_int2);
MID_E
g_bool1
g_string1
g_int1
g_int2
EN
_IN
ENO
g_bool3
g_string2
_L
_P
[ST]
g_bool3:=MID_E(g_bool1,g_string1,g_int1,g_int2,g_string2);
216
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function connects character strings.
1. Format
Expression in each language
Function name
Structured ladder/FBD
_IN
_IN
Label1
Label2
Label3
14
CONCAT_E(EN,_IN,_IN,
Output_label);
Example:
CONCAT_E(X000,Label1,Label2,
Label3);
Label3
Standard
Function
Blocks
CONCAT_E
EN
ENO
_IN
*1
_IN
X000
CONCAT_E
*1
Applied Functions
(Functions Of Time
Data Types)
Label1
Label2
13
ST
CONCAT(_IN,_IN);
Example:
Label3:=
CONCAT(Label1,Label2);
CONCAT
CONCAT
*1.
Applied Functions
(Standard Comparison
Functions)
12.2
15
Output variable
Variable
Input
variable
Data type
EN
Execution condition
_IN ( s1 to s28 )
ENO
Execution status
*1
Bit
Bit
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
2. Set data
Head word device which will store the connected data (character
String
string)
( d )
42H(B)
2nd word
44H(D)
43H(C)
3rd word
00H
45H(E)
"ABCDE123456"
"123456"
"ABCDE"
41H(A)
1st word
32H(2)
31H(1)
1st word
42H(B)
2nd word
34H(4)
33H(3)
2nd word
44H(D)
43H(C)
3rd word
36H(6)
35H(5)
3rd word
31H(1)
45H(E)
4th word
33H(3)
32H(2)
5th word
35H(5)
34H(4)
6th word
00H
36H(6)
4th word
0000H
41H(A)
2) A character string (data) stored in devices specified in s indicates the data until "00H" is detected first
in units of byte in the range starting from the specified device.
3) For direct specification, up to 32 characters can be specified (input).
When word devices are specified in s , this restriction (up to 32 characters) is not applicable.
217
Function/
Operator List
1) This function connects a character string stored in devices specified in s n+1 after a character string
stored in devices specified in sn , and outputs the character string obtained by connection to devices
specified in d .
When connecting a character string stored in devices specified in s n+1 , this function ignores "00H" which
indicates the end of a character string stored in devices specified in sn .
After two character strings are connected, "00H" is automatically added at the end.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling character string data in structured programs, you cannot specify 16-bit devices directly,
different from simple projects. Use labels when handling character string data.
Use global labels when specifying labels.
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the number of devices after the device number specified in d is smaller than the number of
devices required for storing the character string obtained by connection
(In this case, "00H" cannot be stored after all character strings and final character.)
(Error code: K6706)
2) When devices which store character strings specified in s
which will store the character string obtained by connection
(Error code: K6706)
3) When "00H" does not exist in the corresponding device range after devices specified in
(Error code: K6706)
Program example
In this program, a character string stored in devices specified in s2 is connected after a character string
stored in devices specified in s1 , and the character string obtained by connection is output to devices
specified in d .
1) Function without EN/ENO(CONCAT)
[Structured ladder/FBD]
CONCAT
g_string1="ABCDEF"
g_string2="12345"
g_string3="ABCDEF12345"
_IN
_IN
[ST]
g_string3:=CONCAT(g_string1,g_string2);
g_bool1
g_string1
g_string2
CONCAT_E
EN
ENO
_IN
g_bool3
g_string3
_IN
[ST]
g_bool3:=CONCAT_E(g_bool1,g_string1,g_string2,g_string3);
218
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function inserts a character string.
1. Format
Expression in each language
Function name
Structured ladder/FBD
INSERT
X000
Label1
Label2
D20
*1
INSERT_E
EN
ENO
_IN1
*1
_IN2
_P
Label3
Label3
14
INSERT_E(EN,_IN1,_IN2,_P,
Output_label);
Example:
INSERT_E(X000,Label1,Label2,
D20,Label3);
Standard
Function
Blocks
INSERT_E
_IN1
_IN2
_P
INSERT(_IN1,_IN2,_P);
Example:
Label3:=
INSERT(Label1,Label2,D20);
Applied Functions
(Functions Of Time
Data Types)
Label1
Label2
D20
13
ST
INSERT
*1.
Applied Functions
(Standard Comparison
Functions)
12.3
15
Output variable
Variable
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
String
_IN2 ( s2 )
String
_P
Word [signed]
Execution status
Bit
( n )
ENO
*1
( d )
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
2. Set data
B
Function/
Operator List
219
Output value
"ABC123456DE"
1st word
42H(B)
41H(A)
2nd word
44H(D)
43H(C)
3rd word
00H
45H(E)
Insertion start
position n
= 4th character
Input value to s2
"123456"
42H(B)
41H(A)
1st word
31H(1)
43H(C)
2nd word
33H(3)
32H(2)
3rd word
35H(5)
34H(4)
4th word
44H(D)
36H(6)
5th word
00H
45H(E)
6th word
32H(2)
31H(1)
2nd word
34H(4)
33H(3)
3rd word
36H(6)
35H(5)
4th word
0000H
2) A character string (data) stored in devices specified in s indicates the data until "00H" is detected first
in units of byte in the range starting from the specified device.
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling character string data in structured programs, you cannot specify 16-bit devices directly,
different from simple projects. Use labels when handling character string data.
Use global labels when specifying labels.
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When the number of devices after the device number specified in
devices required for storing the output data obtained by insertion
(Error code: K6706)
2) When devices which store character strings specified in s1 and s2 overlap device numbers specified
in d which will store the character string obtained by connection
(Error code: K6706)
3) When "00H" does not exist in the corresponding device range after devices specified in s1 and s2
(Error code: K6706)
4) When the number of characters of a character string stored in devices specified in s2 is 32768 or more
(Error code: K6706)
5) When the value specified in
(Error code: K6706)
220
is negative
11
In this program, a character string stored in devices specified in s2 is inserted into an arbitrary position
(counted from the head) of a character string stored in devices specified in s1 , and the character string
obtained by insertion is output to devices specified in d .
12
Applied Functions
(Standard Character
String Functions)
[Structured ladder/FBD]
INSERT
g_string1="ABCDEF"
g_string2="12345"
g_int1=3
g_string3="AB12345CDEF"
_IN1
_IN2
13
_P
Applied Functions
(Functions Of Time
Data Types)
[ST]
g_string3:=INSERT(g_string1,g_string2,g_int1);
14
g_string1
g_string2
g_int1
INSERT_E
EN
ENO
_IN1
Standard
Function
Blocks
[Structured ladder/FBD]
g_bool1
Applied Functions
(Standard Comparison
Functions)
Program example
g_bool3
g_string3
_IN2
15
_P
Operator
[ST]
g_bool3:=INSERT_E(g_bool1,g_string1,g_string2,g_int1,g_string3);
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
221
12.4
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function deletes a character string.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
DELETE
Label1
D10
D20
DELETE
_IN
_L
_P
X000
DELETE_E
*1.
Label1
D10
D20
*1
DELETE_E
EN
ENO
*1
_IN
_L
_P
Label2
Label2
DELETE(_IN,_L ,_P);
Example:
Label2:=
DELETE(Label1,D10,D20);
DELETE_E(EN,_IN,_L ,_P,
Output_label);
Example:
DELETE_E(X000, Label1,
D10, D20, Label2);
Output variable
2. Set data
Variable
EN
Input
variable
Output
variable
Description
Data type
Execution condition
Bit
_IN ( s )
String
_L
( n1 )
Word [signed]
_P
( n2 )
Word [signed]
ENO
Execution status
Bit
*1
Head word device which will store a character string remaining after
String
deletion
( d )
"ABCD45"
1st word
42H(B)
41H(A)
42H(B)
41H(A)
1st word
2nd word
44H(D)
43H(C)
44H(D)
43H(C)
2nd word
3rd word
46H(F)
45H(E)
35H(5)
34H(4)
3rd word
4th word
32H(2)
31H(1)
5th word
34H(4)
33H(3)
6th word
00H
35H(5)
Deletion start
position n2
= 5th character
0000H
4th word
Number of characters
to be deleted n1 = 5
2) A character string (data) stored in devices specified in s indicates the data until "00H" is detected first
in units of byte in the range starting from the specified device.
222
11
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When "00H" does not exist in the corresponding device range after the device specified in
(Error code: K6706)
s
13
is 32768 or more
Program example
g_int2="3"
Correspondence
between Devices
and Addresses
DELETE
g_string1="ABCDEF12345"
g_int1="4"
g_string2="AB12345"
_IN
_L
_P
[ST]
B
Function/
Operator List
g_string2:=DELETE(g_string1,g_int1,g_int2);
g_bool1
g_string1
g_int1
g_int2
DELETE_E
EN
ENO
_IN
15
Operator
In this program, specified number of characters are deleted from an arbitrary position of a character string
stored in devices specified in s , and the character string remaining after deletion is output to devices
specified in d .
14
Standard
Function
Blocks
3) When the number of devices after the device number specified in d is smaller than the number of
devices required for storing the character string remaining after deletion of specified number of
characters
(Error code: K6706)
Applied Functions
(Functions Of Time
Data Types)
12
Applied Functions
(Standard Character
String Functions)
Error
Applied Functions
(Standard Comparison
Functions)
Cautions
g_bool3
g_string2
_L
_P
[ST]
g_bool3:=DELETE_E(g_bool1,g_string1,g_int1,g_int2,g_string2);
223
12.5
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function replaces a character string.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
D20
D30
REPLACE
X000
Label1
Label2
D20
D30
REPLACE_E
*1.
REPLACE
_IN1
*1
_IN2
_L
_P
REPLACE_E
EN
ENO
_IN1
*1
_IN2
_L
_P
ST
Label3
Label3
REPLACE(_IN1,_IN2,_L ,_P);
Example:
Label3:=
REPLACE(Label1,Label2,
D20,D30);
REPLACE_E(EN,_IN1,_IN2,
_L ,_P,Output_label);
Example:
REPLACE_E(X000,Label1,
Label2,D20,D30,Label3);
Output variable
2. Set data
Variable
Input
variable
Output
variable
Description
Execution condition
Bit
_IN1 ( s1 )
String
_IN2 ( s2 )
String
_L
( n1 )
Word [signed]
_P
( n2 )
ENO
Execution status
*1
( d )
224
Data type
EN
Bit
11
Input value to s1
"ABCDEFGH123"
Output value
"ABCD1234523"
42H(B)
41H(A)
2nd word
44H(D)
43H(C)
Replacement start
position n2
= 5th character
13
42H(B)
41H(A)
1st word
44H(D)
43H(C)
2nd word
32H(2)
31H(1)
3rd word
34H(4)
33H(3)
4th word
46H(F)
45H(E)
4th word
48H(H)
47H(G)
5th word
32H(2)
31H(1)
32H(2)
35H(5)
5th word
6th word
00H
33H(3)
00H
33H(3)
6th word
Input value to s2
"123456"
14
Standard
Function
Blocks
3rd word
Applied Functions
(Functions Of Time
Data Types)
1st word
Number of characters
to be replaced n1 = 5
31H(1)
2nd word
34H(4)
33H(3)
3rd word
36H(6)
35H(5)
4th word
15
Operator
1st word
12
Applied Functions
(Standard Character
String Functions)
1) This function replaces specified number of characters from an arbitrary position of a character string
stored in devices specified in s1 with a character string stored in devices specified in s2 , and outputs
the character string obtained by replacement to devices specified in d .
The value specified in n1 specifies the number of characters to be replaced.
The value specified in n2 specifies the position from which specified number of characters are replaced.
Example: When "5" is specified in n1 and n2
Applied Functions
(Standard Comparison
Functions)
0000H
2) A character string (data) stored in devices specified in s indicates the data until "00H" is detected first
in units of byte in the range starting from the specified device.
4) When "-1" is specified in n1 , the number of characters of a character string stored in devices specified
in s2 is regarded as the value specified in n1 .
225
B
Function/
Operator List
Cautions
Correspondence
between Devices
and Addresses
3) When "n1+n2" exceeds the number of characters of a character string stored in devices specified in s1 ,
excessive characters are not output to devices specified in d .
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When "00H" does not exist in the corresponding device range after the devices specified in s1
and
s2
Program example
In this program, specified number of characters starting from an arbitrary position of a character string stored
in devices specified in s1 are replaced with a character string stored in devices specified in s2 , and the
character string obtained by replacement is output to devices specified in d .
1) Function without EN/ENO(REPLACE)
[Structured ladder/FBD]
REPLACE
g_string1="ABCDEFGH"
_IN1
g_string2="012345678"
g_int1=6
_IN2
g_int2=3
g_string3="AB012345"
_L
_P
[ST]
g_string3:=REPLACE(g_string1,g_string2,g_int1,g_int2);
g_bool1
g_string1
g_string2
REPLACE_E
EN
ENO
_IN1
g_bool3
g_string3
_IN2
g_int1
_L
g_int2
_P
[ST]
g_bool3:=REPLACE_E(g_bool1,g_string1,g_string2,g_int1,g_int2,g_string3);
226
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function searches a character string.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
Label1
Label2
FIND_E
EN
ENO
_IN1
*1
_IN2
D20
D20
FIND_E(EN,_IN1,_IN2,
Output_label);
Example:
FIND_E(X000,Label1,Label2,
D20);
14
Standard
Function
Blocks
FIND_E
FIND
_IN1
*1
_IN2
13
ST
FIND(_IN1,_IN2);
Example:
D20:=
FIND(Label1,Label2);
Applied Functions
(Functions Of Time
Data Types)
FIND
*1.
Applied Functions
(Standard Comparison
Functions)
12.6
Output variable
15
2. Set data
Input
variable
Data type
EN
Execution condition
_IN1 ( s1 )
String
_IN2 ( s2 )
String
ENO
Execution status
Bit
Word [signed]
*1
( d )
Bit
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
Variable
B
Function/
Operator List
227
Output value
5
Word [signed]
1st word
42H(B)
41H(A)
2nd word
44H(D)
43H(C)
3rd word
32H(2)
31H(1)
4th word
34H(4)
33H(3)
5th word
36H(6)
35H(5)
6th word
00H
37H(7)
Input value to s2
"1234"
Search of
character string
32H(2)
31H(1)
2nd word
34H(4)
33H(3)
3rd word
0000H
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling character string data in structured programs, you cannot specify 16-bit devices directly,
different from simple projects. Use labels when handling character string data.
Use global labels when specifying labels.
Error
An operation error occurs in the following cases. The error flag M8067 turns ON, and D8067 stores the error
code.
1) When "00H (NULL)" does not exist in the corresponding device range specified in s1
(Error code: K6706)
2) When "00H (NULL)" does not exist in the corresponding device range specified in s2
(Error code: K6706)
228
11
In this program, a character string stored in devices specified in s2 is searched from the beginning of a
character string stored in devices specified in s1 , and the search result is output to devices specified in
d .
12
Applied Functions
(Standard Character
String Functions)
[Structured ladder/FBD]
FIND
g_string1="ABCDEFGHIJK"
_IN1
g_string2="EFGHIJK"
_IN2
Applied Functions
(Standard Comparison
Functions)
Program example
g_int1=5
13
[ST]
Applied Functions
(Functions Of Time
Data Types)
g_int1:=FIND(g_string1,g_string2);
14
[Structured ladder/FBD]
g_string1
g_string2
EN
_IN1
ENO
Standard
Function
Blocks
FIND_E
g_bool1
g_bool3
g_int1
_IN2
15
[ST]
Operator
g_bool3:=FIND_E(g_bool1,g_string1,g_string2,g_int1);
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
229
230
Function
Reference
ADD_TIME(_E)
Addition
Section 13.1
SUB_TIME(_E)
Subtraction
Section 13.2
MUL_TIME(_E)
Multiplication
Section 13.3
DIV_TIME(_E)
Division
Section 13.4
11
ADD_TIME(_E) / Addition
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function adds time data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
Label1
Label2
ADD_TIME_E
EN
ENO
_IN1
*1
_IN2
Label3
Label3
ADD_TIME_E(EN,_IN1,_IN2,
Output_label);
Example:
ADD_TIME_E(X000,Label1,
Label2,Label3);
14
Standard
Function
Blocks
ADD_TIME_E
ADD_TIME
_IN1
*1
_IN2
13
ST
ADD_TIME(_IN1,_IN2);
Example:
Label3:=
ADD_TIME(Label1,Label2);
Applied Functions
(Functions Of Time
Data Types)
ADD_TIME
*1.
Applied Functions
(Standard Comparison
Functions)
13.1
Output variable
15
2. Set data
Input
variable
Data type
EN
Execution condition
_IN1 ( s1 )
Time
_IN2 ( s2 )
Time
ENO
Execution status
Bit
Time
*1
( d )
Bit
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
Variable
231
B
Function/
Operator List
This function performs addition ( s1 + s2 ) of time data stored in devices specified in s1 and s2 , and
outputs the operation result expressed as time data to devices specified in d .
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
However, note that the accurate operation result cannot be obtained in this case.
("ADD_TIME_E" outputs "TRUE" from ENO.)
Either of the flags shown in the table below turns ON or OFF in accordance with the operation result.
Device
Name
Description
ON : When the operation result is "0"
OFF: When the operation result is any other than "0"
M8020
Zero
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 the operation result is "-32,768" (16-bit operation) or more or "-2,147,483,648" (32bit operation) or more
Carry
ON : When the operation result exceeds "32,767" (16-bit operation) or "2,147,483,647" (32-bit
operation)
OFF: When the operation result is "32,767" (16-bit operation) or less or "2,147,483,647" (32-bit
operation) or less
M8022
Zero flag
Zero flag
-2 , -1 , 0 ,
-1 , 0 , 1
-32,768
Borrow flag
Zero flag
The most
significant bit
of data is "1".
32,767 ,
The most
significant bit
of data is "0".
Zero flag
-2 , -1 , 0 ,
0, 1, 2
Carry flag
Zero flag
-1 , 0 , 1
-2,147,483,648
Borrow flag
Zero flag
2,147,483,647 ,
0, 1, 2
Carry flag
Program example
In this program, addition ( s1 + s2 ) is performed using time data stored in devices specified in s1 and
s2 , and the operation result expressed as time data is output to devices specified in d .
1) Function without EN/ENO(ADD_TIME)
[Structured ladder/FBD]
g_time1
g_time2
ADD_TIME
_IN1
_IN2
g_time3
[ST]
g_time3:=ADD_TIME(g_time1,g_time2);
g_bool1
g_time1
g_time2
ADD_TIME_E
EN
ENO
_IN1
_IN2
g_bool3
g_time3
[ST]
g_bool3:=ADD_TIME_E(g_bool1,g_time1,g_time2,g_time3);
232
11
SUB_TIME(_E) / Subtraction
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function performs subtraction of time data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
Label1
Label2
SUB_TIME_E
EN
ENO
_IN1
*1
_IN2
Label3
Label3
SUB_TIME_E(EN,_IN1,_IN2,
Output_label);
Example:
SUB_TIME_E(X000,Label1,
Label2,Label3);
14
Standard
Function
Blocks
SUB_TIME_E
SUB_TIME
_IN1
*1
_IN2
13
ST
SUB_TIME(_IN1,_IN2);
Example:
Label3:=
SUB_TIME(Label1,Label2);
Applied Functions
(Functions Of Time
Data Types)
SUB_TIME
*1.
Applied Functions
(Standard Comparison
Functions)
13.2
Output variable
15
2. Set data
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
Time
_IN2 ( s2 )
Time
ENO
Execution status
Bit
Time
*1
( d )
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
Variable
233
B
Function/
Operator List
This function performs subtraction ( s1 - s2 ) of time data stored in devices specified in s1 and s2 , and
outputs the operation result expressed as time data to devices specified in d .
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
However, note that the accurate operation result cannot be obtained in this case.
("SUB_TIME_E" outputs "TRUE" from ENO.)
Either of the flags shown in the table below turns ON or OFF in accordance with the operation result.
Device
Name
Description
ON : When the operation result is "0"
OFF: When the operation result is any other than "0"
M8020
Zero
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 the operation result is "-32,768" (16-bit operation) or more or "-2,147,483,648" (32bit operation) or more
Carry
ON : When the operation result exceeds "32,767" (16-bit operation) or "2,147,483,647" (32-bit
operation)
OFF: When the operation result is "32,767" (16-bit operation) or less or "2,147,483,647" (32-bit
operation) or less
M8022
Zero flag
Zero flag
-1 , 0 , 1
-2 , -1 , 0 , -32,768
Borrow flag
Zero flag
The most
significant bit
of data is "1".
32,767 ,
The most
significant bit
of data is "0".
Zero flag
-2 , -1 , 0 ,
0, 1, 2
Carry flag
Zero flag
-1 , 0 , 1
-2,147,483,648
Borrow flag
Zero flag
2,147,483,647 ,
0, 1, 2
Carry flag
Program example
In this program, subtraction ( s1 - s2 ) is performed using time data stored in devices specified in s1 and
s2 , and the operation result expressed as time data is output to devices specified in d .
1) Function without EN/ENO(SUB_TIME)
[Structured ladder/FBD]
g_time1
g_time2
SUB_TIME
_IN1
_IN2
g_time3
[ST]
g_time3:=SUB_TIME(g_time1,g_time2);
g_bool1
g_time1
g_time2
SUB_TIME_E
EN
ENO
_IN1
_IN2
g_bool3
g_time3
[ST]
g_bool3:=SUB_TIME_E(g_bool1,g_time1,g_time2,g_time3);
234
11
MUL_TIME(_E) / Multiplication
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function performs multiplication of time data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
Label1
Label2
MUL_TIME_E
EN
ENO
_IN1
*1
_IN2
Label3
Label3
MUL_TIME_E(EN,_IN1,_IN2,
Output_label);
Example:
MUL_TIME_E(X000,Label1,
Label2,Label3);
14
Standard
Function
Blocks
MUL_TIME_E
MUL_TIME
_IN1
*1
_IN2
13
ST
MUL_TIME(_IN1,_IN2);
Example:
Label3:=
MUL_TIME(Label1,Label2);
Applied Functions
(Functions Of Time
Data Types)
MUL_TIME
*1.
Applied Functions
(Standard Comparison
Functions)
13.3
Output variable
15
2. Set data
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
Time
_IN2 ( s2 )
ANY_NUM
ENO
Execution status
Bit
Time
*1
( d )
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
Variable
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) Even if underflow or overflow occurs in the operation result, it is not regarded as an operation error.
However, note that the accurate operation result cannot be obtained in this case.
("MUL_TIME_E" outputs "TRUE" from ENO.)
4) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
235
B
Function/
Operator List
This function performs multiplication( s1 s2 ) using time data stored in devices specified in s1 and
s2 , and outputs the operation result expressed as time data to devices specified in d .
Program example
In this program, multiplication ( s1 s2 ) is performed using time data stored in devices specified in s1
and s2 , and the operation result expressed as time data is output to devices specified in d .
1) Function without EN/ENO(MUL_TIME)
[Structured ladder/FBD]
g_time1
g_int1
MUL_TIME
_IN1
_IN2
g_time2
[ST]
g_time2:=MUL_TIME(g_time1,g_int1);
g_bool1
g_time1
g_int1
MUL_TIME_E
EN
ENO
_IN1
_IN2
g_bool3
g_time2
[ST]
g_bool3:=MUL_TIME_E(g_bool1,g_time1,g_int1,g_time2);
236
11
DIV_TIME(_E) / Division
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function performs division using time data.
1. Format
Expression in each language
Function name
Structured ladder/FBD
Label1
Label2
X000
Label1
Label2
DIV_TIME_E
EN
ENO
_IN1
*1
_IN2
Label3
Label3
DIV_TIME_E(EN,_IN1,_IN2,
Output_label);
Example:
DIV_TIME_E(X000,Label1,
Label2,Label3);
14
Standard
Function
Blocks
DIV_TIME_E
DIV_TIME
_IN1
*1
_IN2
13
ST
DIV_TIME(_IN1,_IN2);
Example:
Label3:=
DIV_TIME(Label1,Label2);
Applied Functions
(Functions Of Time
Data Types)
DIV_TIME
*1.
Applied Functions
(Standard Comparison
Functions)
13.4
Output variable
15
2. Set data
Input
variable
Data type
EN
Execution condition
Bit
_IN1 ( s1 )
Time
_IN2 ( s2 )
ANY_NUM
ENO
Execution status
Bit
Time
*1
( d )
A
Correspondence
between Devices
and Addresses
Output
variable
Description
Operator
Variable
2) The contents of devices specified in s2 are ANY_NUM type data except "0".
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
3) When the FLOAT (Single Precision) data to s is set from the programming tool, a rounding error may
be generated.
Refer to the MELSEC-Q/L/F Structured Programming Manual (Fundamentals) for cautions on setting the
input value from the programming tool.
Error
1) An operation error occurs when the divisor stored in devices specified in s2 is "0", and the function is
not executed.
2) An operation error occurs when the operation result exceeds "2,147,483,647".
237
B
Function/
Operator List
1) This function performs division ( s1 / s2 ) using time data stored in devices specified in s1 and s2 ,
and outputs the operation result expressed as time data to devices specified in d .
Program example
In this program, division ( s1 / s2 ) is performed using time data stored in devices specified in s1 and
s2 , and the operation result expressed as time data is output to devices specified in d .
1) Function without EN/ENO(DIV_TIME)
[Structured ladder/FBD]
g_time1
g_int1
DIV_TIME
_IN1
_IN2
g_time2
[ST]
g_time2:=DIV_TIME(g_time1,g_int1);
g_bool1
g_time1
g_int1
DIV_TIME_E
EN
ENO
_IN1
_IN2
g_bool3
g_time2
[ST]
g_bool3:=DIV_TIME_E(g_bool1,g_time1,g_int1,g_time2);
238
11
Applied Functions
(Standard Comparison
Functions)
12
Function
Reference
Section 14.1
F_TRIG(_E)
Section 14.2
CTU(_E)
Up counter
Section 14.3
CTD(_E)
Down counter
Section 14.4
CTUD(_E)
Up/Down counter
Section 14.5
TP(_E)
TP_10(_E)
Pulse timer
Section 14.6
TON(_E)
TON_10(_E)
On delay timer
Section 14.7
TOF(_E)
TOF_10(_E)
Section 14.8
Section 14.9
COUNTER_FB_M
TIMER_10_FB_M
Section 14.10
TIMER_CONT_FB_M
Section 14.11
TIMER_100_FB_M
Section 14.12
13
14
Standard
Function
Blocks
Applied Functions
(Functions Of Time
Data Types)
R_TRIG(_E)
Applied Functions
(Standard Character
String Functions)
Function name
15
Operator
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
239
14.1
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block detects the rising edge of a signal, and outputs pulse signal.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
M10
R_TRIG(_CLK,Q);
Example:
Instance name(_CLK:=M0,
Q:=M10);
M10
R_TRIG_E(EN,_CLK,Q,ENO);
Example:
Instance name(EN:=X000,
_CLK:=M0,Q:=M10);
Instance name
R_TRIG
M0
R_TRIG
Q
_CLK
Instance name
X000
R_TRIG_E
M0
R_TRIG_E
EN
ENO
_CLK
Q
2. Set data
Variable
Description
Data type
Input
variable
EN
Output
variable
ENO
Execution status
Bit
Output signal
Bit
_CLK
( s )
( d )
Execution condition
Bit
Bit
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
Set the instance when using a function block.
Describe the instance name when programming a function block.
Error
1) When an output number is specified in d 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 d and the specified device number
does not exist due to indexing, an operation error (Error code: 6706) occurs.
240
11
In this program, a device specified in d turns ON when the bit data stored in a device specified in
turns ON from OFF, and the device specified in d remains ON only for 1 operation cycle.
12
[Structured ladder/FBD]
Applied Functions
(Standard Character
String Functions)
R_TRIG_Instance
R_TRIG
_CLK
g_bool1
g_bool2
[ST]
13
R_TRIG_Instance(_CLK:=g_bool1,Q:=g_bool2);
Applied Functions
(Functions Of Time
Data Types)
X000
14
Y010
Standard
Function
Blocks
g_bool1
R_TRIG_E_Instance
R_TRIG_E
EN
ENO
_CLK
Q
Applied Functions
(Standard Comparison
Functions)
Program example
g_bool2
[ST]
R_TRIG_E_Instance(EN:=X000,_CLK:=g_bool1,Q:=g_bool2,ENO:=Y010);
15
Operator
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
241
14.2
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block detects the falling edge of a signal, and outputs pulse signal.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
M10
F_TRIG(_CLK,Q);
Example:
Instance name(_CLK:=M0,
Q:=M10);
M10
F_TRIG_E(EN,_CLK,Q,ENO);
Example:
Instance name(EN:=X000,
_CLK:=M0,Q:=M10);
Instance name
F_TRIG
M0
F_TRIG
_CLK
Q
Instance name
X000
F_TRIG_E
M0
F_TRIG_E
EN
ENO
_CLK
Q
2. Set data
Variable
Input
variable
EN
Output
variable
ENO
_CLK
Q
Description
( s )
( d )
Data type
Execution condition
Bit
Bit
Execution status
Bit
Output signal
Bit
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
Set the instance when using a function block.
Describe the instance name when programming a function block.
Error
1) When an output number is specified in d 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 d and the specified device number
does not exist due to indexing, an operation error (Error code: 6706) occurs.
242
11
In this program, a device specified in d turns ON when the bit data stored in a device specified in
turns OFF from ON, and the device specified in d remains ON only for 1 operation cycle.
12
[Structured ladder/FBD]
Applied Functions
(Standard Character
String Functions)
F_TRIG_Instance
F_TRIG
_CLK
g_bool1
g_bool2
[ST]
13
F_TRIG_Instance(_CLK:=g_bool1,Q:=g_bool2);
Applied Functions
(Functions Of Time
Data Types)
X000
14
Y010
Standard
Function
Blocks
g_bool1
F_TRIG_E_Instance
F_TRIG_E
EN
ENO
_CLK
Q
Applied Functions
(Standard Comparison
Functions)
Program example
g_bool2
[ST]
F_TRIG_E_Instance(EN:=X000,_CLK:=g_bool1,Q:=g_bool2,ENO:=Y010);
15
Operator
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
243
14.3
CTU(_E) / Up counter
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block counts up the number of times of rising of a signal.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
Instance name
CTU(CU,RESET,PV,Q,CV);
Example:
Instance name(CU:=M0,
RESET:=M10,PV:=D0,Q:=M20,
CV:=D10);
CTU
CTU
M0
M10
D0
CU
RESET
PV
Q
CV
M20
D10
Instance name
X000
CTU_E
M0
M10
D0
CTU_E
EN
ENO
CU
Q
RESET CV
PV
M20
D10
CTU_E(EN,CU,RESET,PV,Q,CV,
ENO);
Example:
Instance name(EN:=X000,
CU:=M0,RESET:=M10,PV:=D0,
Q:=M20,CV:=D10);
2. Set data
Variable
Description
EN
Input
variable
CU
( s1 )
RESET ( s2 )
PV
( n )
ENO
Output
variable
Data type
Execution condition
Bit
Bit
Bit
Word [signed]
Execution status
Bit
( d1 )
Bit
CV
( d2 )
Word [signed]
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
Set the instance when using a function block.
Describe the instance name when programming a function block.
244
11
In this program, the number of times the bit data stored in a device specified in s1 turns ON from OFF is
counted, and the count value is output to a device specified in d2 .
1) Function without EN/ENO(CTU)
12
[Structured ladder/FBD]
Applied Functions
(Standard Character
String Functions)
CTU_Instance
CTU
g_bool1
CU
g_bool2
RESET
g_int1
Q
CV
Applied Functions
(Standard Comparison
Functions)
Program example
g_bool3
g_int2
13
PV
Applied Functions
(Functions Of Time
Data Types)
[ST]
CTU_Instance(CU:=g_bool1,RESET:=g_bool2,PV:=g_int1,Q:=g_bool3,CV:=g_int2);
14
[Structured ladder/FBD]
Standard
Function
Blocks
CTU_E_Instance
CTU_E
M10
g_bool1
EN
CU
g_bool2
g_int1
RESET
PV
ENO
Q
CV
M11
g_bool3
g_int2
15
CTU_E_Instance(EN:=M10,CU:=g_bool1,RESET:=g_bool2,PV:=g_int1,Q:=g_bool3,CV:=g_int2,ENO:=M11);
Operator
[ST]
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
245
14.4
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block counts down the number of times of rising of a signal.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
Instance name
CTD(CD,LOAD,PV,Q,CV);
Example:
Instance name(CD:=M0,
LOAD:=M10,PV:=D0,Q:=M20,
CV:=D10);
CTD
CTD
M0
M10
D0
CD
LOAD
PV
Q
CV
M20
D10
Instance name
X000
CTD_E
M0
M10
D0
CTD_E
EN
ENO
CD
Q
LOAD
CV
PV
CTD_E(EN,CD,LOAD,PV,Q,CV,
ENO);
Example:
Instance name(EN:=X000,
CD:=M0,LOAD:=M10,PV:=D0,
Q:=M20,CV:=D10);
M20
D10
2. Set data
Variable
Description
EN
Input
variable
Output
variable
Data type
Execution condition
Bit
CD
( s1 )
Bit
LOAD
( s2 )
Bit
PV
( n )
Word [signed]
ENO
Execution status
Bit
( d1 )
CV
( d2 )
Word [signed]
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
Set the instance when using a function block.
Describe the instance name when programming a function block.
246
11
In this program, the number of times the bit data stored in a device specified in s1 turns ON from OFF is
counted, and a device specified in d1 turns ON when the value stored in a device specified in d2
becomes "0".
12
Applied Functions
(Standard Character
String Functions)
[Structured ladder/FBD]
CTD_Instance
CTD
g_bool1
CD
g_bool2
LOAD
g_int1
Q
CV
g_bool3
g_int2
13
PV
Applied Functions
(Functions Of Time
Data Types)
[ST]
CTD_Instance(CD:=g_bool1,LOAD:=g_bool2,PV:=g_int1,Q:=g_bool3,CV:=g_int2);
14
Standard
Function
Blocks
[Structured ladder/FBD]
CTD_E_Instance
CTD_E
M10
g_bool2
g_int1
LOAD
PV
ENO
Q
CV
M11
g_bool3
15
g_int2
Operator
g_bool1
EN
CD
Applied Functions
(Standard Comparison
Functions)
Program example
[ST]
CTD_E_Instance(EN:=M10,CD:=g_bool1,LOAD:=g_bool2,PV:=g_int1,Q:=g_bool3,CV:=g_int2,ENO:=M11);
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
247
14.5
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block counts up/down the number of times of rising of a signal.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
Instance name
CTUD(CU,CD,RESET,LOAD,PV,
QU,QD,CV);
Example:
Instance name(CU:=M0,
CD:=M10,RESET:=M20,
LOAD:=M30,PV:=D0,QU:=M40,
QD:=M50,CV:=D10);
CTUD
M0
M10
M20
M30
D0
CTUD
CU
QU
CD
QD
RESET CV
LOAD
PV
M40
M50
D10
Instance name
X000
M0
M10
M20
M30
D0
CTUD_E
CTUD_E
EN
ENO
QU
CU
CD
QD
RESET CV
LOAD
PV
M40
M50
D10
CTUD_E(EN,CU,CD,RESET,
LOAD,PV,QU,QD,CV,ENO);
Example:
Instance name(EN:=X000,
CU:=M0,CD:=M10,RESET:=M20,
LOAD:=M30,PV:=D0,QU:=M40,
QD:=M50,CV:=D10);
2. Set data
Variable
Description
EN
Input
variable
Execution condition
CU
( s1 )
Count up signal
Bit
CD
( s2 )
Bit
RESET ( s3 )
Bit
LOAD
( s4 )
Resetting signal
Bit
PV
( n )
Word [signed]
Execution status
Bit
( d1 )
Bit
QD
( d2 )
CV
( d3 )
ENO
Output
variable
Data type
Bit
QU
Word [signed]
248
11
Applied Functions
(Standard Comparison
Functions)
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) Expression of function blocks in each language
Set the instance when using a function block.
12
14
[Structured ladder/FBD]
Standard
Function
Blocks
CTUD_Instance
CTUD
g_bool1
CU
QU
g_bool2
CD
QD
g_bool5
g_bool6
g_bool3
RESET
CV
g_int2
g_bool4
LOAD
15
PV
Operator
g_int1
13
Applied Functions
(Functions Of Time
Data Types)
In this program, the number of times the bit data stored in a device specified in s1 turns ON from OFF is
counted up (added by "1"). When the value stored in a device specified in d3 reaches the value specified in
n , a device specified in d1 turns ON.
At the same time, the number of times the bit data stored in a device specified in s2 turns ON from OFF is
counted down (subtracted by "1"). When the value stored in a device specified in d3 becomes "0", a device
specified in d2 turns ON.
Applied Functions
(Standard Character
String Functions)
Program example
[ST]
CTUD_Instance(CU:=g_bool1,CD:=g_bool2,RESET:=g_bool3,LOAD:=g_bool4,PV:=g_int1,QU:=g_bool5,
QD:=g_bool6,CV:=g_int2);
A
Correspondence
between Devices
and Addresses
CTUD_E_Instance
CTUD_E
M0
g_bool2
g_bool3
g_bool4
g_int1
CD
RESET
LOAD
PV
ENO
QU
QD
CV
M10
g_bool5
Function/
Operator List
g_bool1
EN
CU
g_bool6
g_int2
[ST]
CTUD_E_Instance(EN:=M0,CU:=g_bool1,CD:=g_bool2,RESET:=g_bool3,LOAD:=g_bool4,PV:=g_int1,
QU:=g_bool5,QD:=g_bool6,CV:=g_int2,ENO:=M10);
249
14.6
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
TP(_E)
TP_10(_E)
Outline
This function block keeps ON a signal for specified duration.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
Instance name
TP
TP
M0
Label1
IN
PT
Q
ET
M10
Label2
Instance name
X000
TP_E
M0
Label1
TP_E
EN
ENO
IN
Q
PT
ET
M10
Label2
Instance name
TP_10
TP_10
M0
Label1
IN
PT
Q
ET
M10
Label2
Instance name
X000
TP_10_E
M0
Label1
TP_10_E
EN
ENO
IN
Q
PT
ET
M10
Label2
TP(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
TP_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
TP_10(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
TP_10_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
2. Set data
Variable
EN
Input
variable
Output
variable
Description
Data type
Execution condition
Bit
Bit
PT ( n )
ON duration data
Time
ENO
Execution status
Bit
IN
( s )
( d1 )
ET ( d2 )
Output signal
Bit
Time
250
11
13
Program example
s
14
[Structured ladder/FBD]
Standard
Function
Blocks
TP_Instance
TP
IN
PT
Applied Functions
(Functions Of Time
Data Types)
T#10s
12
Applied Functions
(Standard Character
String Functions)
g_bool1
Applied Functions
(Standard Comparison
Functions)
Cautions
Q
ET
g_bool2
g_time1
[ST]
15
TP_Instance(IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1);
Operator
M0
T#10s
M10
PT
g_time1
ET
A
Correspondence
between Devices
and Addresses
g_bool1
TP_E_Instance
TP_E
EN
ENO
IN
Q
g_bool2
[ST]
TP_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1,ENO:=M10);
Function/
Operator List
251
14.7
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
TON(_E)
TON_10(_E)
Outline
This function block turns ON after specified time.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
M10
Label2
TON(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
M10
Label2
TON_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
Instance name
TON
TON
M0
Label1
IN
PT
Q
ET
Instance name
X000
TON_E
M0
Label1
TON_E
EN
ENO
Q
IN
PT
ET
Instance name
TON_10
M0
Label1
TON_10
IN
Q
PT
ET
M10
Label2
Instance name
X000
TON_10_E
M0
Label1
TON_10_E
EN
ENO
IN
Q
PT
ET
M10
Label2
TON_10(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
TON_10_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
2. Set data
Variable
EN
Input
variable
Output
variable
IN
( s )
Description
Data type
Execution condition
Bit
Input signal
Bit
PT ( n )
Time
ENO
Execution status
Bit
Output signal
Bit
Time
( d1 )
ET ( d2 )
252
11
13
Program example
s
14
[Structured ladder/FBD]
Standard
Function
Blocks
TON_Instance
TON
IN
PT
Q
ET
Applied Functions
(Functions Of Time
Data Types)
T#10s
12
Applied Functions
(Standard Character
String Functions)
g_bool1
Applied Functions
(Standard Comparison
Functions)
Cautions
g_bool2
g_time1
[ST]
15
TON_Instance(IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1);
Operator
M0
T#10s
M10
PT
g_time1
ET
A
Correspondence
between Devices
and Addresses
g_bool1
TON_E_Instance
TON_E
EN
ENO
IN
Q
g_bool2
[ST]
TON_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1,ENO:=M10);
Function/
Operator List
253
14.8
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
TOF(_E)
TOF_10(_E)
Outline
When the input signal turns OFF, this function block turns OFF the output signal after the specified time.
1. Format
Expression in each language
Function name
Structured ladder/FBD
ST
M10
Label2
TOF(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
M10
Label2
TOF_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
M10
Label2
TOF_10(IN,PT,Q,ET);
Example:
Instance name(IN:=M0,
PT:=Label1,Q:=M10,
ET:=Label2);
Instance name
TOF
TOF
M0
Label1
IN
PT
Q
ET
Instance name
X000
TOF_E
M0
Label1
TOF_E
EN
ENO
Q
IN
PT
ET
Instance name
TOF_10
M0
Label1
TOF_10
IN
Q
PT
ET
Instance name
X000
TOF_10_E
M0
Label1
TOF_10_E
EN
ENO
IN
Q
PT
ET
M10
Label2
TOF_10_E(EN,IN,PT,Q,ET,ENO);
Example:
Instance name(EN:=X000,
IN:=M0,PT:=Label1,Q:=M10,
ET:=Label2);
2. Set data
Variable
EN
Input
variable
Output
variable
IN
( s )
Description
Data type
Execution condition
Bit
Input signal
Bit
PT ( n )
Time
ENO
Execution status
Bit
Output signal
Bit
Time
( d1 )
ET ( d2 )
254
11
13
Program example
14
Standard
Function
Blocks
[Structured ladder/FBD]
TOF_Instance
TOF
IN
PT
Q
ET
Applied Functions
(Functions Of Time
Data Types)
In this program, when bit data stored in a device specified in s turns ON, bit data stored in a device
specified in d1 turns ON. When bit data stored in a device specified in s turns OFF, bit data stored in a
device specified in d1 turns OFF 10 seconds later.
T#10s
12
Applied Functions
(Standard Character
String Functions)
g_bool1
Applied Functions
(Standard Comparison
Functions)
Cautions
g_bool2
g_time1
15
[ST]
Operator
TOF_Instance(IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1);
g_bool1
T#10s
M10
PT
g_time1
ET
Correspondence
between Devices
and Addresses
M0
TOF_E_Instance
TOF_E
EN
ENO
IN
Q
g_bool2
[ST]
Function/
Operator List
TOF_E_Instance(EN:=M0,IN:=g_bool1,PT:=T#10s,Q:=g_bool2,ET:=g_time1,ENO:=M10);
255
14.9
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This counter starts counting when the condition turns ON from OFF and generates an output when counting
up to the set value.
A counter initial value can be set.
1. Format
Expression in each language
Function name
Structured ladder/FBD
COUNTER_FB_M
ST
Instance name
COUNTER_FB_M
Coil
ValueOut
Preset
Status
ValueIn
COUNTER_FB_M(Coil,Preset,Val
ueIn,ValueOut,Status);
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
Coil
Execution condition
Bit
Preset
Word [signed]
ValueIn
Word [signed]
ValueOut
ANY16
Status
Bit
timing chart
COUNTER_FB_M_Instance
Var_M0
10
1
COUNTER_FB_M
Coil
ValueOut
Preset
Status
ValueIn
Var_M0
Var_D10 *1
Var_M10 *2
Value of Var_D10
[ ST ]
COUNTER_FB_M_Instance(Coil:= Var_M0,Preset:=10,
ValueIn:=1,ValueOut:=Var_D10,Status:=Var_M10);
256
Var_M10
ON
ON
ON
10
ON
11
Applied Functions
(Standard Comparison
Functions)
2) When resetting the current value of the counter, reset input variable coil.
[Structured ladder/FBD]
COUNTER_FB_M_Instance
COUNTER_FB_M
Var_D10
Coil
ValueOut
Var_M0
Preset
ValueIn
Status
12
Var_M10
Applied Functions
(Standard Character
String Functions)
10
RST
M15
EN
ENO
d
COUNTER_FB_M_Instance.Coil
13
Applied Functions
(Functions Of Time
Data Types)
[ST]
COUNTER_FB_M_Instance(Coil:= Var_M0,Preset:=10,ValueIn:=1,
ValueOut:=Var_D10,Status:=Var_M10);
RST(M15,COUNTER_FB_M_Instance.Coil);
14
Standard
Function
Blocks
Cautions
1) Expression in each language of function block
Set the instance when using the function block.
Describe the instance name when programming the function block.
15
Operator
2) For the function block, the automatic allocation device needs to be set as the counter numbers are
allocated automatically.
A
Correspondence
between Devices
and Addresses
B
Function/
Operator List
257
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This function block generates an output when the condition continues for the specified time.
The initial value and setting value of the timer is multiplied by 10 ms.
1. Format
Function name
TIMER_10_FB_M
ST
Instance name
TIMER_10_FB_M
Coil
ValueOut
Preset
Status
ValueIn
TIMER_10_FB_M(Coil,Preset,
ValueIn,ValueOut,Status);
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
Coil
Execution condition
Bit
Preset
Word [signed]
ValueIn
Word [signed]
ValueOut
ANY16
Status
Bit
timing chart
ON
Var_M0
10
Value of Var_D10
90ms
[ ST ]
TIMER_10_FB_M_Instance(Coil:= Var_M0,Preset:= 10,
ValueIn:= 1,ValueOut:= Var_D10,Status:=Var_M10);
*1.
*2.
Var_M10
ON
Cautions
1) Expression in each language of function block
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.
258
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
12
This function block counts the period of time while the condition is satisfied, and generates an output when
the timer counts up the specified time.
1. Format
13
Function name
Structured ladder/FBD
ST
Instance name
TIMER_CONT_FB_M
Coil
ValueOut
Preset
Status
ValueIn
TIMER_CONT_FB_M(Coil,
Preset,ValueIn,ValueOut,Status);
Applied Functions
(Functions Of Time
Data Types)
TIMER_
CONT_FB_M
14
Standard
Function
Blocks
2. Set data
Variable
Input
variable
Description
Data type
Coil
Execution condition
Bit
Preset
Word [signed]
ValueIn
Word [signed]
ValueOut
ANY16
Status
Bit
15
Operator
Output
variable
Applied Functions
(Standard Character
String Functions)
Outline
For FX3S
T128 to T131 :1ms
T132 to T137 :100ms
2) The condition of measurement ValueOut and output argument ON/OFF status is maintained even if the
execution condition of the input argument Coil turns OFF.
When the execution condition of the input argument Coil turns ON, the timer resume counting from the
measurement it holds.
[Structured ladder/FBD]
TIMER_CONT_FB_M_Instance
Var_M0
200
0
TIMER_CONT_FB_M
Coil
ValueOut
Preset
Status
ValueIn
timing chart
Var_M0
Var_D10 *1
Var_M10 *2
Value of Var_D10
[ ST ]
TIMER_CONT_FB_M_Instance(Coil:= Var_M0,Preset:= 200,
ValueIn:= 0,ValueOut:= Var_D10,Status:=Var_M10);
*1.
*2.
Var_M10
ON
ON
15 sec
5 sec
150
151-200
ON
259
B
Function/
Operator List
A
Correspondence
between Devices
and Addresses
1) This is a retentive timer that counts the time when the variable is ON. It starts counting the current value
when the execution condition of the input argument Coil turns ON.
The timer starts counting from "ValueIn 1 ms or 100 ms". When it counts up to "Preset 1 ms or 100
ms", the output argument Status turns ON.
The current measurement value is outputted into ValueOut.
The magnification of Valueln and Preset (1 ms or 100 ms) is specified depending on the allocation device
(retentive timer) during compiling.
The allocation device (retentive timer)
3) When resetting the current value of the retentive timer, reset input variable coil.
[Structured ladder/FBD]
TIMER_CONT_FB_M_Instance
TIMER_CONT_FB_M
Var_D10
Coil
ValueOut
Var_M0
10
Preset
ValueIn
Status
Var_M10
RST
M15
EN
ENO
d
TIMER_CONT_FB_M_Instance.Coil
[ST]
TIMER_CONT_FB_M_Instance(Coil:= Var_M0,Preset:=10,ValueIn:=1,
ValueOut:=Var_D10,Status:=Var_M10);
RST(M15,TIMER_CONT_FB_M_Instance.Coil);
Cautions
1) Expression in each language of function block
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.
260
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
12
Applied Functions
(Standard Character
String Functions)
Outline
This function block generates an output when the condition continues for the specified time.
The initial value and setting value of the timer is multiplied by 100 ms.
1. Format
Function name
ST
Instance name
TIMER_100_FB_M
Coil
ValueOut
Preset
Status
ValueIn
Applied Functions
(Functions Of Time
Data Types)
TIMER_100_FB_M
13
TIMER_100_FB_M(Coil,Preset,
ValueIn,ValueOut,Status);
14
Standard
Function
Blocks
2. Set data
Variable
Input
variable
Data type
Execution condition
Bit
Preset
Word [signed]
ValueIn
Word [signed]
ValueOut
ANY16
Status
Bit
15
Operator
Output
variable
Description
Coil
2) When the execution condition of the input argument Coil turns OFF, the current value takes on the value
of ValueIn and the output argument Status also turns OFF.
[Structured ladder/FBD]
timing chart
Var_M0
10
1
[ ST ]
TIMER_100_FB_M
Coil
ValueOut
Status
Preset
ValueIn
Var_D10 *1
Var_M10 *2
ON
Var_M0
10
Value of Var_D10
*1.
*2.
Var_M10
B
Function/
Operator List
TIMER_100_FB_M_Instance
A
Correspondence
between Devices
and Addresses
1) When the execution condition of the input argument Coil turns ON, counting the current value starts.
The timer starts counting from "ValueIn 100 ms". When it counts up to "Preset 100 ms", the output
argument Status turns ON.
The current measurement value is outputted into ValueOut.
900ms
ON
Cautions
1) Expression in each language of function block
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.
261
15 Operator
15. Operator
Function name
Reference
Addition
Section 15.1
SUB
Subtraction
Section 15.2
MUL
Multiplication
Section 15.3
DIV
Division
Section 15.4
Modulus operation
Section 15.5
**
Exponentiation
Section 15.6
AND
Logical product
Section 15.7
MOD
OR
XOR
NOT
262
Function
ADD
Logical sum
Section 15.8
Section 15.9
Logical negation
Section 15.10
GT
Comparison
Section 15.11
GE
Comparison
Section 15.12
EQ
Comparison
Section 15.13
LE
Comparison
Section 15.14
LT
Comparison
Section 15.15
NE
Comparison
Section 15.16
11
ADD / Addition
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.1
15 Operator
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator performs addition using two values (A + B = C), and outputs the operation result.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
D0
D10
s1
s2
D20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_NUM
ANY_NUM
15
1) This function performs addition ( s1 + s2 + s28 ) using word [signed]/double word [signed]/float
(single precision) data stored in devices specified in s1 to s28 , and outputs the operation result to a
device specified in d using the data type of data stored in devices specified in s1 to s28 .
Example: When the data type is word [signed]
s1 (Word
[signed] data)
5678
6912
s2 (Word
[signed] data)
d (Word
[signed] data)
Program example
In this program, addition is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
ADD
g_dint3
[ST]
g_dint3:=(g_dint1)+(g_dint2);
263
B
Function/
Operator List
Cautions
g_dint1
g_dint2
A
Correspondence
between Devices
and Addresses
Operator
1234
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
s1+s2;
Example:
D20:=D0+D10;
ADD
ADD
13
ST
15.2
15 Operator
15.2 SUB / Subtraction
SUB / Subtraction
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator performs subtraction using two values (A - B = C), and outputs the operation result.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1-s2;
Example:
D20:=D0-D10;
SUB
SUB
D0
D10
s1
s2
D20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
Description
Data type
s1
ANY_NUM
s2
ANY_NUM
ANY_NUM
Output
variable
s1 (Word
[signed] data)
6789
5556
s2 (Word
[signed] data)
d (Word
[signed] data)
Cautions
Refer to Section 7.2.
Program example
In this program, subtraction is performed using word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
SUB
[ST]
g_int3:=(g_int1)-(g_int2);
264
g_int3
11
MUL / Multiplication
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.3
15 Operator
12
This operator performs multiplication using two or more values (A B = C), and outputs the operation result.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
D10
s1
s2
s1*s2;
Example:
D20:=D0*D10;
D20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_NUM
ANY_NUM
15
1) This function performs multiplication ( s1 s2 s28 ) using word [signed]/double word [signed]/float
(single precision) data stored in devices specified in s1 to s28 , and outputs the operation result to a
device specified in d using the data type of data stored in devices specified in s1 to s28 .
Example: When the data type is word [signed]
1500
s1 (Word
[signed] data)
s2 (Word
[signed] data)
d (Word
[signed] data)
Program example
In this program, multiplication is performed using double word [signed] data stored in devices specified in
s1 and s2 , and the operation result is output to a device specified in d .
[Structured ladder/FBD]
MUL
g_dint3
[ST]
g_dint3:=(g_dint1) * (g_dint2);
265
B
Function/
Operator List
Cautions
g_dint1
g_dint2
A
Correspondence
between Devices
and Addresses
15
Operator
100
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
D0
13
ST
MUL
MUL
Applied Functions
(Standard Character
String Functions)
Outline
15.4
15 Operator
15.4 DIV / Division
DIV / Division
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator performs division using two values (A / B = C remainder), and outputs the quotient.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1/s2;
Example:
D20:=D0/D10;
DIV
DIV
D0
D10
s1
s2
D20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
s1
ANY_NUM
s2
Data for division (divisor), or word device which stores such data
ANY_NUM
ANY_NUM
s1 (Word
[signed] data)
(Quotient)
2
2
s2 (Word
[signed] data)
d (Word
[signed] data)
Cautions
Refer to Section 7.4.
Error
Refer to Section 7.4.
Program example
In this program, division is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the operation result is output to a device specified in d using the data type of data stored in
devices specified in s1 and s2 .
[Structured ladder/FBD]
g_dint1
g_dint2
DIV
[ST]
g_dint3:=(g_dint1) /(g_dint2);
266
g_dint3
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.5
15 Operator
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator performs division using two values (A / B = C remainder), and outputs the remainder.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
13
ST
MOD
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Input
variable
Output
variable
Description
14
Data type
s1
ANY_INT
s2
Data for division (divisor), or word device which stores such data
ANY_INT
ANY_INT
Standard
Function
Blocks
Variable
15
This function performs division ( s1 / s2 ) using word [signed]/double word [signed] data stored in devices
specified in s1 and s2 , and outputs the remainder to a device specified in d using the data type of
data stored in devices specified in s1 and s2 .
Example: When the data type is word [signed]
s1 (Word
[signed] data)
2
s2 (Word
[signed] data)
Not output
(Remainder)
1
A
Correspondence
between Devices
and Addresses
(Quotient)
2
Operator
Applied Functions
(Functions Of Time
Data Types)
s1 MOD s2 ;
The MOD operator is not available in Structured ladder/
Example:
FBD language.
d:=s1 MOD s2 ;
d (Word
[signed] data)
Cautions
Function/
Operator List
Error
Refer to Section 7.5.
Program examples
In this program, division is performed using double word [signed] data stored in devices specified in s1 and
s2 , and the remainder is output to a device specified in d using the data type of data stored in devices
specified in s1 and s2 .
[ST]
267
15.6
15 Operator
15.6 ** / Exponentiation
** / Exponentiation
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator obtains raised result, and outputs it.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1 **s2;
The "**" operator is not available in Structured ladder/
Example:
FBD language.
d:=s1 **s2;
**
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
Output
variable
Description
Data type
s1
s2
ANY_NUM
Word
[signed] data
s2
16.0
d
Float (single
precision) data
Cautions
Cautions
Refer to Section 7.6.
Error
Refer to Section 7.6.
Program examples
In this program, the value stored in a device specified in s1 is raised to the power of the value stored in a
device specified in s2 , and the operation result is output to a device specified in d using the data type of
data stored in a device specified in s1 .
[ST]
g_real2:=EXPT(g_real1,g_int1);
268
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.7
15 Operator
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator obtains the logical product of two or more bits, and outputs it.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
M0
s1
s2
M10
M20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
14
2. Set data
s1
Output
variable
Description
to s28
Standard
Function
Blocks
Variable
Input
variable
Data type
ANY_BIT
ANY_BIT
15
1) This function obtains the logical product using each bit of bit/word [unsigned]/bit string [16-bit]/double
word [unsigned]/bit string [32-bit] data stored in devices specified in s1 to s28 , and outputs the
operation result to a device specified in d using the data type of data stored in devices specified in
s1 to s28 .
Example: When the data type is word [unsigned]/bit string [16-bit]
1
Logical product
s2
A
Correspondence
between Devices
and Addresses
Operator
s1
Applied Functions
(Functions Of Time
Data Types)
s1 AND s2;
Example:
M20:=M0 AND M10;
AND
AND
13
ST
B
2)
0
s
Cautions
Refer to Section 9.1.
Program examples
In this program, the logical product is obtained using each bit of word [unsigned]/bit string [16-bit] data stored
in devices specified in s1 and s2 , and the operation result is output to a device specified in d using the
data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
g_word1
g_word2
AND
g_word3
[ST]
269
Function/
Operator List
15.8
15 Operator
15.8 OR / Logical sum
OR / Logical sum
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator obtains the logical sum of two or more bits, and outputs it.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1 OR s2;
Example:
M20:=M0 OR M10;
OR
OR
M0
s1
s2
M10
M20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_BIT
ANY_BIT
Logical sum
s2
Cautions
Refer to Section 9.2.
Program examples
In this program, the logical sum is obtained using each bit of word [unsigned]/bit string [16-bit] data stored in
devices specified in s1 and s2 , and the operation result is output to a device specified in d using the
data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
g_word1
g_word2
OR
g_word3
[ST]
g_word3:=(g_word1) OR (g_word2);
270
11
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator obtains the logical sum of two or more bits, and outputs it.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
s1
s2
M10
s1 XOR s2;
Example:
M20:=M0 XOR M10;
M20
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_BIT
ANY_BIT
15
3) If there are 3 or more s , the exclusive logical sum is obtained using the "exclusive logical sum of s1
and s2 " and s3 .
If there is s4 , the exclusive logical sum is obtained using the "exclusive logical sum of "exclusive logical
sum of s1 and s2 " and " s3 "" and s4 . In this way, the exclusive logical sum is obtained the
s6
required number of times for all input labels s5
Example: When the data type is bit
When the number
of "_IN" is 3
s1
s2
FALSE
TRUE
FALSE
TRUE
XOR
XOR
XOR
XOR
TRUE
Result TRUE
s3
TRUE
Result FALSE
s4
TRUE
Result TRUE
s5
TRUE
271
Function/
Operator List
s2
A
Correspondence
between Devices
and Addresses
1) This function obtains the exclusive logical sum using each bit of bit/word [unsigned]/bit string [16-bit]/
double word [unsigned]/bit string [32-bit] data stored in devices specified in s1 to s28 , and outputs the
operation result to a device specified in d using the data type of data stored in devices specified in
s1 to s28 .
Example: When the data type is word [unsigned]/bit string [16-bit]
Operator
s1
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
M0
13
ST
XOR
XOR
2)
Applied Functions
(Standard Comparison
Functions)
15.9
15 Operator
15 Operator
15.9 XOR / Exclusive logical sum
Cautions
Refer to Section 9.3.
Program examples
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 s1 and s2 , and the operation result is output to a device specified in d
using the data type of data stored in devices specified in s1 and s2 .
[Structured ladder/FBD]
g_word1
g_word2
XOR
g_word3
[ST]
272
15 Operator
15.10 NOT / Logical negation
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator obtains the logical negation of bits, and outputs it.
1. Format
Expression in each language
Operator name
Structured ladder/FBD
13
ST
NOT
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Description
14
Data type
Input
variable
ANY_BIT
Output
variable
ANY_BIT
Standard
Function
Blocks
Variable
15
This function obtains the logical negation using each bit of bit/word [unsigned]/bit string [16-bit]/double word
[unsigned]/bit string [32-bit] data stored in a device specified in s , and outputs the operation result to a
device specified in d using the data type of data stored in a device specified in s .
Example: When the data type is word [unsigned]/bit string [16-bit]
0
Logical negation
1
A
Correspondence
between Devices
and Addresses
Operator
Applied Functions
(Functions Of Time
Data Types)
NOT s1;
The NOT operator is not available in Structured ladder/
Example:
FBD language.
d:=NOT(s);
Cautions
Program examples
In this program, the logical negation is obtained using each bit of word [unsigned]/bit string [16-bit] data stored
in a device specified in s , and the operation result is output to a device specified in d using the data
type of data stored in a device specified in s .
[ST]
g_word2:= NOT(g_word1);
273
Function/
Operator List
15 Operator
15.11 GT / Comparison
15.11 GT / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator compares data with regard to "> (larger)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1>s2;
Example:
M0:=D0>D10;
GT
GT
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_BIT
Bit
Cautions
Refer to Section 11.1.
Program examples
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
GT
[ST]
g_bool2:=(g_int1)>(g_int2);
274
g_bool2
15 Operator
15.12 GE / Comparison
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.12 GE / Comparison
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator compares data with regard to " (larger or equal)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_SIMPLE
Bit
15
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ] & [ s2 s3 ] & & [ s n-1 sn ].
b) This function outputs "FALSE" when any comparison result is " s n-1 < sn ".
s
A
Correspondence
between Devices
and Addresses
a) This function outputs "TRUE" when all comparison results are " s n-1 sn ".
Operator
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
s1>=s2;
Example:
M0:=D0>=D10;
GE
GE
13
ST
B
Function/
Operator List
Cautions
Refer to Section 11.2.
Program examples
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
GE
g_bool2
[ST]
g_bool2:=(g_int1)>=(g_int2);
275
15 Operator
15.13 EQ / Comparison
15.13 EQ / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator compares data with regard to "= (equal)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1=s2;
Example:
M0:=D0=D10;
EQ
EQ
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_SIMPLE
Bit
Cautions
Refer to Section 11.3.
Program examples
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
EQ
[ST]
g_bool2:=(g_int1)=(g_int2);
276
g_bool2
15 Operator
15.14 LE / Comparison
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.14 LE / Comparison
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator compares data with regard to " (smaller or equal)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_SIMPLE
Bit
15
1) This function compares the contents of devices specified in s1 to s28 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ] & [ s2 s3 ] & & [ s n-1 sn ].
b) This function outputs "FALSE" when any comparison result is " s n-1 > sn ".
s
A
Correspondence
between Devices
and Addresses
a) This function outputs "TRUE" when all comparison results are " s n-1 sn ".
Operator
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
s1<=s2;
Example:
M0:=D0<=D10;
LE
LE
13
ST
B
Function/
Operator List
Cautions
Refer to Section 11.4.
Program examples
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
LE
g_bool2
[ST]
g_bool2:=(g_int1)<=(g_int2);
277
15 Operator
15.15 LT / Comparison
15.15 LT / Comparison
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Outline
This operator compares data with regard to "< (smaller)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
ST
s1<s2;
Example:
M0:=D0<D10;
LT
LT
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
2. Set data
Variable
Input
variable
s1
Output
variable
Description
to s28
Data type
ANY_SIMPLE
Bit
Cautions
Refer to Section 11.5.
Program examples
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_int1
g_int2
LT
[ST]
g_bool2:=(g_int1)<(g_int2);
278
g_bool2
15 Operator
15.16 NE / Comparison
11
FX3U(C)
FX3G(C)
FX3S
FX2N(C)
FX1N(C)
FX1S
FXU/FX2C
FX0N
FX0(S)
Applied Functions
(Standard Comparison
Functions)
15.16 NE / Comparison
12
Applied Functions
(Standard Character
String Functions)
Outline
This operator compares data with regard to " (unequal)".
1. Format
Expression in each language
Operator name
Structured ladder/FBD
D0
D10
s1
s2
M0
In explanation of operators, the input variable is described as "s " and the output variable is descried as "d".
Variable
Input
variable
s1
Output
variable
to
Description
s2
Data type
ANY_SIMPLE
Bit
15
This function compares the contents of devices specified in s1 and s2 , and outputs the operation result
expressed as the bit type data to a device specified in d .
This function executes comparison [ s1 s2 ].
a) This function outputs "TRUE" when in the case of " s1 s2 "
A
Correspondence
between Devices
and Addresses
Cautions
Refer to Section 11.6.
In this program, the contents of devices specified in s1 and s2 are compared, and the operation result is
output to a device specified in d .
[Structured ladder/FBD]
g_bool2
[ST]
g_bool2:=(g_int1)<>(g_int2);
279
Function/
Operator List
Program examples
NE
Operator
g_int1
g_int2
14
Standard
Function
Blocks
2. Set data
Applied Functions
(Functions Of Time
Data Types)
s1<>s2;
Example:
M0:=D0<>D10;
NE
NE
13
ST
Device
Address
Device
Address
Input relay
Xn
%IXn
X367
%IX247
Output relay
Yn
%QXn
Y367
%QX247
Timer
Auxiliary relay
Mn
%MX0.n
M499
%MX0.499
Contact
TS
Tn
%MX3.n
TS191
%MX3.191
Coil
TC
Tn
%MX5.n
TC191
%MX5.191
Tn
%MW3.n
%MD3.n
TN190
T190
%MW3.191
%MD3.190
Current value
TN
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
Dn
%MW0.n
%MD0.n
D198*
D198
%MW0.199
%MD0.198
Ux\Gn
%MW14.x.n
%MD14.x.n
U0\G09
U0\G09
%MW14.0.10
%MD14.0.9
Extension register
Rn
%MW2.n
%MD2.n
R32766
R32766
%MW2.32767
%MD2.32766
ER
ERn
No correspondence
Pointer
Pn
Interrupt pointer
In
No correspondence
Nesting
Nn
No correspondence
Zn
%MW7.n
%MD7.n
Vn
%MW6.n
V7
%MW6.7
Sn
%MX2.n
S4095
%MX2.4095
Counter
Contact
Index register
State
280
Notation
Device
P4095
Z6
Z6
No correspondence
%MW7.7
%MD7.6
11
Applied Functions
(Standard Comparison
Functions)
MEMO
12
Applied Functions
(Standard Character
String Functions)
13
Applied Functions
(Functions Of Time
Data Types)
14
Standard
Function
Blocks
15
Operator
Correspondence
between Devices
and Addresses
Function/
Operator List
281
282
Function
Ref.
Page
Function
name
REAL_TO_
STR(_E)
Function
Converts float (single precision) data into
string data.
Ref.
Page
88
BOOL_TO_
Converts bit data into word [signed] data.
INT(_E)
40
91
42
93
BOOL_TO_
Converts bit data into string data.
STR(_E)
44
WORD_TO
_INT(_E)
95
46
97
WORD_TO
_DINT(_E)
48
DWORD_
Converts double word [unsigned]/bit string
TO_INT(_E) [32-bit] data into word [signed] data.
99
BOOL_TO_
Converts bit data into time data.
TIME(_E)
50
INT_TO_
DINT(_E)
101
52
DINT_TO_
INT(_E)
54
103
INT_TO_
BOOL(_E)
56
DINT_TO_
BOOL(_E)
105
58
DWORD_
TO_WORD
(_E)
INT_TO_
REAL(_E)
60
WORD_TO
_TIME(_E)
107
DINT_TO_
REAL(_E)
62
DWORD_
TO_TIME(_
E)
109
INT_TO_
STR(_E)
64
STR_TO_
BOOL(_E)
111
DINT_TO_
STR(_E)
66
STR_TO_
INT(_E)
113
INT_TO_
WORD(_E)
68
STR_TO_
DINT(_E)
115
DINT_TO_
WORD(_E)
70
STR_TO_
REAL(_E)
117
INT_TO_
Converts word [signed] data into double
DWORD(_E) word [unsigned]/bit string [32-bit] data.
72
STR_TO_
TIME(_E)
120
74
BCD_TO_
INT(_E)
122
INT_TO_B
CD(_E)
76
BCD_TO_
DINT(_E)
124
DINT_TO_
BCD(_E)
78
TIME_TO_
BOOL(_E)
126
INT_TO_
TIME(_E)
80
TIME_TO_I
Converts time data into word [signed] data.
NT(_E)
128
DINT_TO_
TIME(_E)
82
TIME_TO_
DINT(_E)
130
REAL_TO_
INT(_E)
84
TIME_TO_
STR(_E)
132
REAL_TO_
DINT(_E)
86
TIME_TO_
WORD(_E)
134
Function
Ref.
Page
136
138
140
DINT_TO_
BITARR(_E)
142
181
OR_E
183
12
XOR_E
185
NOT(_E)
187
Ref.
Page
Function
Function
Ref.
Page
SEL(_E)
190
13
146
192
GET_BIT_
OF_INT(_E)
MAXIMUM
(_E)
148
14
194
SET_BIT_
OF_INT(_E)
MINIMUM
(_E)
150
196
CPY_BIT_
OF_INT(_E)
152
198
144
MUX(_E)
GET_INT_
ADDR
155
156
Function
Ref.
Page
GT_E
201
GE_E
203
Ref.
Page
EQ_E
205
158
LE_E
207
LT_E
"<
209
Compares data
(unequal)".
"
NE_E
211
ABS(_E)
Function
Obtains the absolute value.
Function
Ref.
Page
ADD_E
161
SUB_E
Subtracts data.
163
MUL_E
165
DIV_E
167
MOD(_E)
169
EXPT(_E)
171
MOVE(_E)
Transfers data.
173
Function
Ref.
Page
SHL(_E)
176
SHR(_E)
178
Function
name
with
regard
to
Function
Ref.
Page
MID(_E)
214
CONCAT
(_E)
217
INSERT
(_E)
219
DELETE
(_E)
222
REPLACE
(_E)
224
FIND(_E)
227
283
A
Correspondence
between Devices
and Addresses
15
Function/
Operator List
154
Operator
GET_BOOL
Outputs start data as bit data.
_ADDR
Standard
Function
Blocks
Applied Functions
(Functions Of Time
Data Types)
INT_TO_
BITARR(_E)
AND_E
Function
name
Applied Functions
(Standard Character
String Functions)
11
Applied Functions
(Standard Comparison
Functions)
Function
name
Function
Ref.
Page
ADD_TIME
(_E)
SUB_TIME
(_E)
233
MUL_TIME
(_E)
235
DIV_TIME
(_E)
231
237
Function
Ref.
Page
R_TRIG
(_E)
240
F_TRIG
(_E)
242
CTU(_E)
244
CTD(_E)
246
CTUD(_E)
248
TP(_E)
TP_10(_E)
250
TON(_E)
Keeps OFF a signal during specified time
TON_10(_E) duration.
252
TOF(_E)
Turns OFF the output signal at specified
TOF_10(_E) time after the input signal turned OFF.
254
COUNTER
_FB_M
256
Counter drive
TIMER_10_
10ms timer drive
FB_M
258
TIMER_CO
Retentive timer drive
NT_FB_M
259
TIMER_100_
100ms timer drive
FB_M
261
284
ST
Function
Ref.
Page
ADD
263
SUB
Subtracts data.
264
MUL
265
DIV
266
MOD
267
**
268
Operator name
Structured ladder
/FBD
ST
Function
Ref.
Page
AND
&
Obtains the logical product.
AND (Number of pins variable)
269
OR
OR
270
XOR
271
273
ST
Function
Ref.
Page
GT
>
274
GE
>=
275
EQ
276
LE
<=
277
LT
<
278
NE
<>
279
11
Functions
Function
name
Ref.
Page
Function
Function
name
Function
Ref.
Page
158
DINT_TO_I
NT(_E)
54
ADD_TIME
(_E)
231
DINT_TO_
REAL(_E)
62
ADD_E
161
66
AND_E
DINT_TO_
STR(_E)
181
82
70
13
124
BCD_TO_I
NT(_E)
122
DIV_TIME
(_E)
237
DIV_E
167
140
DWORD_T
O_BOOL
(_E)
93
14
138
101
42
DWORD_T
O_INT(_E)
99
48
109
BOOL_TO_
Converts bit data into word [signed] data.
INT(_E)
40
105
BOOL_TO_
Converts bit data into string data.
STR(_E)
DWORD_T
O_WORD
(_E)
Operator
Standard
Function
Blocks
BCD_TO_
DINT(_E)
DINT_TO_
WORD(_E)
Applied Functions
(Functions Of Time
Data Types)
12
Applied Functions
(Standard Character
String Functions)
ABS(_E)
Applied Functions
(Standard Comparison
Functions)
44
BOOL_TO_
Converts bit data into time data.
TIME(_E)
50
EQ_E
205
46
EXPT(_E)
171
227
242
BITARR_T
O_INT(_E)
word
FIND(_E)
Connects character strings.
(Number of pins variable)
217
COUNTER
_FB_M
Counter drive
256
CPY_BITA
RR(_E)
146
G
GE_E
203
148
152
GET_BOOL
Outputs start data as bit data.
_ADDR
154
246
GET_INT_A
Outputs start data as word [signed] data.
DDR
155
CTUD(_E)
248
GET_WOR
D_ADDR
156
CTU(_E)
244
GT_E
201
222
219
DINT_TO_
BCD(_E)
78
INT_TO_B
CD(_E)
78
144
INT_TO_BI
TARR(_E)
142
DINT_TO_
BOOL(_E)
58
INT_TO_B
OOL(_E)
56
74
INT_TO_DI
NT(_E)
52
285
B
Function/
Operator List
CONCAT(_
E)
Correspondence
between Devices
and Addresses
15
Function
name
Function
Ref.
Page
INT_TO_D
WORD(_E)
72
115
INT_TO_R
EAL(_E)
60
STR_TO_I
NT(_E)
113
64
117
INT_TO_TI
ME(_E)
80
STR_TO_TI
Converts string data into time data.
ME(_E)
120
INT_TO_W
ORD(_E)
68
SUB_TIME
(_E)
233
SUB_E
Subtracts data.
163
TIME_TO_
BOOL(_E)
126
Function
Ref.
Page
L
LE_E
207
LIMITATIO
N(_E)
196
TIME_TO_
DINT(_E)
130
LT_E
209
136
TIME_TO_I
Converts time data into word [signed] data.
NT(_E)
128
TIME_TO_
STR(_E)
132
TIME_TO_
WORD(_E)
134
M
MAXIMUM
(_E)
192
MID(_E)
214
MINIMUM
(_E)
194
MOD(_E)
169
MOVE(_E)
Transfers data.
173
MUL_TIME
(_E)
235
MUL_E
MUX(_E)
259
TIMER_10_
10ms timer drive
FB_M
258
165
TIMER_100
100ms timer drive
_FB_M
261
198
TOF(_E)
Turns OFF the output signal at specified
TOF_10(_E) time after the input signal turned OFF.
254
TON(_E)
Keeps OFF a signal during specified time
TON_10(_E) duration.
252
TP(_E)
TP_10(_E)
250
91
WORD_TO
_DINT(_E)
97
WORD_TO
_DWORD
(_E)
103
WORD_TO
_INT(_E)
95
WORD_TO
_TIME(_E)
107
185
NE_E
211
NOT(_E)
187
183
O
OR_E
R
REAL_TO_
DINT(_E)
86
84
REAL_TO_
STR(_E)
88
REPLACE
(_E)
224
R_TRIG(_E)
240
190
150
S
SEL(_E)
TIMER_CO
Retentive timer drive
NT_FB_M
286
Function
name
SHL(_E)
176
SHR(_E)
178
STR_TO_B
Converts string data into bit data.
OOL(_E)
111
X
XOR_E
11
Operator
name
Applied Functions
(Standard Comparison
Functions)
Operator
Ref.
Page
Function
Symbol
263
Subtracts data.
264
265
12
266
**
268
&
269
>
274
13
>=
275
276
<=
277
"<
14
<
278
<>
Compares data
(unequal)".
"
with
regard
to
Applied Functions
(Functions Of Time
Data Types)
Standard
Function
Blocks
Applied Functions
(Standard Character
String Functions)
279
A
Adds data. (Number of pins variable)
263
AND
269
266
276
GE
275
GT
274
LE
277
LT
278
15
Operator
ADD
D
DIV
E
EQ
A
Correspondence
between Devices
and Addresses
Function/
Operator List
"<
M
MOD
267
MUL
265
NE
Compares data
(unequal)".
279
NOT
273
270
Subtracts data.
264
N
with
regard
to
"
O
OR
S
SUB
X
XOR
logical
sum.
271
287
MEMO
288
Warranty
Warranty
Please confirm the following product warranty details before using this product.
The range shall be limited to normal use within the usage state, usage methods and usage environment, etc., which follow the
conditions and precautions, etc., given in the instruction manual, user's manual and caution labels on the product.
Even within the gratis warranty term, repairs shall be charged for in the following cases.
a) Failure occurring from inappropriate storage or handling, carelessness or negligence by the user. Failure caused by the
user's hardware or software design.
b) Failure caused by unapproved modifications, etc., to the product by the user.
c) When the Mitsubishi product is assembled into a user's device, Failure that could have been avoided if functions or
structures, judged as necessary in the legal safety measures the user's device is subject to or as necessary by industry
standards, had been provided.
d) Failure that could have been avoided if consumable parts (battery, backlight, fuse, etc.) designated in the instruction
manual had been correctly serviced or replaced.
e) Relay failure or output contact failure caused by usage beyond the specified Life of contact (cycles).
f) Failure caused by external irresistible forces such as fires or abnormal voltages, and failure caused by force majeure such
as earthquakes, lightning, wind and water damage.
g) Failure caused by reasons unpredictable by scientific technology standards at time of shipment from Mitsubishi.
h) Any other failure found not to be the responsibility of Mitsubishi or that admitted not to be so by the user.
Mitsubishi shall accept onerous product repairs for seven (7) years after production of the product is discontinued.
Discontinuation of production shall be notified with Mitsubishi Technical Bulletins, etc.
2)
Product supply (including repair parts) is not available after production is discontinued.
3. Overseas service
Overseas, repairs shall be accepted by Mitsubishi's local overseas FA Center. Note that the repair conditions at each FA Center
may differ.
6. Product application
1)
In using the Mitsubishi MELSEC programmable logic controller, the usage conditions shall be that the application will not lead to
a major accident even if any problem or fault should occur in the programmable logic controller device, and that backup and failsafe functions are systematically provided outside of the device for any problem or fault.
2)
The Mitsubishi programmable logic controller has been designed and manufactured for applications in general industries, etc.
Thus, applications in which the public could be affected such as in nuclear power plants and other power plants operated by
respective power companies, and applications in which a special quality assurance system is required, such as for Railway
companies or Public service purposes shall be excluded from the programmable logic controller applications.
In addition, applications in which human life or property that could be greatly affected, such as in aircraft, medical applications,
incineration and fuel devices, manned transportation, equipment for recreation and amusement, and safety devices, shall also
be excluded from the programmable logic controller range of applications.
However, in certain cases, some applications may be possible, providing the user consults their local Mitsubishi
representative outlining the special requirements of the project, and providing that all parties concerned agree to the special
circumstances, solely at the users discretion.
289
Revision History
Revision History
290
Date of preparation
Revision
Description
1/2009
First Edition.
7/2009
2/2010
9/2010
7/2011
2/2012
FX3GC is added.
5/2012
The reset method of the counter value and timer value of a function block
(COUNTER_FB_M, TIMER_CONT_FB_M) is added.
2/2013
5/2013
FX3S is added.
FXCPU
Structured Programming Manual
Application Functions
HEAD OFFICE: TOKYO BUILDING, 2-7-3 MARUNOUCHI, CHIYODA-KU, TOKYO 100-8310, JAPAN
HIMEJI WORKS: 840, CHIYODA CHO, HIMEJI, JAPAN
MODEL
FX-KP-OK-E
MODEL CODE
09R927
JY997D34801J
(MEE)