Author Topic: Experimenting with counters: Qa output dead?  (Read 867 times)

0 Members and 1 Guest are viewing this topic.

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 490
  • Country: it
Experimenting with counters: Qa output dead?
« on: April 20, 2021, 08:36:40 am »
Hello, I'm experimenting with a CD74AC163 4 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 QB to QD work perfectly and display the correct waveforms (I also tested them with LEDs) of 0.5, 0.25 and 0.125 Hz

The problem is that the QA output, that I expect to be 1Hz does not work. The experiment is breadboarded btw. On another breadboard I had the counter and its QA output working fine using 10MHz.

I tried the following:
  • Changing the location of the counter on the BB
  • Changing the counter IC
  • Resetting the counter
  • Tying the A input of the parallel load (unused) to VCC, GND or leaving it untouched
  • Inspecting the waveform directly on the IC pin and not via the adapter/breadboard
  • for good measure checking the continuity of the pin to the breadboard and its non continuity to GND/VCC

Nothing changes though. What am I doing wrong?

Do I need to provide more? Thanks
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6177
  • Country: ro
Re: Experimenting with counters: Qa output dead?
« Reply #1 on: April 20, 2021, 09:28:10 am »
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.

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 490
  • Country: it
Re: Experimenting with counters: Qa output dead?
« Reply #2 on: April 20, 2021, 10:43:32 am »
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.

Thanks, I'll try those suggestions when I can and I'll get back here.
 

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 490
  • Country: it
Re: Experimenting with counters: Qa output dead?
« Reply #3 on: April 20, 2021, 11:26:51 am »
So, I did the following:
  • Buffered the output of my pps input, for good measure via a sn74LVC1G17 schmitt trigger, just to have a steeper rise time, just in cas
  • Added 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 input

And 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 QA output of the counter.

Is there anything else?
Thanks
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6177
  • Country: ro
Re: Experimenting with counters: Qa output dead?
« Reply #4 on: April 20, 2021, 12:39:05 pm »
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 IC

Very 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.
« Last Edit: April 20, 2021, 12:54:49 pm by RoGeorge »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Experimenting with counters: Qa output dead?
« Reply #5 on: April 20, 2021, 03:16:01 pm »
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.

 

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 490
  • Country: it
Re: Experimenting with counters: Qa output dead?
« Reply #6 on: April 20, 2021, 05:04:29 pm »
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… :-//
 

Online Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: Experimenting with counters: Qa output dead?
« Reply #7 on: April 20, 2021, 06:00:18 pm »
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… :-//

You 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.
 
The following users thanked this post: Moriambar

Offline MoriambarTopic starter

  • Supporter
  • ****
  • Posts: 490
  • Country: it
Re: Experimenting with counters: Qa output dead?
« Reply #8 on: April 20, 2021, 06:02:50 pm »
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… :-//

You 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.
Ok, thanks.
Regarding the IC… it's what I had around lol, thanks again
 

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6177
  • Country: ro
Re: Experimenting with counters: Qa output dead?
« Reply #9 on: April 20, 2021, 07:35:37 pm »
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… :-//

There is nothing dirty in the original signal, however it might appear as "dirty" for your counter, and here is why.

There are signal reflections ( <--- words written in italics are dedicated terms) in the wires between the GPS and the input gate.
- any piece of wire acts as a transmission line
- signals travels through wires at almost the speed of light (to be more precise at the velocity 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 counter

The only way to avoid the reflections is to remove any sudden changes in impedance along the path of the signal, or other said to match the impedance between the source and the load.

https://en.wikipedia.org/wiki/Reflections_of_signals_on_conducting_lines

The 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.
« Last Edit: April 20, 2021, 08:08:53 pm by RoGeorge »
 
The following users thanked this post: Moriambar


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf