Digital Clock: Help with Hours Logic

Discussion in 'The Projects Forum' started by rane.brown, Apr 7, 2013.

  1. rane.brown

    Thread Starter New Member

    Apr 7, 2013
    4
    0
    I am designing a digital clock and I am having trouble figuring out the hours section. I have the seconds and minutes working but I'm not sure where to go with the logic for the hours. I would like to create it in a 12 hr format.

    I currently have the Clock signal from the seconds disconnected so I can test things on the hours side.

    I know if I put a NAND gate on Qd and Qb it will make HR1 count modulo 10 but after it resets it only needs to count modulo 3 and then both HR1 and HR2 need to reset. I'm pretty lost on how to make this happen.

    BCDH2 and BCDH1 are identical.

    Any help would be appreciated.
     
  2. rane.brown

    Thread Starter New Member

    Apr 7, 2013
    4
    0
    This should be under homework forum. Didn't see that section before.
     
  3. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Hint: Make 2 circuits to reset the Unit Hour to zero. One would reset the Unit Hour counter at "1010" while the other at "0011". Since the Tenth Hour only counts "0" or "1" so use that to control the selection of the above 2 circuit's output to reset the Unit Hour.

    Think about it carefully and see if you can understand.

    Allen
     
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Reset the hours to what? Sometimes to zero, sometimes to one, depending if it's the 12->1 change or the 9->10 change. What differentiates the two is the count, good news is you only need check 2 bits on each case. Use those outputs to load the start count on the next clock.
     
  5. rane.brown

    Thread Starter New Member

    Apr 7, 2013
    4
    0
    I think I understand what you are saying about using the tens place of the hours to determine whether the ones section uses mod10 or mod3. I placed two NAND gates to select between the mods and then ran these through a multiplexer. If the multiplexer reads 0 then mod10 is counted and if it reads 1 mod3 is counted.

    Counting mod2 for the tens place is also easy. Just run Qa through an inverter and back to load.

    What do I use for a clock source to feed into the tens place of the hours?

    Also, how do I get it to reset to 1 instead of back to 0?
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,437
    3,360
    Use a counter that has a LOAD or PRESET function.
     
  7. rane.brown

    Thread Starter New Member

    Apr 7, 2013
    4
    0
    I'm currently using a 74HC161 and it does have a load function. What is the preset function? Any recommended IC?
     
  8. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    OOps...:p I must be thinking it as a counter counting 00-12 then back to 00 instead of a clock from 01-12 then back to 01. Sorry about that...

    If you set D3-D0 to '0001', when "LOAD" goes low, Q3-Q0 would become same as D3-D0. Some chips labelled it as "PL" and some as "LOAD". They are the same thing.

    You can also use a 74HC00 to make the 2:1 MUX. But since you know how to use the 74HC157, you should have no problem with your design.

    Allen
     
    Last edited: Apr 8, 2013
  9. MrChips

    Moderator

    Oct 2, 2009
    12,437
    3,360
    74HC161 is ok. Pin-9 is labelled SPE' = Synchronous Parallel Enable.
    When SPE' is brought LOW, the data presented at the input pins, 6, 5, 4, 3 will be loaded into the counter on the next Low-to-High transition of the clock pulse.

    Set this input to 0001 and the 74HC161 will be preset to count from 1.
    The SPE' input will be fed from your decoder circuit when [1] [2] is encountered.

    The decoder is simple. A single 2-input NAND gate is all you need.
     
Loading...