2 Instruction Descriptions
2-230
NJ-series Instructions Reference Manual (W502)
The AryToBin instruction converts Size elements of array of BCD bit strings In[] starting from In[0] to
unsigned integers. It outputs the unsigned integers to unsigned integer array AryOut[].
The following example is for when Size is UINT#3.
The following table shows the valid ranges for In[] and AryOut[] according to the data types of their
elements.
• Use the same data type and size for In[] and AryOut[]. For example, if the elements of In[] are WORD
data, use USINT as the data type of the elements of AryOut[].
• This instruction does not convert signed BCD to signed binary. Use an unsigned integer (USINT,
UINT, UDINT, or ULINT) as the data type of AryOut [].
• The values in AryOut[] do not change if the value of Size is 0.
• Return value Out is not used when the instruction is used in ST.
• An error occurs in the following cases. ENO will be FALSE, and AryOut[] will not change.
• The data type sizes of In[] and AryOut[] are different.
• The value of Size exceeds the array area of In[] or AryOut[].
• A value in In[] is not a BCD bit string (i.e., contains A, B, C, D, E, or F hexadecimal).
Function
Data type of the ele-
ments of In[]
Data type of the ele-
ments of AryOut[]
Valid range of In[] Valid range of AryOut[]
BYTE USINT 16#00 to 16#99 (BCD) 0 to 99
WORD UINT 16#0000 to 16#9999 (BCD) 0 to 9999
DWORD UDINT 16#0000_0000 to 16#9999_9999
(BCD)
0 to 99999999
LWORD ULINT 16#0000_0000_0000_0000 to
16#9999_9999_9999_9999 (BCD)
0 to 9999999999999999
Precautions for Correct Use
AryToBin(abc[1], UINT#3, def[2]);
LD ST
UINT#3
abc[1]
def[2]
def[2]
AryToBin
EN ENO
In
Size
AryOut
In[0]=abc[1]
In[1]=abc[2]
In[2]=abc[3]
16#10EC
16#0013
16#123B
AryOut[0]=def[2]
AryOut[1]=def[3]
AryOut[2]=def[4]
4332
0019
4667
Size=UINT#3