
103
CHAPTER 5 APPLICATIONS OF 16-BIT TIMER/EVENT COUNTER
; Level check P0.0 = 0: noise
; Waits for 100
μ
s
; Reads timer value
; 6.8 ms – (1.5 ms * 4)
; 11.8 ms – (1.5 ms * 5)
; Leader high detection mode
; INTP0 falling edge
; Sets leader (low) detection mode
; Sets leader (low) detection mode
; Level check P0.0 = 1: noise
; Waits for 100
μ
s
; Reads timer value
;
1.8 ms – 100
μ
s * 2 – 160 clocks (edge detection
→
timer starts)
;
5 ms – 100
μ
s * 2 – 160 clocks (edge detection
→
timer starts)
; Custom/data code (3 ms – 100
μ
s * 2)
; Data loading mode
; Initializes work area
; Sets most significant bit to 1 (to check end of data)
; Repeat detection mode
; INTP0 rises
; Sets leader (low) detection mode
; Sets leader (low) detection mode
;****************************************
;*
Leader low detection
;****************************************
LEAD_L:
if_bit(P0.0)
CALL
if_bit(P0.0)
CALL
if(AX>=#3354)
!WAIT
!CR_READ
if(AX<#18035)
SELMOD=#2
INTM0=#00000000B
else
CALL
endif
else
CALL
!S_MOSET
endif
endif
endif
RET
!S_MOSET
$EJECT
;****************************************
;*
Leader high detection
;****************************************
LEAD_H:
if_bit(!P0.0)
CALL
if_bit(!P0.0)
CALL
if(AX>=#6710–160/2)
if(AX<#20132–160/2)
!WAIT
!CR_READ
if(AX>#11743–160/2)
SELMOD=#3
WORKP=#0000H
(WORKP)+2=#8000H
else
SELMOD=#4
INTM0=#00000100B
endif
else
CALL
!S_M0SET
endif
else
CALL
!S_M0SET
endif
endif
endif
RET
$EJECT