"Steve Minshull" wrote in news:HBGre.13082$ snipped-for-privacy@newsfe5-win.ntli.net:
You tune things to the PWM frequency, not the control loop frequency.
Look at some pseudo code
main(){ set PWM frequency to 40K set PWM duty cycle to 50%
while (1){
if timerflag=1 { sample the voltage and/or current calculate next PWM duty cycle set PWM duty cycle timerflag=0 }
}} timer_isr(){ timerflag=1 timercount=timercount+offset (to give you 1kHz control loop) }
Whenever the timer rolls over (goes from ffff to 0) the interrupt service routine gets triggered, setting the timer flag, and then adding any offset to the count register that you need to give you the control rate you need. Thus, your main loop sits there doing nothing until the timer rolls over, but your hardware PWM is ticking away at 40K, at whatever duty cycle it was last set to.
The only waveform your buck converter sees is the PWM switching at 40K. This is the frequency that you select all your components for. The control loop is merely how often you change the duty cycle.
Scott