We can build on top of the equations in the previous section. The trick is to utilize the output enable line and a pull-down resistor for each output. This way, we can connect the PWM (output compare) signal from the MCU directly to the output enable signal. When a pin is not driving, the signal defaults to 0, and the corresponding H-bridge goes to Hi-Z state.
The modification is as follows:
| (12.11) | |||
| (12.12) |
This approach requires the use of four output compare channels. In addition, the duty cycle needs to be controled dynamically (the overflow interrupt needs to change the duty cycle).
Copyright © 2006-02-15 by Tak Auyeung