
110
CHAPTER 5 APPLICATIONS OF 16-BIT TIMER/EVENT COUNTER
; Custom code
; PWM output, low active setting
; Selects count clock f
X
/2
; PWM mode, overflow occurs
; INTP0 falling edge
; INTP0 sampling clock f
X
/128
; INTP0 with high priority
; Clears flag
; Enables INTP0 interrupt
; Detects timer overflow by INTP0 processing
; Timer overflow occurs
(2) Example of use
PUBLIC CSTM
EXTRN
EXTBIT RPT,RMDTSET,IPDTFG,TO_FLG,OVSENS
EQU
9DH
RMDATA,RPTCT,PWM,PWMOUT,TIM_PRO
CSTM
TOC0=#00000011B
TCL0=#00100000B
TMC0=#00000010B
INTM0=#00000000B
SCS=#00000011B
CLR1
CLR1
CLR1
CLR1
PPR0
RPT
IPDTFG
RMDTSET
CLR1
EI
PMK0
DT_TEST:
if_bit(OVSENS)
CLR1
CALL
elseif_bit(OVF0)
CLR1
SET1
CALL
endif
if_bit(RMDTSET)
CLR1
if_bit(RPT)
OVSENS
!TIM_PRO
OVF0
TO_FLG
!TIM_PRO
RMDTSET
;
;
;
Repeat processing
else
;
;
;
Processing when input exists
endif
else
if_bit(!RPT)
;
;
;
Processing when input does not exist
endif
endif
MOV
CALL
PWMOUT,A
!PWM