Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Generate and display BCD up counter with frequency 1Hz

Published on Nov 18 2009 // Working with Counters

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

Source program:

  • LXI SP, 27FFH : Initialize stack pointer
  • MVI C, OOH : Initialize counter
  • BACK: CALL Display : Call display subroutine
  • CALL Delay : Call delay subroutine
  • MOV A, C
  • ADI A, 0 1 : Increment counter
  • DAA : Adjust it for decimal
  • MOV C,A : Store count
  • CPI ,00 : Check count is > 99
  • JNZ BACK : If not, repeat
  • HLT : Stop

Delay Routine:

  • Delay:MVI B, Multiplier-count           : Initialize multiplier count
  • BACK 1                                               :LXI D, Initialize Count
  • BACK:DCX  D                                       : Decrement count
  • MOV A, E
  • ORA D                                                 : Logically OR D and E
  • JNZ BACK                                           : If result is not a, repeat
  • DCR B                                                 : Decrement multiplier count
  • JNZ BACK 1                                        : If not zero, repeat
  • RET                                                     : Return to main program.

50.b-Generate and display BCD up counter

Flowchart for Program

50.a-Generate and display BCD up counter

Flowchart for delay routine

49.d-50.cGenerate and display binary up counter

Related Programs (Click down)

Sub routine to  perform the task of DAA

Program to test RAM

Program to generate Fibonacci number

Generate a delay of 0.4 seconds