2 Instruction Descriptions
2-218
NJ-series Instructions Reference Manual (W502)
BCD_TO_**
The BCD_TO_** instruction converts BCD bit strings into unsigned integers.
*1 The valid ranges depend on the data types of In and Out. Refer to Function, below, for details.
*2 If you omit the input parameter, the default value is not applied. A building error will occur.
These instructions convert data to convert In (which must be a BCD bit string) into an unsigned integer.
The name of the instruction is determined by the data type of conversion result Out. For example, if Out
is the UINT data type, the instruction is BCD_TO_UINT.
The following example for the BCD_TO_UINT instruction is for when In is WORD#16#3452.
Instruction Name FB/FUN Graphic expression ST expression
BCD_TO_** BCD Data Type-to-
Unsigned Integer
Conversion Group
FUN Out:=BCD_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
Out OKOKOKOKOKOKOKOK
Function
(@)BCD_TO_**
EN ENO
In Out
"**" must be an integer data type.
abc:=BCD_TO_UINT(WORD#16#3452);
LD
ST
abc
WORD#16#3452
BCD_TO_UINT
EN ENO
In
In
Out=abc
3452
UNIT data
WORD BCD data
WORD#16#3452