AN2839 Freescale Semiconductor / Motorola, AN2839 Datasheet - Page 20

no-image

AN2839

Manufacturer Part Number
AN2839
Description
Implementing a Lamp Dimmer with an HC908Q Family MCU
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Software Description
ZeroDetec:
ZeroDetect: nop
Count1:
Out:
;**** Interrupt Vectors ***********
END
20
jsr
cli
nop
brclr PTA0,PTA,ZeroDetec ;Wait for a edge on PTA0 (Zero crossing)
mov
jsr
jsr
brset
mov
jsr
jsr
inc
lda
cbeq
bra
inc
lda
cbeq
bra
clr
clr
stop
org
dcw
InitTimer
#StartTim,TSC
TOverflow
Gate
#StartTim,TSC ;Start the timer
TOverflow
Gate
Counter1
#CntLcmp
Counter1,Count1
ZeroDetec
Counter2
#CntHcmp
Counter2,Out
ZeroDetec
Counter1
Counter2
PTA0,PTA,ZeroDetect ;Wait for a edge on PTA0 (Zero crossing)
$FFFE
main
Implementing a Lamp Dimmer with an HC908Q Family MCU, Rev. 0
;Goes config Timer
;Allow interrupts to happen
;Go to Timer Overflow subroutine
;Go to Gate subroutine
;Go to Timer Overflow subroutine
;Go to Gate subroutine
;Increment 1st byte Counter for charge time OVF period
;Increment 2nd byte Counter for charge time OVF period
;Start the timer
Freescale Semiconductor

Related parts for AN2839