0
\$\begingroup\$

I am trying to get a 74161N 4-bit counter to work. If I connect the clock input to a button to ground, pressing the button increments the counter. Unfortunately due to the physical connection in the button, it will sometimes send out extra pulses causing the counter to do multiple counts in fractions of a second. This leads to the counter counting unreliably. So to circumvent this I used an Arduino with a simple blink program to send clock input to the adder. To no prevail, something odd happened, the first bit kept blinking at half of the speed I set the Arduino to count to, (500ms -> 1000ms) and this confused me. Next I set up a simple astable 555 timer circuit and fed that into the clock input. Now a similar thing is happening as before but except to the 4th bit. I check to see if this was the IC by replacing it with an identical, but still no prevail. I've been stuck on this for days without answer. Here's the datasheet I used: http://www.jameco.com/Jameco/Products/ProdDS/49664.pdf I hope someone can help be get the counter to work properly.

(Also if this is really simple and I'm being dumb I am very much a noob at electronics.)

\$\endgroup\$
  • \$\begingroup\$ A schematic describing how you have the 161 connected would be helpful. \$\endgroup\$ – uint128_t Feb 4 '16 at 0:28
  • \$\begingroup\$ I guess I could make a rough sketch in paint.net, in the meanwhile pin 16 is connected to 5V, 8 to ground, QA through QD are conncected to 1K Ohm resistors then and LED then to ground, and pin 2 is connected to the output a of a 555 timer. \$\endgroup\$ – tjpc3 The Redstoner Feb 4 '16 at 0:32
  • \$\begingroup\$ ... or you could edit your question and hit the button to add a schematic - its built into this site ... \$\endgroup\$ – brhans Feb 4 '16 at 1:49
2
\$\begingroup\$

Answer: sanitize your inputs, switches bounce many times (they are springy they can bounce on and off many many times before they come to a resting state). This will do bad things to digital electronics, such as missed counts or even metastability. Use a Schmidt trigger and an RC filter or other circuit (google switch bounce circuit) to get rid of the switch bounce. http://www.labbookpages.co.uk/electronics/debounce.html

Suggestion: Get a cheap oscilloscope or logic analyzer on ebay. Would you rather be short 20-50$ or have those hours of your life back. Scopes make it dead simple to troubleshoot problems like this.

\$\endgroup\$
  • \$\begingroup\$ I'll see if I can try this. \$\endgroup\$ – tjpc3 The Redstoner Feb 4 '16 at 0:35
  • \$\begingroup\$ YES!!! It worked! Thank you so much! I can't believe the fix was as simple as that. I'm still a bit curious as to why the 555 timer wasn't working, as I'm going to use that timer for the same purpose down the line. \$\endgroup\$ – tjpc3 The Redstoner Feb 4 '16 at 0:48
0
\$\begingroup\$

If you use a switch, you need to handle switch bounce, easily with a capacitor, if you aren't using an MCU. Did you connect the A-D preset pins of the 74161 to a particular voltage (e.g. GND)?. The chip is meant to increase from the preset value to the maximum count of 15 (1111) and back to zero. The QA pin is the least significant bit and should correctly blink at half the input frequency, while the QD pin should blink at 1/16 of the input frequency. Ensure that CLR, ENP, /LOAD and ENT pins are raised HIGH.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.