Chapter 6 Applied Instructions 
6-445 
API    Instruction code  Operand 
Function 
2102  D  BCDDA  P 
S, D 
Converting the binary-coded decimal 
number into the ASCII code 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#
“$”  DF 
Pulse instruction  16-bit instruction (5 steps)  32-bit instruction (5 steps)
Symbol: 
S
: 
Source value  Word/Double word 
D
: 
Device in which the conversion 
result is stored 
Word 
Explanation: 
1.  The binary-coded decimal number in S is converted into the ASCII code, and the conversion 
result is stored in D. 
2.  The instruction supports SM690, which controls the ending character. 
3.  The binary-coded decimal value in S used in the 16-bit instruction should be within the range 
between 0 and 9999, and should be a four-digit binary-coded decimal value. The operand D 
occupies three word devices. The data is converted as follows. 
 b15
 b0
 S
Thousands 
place
 b15
 b0
 b7 b8
 D
 D
 D
+1
+2
Hundreds
place
Tens place
Units place
 b3
 b4 b7
 b8
 b11
 b12
ASCII code in 
the hundreds place
ASCII code in 
the thousands place
ASCII code in 
the tens place
ASCII code in 
the units place
Ending character (16#0000 or unchanged)
 
If SM690 is OFF, 16#0000 is stored in D+2. If SM690 is ON, the value in D+2 is unchanged.   
4.  The binary-coded decimal value in S used in the 32-bit instruction should be within the range 
between 0 and 99999999, and should be an eight-digit binary-coded decimal value. The 
operand D occupies five word devices. The data is converted as follows. 
Ending character (16#0000 or unchanged)
 S
 b15
 b0
 b7
 b8
 D
 D
 D
 D
+1
+2
+3
 D
+4
 b15
 b12 b11
 b8 b7  b4
 b3
 b0
 b15
 b12 b11
 b8 b7  b4
 b3
 b0
 S
+1
Units place
Tens place
Hundreds place
Thousands place
Hundred thousands place
Ten thousands place
Millions place
Ten millions place
ASCII code in 
the units place
ASCII code in 
the tens place
ASCII code in 
the hundreds place
ASCII code in 
the thousands place
ASCII code in the 
ten thousands  place
ASCII code in the hundred 
thousands  place
ASCII code in 
the millions place
ASCII code in 
the ten millions place
 
If SM690 is OFF, 16#0000 is stored in D+5. If SM690 is ON, the value in D+5 is unchanged. 
5.  Take the binary-coded decimal number 12098 in S for example. The digit in the hundred 
thousands place of the number, the digit in the millions place of the number, and the digit in the