235
CHAPTER 13 16-Bit I/O TIMER
MOV I:ICS01,#00010001B ;IN0 pin selection, External trigger,
;IPCP0 rising edge
;Without IPCP1 edge detection
;Clear each valid edge detection flag
;Input capture interrupt request enable
MOV ILM,#07H ;Set ILM in PS to level 7
OR CCR,#40H ;Interrupt enable
LOOP:
:
User processing
:
BRA LOOP
;---------Interrupt program---------------------------------------------
WARI0:
CLRB I:ICP0 ;Clear valid edge detection flag
: ;Save OV-CNT and input capture value
User processing
:
MOV A,0 ;Clear overflow count counter
MOV OV_CNT,A ;for next cycle measurement
RETI ;Recover from interrupt
WARI1:
CLRB I:IVF0 ;Clear timer overflow generation flag
INC OV_CNT ;Increment overflow counter
:
User processing
:
RETI ;Recover from interrupt
CODE ENDS
;---------Vector setting------------------------------------------------
VECT CSEG ABS=0FFH
ORG 00FF78H ;Setting vector to interrupt number #33(21
H
)
;(Input capture)
DSL WARI0
ORG 00FF84H ;Setting vector to interrupt number #30(1E
H
)
;(Overflow)
DSL WARI1
ORG 00FFDCH ;Reset vector setting
DSL START
DB 00H ;Setting to single-chip mode
VECT ENDS
END START