Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

ASCII to Decimal Conversion

Published on Nov 20 2009 // Code conversion

Statement: Convert the ASCII number in memory to its equivalent decimal number




Source program :

  • LXI H, 4150 : Point to data
  • MOV A, M : Get operand
  • SUI 30 : convert to decimal
  • CPI 0A : Check whether it is valid decimal number
  • JC LOOP : yes, store result
  • MVI A, FF : No, make result=FF
  • LOOP: INX H
  • MOV M, A
  • HLT : (A) = (4151)

Note: The ASCII Code (American Standard Code for Information Interchange) is commonly used for communication. It is a seven bit code. In this code number 0 through 9 are represented as 30 through 39 respectively and letters A through Z are represented as 41H through 5AH. Therefore, by subtracting 30H we can convert an ASCII number into its decimal equivalent.

Related Programs for Beginners: (Click down)

Search a byte in a given number

Add two decimal numbers of 6 digit each

Add each element of array with the elements of another array

Separate even numbers from given numbers