8085 is a Microprocessor which was developed by Intel in 1970s. All the instructions in this microprocessor are encoded in a single byte. Some of the instructions are followed by one or two bytes of data, which can be a memory address, an immediate operand or a port number.
In this post, we will write a program in 8085 to convert binary number to binary coded decimal(BCD) without using DAA operation.
Algorithm
Start Clear D and E registers to account for hundreds and tens Load data in A Compare A with 64H If CS = 1 go to 9 A <- A - 64H E <- E + 1 Go to 4 Compare A with 0AH if CS = 1 go to 14 A <- A - 0AH D <- D + 1 go to C <- A A <- D Rotate left A 4 times Combine unit and tens to form lower bit result Save hundreds as upper bits and combined result as lower bit Stop
Flow Chart
Program
MVI E, 00H MOV D, E LDA 2100H HUND: CPI 64H JC TEN SUI 64H INR E JMP HUND TEN: CPI 0AH JC UNIT SUI 0AH INR D JMP TEN UNIT: MOV C, A MOV A, D RLC RLC RLC RLC ADD C STA 2101H MOV A, E STA 2102H RST-5
Example
2100H: FF 2101H: 55 -> lower bits 2105H: 02 -> upper bits // output is 255
Check out our other 8085 programs
- Program to Calculate 8-bit Sum of N 8-bit Numbers
- Program to Find the Maximum of N Numbers
- Program to Find the Minimum of N Numbers
- Program to multiply two 8-bit numbers without using shifting multiplicand
- Program to multiply two 8-bit numbers using shifting multiplicand
- Program to divide a 16-bit number with an 8-bit number
- Program to find the HCF of two numbers
- Program to find the HCF of N numbers
- Program to convert binary number to decimal
- Program to convert binary number to decimal without using DAA
- Program to convert decimal to binary
Let us know in the comments if you are having any questions regarding this microprocessor program.
And if you found this post helpful, then please help us by sharing this post with your friends. Thank You