AN2839 Freescale Semiconductor / Motorola, AN2839 Datasheet - Page 12

no-image

AN2839

Manufacturer Part Number
AN2839
Description
Implementing a Lamp Dimmer with an HC908Q Family MCU
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Software Description
A 2-byte counter is incremented at each zero-crossing of 60 Hz (or 50 Hz if it is used) and compared to
CntHcmp and CntLcmp constants. These constants may also be changed if the user desires to increase
or decrease the timer. A simple formula can be used:
Equation (1)
Where: t = desired timer, [s]
f
= line frequency, [Hz]
CntHcmp:CntLcmp = constant values, [decimal]
The user must remember that for a 2-byte counter, the maximum time will be approximately 18 seconds
for 60-Hz and 21 seconds for 50-Hz line frequency, according to the equation. Software timing techniques
can be used to extend this delay time.
When the defined time is reached, the MCU enters stop mode to minimize current consumption.
The lamp timer turns on again after a reset.
Start
MCU Initialization
RST
Clear Variables
Initialize Timer Module
Lamp Timer Initiated
N
Desired Time
Reached?
Y
MCU Enters STOP Mode
Figure 10. Flowchart for Lamp Timer
Implementing a Lamp Dimmer with an HC908Q Family MCU, Rev. 0
12
Freescale Semiconductor

Related parts for AN2839