How to control the duty cycle of square waveforms?

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
Hi all,

this is related to my other thread about the video generation stuff. I was wondering how one can control the duty cycle of waveforms?

One way that I have thought is by taking a main clock, then dividing it by some even number, and then ANDing, ORing and XOring the waveforms to get different duty cycles...

Is there another way ?
 

AnalogKid

Joined Aug 1, 2013
11,045
Sticking with squarewaves and digital logic circuits, you can divide a clock signal by any integer x, and by x.5 with a little gating logic. Other fractions are not possible without much more complex circuits, limiting the input to a single fixed frequency, etc.

ak
 

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
Sticking with squarewaves and digital logic circuits, you can divide a clock signal by any integer x, and by x.5 with a little gating logic. Other fractions are not possible without much more complex circuits, limiting the input to a single fixed frequency, etc.

ak

How would you divide by 2.5 for example ? 2.5 = 25/10 = 5/2. Doesn't this mean it requires you to multiply by 5 and then divide by 2 ?

What am I missing AnalogKid ?
 

AnalogKid

Joined Aug 1, 2013
11,045
How would you divide by 2.5 for example ? 2.5 = 25/10 = 5/2. Doesn't this mean it requires you to multiply by 5 and then divide by 2 ?

What am I missing AnalogKid ?
For something like a clock going to a 4-bit counter, with an exclusive-OR in the gating before the clock input you can invert the clock (a 1/2 cycle shift) depending on a particular decoded counter value.

ak
 
Last edited:

Thread Starter

PauloConstantino

Joined Jun 23, 2016
266
For something like a clock goint go a 4-bit counter, with an exclusive-OR in the gating before the clock input you can invert the clock (a 1/2 cycle shift) depending on a particular decoded counter value.

ak
Interesting... Do you mean using a XOR gate with one input being the clock, and the other being one of the outputs from the counter? I didn't quite get what you wrote
 

AnalogKid

Joined Aug 1, 2013
11,045
Maybe one of the counter output pins, or maybe the output of some gates decoding a specific counter value. One way to view a 2-input XOR or XNOR gate is as a programmable inverter. One input has the signal going to the output, and the other input determines if the output is inverted or not with respect to the input. Fun part.

ak
 

GopherT

Joined Nov 23, 2012
8,009
Interesting... Do you mean using a XOR gate with one input being the clock, and the other being one of the outputs from the counter? I didn't quite get what you wrote
Is the duty cycle selected manually (pushing buttons/turning knobs) or automatically (based on input from a sensor) .
 

EM Fields

Joined Jun 8, 2016
583
Hi all,

this is related to my other thread about the video generation stuff. I was wondering how one can control the duty cycle of waveforms?

One way that I have thought is by taking a main clock, then dividing it by some even number, and then ANDing, ORing and XOring the waveforms to get different duty cycles...

Is there another way ?

There are many ways, and it seems like what you want to do is change the duty cycle of a rectangular waveform with a fixed period.

Something like this, perhaps?

Duty cycle.png
 

EM Fields

Joined Jun 8, 2016
583
View attachment 118217
Yes sir! How to do that ? Using logic gates?
Kinda.

If you're generating the trigger, then you could do something like this to generate the discrete PWM steps you're looking for:

555 multiple duty cycle.png

EDIT / UPDATE:
This is essentially the same circuit I posted earlier, but with the analog transmission gates replaced by three instances of two-pole single throw normally open relays, and the duty cycle determining resistances replaced with potentiometers.

In use, SEL1 would be driven high while SEL2 and SEL3 were held low, and OUT would be monitored while R1 was being adjusted until the desired duty cycle was observed at OUT.

The same procedure would be used on the other two channels, with the hot channel's SELect line being driven high and the other two channels being driven low.

I've shown only three channels, but any number of channels is possible by paralleling relays and pots or analog switches / multiplexers-demultiplexers.

Relay controlled adjustable duty cycle oscillator.png


 
Last edited:
Top