Google

7 Ağustos 2007 Salı

Main Routine

These tasks are done in the MAIN_LOOP routine:

• New PWM duty cycle is calculated by the subroutine UPDATE_PWM_DUTYCYCLES Three pointers pointing to three different values on the Sine table corresponding to the phase difference between V a, V and V . The sine table is drawn to maximum duty cycle available when the sine value reaches 90 degrees. Every value is scaled down based on the frequency input to follow a linear VF profile.

• PWM duty cycle sorting is handled by the subroutine PRIORITIZE_PWMS PWM duty cycles calculated earlier are sorted in ascending order, so that the duty cycle with minimum ON time can be addressed first and PWM with maximum duty cycle last.Corresponding Flags are set to indicate which PWM duty cycle corresponds to which PWM output

• Timer0 reload value is calculated by the subroutine TIMER0_OVERFLOW Timer0 is used for setting the motor frequency. The Timer0 reload value is calculated based on three factors: first is the frequency reference input from the potentiometer, second is the number of sine table values, and third is the MCU operating frequency.

• Polling for the ADC result is handled by the subroutine AD_CONV_COMPLETE ADC conversion is poled in the main routine. Alternatively, frequency reference (AN0), motor current (AN1) and heatsink temperature (AN2) are selected and converted.

Hiç yorum yok: