Voodoo 74HC161 counter

Jan 26, 2006 1 Replies

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



The first think I\'d do would be to check the wiring (especially Vcc and GND) for high resistance or intermittents. The next thing is that since your counter is CMOS, it\'s _mandatory_ that _all_ the inputs be terminated either to Vcc or GND, as appropriate, for the counter to work. That means, for example, that the MR- terminal needs to be pulled up to Vcc when it\'s not being used, as do CET, CEP, PE-, and D0 through D4. After that I\'d suspect the problem might be the speed of the edge of the "clock" from the phototransistor. The slowest thing non-Schmitt trigger CMOS inputs want to see is about 500ns, and that phototransistor output is going to be way, way slower than that. The next problem is that HC isn\'t designed to be driven by TTL, so there may be something iffy going on with that, depending on your parts. The way to fix that is to pull up the CMOS clock input and drive it with the output of one of the TTL gates (to get the speed you need) or, preferably, get yourself a comparator to do the dark-light switching and use its output as the clock input to the counter.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required