AN2839 Freescale Semiconductor / Motorola, AN2839 Datasheet - Page 22

no-image

AN2839

Manufacturer Part Number
AN2839
Description
Implementing a Lamp Dimmer with an HC908Q Family MCU
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Notes
;
;
initTim:
;
;
;
;
;
;
;
;
;
StartTim:
;
;
;
;
;
;
;
;
;
InitDDRA:
InitIRQ:
InitTMODH:
InitTMODL:
GateVal:
TSCClr:
Counter1:
Counter2:
IncTcomp:
DecTcomp:
CntLcmp:
CntHcmp:
Delval:
Xval:
Notes
22
equ
equ
equ
equ
equ
equ
equ
equ
rmb
rmb
equ
equ
equ
equ
equ
equ
%00110001
%00000001
%00000010
$00
$00
$FF
$50
$7F
1
1
$1F
$01
$00
$0E
$FF
$01
|+-------IRQEN
+--------IRQPUD
|||||||| TIM Status and Control Register
|||||||+-PS0
||||||+--PS1
|||||+---PS2
||||+----0
|||+-----TRST
||+------TSTOP
|+-------TOIE
+--------TOF
||||||||
|||||||+-PS0
||||||+--PS1
|||||+---PS2
||||+----0
|||+-----TRST
||+------TSTOP
|+-------TOIE
+--------TOF
Implementing a Lamp Dimmer with an HC908Q Family MCU, Rev. 0
;Timer Status and control Reg. value
;Timer Status and control Reg. value
TIM Status and Control Register
;PTA0 -> Zero Crossing detection
;PTA1 -> Pulses on Thyristor gate
;PTA2 -> Increment Dimmer
;PTA4 -> Decrement Dimmer
;PTA5 -> Turns on 1-minute timer.
;IRQ configuration
;Set max. brightness
;after we start the timer.
;Gate pulse duration
;Value to clear TOF bit on TSC register
- 1 enable IRQ function
- 0 Internal pullup connect IRQ and VDD
- 1 Prescaler select bit
- 0 Prescaler select bit
- 0 Tim clock source int. bus
- 0
- 1 TIM reset bit
- 1 TIM counter stopped
- 0 disable TIM overflow interrupts
- 0 TIM overflow flag bit
- 1 Prescaler select bit
- 0 Prescaler select bit
- 0 Tim clock source int. bus
- 0
- 0 TIM reset bit
- 0 TIM counter started
- 0 disable TIM overflow interrupts
- 0 TIM overflow flag bit
Freescale Semiconductor

Related parts for AN2839