Sunday, September 13, 2009

Generate and display BCD down counter (8085)




Statement:Write a program for displaying BCD down counter. Counter should count numbers from 99 to 00 and it should increment after every 1 sec. Assume operating frequency of 8085 equal to 3MHz. Display routine is available




Source Program 1:

LXI SP, 27FFH : Initialize stack pointer
MVI C, 99H : Initialize counter = 99
BACK:CALL Display : Call display subroutine
CALL Delay : Call delay subroutine
ADI 99H : See Addition below
DAA : Adjust for decimal
CPI 99H : Compare with last count
JNZ BACK :If no, repeat
HLT




Source Program2:
LXI SP, 27FFH : Initialize stack pointer
MVI C, 99H : Initialize counter = 99
BACK: CALL Display : Call display subroutine
CALL Delay : Call delay subroutine
MOV A, C : Get count
ANI 0FH : Check for lower nibble
JNZ SKIP : If it is not 0FH go to skip
MOV A,C : Else get the count
SBI ,06 : Subtract 06
MOV C,A : Store the count
DCR C : Decrement count
CPI 99H : Check it for last count
JNZ BACK : If not, repeat
HLT : Stop

2 comments: