Counter output weirdness

Thread Starter

Veracohr

Joined Jan 3, 2011
783
I have a circuit in which I use a 74HCT193 counter and create a bipolar stair step signal from its outputs. When the signal at the Count-Up input has 50% duty cycle, the output is as expected. When the duty cycle increases, the output gets weird. What could be causing this? The maximum input frequency I give it is around 18Hz, so I'm nowhere near the frequency/time limits of the part.

The first attachment shows the counter and stair step part of the circuit. The input to the count-up input (CPU) comes from a rotary switch which is currently set to the output of a NAND gate. The second attachment shows the step-up output when the output of the NAND gate is about 50% duty cycle. The third attachment shows the output when the duty cycle is around 80%. The last attachment is a smaller time scale so you can see more how the output compares to the input. In that image you can see that the output changes on high-low transitions as well as low-high, which shouldn't happen. It should only change on low-high.

I verified the circuit with a 74LS193 on my breadboard and the output was as expected for any duty cycle at a similar frequency (15Hz).

The whole circuit is a modulation source I made for a modular synthesizer. The input to the counter is ultimately derived from oscillators, via logic gates and analog comparators, and the oscillator I'm currently using has square and triangle outputs. When it's set to square, everything is fine. The triangle output gives a higher duty cycle at the output of the NAND gate, which does weird things to the output of the counter.

Any ideas what's going on?
 

Attachments

crutschow

Joined Mar 14, 2008
38,507
Expand the clock signal display a lot more and look at the edges.
Sounds like you have some high frequency oscillations at the edges which causes the incorrect counting.

Did you incorporated hysteresis into the comparators so that they don't oscillate at the trigger point of the triangular wave?
 

Thread Starter

Veracohr

Joined Jan 3, 2011
783
Expand the clock signal display a lot more and look at the edges.
Sounds like you have some high frequency oscillations at the edges which causes the incorrect counting.

Did you incorporated hysteresis into the comparators so that they don't oscillate at the trigger point of the triangular wave?
Crap, you're right. There was ~700kHz oscillation at the transitions. I tried to incorporate hysteresis but looking at the datasheet again it appears I did it wrong. I can't even remember now what my thinking was on the comparator part of the circuit, but it must have seemed ok when I breadboarded it. I guess I should refresh my knowledge of hysteresis.

This is the comparator part. In the output images I attached above, the inverting input comes from an external oscillator, 10V p-p centered around 5V. The non-inverting input was DC around 2.5V. In full use both inputs would have AC signals.

Thanks.

Screen Shot 2018-02-06 at 9.18.55 PM.png
 

Thread Starter

Veracohr

Joined Jan 3, 2011
783
After redesigning some things I'm still seeing oscillation around the trip point of a triangle wave. What's going wrong here? In the circuit below (cropped down to the relevant parts), I get oscillation at the output of the comparator with a triangle wave in J4 and nothing in J1. The output of either opamp with no input is 5V. With the input on 1 and nothing on 4, there is no oscillation.

Screen Shot 2018-03-16 at 10.45.54 PM.png
 
Top