Help With JK Flip Flop Clock Pulse

Thread Starter

tempparasite7

Joined Jul 21, 2019
4
Hi all,

i have a sn74ls76 dual jk flip flop. I have it configurated to work as an T flip flop. The function of this circuit is to count every time a push button is pressed, with a reset condition. But when I am acting the button, sometimes a single press counts as two in the flip flops (it makes two changes of states). how can I configure this so that whenever the button is pressed only a change of state occurs?

JK_circuit_colors.png
Moderators note : showed image full size inverted colors​
 

Attachments

Last edited by a moderator:

MrChips

Joined Oct 2, 2009
19,417
In simulation as well as in real life, all unused inputs must be connected to a valid logic voltage, low or high.

In real life, a push button used as a clock source must be debounced!
 

bertus

Joined Apr 5, 2008
20,105
Hello,

Also have a look at the power connection.
The phototransistor has a +24 in the emitor and nothing in the collector.
Also the TTL chips wil not work at 24 Volts.
TTL chips will work from 4.75 to 5.25 Volts. 5 Volts is the standard for TTL.

Bertus
 

AnalogKid

Joined Aug 1, 2013
8,153
The input to IC1a has two problems. First, as above, it is not debounced. Switch contacts do not come together and pull apart cleanly. There can be a burst of very rapid make-break-make-break cycles in a few milliseconds. Your ff might be seeing 20 to 50 button presses very rapidly. Second. when the button is not pressed the clock input is floating. This can lead to false triggering, or the first valid trigger edge being ignored.

To help with both problems, add a 47 uF capacitor and 1 K resistor in parallel from the U1a clock input to GND. If the chip is a CMOS logic type (CD, HC, AC, etc.) the values can change and the capacitor can be much smaller.

ak
 

AnalogKid

Joined Aug 1, 2013
8,153
IC1a, IC1b, and IC2a can source very little current into their respective LEDs, barely enough to be seen in dim lighting.

D3 needs a current limiting resistor.

Are you sure you want D3 connected between two gate outputs?

When the IC1a output is high, there still is a current path to GND for D3 through R2 and D2.

ak
 

djsfantasi

Joined Apr 11, 2010
5,704
Here’s an image of what happens electrically when you press a push button.
2104F192-A6C3-4BD4-A3D1-05CF58A8F2EA.png

“Debouncing” a switch ignores the many pulses after pressing the push button switch. It can be done with hardware or software. Searching for “switch debounce” results in many resources, including this article on AAC.
 

Thread Starter

tempparasite7

Joined Jul 21, 2019
4
Hello,

Also have a look at the power connection.
The phototransistor has a +24 in the emitor and nothing in the collector.
Also the TTL chips wil not work at 24 Volts.
TTL chips will work from 4.75 to 5.25 Volts. 5 Volts is the standard for TTL.

Bertus
The input to IC1a has two problems. First, as above, it is not debounced. Switch contacts do not come together and pull apart cleanly. There can be a burst of very rapid make-break-make-break cycles in a few milliseconds. Your ff might be seeing 20 to 50 button presses very rapidly. Second. when the button is not pressed the clock input is floating. This can lead to false triggering, or the first valid trigger edge being ignored.

To help with both problems, add a 47 uF capacitor and 1 K resistor in parallel from the U1a clock input to GND. If the chip is a CMOS logic type (CD, HC, AC, etc.) the values can change and the capacitor can be much smaller.

ak
First of all thank's everybody for help me.
I'm using a 5V power supply with my circuit, i was using a 10k omhs to ground on IC1a Clock. i aplied the RC circuit to the button just like you say but im steel having the same problem with the bounce, do i have to apply the RC filter on the IC1b clock as well?
here is how i have connect the flip flop circuit right now just to test the clock pulse
View attachment 182183
 

crutschow

Joined Mar 14, 2008
23,529
do i have to apply the RC filter on the IC1b clock as well?
No, it should only be needed for the switch output.

Can you use a 7474 D-FF instead of the JK as a T-FF, since those are easily debounced by adding an RC delay in the feedback from the /Q output to the D input.

Your attachment gives an error when I try to open it.
 

crutschow

Joined Mar 14, 2008
23,529
Your debounce RC time-constant is only 1ms, which likely is shorter than the switch-bounce duration.
Try making that time at least 100ms (C1=100μF).

And, as others have noted, it's not good practice to leave any inputs floating.
Tie the J, K, and and unused Set/Clr inputs to V+.
 
Last edited:
Top