Voodoo 74HC161 counter

Hi,

I'm not that knowledgeable in TTL but know enough to get myself in trouble. ;-) I built a very simply TTL circuit that is not behaving as it should IMHO.

I have one 54LS00J NAND chip, one 74HC161 hi-speed CMOS counter, and some phototransistors. I am simply trying to tie the phototransistor to the counters clock input. I am doing this the common way by placing a resistor (47K) from Vcc to collector and grounding the emitter and then using the phototransistors collector as the output, which goes to the counters clock input (pin 2). I understand 47K is not common, but it works best with my phototransistor since the phototransistor goes from over 2 mega ohms in darkness to several kilo ohms in light. So as a test, I simply move the phototransistors from light to dark, then back to light and so forth. It is a gentle transition and I see no noise. Of course it is not an instant transition either. The counters clock input looks fine as it goes from nearly zero to 5.22 volts. For some reason the counter won't respond. Below you'll see that I've tried adding various size capacitors to eliminate noise.

So then I use two of the four NAND gates to create a J/K flip-flop just to see if the counter is working. So now I have two phototransistors tied to a J/K flip-flop. Both phototransistors are in the dark and I move one of them into the light and then back into the dark then do the same to the other phototransistors. This makes the flip-flops R input go from H to L to H and then the S input goes from H to L to H. That causes the flip-flop to change. I tie either one of the flip-flops output to the counters clock and it works! So fine, I figure the counter just don't like my phototransistor. I have no idea why because the voltages look fine. I don't want the phototransistor to go to a flip-flop, that was just a test. So instead of feeding two phototransistors to a flip-flop, I feed one single phototransistor to one NAND gate and then feed the NAND gate output to the counters clock. So then I verified that the NAND gate is working fine; i.e., it's happy with the phototransistor, BUT the counter is not happy! So then I feed the NAND output to another NAND (on the same NAND chip) and then that NAND output to the counters clock input. Still doesn't work! Also I tried placing various size capacitors from the phototransistor's collector to ground just incase their was some noise, but it made no difference.

BTW, I am using a simple digital multimeter to measure the voltage. Here's where some weird voodoo stuff comes in. If I reset the counter by making the master reset (pin 1) go low then all four output bits of the counter goes low. Then if I move the phototransistor in light and back to dark the least significant bit goes high. After that point, regardless if I move the phototransistor in light and back to dark, etc. it will not change. Although, if I remove the multimeter and then move the phototransistor in light and back to dark and then put the multimeters clip lead back on counters least significant bit (pin 14) then it is low! If I remove the multimeter again and move the phototransistor back and forth in light / dark and put multimeter back on then nothing changes, but if I leave the multimeter on pin 14 and then move phototransistor back and forth in light / dark then the counter bit goes high. I can't understand how my multimeter is affecting the counter. I have no reason to believe there's anything wrong with my multimeter. Regardless, the counter will not work if the multimeter is connected or not.

I always thought a voltage was a voltage. The counters clock input (pin

2) goes from 0.11 to 4.11 volts coming from the NAND gate, but it does not work. Yet, when I make two NAND's into j/k flip-flop then the counter works even though the clock input voltages are not any difference as they still change from 0.11 to 4.11 volts. Why would the counter care? I refuse to believe there's any noise in my NAND output.

I would appreciate any help or suggestions!

Thanks, Paul

Reply to
pmlonline
Loading thread data ...

Argh. Slowing the transition with capacitors is a very bad thing to do at the input of a synchronous counter.

You have to hook up a scope. I'm guessing that the transition from H to L is many milliseconds, and that's not a Good Thing for a high-speed synch counter. A Schmitt trigger to square things up will be a start. Also good bypassing is a must.

Tim.

Reply to
Tim Shoppa

Thanks for help. A Schmitt trigger ... I'll try that. I see NTE has a hex Schmitt trigger, 40106BT.

I curious though, when I fed the phototransistor collector output to a NAND and then fed that output to yet another NAND, then why wouldn't that output work for the counter? That's two NAND's in series.

Paul

Reply to
pmlonline

Perhaps even better than the cmos 40106bt is a 7414: Hex Schmitt-Trigger Inverter. Any ideas which family is better, 7414,

74LS14, 74HC14, etc? Since my counter is HC perhaps I should buy a 74HC14.

Thanks, Paul

Reply to
pmlonline

74HC parts really want input voltages that go from 0V to VCC. 74LS parts don't necessarily drive that high -- they're something like two diode drops below VCC, which can cause problems with some 74HC inputs.

I would use 74HC parts.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

Tim, you're a wealth of knowledge. You may have nailed it. My NAND is LS series and the counter is HC series. Perhaps that's the other problem / voodoo stuff I've been seeing. I'll file my 54LS00 and buy a

74HC00. I bet that will fix the problem, but will also get a Schmitt trigger inverter, 74HC14 just in case the 74HC00 doesn't like my slow rise time from the phototransistor.

Better yet, I see there's a Schmitt Trigger Quad 2-input NAND, 74HC132 ... two birds with one stone.

Reply to
pmlonline

--
Learn to cross-post. It makes it easier on all of us, and I wouldn\'t
have to tell you that I answered your post on seb.
Reply to
John Fields

No, no. Lose the NAND entirely. Run the PHT output to the input of the

74HC14, then hook its output to the counter's input. The HC74 clocks on the rising edge, so this arrangement will clock when the PHT goes from dark to light. If you want it to clock going light to dark, use another 74HC14 section to invert the clock.

