Chapter 6 Applied Instructions Symbol S : Source value D : Device where the conversion result is stored Explanation 1. This instruction converts a binary-coded decimal number in S into an ASCII code, and stores the conversion result 6_ in D . 2. The instruction supports SM690 to control the ending character. 3. The binary-coded decimal value in S used in the 16-bit instruction must be between 0–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-12 b11-8 b7-4 b3-0 b15 b8 b7 b0 D + 0 Thousands Hundreds Tens Units D + 1 D + 2 If SM690 is OFF, the instruction stores the ending character 16#0000 in D +2.
If SM690 is ON, the value in D +2 is unchanged without the ending character. 4. For 32-bit instructions, the binary-coded decimal value in S must be between 0–99999999, and should be an eight-digit binary-coded decimal value. The operand D occupies five word devices. The data is converted as follows.
6-633 API Instruction code Operand Function 2102 D BCDDA P S, D Converting a binary-coded decimal number into an ASCII code Device X Y M S T C HC D FR SM SR E K 16# “$” F S D BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S D Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 ES3 0 8 7 6 16#38 16#30 16#36 16#37 16#00 16#00