BCD TO HEX CONVERSION

To convert two BCD numbers in memory to the equivalent HEX number using 8085
instruction set

ALGORITHM:
1) Initialize memory pointer to 4150 H
2) Get the Most Significant Digit (MSD)
3) Multiply the MSD by ten using repeated addition


4) Add the Least Significant Digit (LSD) to the result obtained in previous step
5) Store the HEX data in Memory


PROGRAM:
LXI H,4150
MOV A,M Initialize memory pointer
ADD A MSD X 2
MOV B,A Store MSD X 2
ADD A MSD X 4
ADD A MSD X 8
ADD B MSD X 10
INX H Point to LSD
ADD M Add to form HEX
INX H
MOV M,A Store the result
HLT

OBSERVATION:
Input: 4150 : 02 (MSD)
4151 : 09 (LSD)
Output: 4152 : 1D H
BCD TO HEX CONVERSION BCD TO HEX CONVERSION Reviewed by enakta13 on August 20, 2012 Rating: 5

Search your question

Powered by Blogger.