# 4-bit counters not working properly

I have three SN74HC161N connected such that an overflow on the first triggers the second etc. (the normal ripple carry setup, where RCO feeds into ENT). The clock inputs of these are connected to a 1 MHz oscillator. The voltage in the circuit is 5V.

From what I can see from the data sheets (https://www.ti.com/lit/ds/symlink/sn74hc161.pdf and https://www.ctscorp.com/wp-content/uploads/MXO45_MXO45HS.pdf) everything should work properly. It seems like the maximum frequency for these counters would be 1 / 500 ns = 2.00 MHz, well above the 1 MHz frequency of my oscillators. I have verified that the counters work using a much slower clock (a 555 timer), but for some reason it doesn’t count when using oscillators (I’ve tried several of them). Have I misunderstood the data sheets (English isn't my native language), or am I overlooking something here?

Below are some pictures of the actual circuit. I've used yellow wires for ground connections (except the four going to LEDs). Red and orange (and one white) indicates power (5V). The green wires (and the longer oranges) are just used for connections between different counters. All capacitors are 0.1 µF, except for the one connected to the 555 timer (on the right) which is 3.3 µF. As the image shows, the long blue wire is connected to the clock inputs of the counters and is currently driven by the oscillator, meaning the 555 isn't really doing anything as for now.

Also a little note: In the schematic, the ENP, CLR* and LOAD* pins are directly connected to 5V, but in the actual hardware I've used green/orange wires to wire them together.

I apologise if my pick of colours doesn't seem natural, however my arsenal of wires is pretty limited at the moment (new ones arrive in a week or two).

The red and blue wires in the top left are connected to an Arduino Uno's 5V and GND pins.

• If enabled on Load! CLR! , EnT, EnP all hi, it should be able to clock @ 30MHz. Verify Vdd=5,Vss=0 and all input, output voltages. Apr 12 '21 at 21:21
• Can you provide a schematic? Need to see how the RCO's are connected to the ENT's on each stage. Apr 12 '21 at 21:29
• I've updated my post. Not the prettiest drawing, but it should sum up how the circuit is made. Apr 12 '21 at 21:44
• @Frævik - Hi, (a) Do you have an oscilloscope, to compare relevant waveforms between your working (555 timer) and non-working (xtal oscillator) test cases? (b) Can you add a photo or two of your actual hardware, in case readers see something worrying? (c) Is it possible that the counter is working, but counting faster than you can measure/detect? (d) You said: "it doesn’t count" using the xtal oscillators as the clock source. With that partial schematic, we don't know what else is attached to the 74HC161 ICs. Can you simplify your test e.g. just one IC, fixed inputs etc. Thanks. Apr 12 '21 at 22:27
• How long is your carry wire. How clean is the oscillator, could you put it through 7400 not gate, just to clean it up, or through 7414 to make sure Schmitt trigger will not cause some threshold issues. Apr 12 '21 at 23:10

Summary: Seeing those photos, there are several concerns (including the decoupling capacitors' location, type & value, and the lack of connections to 74HC161 inputs A-D). Making the circuit work reliably might be an iterative process for you.

However, the first and clearest problem is: You have connected the oscillator wrongly. You need to swap your connections to pins 8 & 14 on the oscillator.

Details:

Looking at the package drawing from the datasheet for your MXO45 oscillator, with my annotations in red:

For the MXO45 "DIP-14" version you have, it has 4 pins actually present in DIP pin positions 1, 7, 8, 14.

Its pinout is:

So in text form for the "DIP-14" version:

Pin Symbol Function
1 EOH Enable (not used on MXO45 version)
7 GND Ground
8 Output RF Output
14 Vcc Supply Voltage

But you have connected:

Pin Symbol Connection
1 EOH Supply Voltage (not used on MXO45 version)
7 GND Ground = OK
8 Output Supply Voltage = NOT OK
14 Vcc Output to 74HC161 = NOT OK

We can see those incorrect connections, in the photo of the oscillator on the breadboard you kindly added:

So your 74HC161 counters are not getting a clock signal, because they are connected to the power pin on the oscillator to which 5 V should be supplied.

Connecting an oscillator's output pin to the 5 V supply, might have permanently damaged it (I don't see a claim in the datasheet that the oscillator will survive a shorted output pin). Since you said that you have tried several oscillators, then you might have damaged them all.

If the oscillators you have are still undamaged then, as a starting point, swap the connections to oscillator pins 8 & 14, so that the 74HC161 counters are connected to the oscillator output on "pin 8" and supply 5 V Vcc to the oscillator on "pin 14".

I would also disconnect pin 1 of the oscillator, as your MXO45 version does not support the output enable function (see page 1 of the datasheet) - the MXO45T or MXO45HST 8-pin versions do support that functionality.

• One fine piece of detective work! Apr 14 '21 at 10:00
• I appreciate your help. For future readers: Apparently I've been looking at the pinout of the DIP-8 oscillator, not the DIP-14 (which is what I'm using). Moral of the story: We all start out at beginners (and this is proof that I certainly still am one :)), but reading carefully through the datasheet gets you a long way. Thank you so much for your help Sam. Apr 14 '21 at 15:44

There are any number of possibilities. An obvious one is the parallel load inputs A-D and the various enable inputs. Are these left floating? If so, you are asking for trouble. With 74HC, ALL inputs must be tied to logic high or low - no exceptions.

Another thing - how is your circuit constructed? Are you using a ground plane? Or at least good tight construction with fairly beefy (and short) wires connecting the grounds together, as well as the +5 lines?

Finally, assuming your ground/power network is OK, what are you doing for decoupling? Each IC should have a 0.1 uF ceramic capacitor between Vcc and ground - and connected as close as possible to (in this case) pins 8 and 16.