5.2 PWM Generation
The PWM signal is generated using the error amplifier and the voltage ramp generated by the filtered waveform output of the TCB. As seen in Figure 5-2, the error voltage, Vdiff, on the output of the op amp sets the duty cycle in relation to the voltage ramp, Vramp. This means that to achieve good regulation, the amplification factor must therefore be set in relation to the amplitude of the ramp signal generated by the TCB waveform generator and filter. Taking into account the effects of ωc and ω0, the amplification factor AVM can be set:
Generating the ramp signal, Vramp, is done by filtering the square wave output of the timer with an RC-filter. The amplitude of the signal is decided based on the accuracy and responsiveness of the op amp in the controller, meaning the better characteristics in the op amp will allow for lower amplitudes, which will lead to a more efficient system. Knowing this, the components for the triangle wave filter can be set using the equation for charging a capacitor in the RC circuit, seen in Figure 5-3, like this:
where VCC is the supply voltage of the microcontroller. The switching frequency, fSW, is set as the frequency in the TCB, as described in Timer Counter B.