High School Physics

# HEX to ASCII conversion program in 8085 – PhysicsTeacher.in

In this post, we will see how to convert a given Hexadecimal number into its equivalent ASCII number using the 8085 microprocessor instruction set. (HEX to ASCII conversion)

## Algorithm for HEX to ASCII Conversion with 8085 microprocessor

1. Load the given data in A register and move to B register
2. Mask the upper nibble of the Hexa decimal number in A register
3. Call subroutine to get ASCII of lower nibble
4. Store it in memory
5. Move B register to A register and mask the lower nibble
6. Rotate the upper nibble to lower nibble position
7. Call subroutine to get ASCII of upper nibble
8. Store it in memory
9. Terminate the program.

## Program to convert a Hex (Hexadecimal) number into its equivalent ASCII using the 8085 microprocessor

LDA 4200 Get Hexa Data
MOV B,A
CALL SUB1 Get ASCII code for upper nibble
STA 4201
MOV A,B
RLC
RLC
RLC
RLC
CALL SUB1 Get ASCII code for lower nibble
STA 4202
HLT
SUB1: CPI 0A
JC SKIP
RET

## Observation

Input: 4200 E4(Hexa data)
Output: 4201 34(ASCII Code for 4)
4202 45(ASCII Code for E)

## Result

Thus the 8085 microprocessor program to convert a Hexadecimal number to ASCII code was executed.

See also  Instruction Word flow diagram and Data Word flow diagram for Intel 8085 & 8086
Scroll to top
error: physicsTeacher.in