# PWM with programmable Dead Time

I need to make a circuit that generates a PWM signal for a motor. The motor has 2 inputs - P and Q. They are the inverse of each other. Now, both signals aren't allowed to be high at the same time. That's why there needs to be a programmable Dead Time - the time between the signal that is high to go low and the low signal to go high.

Now I know how to easily make a PWM signal. It's allowed to have a fixed signal width and fixed period - because it's for educational purposes. To generate this, I just have a comparator with on one input a 8-bit-counter continuously counting, and a constant on the other.

Now, I need to somehow check whether the signal toggles upwards or downwards. If it goes upwards, it can go straight through, but else it has to load a loadable 8-bit counter with certain value and wait for it to overflow before the new high output gets outputted.

For the loadable counter part I should have enough knowledge, but I don't know how to detect the edges (preferably asynchronous stuff should be avoided)

You can produce two outputs from one PWM signal using an RC filter and a couple of logic gates. Try this: -

Because you don't want either to be high at the same time, invert the OR gate's output. Use schmitt trigger gates for the best result.

• Thanks Andy, for the answer, can you please explain how the RC Filter work here? I am not able to understand it. Mar 2 '14 at 20:08
• Ok!! Let me tell you first what I think how it works: At the rising edge of square pulse the CAP provides a delay since it takes a while to get charged to HIGH level. So AND gate outputs a '1' late, then again it holds the charge for a while at the falling edge; now since original PWM pulse goes to '0', AND outputs a LOW. In both the cases the OR Gate always has at least one input HIGH hence it produces '1' for long. Is that right? Mar 2 '14 at 20:14
• @MadHatter spot on!!! Mar 2 '14 at 21:01