# 8051 Program To Convert Hexadecimal To Decimal

Converting any hexadecimal value to decimal is very simple if you already remember the basic concept of hexadecimal conversion.

First, we are going to see the algorithms. It basically describes what you should do and how each step is performed.

After that, we will see the flowchart, which will tell us how the program flow works.

## Algorithm

1. Start
2. Load the accumulator with 0FFH
3. Load register B with decimal value 100
4. Divide A by B
5. Load R0 register with the content of Accumulator
6. Load the content of B to the Accumulator
7. Load B with the decimal value of 10
8. Divide A by B
9. Load the content of Accumulator to R1
10. Load the content of B to R2 register
11. Stop

## Hexadecimal To Decimal Program (1st Method)

``````	ORG 0000H
MOV A,#0FFH
MOV B,#100
DIV AB
MOV R0,A
MOV A,B
MOV B,#10
DIV AB
MOV R1,A
MOV R2,B
SJMP \$
END``````
ASM

## Hexadecimal To Decimal Program (2nd Method)

``````	ORG 0000H
MOV A,#0FFH
MOV B,#10
DIV AB
MOV R5,B
MOV B,#10
DIV AB
MOV R4,B
MOV B,#10
DIV AB
MOV R3,B
SJMP \$
END``````

## Output

Note:- If you want to run the program and see the output then I would highly recommend you install Keil uVision5.