2-215
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
BCD Conversion Instructions
2
**_TO_BCD_***
**_TO_BCD_***
These instructions convert unsigned integers to BCD bit strings.
* The valid ranges depend on the data types of In and Out. Refer to Function, below, for details.
These instructions convert data to convert In (which must be an unsigned integer) to a BCD bit string.
The name of the instruction is determined by the data types of In and conversion result Out. For exam-
ple, if In is UINT data and Out is WORD data, the name of the instruction is UINT_TO_BCD_WORD.
The following example for the UINT_TO_BCD_WORD instruction is for when In is UNIT#3452.
Instruction Name FB/FUN Graphic expression ST expression
**_TO_BCD_*** Unsigned Integer-
to-BCD Conversion
Group
FUN Out:=**_TO_BCD_*** (In);
"**" must be an integer data
type.
"***" must be a bit string
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 OKOKOKOK
Function
(@)**_TO_BCD_***
EN ENO
In Out
"**" must be an integer data type.
"***" must be a bit string data type.
abc:=UINT_TO_BCD_WORD(UINT#3452);
LD
ST
abc
UINT#3452
UINT_TO_BCD_WORD
EN ENO
In
Out=abc
In
16#3452
WORD BCD data
UNIT data
UINT#3452