Maker Pro
Maker Pro

74HC193 Not Counting Properly

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
Greetings,

I'm pulsing the count up (CPU) pin of a 74HC193 using a schmitt trigger (so no bouncing) and it counts fine except that it misses 8 and 0 for some reason - goes straight from 7-9 and 15-1.

I dont have a schematic just at the moment but I'll give as many details as I can:

- Powered from a 7805 with 10uF and 1uF capacitors for extra smoothing
- Q outputs are connected to a bar graph display through 330 ohm resistors
- MR is connected to a reset switch (monostable 555)
- PL is tied high
- CPD is tied high
- CPU is connected to a schmitt trigger which takes its input from the PC sound card (feeding it a square wave)

Everything else is unconnected.

I've tried swapping the chip as well.
 

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
Its not noise from the power supply either. I capacitored the **** out of it and still no difference (only noticable difference was without any)
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
When you say you're using a "Schmitt trigger (so no bouncing)" can you describe what else you have to eliminate the bouncing. A circuit diagram of this particular point would be great.

Do you have all your inputs tied somewhere? (you shouldn't leave any floating)
 

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
It would appear the schmitt trigger is the problem - I swapped the clock input to the reset switch / 555 and it counts perfectly.

As for the schmitt trigger, it uses a LM358, non inverting and the resistor values are 1K input and 10K feedback. The reference voltage is the common wire from the audio and the input is one of the left or right channels (there is 1 for each channel using both halves of the 358). They look pretty stable with LEDs stuck on them even when using sine waves. Its puzzling why the instability would occur only at the 8 and 0 counts though.

I'll have a better look at it and make some diagrams tomorrow.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
OK, 2 things. Resistors and a Schmitt trigger do not make a debouncer. A capacitor really needs to make an appearance in there somewhere.

Secondly, the probably reason why the 15-0 and the 7-8 transitions were problematic is that these are where the largest number of bits were changing. It is likely that enough ground bounce was occurring as to cause another clock transition (possibly via the less than perfect debouncing).

A small capacitor (0.1uF across the supply pins of the ICs *may* fix it, but it's probably then just masking the poor debouncing.

You may also get away with the small cap across the power supply connections. It is possible that your filter caps have a high ESR at high frequencies thus not helping greatly to filter high frequency noise.
 

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
I've tried adding capacitors just about everywhere, changing resistor values, switching a transistor with it (both common emitter and common collector). That schmitt trigger arrangement is just NOT suitable for what I want to do (and even if its an issue with the source that still means its not versatile enough). It looks like it will take nothing short of adding 2 full debouncers to those outputs. It just seems overly complicated for such a simple thing. Am I missing something here??
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
A simple debouncer is made with a Schmitt trigger inverter, a resistor, and a capacitor.

Connect the resistor from the input of the Schmitt trigger inverter to V+. Connect the capacitor from the Schmitt trigger inverter input to gnd. Connect the switch across the capacitor. If your Schmitt trigger devices are non-inverting, reverse the V+ and gnd connections from those I've stated above. This circuit's output will go high when the switch is closed.

R and C should be something like 100k and 0.1uF. This will give about a 10 millisecond delay which should be enough. If it's not, increase either/both the resistor and the capacitor. Note that you may get a short pulse when power is applied too.
 

Raven Luni

Oct 15, 2011
798
Joined
Oct 15, 2011
Messages
798
I've decided to just bite teh bullet and put a 556 on the 2 outputs. No amount of tweaking seems to make a difference (including based on your suggestion) so its got to be a pretty fundamental issue rather than just a bit of stray noise. I dont know if there would be impedance matching issues from the audio out (I'm not too familiar with that stuff) or something to do with the suitability of the 358 itself - maybe prone to drift etc. Another possibility could be filtering on the soundcard itself. Although all the effects etc. are off there would probably still be some built in equalisation that could cause a ripple in a square wave (gibbs effect etc).
 
Top