2-237
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Data Type Conversion Instructions
2
**_TO_*** (Integer-to-Real Number Conversion Group)
**_TO_*** (Integer-to-Real Number
Conversion Group)
These instructions convert integers to real numbers.
* The valid ranges depend on the data types of In and Out. Refer to Function, below, for details.
These instructions convert an integer, In, to a real number.
The name of the instruction is determined by the data types of In and conversion result Out. For exam-
ple, if In is INT data and Out is REAL data, the name of the instruction is INT_TO_REAL.
The following example for the INT_TO_REAL instruction is for when In is INT#1234.
Instruction Name FB/FUN Graphic expression ST expression
**_TO_*** Integer-to-Real
Number Conversion
Group
FUN Out:=**_TO_*** (In);
"**" must be an integer data
type.
"***" must be a real number
data type.
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to
convert
Input Data to convert *
--- 0
Out Conver-
sion result
Output Conversion result *
--- ---
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
Out OK OK
Function
"**" must be an integer data type.
"***" must be a real number data type.
(@)**_TO_***
EN ENO
In Out
abc:=INT_TO_REAL(INT#1234);
LD ST
abc
INT#1234
INT_TO_REAL
EN ENO
In