Setting time for counter

Discussion in 'The Projects Forum' started by adriano08, May 8, 2010.

  1. adriano08

    Thread Starter Member

    Apr 25, 2010
    33
    1
    Using 74ls161 and 4511, how do I manually set the time using a switch? I experimented different ways but am still unsure.
    Without pulses, I was able to count up using a push button switch-4 pins.. however, it wasn't stable. I mean sometime when I press the button, it count... 1.. 2.. 3...5...6...8...9...0...2... and so on. I connected it to the clk input. I wonder why was it unable to count properly.

    when I connected to 1hz pulses, it count up normally. With the push button still there, when I pressed on it, I wasn't able to set it as it kept counting upward. So anyone can enlighten me?:confused:
     
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Look up 'DEBOUNCING'

    The problem is, as the contacts in the switch start to touch each other, they 'bounce'. If you looked at the signal at time of switch closing, it would jump up and down many times in a millisecond. The counter "COUNTS" these as separate pulses.

    Switch De-bouncing takes these many pulses and turns them into 1.

    Here is some info on "Bouncing". What is looks like and what you can do about it.:
    http://www.ganssle.com/debouncing.pdf
    From right here in Baltimore ;)
     
  3. adriano08

    Thread Starter Member

    Apr 25, 2010
    33
    1
    oh great! now I know. thanks. :) btw, how can I do this?
    I want it to set the time manually when the pulses is there. So my method is to stop the counter for awhile for setting of time, when the time is set.. the counter will count from there..
    I can't set the time when the number kept counting. Now I am testing for seconds part. For eg. the seconds from 0-9.. i want it to stop and set the time from there. I am not sure though.. hope someone can assist me.
    I have already done a 6hrs counter hopefully can do the setting of the desire time and run it. :confused:
     
  4. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    You could use a monentary button that is NC.
    The regular timer pulse could go through the Normally Closed button.

    When you press and hold the button, it would disconnect the counter.

    Just like the clocks where you press and hold TIME SET then tap the MIN or HOUR buttons.

    By pressing the time set, it will disconnect the counter pulse line and set the time with minute hour and seconds buttons.

    Or you could use a switch to switch over to a faster counter pulse and use an UP and DOWN button that would scroll quickly through the times until they get to the one they want.
     
  5. adriano08

    Thread Starter Member

    Apr 25, 2010
    33
    1
    you mean when I press on the button, it becomes NO? Then the pulse line is cut off and the 2nd button switch is to set the time before I press the 1st button back to NC huh.. so it continue counting..

    I think I'll get the 2 pins button switch to try out. http://www.farnell.com/datasheets/530647.pdf
    So I hook 1st pin of the NC switch to the clk pulse input and the 2nd pin to gnd? Also, the setting switch can connect to clk pulse input and to debounce circuit?
    :confused:
     
  6. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    The NC button will go in line from the clock to the counter.

    Just cut the wire to the counter from the osc, and put the switch in place.

    So when you leave it alone, it runs like normal.

    When you press the button, it disconnects the crystal from the circuit.
     
  7. ELECTRONERD

    Senior Member

    May 26, 2009
    1,146
    16
    A capacitor is also used to suppress the effect of debouncing, I'd add that as well.

    Austin
     
Loading...