Simple flip flop wiring for audio A/B channel switch

Thread Starter

d-rainger

Joined Jun 9, 2016
23
The flip flop is a Toshiba TC7WZ74 FU D-type, and the switch is a spst pushbutton momentary thing, quite small. The resistances are as shown on the diagram.
BTW the switch can be easily inverted to make a falling edge the first thing that happens when pressed..... Do I really need an inverter?
 

dl324

Joined Mar 30, 2015
16,909
The flip flop is a Toshiba TC7WZ74 FU D-type
Toshiba makes crappy datasheets. The part is apparently being marketed as a TTL replacement because they're using the TTL part designator, but it's CMOS. CMOS parts usually have a input transition requirements because slow transitions will increase power dissipation and associated power supply glitches. That datasheet doesn't mention any clock risetime restriction...
The resistances are as shown on the diagram.
What does 33k/100k mean? Is it one or the other? Do you have them in parallel?
BTW the switch can be easily inverted to make a falling edge the first thing that happens when pressed..... Do I really need an inverter?
You weren't very clear about what "works only very occasionally" means, but I suspect a problem with the time constant of the poor man's debounce circuit being used. 100KΩ and 10uF gives tau=1S. With such slow transitions, you may need a schmitt inverter.
 

Thread Starter

d-rainger

Joined Jun 9, 2016
23
Toshiba makes crappy datasheets. The part is apparently being marketed as a TTL replacement because they're using the TTL part designator, but it's CMOS. CMOS parts usually have a input transition requirements because slow transitions will increase power dissipation and associated power supply glitches. That datasheet doesn't mention any clock risetime restriction...
What does 33k/100k mean? Is it one or the other? Do you have them in parallel?
You weren't very clear about what "works only very occasionally" means, but I suspect a problem with the time constant of the poor man's debounce circuit being used. 100KΩ and 10uF gives tau=1S. With such slow transitions, you may need a schmitt inverter.
Toshiba - Hmm, OK... Is it worth carrying on?

'33k/100k' means I've tried 33k and then replaced it with 100k... no joy. 'Only occasionally' means one out of four hits works good, the reast either do nothing, or an instantaneous flicker on the other side (I have two LEDs, on Q and /Q).

BTW I very much appreciate all the help I'm getting here - whether it's effctive or not!
 

dl324

Joined Mar 30, 2015
16,909
Toshiba - Hmm, OK... Is it worth carrying on?
I think the problem is with the debounce circuit.
'33k/100k' means I've tried 33k and then replaced it with 100k... no joy. 'Only occasionally' means one out of four hits works good, the reast either do nothing, or an instantaneous flicker on the other side (I have two LEDs, on Q and /Q).
Did 100k work better than 33k?

Without a part number for the switch, we can only guess at how long the contacts might bounce. Without better information, I'd assume something close to 10mS. Try decreasing the RC time constant.
 

Thread Starter

d-rainger

Joined Jun 9, 2016
23
That's very interesting! It still works about one out of four taps, but usually the LED goes off once the switch is released. On the ones it doesn't work, there's a tiny flash of the other LED - often on releasing the switch. BTW both 33k and 100k work equally as badly. The switch is Rapidonline.com part number 78-0100.
 

eetech00

Joined Jun 8, 2013
3,934
Hmm...from what I can tell from reading datasheets, the TC7WZ74 is a LVC device, operating at 3.0 volts.
Its equivalent to a TI SN74LVC2G74. Why not just use a CD4013B?
 

Attachments

Thread Starter

d-rainger

Joined Jun 9, 2016
23
I don't have space to use a 14-pin chip, plus I only have SMD-to-breadboard adapting PCBs in 8-pin format.

Here's where I'm up to, and it works perfectly - except it only switches to the other output for as long as the switch is pressed.... When I release the switch it goes back to the original side.
But it's reliable, and no flickering!!! Almost there?!!
 

Tonyr1084

Joined Sep 24, 2015
7,894
First, I don't understand why holding the switch achieves the desired result but then as soon as you let it go it goes back to the other state. I'm wondering if you've made a mistake in your wiring. It's worth going over one more time.

Also, I've made a few small changes to your diagram. Give this a try:
 

Attachments

Tonyr1084

Joined Sep 24, 2015
7,894
Holding CLR (L); PR (H); D (X); C (X) resets Q (L); /Q (H)
Holding CLR (H); PR (L); D (X); C (X) presets Q (H); /Q (L)
Holding CLR (L); PR (L); D (X); C (X) sets Q (H); /Q (H)
Holding CLR (H); PR (H); D (L); C (PGE) sets Q (L); /Q (H)
Holding CLR (H); PR (H); D (H); C (PGE) sets Q (H); /Q (L).

(NGE) on the clock should precipitate no changes at all. So if it is resetting then something seems to be wired incorrectly - OR the chip has failed.

/Q = NOT Q
(L) = Low State
(H) = High State
(X) = does not matter
(PGE) = Positive Going edge
(NGE) = Negative Going Edge
 

Thread Starter

d-rainger

Joined Jun 9, 2016
23
Tried the altered circuit (and re-checked it)... It works about half of the time, often triggering again when the switch is released (or at least giving an instantaneous gap in illumination when released). When it doesn't work, there's usually a very quick flash of the other LED.

I was thinking because of all the flashing there were multiple hits (ie switch bounce) still. So I tried raising the 1k (with a pot, up to 100k) to lower the cut-off frequency of the RC filter created by the 1k and the 0.1uF..... No improvement.
 

Tonyr1084

Joined Sep 24, 2015
7,894
The capacitor reduces the rise time of the PGE clock signal. TOO LONG a period can cause it to not clock. Instead of a 100K pot I'd try either a 1K pot or change the cap to a 0.01 µF rating. But too fast a rise time and the bounce signal can sneak in and screw things up.

From what you're saying it sounds a little like the chip is malfunctioning. I'm assuming you've reverified your wiring, so I won't keep beating that drum. But for sure, something's up.
 

Marcus2012

Joined Feb 22, 2015
425
I mentioned earlier using a much smaller cap value. And I am also concerned that because of the load you have on /Q the voltage at D will not be high enough to register as a CMOS HIGH, probably wouldn't be a problem for TTL, but I don't think it will be over 0.7Vdd.
 

eetech00

Joined Jun 8, 2013
3,934
I don't have space to use a 14-pin chip, plus I only have SMD-to-breadboard adapting PCBs in 8-pin format.

Here's where I'm up to, and it works perfectly - except it only switches to the other output for as long as the switch is pressed.... When I release the switch it goes back to the original side.
But it's reliable, and no flickering!!! Almost there?!!
Press and hold the button while measuring the voltage at the "Q" pin. What is the logic high voltage measured at pin "Q" or "not Q"?
 

Marcus2012

Joined Feb 22, 2015
425
This will do what you ask with a delay between presses of about 1.2 ms (a delay is unavoidable with a D-type). Using either type of BJT with the right topology will bring the voltage at D back up to Vdd (5V or close).

D Type Switch.png
 
Last edited:

Marcus2012

Joined Feb 22, 2015
425
Doesn't really matter if you put the cap from CLK to ground or CLK to Vdd but what does matter is you don't use a large cap value (which would increase the delay) and don't divide the voltage at /Q to the point where the voltage at D is less than 0.7Vdd
 
Top