Experimenting with counters: Qa output dead? - Page 1
Forum section: electronics / beginners

author: Moriambar
author_rank: Unknown
timestamp: April 20, 2021, 08:36:40 am
content: Hello, I'm experimenting with aCD74AC1634 bit counter. The experiment is simple, out of my gpsldo box I have a 1pps sqw output, and I'd like to trigger the counter with it and… count.I hooked up the counter correctly, as I had it in a previous experiment, and the counter counts, outputs QBto QDwork perfectly and display the correct waveforms (I also tested them with LEDs) of 0.5, 0.25 and 0.125 HzThe problem is that the QAoutput, that I expect to be 1Hz does not work. The experiment is breadboarded btw. On another breadboard I had the counter and its QAoutput working fine using 10MHz.I tried the following:Changing the location of the counter on the BBChanging the counter ICResetting the counterTying the A input of the parallel load (unused) to VCC, GND or leaving it untouchedInspecting the waveform directly on the IC pin and not via the adapter/breadboardfor good measure checking the continuity of the pin to the breadboard and its non continuity to GND/VCCNothing changes though. What am I doing wrong?Do I need to provide more? Thanks

author: RoGeorge
author_rank: Super Contributor
timestamp: April 20, 2021, 09:28:10 am
content: If the GPS output is one pulse per second (1Hz), then Qa should be 1Hz divided by 2, so 0.5Hz (so 1 second on, 1 second off, not 1Hz - 1Hz would be 0.5s on and 0.5s off).Assuming the counter is connected properly, maybe the signal seen by the counter is not clean, and each edge is seen in fact as 2 very short pulses (for example because of the signal reflections in the cable between the GPS and the counter), thus making the Qa to appear as not working (maybe it is counting, but one state is so short - like a glitch - that it is not observed on the LEDs, yet the AC series of 163 counters is fast enough to detect that few ns and count it).Does Qa stays always or one, or always on zero, or sometimes it's zero and some other times is 1? What voltage do you see with a DMM?For this try using a 50 ohms cable and a parallel 50 ohms resistor at the counter input (I assume the GPS output impedance is 50 ohms). Or add a small parallel capacitor between the counting input and GND, to cut any glitches that might produce a fake flip in the first flip-flop.Another cause may be the lack of well stabilised 5V Vcc or the lack of filtering capacitors. Put a 10uF parallel with 0.1uF between the Vcc and GND, as close as possible near the 163's pins.A schematic diagram with all the conexions of the 163 and a picture of the breadboard might help debugging it further.

author: Moriambar
author_rank: Unknown
timestamp: April 20, 2021, 10:43:32 am
content: Quote from: RoGeorge on April 20, 2021, 09:28:10 amThanks, I'll try those suggestions when I can and I'll get back here.

author: Moriambar
author_rank: Unknown
timestamp: April 20, 2021, 11:26:51 am
content: So, I did the following:Buffered the output of my pps input, for good measure via asn74LVC1G17schmitt trigger, just to have a steeper rise time, just in casAdded capacitance on the 5V line from my linear PSU (10uF total, plus 0.1 on the VCC pin of the counter)Added a 330nF ceramic cap on the counter inputAnd here are the results about QA: it kinda counts now, but erratically. I attached a couple of waveforms from my scope. Green is the 1PPS input, while in yellow I have the QAoutput of the counter.Is there anything else?Thanks

author: RoGeorge
author_rank: Super Contributor
timestamp: April 20, 2021, 12:39:05 pm
content: I suspect there are reflections in the wires between the GPS and the breadboard. This video might help to see how badly reflections (caused by impedance missmatch between the output of the GPS, the cable, and the input of the first gate) alters any square waveform.- first, move the 330nF from the input of the counter to the input of the newly added Schmitt gate (I assume the gate is located near the counter), there is no good reason to put it between the Schmitt buffer and the counter.- try a lower value, say 1nF- add another 0.1uF near the pins of the Schmitt-trigger ICVery important, lookup the specs of your GPS. Does the 1 pps output has 50 ohms impedance? If so, you need to use a 50 ohms cable terminated at the breadboard end with a 50 ohms resistor between the signal and the GND.Impedance matching is very important when working with high speed signals. It doesn't matter if it's only 1 Hz, it matters only how fast are the edges of the 1Hz signal, reflections will appear in the first nanoseconds after each edge, but the counter is fast enough to register those spikes and count them.Please add a picture of the breadboard, to see the whole setup, or else I can only assume and give only generic advice.

author: rstofer
author_rank: Super Contributor
timestamp: April 20, 2021, 03:16:01 pm
content: CLR', ENT, ENP and LOAD' all need to be pulled high. Without seeing a picture of the breadboard, we can only guess at the actual wiring.Unless I was using one of the signals, I would connect them all together and use a 10k resistor to pull them to Vcc.

author: Moriambar
author_rank: Unknown
timestamp: April 20, 2021, 05:04:29 pm
content: So, what I did is I placed a Cap between the input of the buffer and GND.Everything is working properly now. The only thing is that I don't know why…

author: Benta
author_rank: Super Contributor
timestamp: April 20, 2021, 06:00:18 pm
content: Quote from: Moriambar on April 20, 2021, 05:04:29 pmYou have a "dirty" clock. Too long cables, noise etc.A general comment: 74AC logic is NOT suited for plug-in breadboards. At least a perf board should be used. You may have better luck with 74HC163.

author: Moriambar
author_rank: Unknown
timestamp: April 20, 2021, 06:02:50 pm
content: Quote from: Benta on April 20, 2021, 06:00:18 pmOk, thanks.Regarding the IC… it's what I had around lol, thanks again

author: RoGeorge
author_rank: Super Contributor
timestamp: April 20, 2021, 07:35:37 pm
content: Quote from: Moriambar on April 20, 2021, 05:04:29 pmThere is nothing dirty in the original signal, however it might appear as "dirty" for your counter, and here is why.There aresignal reflections( <--- words written in italics are dedicated terms) in the wires between the GPS and the input gate.- any piece of wire acts as atransmission line- signals travels through wires at almost the speed of light (to be more precise at thevelocity factor* speed of light, where the velocity factor is less than one, can be for example 0.6 to 0.8 or so, it depends of the transmission line)- when the signal arrives at the end of the wire, only a part of it is continuing its travel into the IC's pin, the other part is reflected back (but only when there is an impedance mismatch between the impedance of the transmission line and the impedance of the input gate)- the voltage of the signal reflected back can have the same sign or opposite sign relative to the original signal. The sign is given by the ratio between Zline and Zgate (Z means impedance)- then the reflected signal arrives back from where it started, arrives at the output of the GPS again- then a part of it enters back into the GPS and an even smaller part reflects a second time going again to the input gate of your IC, and so on back and forth- each edge suffers from this ping-pong back and forth between the two ends of a wire- the ugly part is that the voltage of the reflected signals adds up with the original signal, making it to double in voltage or to go to zero, therefore it distorts the original signals and can lead to the apparition of fake edges detected by the counterThe only way to avoid the reflections is to remove any sudden changes in impedance along the path of the signal, or other said tomatch the impedancebetween the source and the load.https://en.wikipedia.org/wiki/Reflections_of_signals_on_conducting_linesThe video linked above was for showing on the oscilloscope how the waveform changes at the interactions between the original and the reflected signal.Another different cause can be that the stray capacitance and the inductance of the wires makes an LC circuit that has a tendency to oscillate, thus creating fake spikes at each edge of the original signals.When you put that capacitor to the ground, you make a low pass filter that is killing the spikes produced by the reflections or by the parasitic oscillations in the wires.