Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Generate and display BCD down counter

Published on Nov 18 2009 // Working with Counters

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

51b-Generate and display BCD down counter

Source Program 2:

  • 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 

Flowchart for Program

51.a-Generate and display BCD down counter

 

Related Programs (Click down)

Split a HEX data into two nibbles and store it

Add two 4-digit BCD numbers

Subtraction of two BCD numbers

Multiply two 2-digit BCD numbers