5 Applied Functions
5.1 Type Conversion Functions
36
FXCPU Structured Programming Manual
(Application Functions)
5. Applied Functions
This chapter explains the operation outline of each applied function, symbols, I/O data type, equivalent circuit
in sequence instructions, target models, cautions and program examples.
Refer to the following manual for variables, operators, data types and program languages:
→
Q/FX Structured Programming Manual (Fundamentals)
5.1
Type Conversion Functions
5.1.1
BOOL_TO_INT(_E)
Outline
This function coverts bit data into word [signed] data, and outputs the data obtained by conversion.
1. Format
*1.
Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
This function converts bit data stored in a device specified in
into word [signed] data, and outputs the
data obtained by conversion to a device specified in
.
When the input value is "FALSE", this function outputs "0" as the word [signed] data value.
When the input value is "TRUE", this function outputs "1" as the word [signed] data value.
Cautions
Use the function having "_E" in its name to connect a bus.
FX
3U(C)
FX
3G
FX
2N(C)
FX
1N(C)
FX
1S
FX
U
/FX
2C
FX
0N
FX
0(S)
Function name
Expression in each language
Structured ladder
ST
BOOL_TO_INT
BOOL_TO_INT(_BOOL);
Example:
D0:=
BOOL_TO_INT(M0);
BOOL_TO_INT_E
BOOL_TO_INT_E(EN,_BOOL,
Output label
Example:
BOOL_TO_INT_E(X000,M0,
D0);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_BOOL (
)
Conversion source bit data
Bit
Output
variable
ENO
Execution status
Bit
*1
(
)
Word [signed] data after conversion
Word [signed]
BOOL_TO_INT
_BOOL
*1
D0
M0
BOOL_TO_INT_E
EN
ENO
*1
D0
X000
M0
_BOOL
s
d
s
d
FALSE
0
TRUE
1
Bit data
Word [signed] data