S1C88348/317/316/308 TECHNICAL SOFTWARE
EPSON
II-61
11 STOPWATCH TIMER
(1)
Source List
Vector address setting for stopwatch timer interrupt
intr_vectors:
org
intr_vectors+sw100_vector
dw
sw100_intr
;sw 100hz interrupt
;
org
intr_vectors+sw10_vector
dw
sw10_intr
;sw 10hz interrupt
;
org
intr_vectors+sw1_vector
dw
sw1_intr
;sw 1hz interrupt
;
(1) Initialization for stopwatch timer
org
intr_vectors+sw
;************************************************************************
;*
*
;*
stopwatch initialize (100,10 and 1hz interrupt enable)
*
;*
*
;************************************************************************
;*** initialize routine
sw_init:
ld
br,#br_io
;set br reg. address to 0ffxxh
carl
osc1toosc3
;change osc1 to osc3 ***
ld
a,[lod vdd_ngf]
;vdd ng flag
cp
a,#0ffh
jrl
z,sw_init00
;
ld
a,[br:low intr_pr0]
;interrupt priority reg.
and
a,#11110011b
or
a,#00000100b
ld
[br:low intr_pr0],a
;set sw=/irq1
;sw100,sw10 and sw1 (en. /irq1) intr.
or
[br:low intr_en0],#01110000b
or
[br:low sw_mode],#00000010b
;stopwatch counter reset
or
[br:low sw_mode],#00000001b
;stopwatch start
and
sc,#00111111b
;i1 and i0 flag clear
;************************************************************************
;*** start stopwatch interrupt
;
(user program)
;
;************************************************************************
;*** end processing
and
[br:low sw_mode],#11111110b
;stopwatch stop
sw_init00:
carl
osc3toosc1
;change osc3 to osc1 ***
ret
(2) 100 Hz stopwatch timer interrupt processing
;************************************************************************
;*
*
;*
stopwatch 100hz interrupt processing routine
*
;*
*
;************************************************************************
sw100_intr:
push
ale
;
ld
br,#br_io
;set br reg. address to 0ffxxh
;
stopwatch 100hz processing routine
;
and
[br:low intr_fac0],#01000000b
;clear sw100 flag
pop
ale
rete
(2)