I found a bag of 74HC4020s in my stash. It's a 14-stage ripple counter with two outputs missing - kind of a bizarre part, if you ask me. I hooked the clock input to a signal generator, and outputs Q0, Q4, Q8, and Q13 to the scope. Here it's at 10 MHz, triggered on the transition of Q13, the MSB - all the lower bits are going low, while Q13 goes high:
You can see a bit of delay between the successive stages. Zooming in, it's easy to measure:
All those wiggles are poor layout (a solderless breadboard) and bad probing (long wires attached to the scope probes). Inside the time cursors, the output lines aren't showing the correct count - it's only after the last (blue) transition that the outputs are correct. The delay from Q0 to Q13 is 56ns - so, during that time, the outputs are wrong. But this counter will typically run at 100+ MHz - how can that be?? Let's turn up the frequency. At 18 MHz, Q0 is now transitioning to its next state before Q13 finishes the last:
At this frequency, there's no longer any point in time at which the outputs show the correct count for this state. The state still gets updated correctly, and if you stopped the clock at the trigger point (mid-screen), the output lines would settle into the correct state, but you couldn't use this counter to generate successive values at this frequency.
The generator I was using only goes up to 25 MHz, and there you can see that things just get progressively worse - you're almost missing two states now:
If I really wanted a nasty hack in this project, I'd cut sections of cheap RG59 coax to the exact lengths to equalize the delay between the bits of these counters. At 1ns/foot with a 66% velocity factor, I'd only need 40 feet of cable for that first bit, with progressively shorter cables for the higher bits. It's almost like the kind of stuff you find in classic oscilloscopes. Still, easier just to buy a few synchronous counters.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Great hack-idea! Though maybe to occupy a little less space, one could just add in some gate-delays...? Or some software/address-hackish ideas involving always running the system at the same frequency...
Cool to see these results
Are you sure? yes | no
Yeah, gate delays would be a safer bet, because hopefully, they'd track the delays in the counter over voltage and temperature changes. I could see the cable-delay thing falling apart easily as things drifted.
I ordered a handful of the 74AC163 counters, which should eliminate the whole problem. There's too much coding to be done to worry that much about the hardware :-)
Are you sure? yes | no
"Still, easier just to buy a few synchronous counters."
I agree :-D
Are you sure? yes | no