I think this is right - in the light, the PHT conducts, so its output is low, right? And in the dark it goes high? So when the PHT goes dark, its output = HC14 input goes high, the HC14 output goes low, so then when the PHT gets light, it goes low, the HC14 inverts it, and your counter should clock.

Be sure and tie all of the unused inputs to ground or VCC, depending on which is the inactive state for the particular input.

If you do it right, you won't need the NAND at all, unless you want to inhibit the counting somehow.

+Vcc HC14 Counter | |\\ +---------+ +-----------| >o----| | | |/ +---------+ C B PHT E | GND

I've ignored everything but the counter's clock, but you seen to have a grasp of preset and clear and stuff.

Good Luck! Rich

Reply to
Rich Grise

Thanks for great info. I never thought I'd learn so much from building a simple board. You're both correct, I left the counters data inputs open.

These suggestions should fix the problem.

Kind regards, Paul

Reply to
pmlonline

OK. I use google groups to post. Is cross posting when you post to multiple groups at once? I tried that in google and it didn't work. In the "to:" form I entered "sci.electronics.design, sci.electronics.basics" minus the quotes.

Kind regards, Paul

Reply to
pmlonline

Two things:

  1. Do you have the power supply bypassed? You should stick a 10nF or
100nF cap between VCC and ground, with leads as short as practical.

  1. I notice you're posting from Google Groups. It is customary when posting news messages to copy any relevant previous content (such as I do in this post) in the body of your message, because news servers don't always save previous messages, and because newsreaders don't let you see them simultaneously by default. There's a nice FAQ on how to use Google Groups to do this right -- but I don't have the link.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

--
Yes.
Reply to
John Fields

That should work. You just need faster transitions, however you get them. Look at the data sheet: max rise and fall times for inputs are 1000 to 400 nS as Vcc varies from 2 to 6 volts.

RTFM

Reply to
Don Foreman

Here's a quickie:

Instead of hitting "Reply", scroll up to the header, and click "Show Options". This gives you a full header, with about a half-dozen additional links; use _THAT_ "Reply" link.

That's what I just did, and it includes context. :-)

Google groups still sucks though - you shouldn't have to jump through flaming hoops just to post in a fashion that meets USENET standards.

Cheers! Rich on Google

Reply to
richardgrise

If you post the long way, there's two radio buttons. The "TO:" one is for email. The other one should be obvious that it's the newsgroups, and you only have to separate them by one comma - see my google post: I put "sci.electronics.basics,sci.electronics.design" (no quotes) - actually, all I did was append the ",sci.electronics.design" in the posting window.

I've also mentioned how to post the long way, which you seem to have got right, but for those who are just tuning in, to post a reply from googlegroups, DON'T hit the "Reply" link. Scroll up to the header of the post you want to reply to, click "Show Options", and when that header panel opens, there's about a half-dozen other links. Click _THAT_ "Reply" link, and you get a reply panel that has it all, including context and the option to crosspost. It seems to have radio buttons, where you can select "email to" or "Post to NG" - use the "Post to NG" option, and just type in the NG names that you want to crosspost to, comma-separated with no blanks, up to five.

Good Luck! Rich

Reply to
Rich Grise, but drunk

As you've discovered, analog and digital components don't intermix too well.

The counter's clock input expects to see nice clean transitions, with fast rise and fall times. Like at least 5 million volts per second. (Well actually, 5 volts per microsecond)

The output of the photocell is a very analog signal, wandering all over the place, very slowly changing. Really slowly, like maybe 1000 volts per second.

So they're mismatched, by a factor of about 5,000. That's kinda pushing the limits.

You need something like a schmitt trigger to go SNAP! when the voltage rises past a certain point. Go find a 74HC14, that will give you SIX schmitt triggers.

Reply to
Ancient_Hacker

That worked. Actually I see both sci.electronics.design and sci.electronics.basics are autofilled this time. I guess someone's already corrected this thread. Well now I know what cross-posting is. ;)

Thanks everyone! It works like a charm! Schmitt triggers are amazing and now I'm wondering why all TTL aren't Schmitt triggers. I see there's not only a trigger / snap, but also some histeresis perhaps making the Schmitt great for noise.

Many thanks, Paul

Reply to
pmlonline

The snap comes from the hysteresis, as a matter of fact. The data sheet for the part will list the hysteresis (it varies all over the map), and if you look at the symbol for a Schmitt trigger you'll see that it has a little picture of hysteresis in it:

------ \\ \\ ------

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Reply to
Tim Wescott

Because it takes a little more silicon real estate, so they're a little more expensive (admittedly, not by much :-) ), but mostly because normally they're not needed. The output of a TTL (or, as you've seen, HC) chip "snaps" really quickly, so the input of the next chip doesn't need it at all - the direct connection is fine. :-)

Google is your friend - I was surprised at the result of this just now:

formatting link
The first hit:
formatting link
:-)

Yikes! I put

formatting link
and this was hit #5:
formatting link
(HCMOS is the same as CMOS, but faster and with "stronger" outputs.)

Ain't the internet grand? :-)

Cheers! Rich

Reply to
Rich Grise
[eliminating a bunch of stuff that is no longer germane.]

There is also a speed penalty for Schmitt triggers and designs often pushed speed near the limit.

--
JosephKK
Reply to
Joseph2k

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.