2-277
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Data Type Conversion Instructions
2
TO_** (Integer Conversion Group)
TO_** (Integer Conversion Group)
These instructions convert integers, bit strings, real numbers, and text strings to integers.
*1 The valid ranges depend on the data types of In and Out.
*2 If you omit the input parameter, the default value is not applied. A building error will occur.
These instructions convert the integer, bit string, real number, or text string in In to an integer.
The name of the instruction is determined by the data type of conversion result Out. For example, if Out
is the LINT data type, the instruction is TO_LINT.
The following example for the TO_LINT instruction is for when In is LREAL#1.0e+10.
Instruction Name FB/FUN Graphic expression ST expression
TO_** Integer Conversion
Group
FUN Out:=TO_** (In);
"**" must be an integer data
type.
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to
convert
Input Data to convert
*1
---
*2
Out Conver-
sion result
Output Conversion result
*1
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK
Out OKOKOKOKOKOKOKOK
Function
"**" must be an integer data type.
(@)TO_**
EN ENO
In Out
abc:=TO_LINT(LREAL#1.0e+10);
LD ST
abc
LREAL#1.0e+10
TO_LINT
EN ENO
In
LREAL data
LINT data
In
Out=abc
LREAL#1.0e+10
10000000000