Freescale Semiconductor M68HC08 Stereo System User Manual


 
Wait for a moment to stabilize internal oscillator
Disable all interrupts
RESET
Set PWM :
- reset sine tab. pointer
- PMOD = PWM_MODULUS
- PVAL0 = 0, PVAL1 = 0;
- PCTL2 - reload cycles PWM prescaler, negative
polarity, disable PWM1, enable PWM0
- DISMAP - disable PWM1 if ext.fault occurs
// result 0000 0010=0x02
- FCR - disable fault interrupt, set manual or
automatic fault mode according HW
variation
- PCTL1 - set fault pin bit, enable PWM int.,clear
PWM reload flag, clear LDOK,
enable PWM module
Set IRQ register (INTSCR): falling edge,
enable IRQ interrupt request
Set configuration registers CONFIG1, CONFIG2
Set ADC clock prescaler
Set HRP :
- HRPCTRL - disable HRP
- HRPDCR - set dual freq. generator as a clock
for HRP and set divide ratio
- HRPTBH,HRPTBL- set time base
- HRPPER - set maximum ballast frequency
- HRPDT- set deadtime
- HRPCTRL - disable SHTDWN pin
disable SHTDWN interrupt
enable TOP,BOT pins
set HRP frequency mode
Microcontroller and application setup
Set PWM0 (PTB3), set PWM1 (PTB4), Vout (PTB7)
and fault diode (PTA5) pins as outputs and set
them to log. 1
Set nr. of attemps (ignitFltCNT) when
ignition is unsuccesful
Enable comparator module and powered on
Set value of PI PFC stage regulator for start PFC :
- integralPortionK_1 = 0;
Set nr. of attemps (currFltCNT) when
zero current fault appears during run mode
1
2
Reset DC-BUS voltage variable
Microcontroller and
application setup
Reset current values
Disable PI PFC stage regulator calculation
Enable all interrupts
Set values of PI PFC stage regulator for start PFC :
- integralPortionK_1 = 0;
- sineGain = 0;
Set values of PI ballast stage regulator :
- proportionalGainI = PI_KP_RUNI;
- integralGainI = PI_KI_RUNI;
- integralPortionK_1I = 0;
Set values of PI PFC stage regulator for start PFC :
- proportionalGain = PI_KP_START;
- integralGain = PI_KI_START;
Enable PI PFC stage regulator calculation
Measure DC-BUS voltage
Detailed Software Description
Dimmable Light Ballast with Power Factor Correction, Rev. 1
Freescale Semiconductor 47
Figure 5-7. Flow Chart — Main Flow, Part 1