
Chapter 17 Periodic Interrupt Timer (S12PIT24B8CV1)
MC9S12XE-Family Reference Manual Rev. 1.07
Freescale Semiconductor
697
17.6
Application Information
To get started quickly with the PIT24B8C module this section provides a small code example how to use
theblock.Pleasenotethattheexampleprovidedisonlyonespecificcaseoutofthepossibleconfigurations
and implementations.
Functionality: Generate an PIT interrupt on channel 0 every 500 PIT clock cycles.
ORG
CODESTART
; place the program into specific
; range (to be selected)
; load stack pointer to top of RAM
LDS
MOVW
RAMEND
#CH0_ISR,VEC_PIT_CH0 ; Change value of channel 0 ISR adr
; ******************** Start PIT Initialization *******************************************************
CLR
MOVB
CLR
MOVB
MOVW
MOVB
MOVB
CLI
PITCFLMT
#$01,PITCE
PITMUX
#$63,PITMTLD0
#$0004,PITLD0
#$01,PITINTE
#$80,PITCFLMT
; disable PIT
; enable timer channel 0
; ch0 connected to micro timer 0
; micro time base 0 equals 100 clock cycles
; time base 0 eq. 5 micro time bases 0 =5*100 = 500
; enable interupt channel 0
; enable PIT
; clear Interupt disable Mask bit
;******************** Main Program *************************************************************
MAIN:
BRA *
; loop until interrupt
;******************** Channel 0 Interupt Routine ***************************************************
CH0_ISR:
LDAA
MOVB
RTI
PITTF
#$01,PITTF
; 8 bit read of PIT time out flags
; clear PIT channel 0 time out flag
; return to MAIN