Microcontroller Usage
5.5 Microcontroller Usage
5.5.1 Microcontroller Peripheral Usage
5.5.1.1 High Resolution PWM (HRP)
The HRP controls the ballast
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.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.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
Table
Memory | Available on LB8 | Used |
|
|
|
ROM | 8192 Bytes | 3010 Bytes |
|
|
|
RAM | 128 Bytes | 40 Bytes |
|
|
|
Dimmable Light Ballast with Power Factor Correction, Rev. 1
Freescale Semiconductor | 51 |