Freescale Semiconductor M68HC08 Stereo System User Manual


 
Microcontroller Usage
Dimmable Light Ballast with Power Factor Correction, Rev. 1
Freescale Semiconductor 51
5.5 Microcontroller Usage
5.5.1 Microcontroller Peripheral Usage
5.5.1.1 High Resolution PWM (HRP)
The HRP controls the ballast half-bridge power stage. The module is configured for frequency mode
(constant 50% duty cycle, variable frequency, deadtime). For setting up the module, the worksheet
HRP_Setup in file DLB_Setup.xls can be used (see Reference [
4]).
5.5.1.2 Pulse-Width Modulator (PWM)
The PWM modulator is used to generate the reference sine wave for PFC control by PWM signal. The
PWM1 signal is used only in the discontinuous conduction mode HW variation to directly switch the PFC
switch transistor. For service PWM reload interrupt the pwmISR() routine is used (see
Figure 5-5).
5.5.1.3 Comparator Module (CM)
The comparator module is used to compare the reference sine wave signal for PFC control with the actual
current value. The result is the control signal for the PFC power MOSFET transistor in the hysteresis
current control mode HW version. In the DCM HW version the comparator output is used for switching off
the PWM1 signal.
5.5.1.4 Timer Interface Module (TIM)
Since an internal oscillator is used and its features do not guarantee constant frequency, this module is
used to automatically trim the internal oscillator to the base of frequency of the mains voltage supply
(PLL). The timer counts the time between two zero input voltage detections (
IRQ); the resulting timer
content is compared to the expected value, and the trimming register is adjusted accordingly (see
Figure 5-4).
5.5.1.5 External Interrupt (IRQ)
The external interrupt is active on pin IRQ. The interrupt procedure is used for trimming the internal
oscillator and synchronizing the phase shift of the reference sine wave with the mains voltage. The
IRQisr() routine is used to service the
IRQ interrupt.
5.5.2 Program and Data Memory Usage
Table 5-1 shows the memory that is used by the software. A significant part of the memory remains
available.
Table 5-1. Memory Usage
Memory Available on LB8 Used
ROM 8192 Bytes 3010 Bytes
RAM 128 Bytes 40 Bytes