Connect with us

4026 decade counter: switch bounce, ungated C output

Discussion in 'Electronic Basics' started by Adam Funk, Aug 6, 2012.

  1. Adam Funk

    Adam Funk Guest

    I've been playing with some 4026 decade counters (the ones with output
    suitable for direct connection to 7-segment LEDs) based on some
    material in the _Make: Electronics_ book.


    The book mentions switch bounce when using a push-button switch, &
    says "The simplest option [to debounce the switch] is to put a small
    capacitor in parallel with the switch, to absorb the fluctuations; but
    this is less than ideal." I tried it anyway, & found that a 100 nF
    capacitor does the job quite well, but 33 nF and 1 nF capacitors
    don't. What is bad about using a capacitor for this?

    I'm also wondering what pin 14 is for. The data sheet calls it
    UNGATED "C-SEGMENT" and says it's not gated by DISPLAY ENABLE, a
    feature required for certain divider functions. The Make book labels
    it "Not-2 output" & the example circuits show it grounded, but doesn't
    (unless I've missed something) explain what it's for.
     
  2. Guest

    As you found out, it's not reliable. The value of this capacitor is dependent
    on the timing of the switch bounce. If that changes the circuit can become
    flaky. It can be done but you have to be careful and it's often a source of
    headaches. The perfect debounce is a couple of cross-coupled gates (RS flip
    flop) and a SPDT switch but it's usually impractical so some version of a
    filter is used.
    Apparently it's needed for divide by 60 and divide by 12. The 'c' segment is
    unique in that it's lit with every code except '2'. I don't see their
    circuits and I haven't thought about it for more than thirty seconds but I
    imagine they're feeding the '2' back to the reset for a divide by 12. This
    logic should be valid whether or not the display is gated.
     
  3. Switch bounce isn't the problem of the counter. The switch goes from one
    state to the other, and for a lot of things, it does. But for digital
    logic that can respond really fast, it sees the "bounce" from the switch,
    where the switch alternates between the two states at a very fast rate,
    before settling on the other one. Since the counter can count fast, it
    sees those pulses, and counts them.

    One problem with a capacitor is that if you start using too large a value,
    you end up slowing down real switch output. I suspect with the 100uF you
    won't be able to advance the count by the switch at a very fast rate, the
    capacitor slowing things down.

    The traditional way is a couple of cross connected nand gates, the output
    of one goes to the input of the other, and the same with the second gate,
    the switch is a single pole double throw, and its common point goes to
    ground, the output terminals go to the so far unused inputs of the nand
    gates. It is a latch, it triggers on the first pulse from the switch,
    doesn't reset until the switch is released.

    Pine 14, according to Don Lancaster's CMOS Cookbook, is an output. He
    labels it "2 out" and says it only goes low on count 2.

    Since it's an output, it would never be grounded. Most logic families
    will be damaged if you short an output to ground.

    Clock Enable, pin 2, if that's not high the pulses on the clock input, pin
    1, will be ignored.

    Display Enable, pin 3, only controls the output to the readout. A low on
    that pin turns off the display, so you can sleep at night, or as Don
    Lancaster suggests, it's a way of controlling the brightness of the
    display by clocking the Display Enable at a fast rate, changing the duty
    cycle controls the brightness.

    Michael
     
  4. Adam Funk

    Adam Funk Guest

    Well duh. I think it was the capital C that threw me off, whereas the
    rest of the data sheet uses lower-case letters for the display
    segments. Thanks.
     
  5. Adam Funk

    Adam Funk Guest

    Interesting, thanks.

    Oops. I double-checked the book and it definitely shows it grounded.
    By connecting it to an LED & series resistor, however, I've seen what
    it does --- exactly what you say.

    Thanks. I understood those but failed to get "C-SEGMENT".
     
  6. Adam Funk

    Adam Funk Guest


    The book has a "no floating pins" sidebar & warns that all the input
    pins on a CMOS need to be connected to something (either ground or
    Vcc, if nothing else). But what is the right thing to do with an
    unneeded *output* pin?
     
  7. Guest

    Unused inputs may not do any functional problems if left floating. Data pins,
    for example, won't cause any problems if floating because no matter what the
    data, nothing unexpected will happen. However, CMOS inputs are high impedance
    and as such are a perfect target for ESD. They should be tied to a rail just
    to bleed off charge. Outputs will usually be driven to one state or the other
    via a low impedance driver so ESD isn't as much of a problem. Tristate
    outputs probably should have a resistor tieing them to one state or the other.
     
  8. Adam Funk

    Adam Funk Guest

    I guess it doesn't do any harm to use my latest approach: stick an LED
    & a series resistor on every otherwise unused output, just to see when
    it blinks. :) And it makes the breadboard look more impressive.

    That makes sense.


    Thanks to everyone who answered.


    --
    A recent study conducted by Harvard University found that the average
    American walks about 900 miles a year. Another study by the AMA found
    that Americans drink, on average, 22 gallons of alcohol a year. This
    means, on average, Americans get about 41 miles to the gallon.
    http://www.cartalk.com/content/average-americans-mpg
     
  9. Guest

    It just eats a lot of power. Make sure the outputs can handle the current -
    all of them together (you don't exceed the current in the power or ground
    pins).
     
  10. Guest

    That's a good point, depending on the logic. High-speed gates tend to have a
    lot of shoot-thru, which will show up if the gates are allowed to hang in the
    threshold region.
     
  11. Adam Funk

    Adam Funk Guest


    Thanks. I'll check. (No magic smoke has escaped yet.)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-