Digital clock problem

Discussion in 'Homework Help' started by Zun, Jan 12, 2018.

  1. Zun

    Thread Starter Member

    Aug 6, 2017
    72
    0
    All number going to zero, help
     
  2. Zun

    Thread Starter Member

    Aug 6, 2017
    72
    0
    Last edited: Jan 12, 2018
  3. Zun

    Thread Starter Member

    Aug 6, 2017
    72
    0
  4. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,914
    1,953
  5. dl324

    AAC Fanatic!

    Mar 30, 2015
    8,519
    2,048
    Your schematic is abysmal, but here's a cropped version:
    upload_2018-1-12_7-13-31.png

    If you want people to look at your code, post it (preferably well formatted) on this site.
     
  6. Zun

    Thread Starter Member

    Aug 6, 2017
    72
    0
  7. Zun

    Thread Starter Member

    Aug 6, 2017
    72
    0
  8. LesJones

    Well-Known Member

    Jan 8, 2017
    2,195
    651
    Looking at the code it looks like there should be some keys (Or a keyboard.) for setting the time. This MAY be preventing the counters incrementing. See what happens if you modify the code so that it puts some values in the hours and minutes counters instead of clearing them at the start of the program. This will help to confirm that the multiplexing is working. If the values that you load display correctly then I think the ISR is not incrementing the time registers.

    Les.
     
  9. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,914
    1,953
    What frequency is the crystal?
    So when you switch it on you immediately get a display of four zeroes?
    And that never changes?
     
  10. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,914
    1,953
    They do increment when the code is run in the simulator.
     
  11. LesJones

    Well-Known Member

    Jan 8, 2017
    2,195
    651
    Hi Albert,
    I did not think the missing keyboard was preventing the ISR from working but I did not spend that long looking at the code that initialised timer 0 and how the interrupt routine worked. (I am assuming that it calls the "INCR subroutine every second.)

    Les.
     
  12. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,914
    1,953
    Assuming it is a 4MHz crystal it increments the minutes every 59.93 seconds - very close!
     
Loading...