Going slightly mad: Simple tristate buffer not properly driving output? - Page 1
Forum section: electronics / beginners

author: TheSchilk
author_rank: Contributor
timestamp: July 21, 2020, 07:02:20 pm
content: Hey All!I am slightly confused about the behaviour of a circuit I have built up on a PCB:It is a push button with an RC circuit and buffer IC (SN74LCV1G126DCKR) fordebouncing driving a single T-FlipFlop made up of a D-FlipFlop and a NOT gate.(See schematic and picture of circuit attached). It is used to switch between twodifferent operating modes.I would expect the D-FF to toggle every time I hit the button, but instead it onlyturns on once, then never extinguishes.I wanted to make sure the signal from the button was reaching the D-FlipFlop, soI took a look at the output of the buffer with a multimeter, and as soon as themultimeter is connected the circuit works just fine.In fact, just touching that net with metal tweezers is enough to get it to work.To me it sounds like the output net is floating/not being driven correctly andthe resistance in the DMM (and the capcitance of my body?) is enough to pull itdown?I took a look at the datasheet for the driver, and see nothing that would impactthis. (https://www.ti.com/lit/ds/symlink/sn74lvc1g126.pdf?ts=1595356684716)Anybody have any idea what is going on?I feel like i am missing something obvious but right now I am stumped!I could probably fix it with a 10K to ground, but I would rather understand what is going on hereThanks again!

author: Ian.M
author_rank: Super Contributor
timestamp: July 21, 2020, 08:18:52 pm
content: So you are sweeping a 74LVC1G126 fast high output drive buffer that *DOESN'T* have a Schmidt trigger input *SLooooooooooooooWLY* through its input threshold region, and expecting it to behave? Its almost certainly 'chirping' during each transition, and the final state of the flipflop will depend on the number of oscillation cycles in the chirp, and whether or not its Clk pin can respond fast enough! Loading the output with your probe, finger, tweezers etc, will have lowered the 'chirp' frequency improving the odds that the flipflop can respond fast enough to toggle.A buffer following a RC filter for debouncing *MUST* have hysteresis.You should probably (re)read Jack Ganssle's excellent article on debouncing:http://www.ganssle.com/debouncing.htmespecially part 2 where he covers RC hardware debouncers.

author: TheSchilk
author_rank: Contributor
timestamp: July 21, 2020, 08:50:21 pm
content: Quote from: Ian.M on July 21, 2020, 08:18:52 pmduh. Of course.Thank you

author: Ian.M
author_rank: Super Contributor
timestamp: July 21, 2020, 09:08:52 pm
content: You are over-complicating it anyway. The whole circuit apart from the button can be replaced by a 74LVC2G04, two resistors and a capacitor!

author: eblc1388
author_rank: Frequent Contributor
timestamp: July 22, 2020, 12:17:40 am
content: The two-inverter circuit might power up in an unknown state, with output either high or low.It would be perfect if this can be rectified.

author: Ian.M
author_rank: Super Contributor
timestamp: July 22, 2020, 12:49:20 am
content: That's an easy enough fix if you use NAND gates rather than inverters, as you can then use a RC network on the other input to force the powerup state. Its a little trickier with just inverters,but you can get there with a capacitor charging through a pullup resistor, initially holding the left gate input low via a diode (or flip the R and C and reverse the diode if you want it initially high). Once the initialisation capacitor has fully charged, the diode blocks it from having any further effect on the circuit.P.S. Thanks Eblc1388 forreminding me of this simple latch circuit.

author: eblc1388
author_rank: Frequent Contributor
timestamp: July 22, 2020, 02:06:49 am
content: Yes, the NAND gate with R+C on one input method is the best.Agree it is very tricky to use R+C+Diode with inverter gates implementation as the 10K interstage feedback resistor will be paralleled across the reset capacitor making it difficult to charge up the capacitor via a reasonable value pull up resistor.

author: Ian.M
author_rank: Super Contributor
timestamp: July 22, 2020, 02:59:02 am
content: It only has to force the state for a very short time for it to propagate round the loop. Use a pullup of Rfeedback/10 and the same value reset cap as the toggle/debounce cap, and it will work fine with Vcc supplies that rise rapidly at switch on. If you have very slow rising Vcc, however, the NAND method is probably preferable to making the reset cap 10uF or larger!I've modded your sim from the other thread a bit to set a stepped initial condition for the state of the loop, and added the RC+D reset circuit, which forces the initial state nicely. If you want to see it come up in either state (to confirm the reset circuit is effective), remove the diode.

author: eblc1388
author_rank: Frequent Contributor
timestamp: July 22, 2020, 03:49:22 am
content: With the now increased 22K feedback resistor, it is much easier to force a low state on the first inverter using a single 3n3 capacitor at the input.I tried and the simulation seems to work as expected. May be there are hidden faults in this simple solution.

author: Ian.M
author_rank: Super Contributor
timestamp: July 22, 2020, 05:44:09 am
content: I wasn't entirely convinced because the LTspice digital gate primitives have internal power sources and I suspect they may not respect the .tran startup option, so I made a symbol for the transistor level 74HCU04 unbuffered CMOS inverter model from the other thread, and tried it in your latest sim, replacing the default inverters. It looks good. I should note the button should probably have conductive elastomer contacts to provide some resistance to limit the current spike and thus the EMI when the capacitors transfer charge.I doubt the latching soft button circuit with known power-up state can be muntzed any further!Complete LTspice sim attached.

author: Unixon
author_rank: Frequent Contributor
timestamp: July 22, 2020, 05:52:15 am
content: I would suggest using simple voltage supervisor likeMAX809MAX811 (any with manual reset input) for debouncing switches, they are dirt cheap these days (AliExpress etc.) and generate clean output pulse.