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)