
S1C88348/317/316/308 TECHNICAL SOFTWARE
EPSON
II-85
12 PROGRAMMABLE TIMER
Source List
Control of programmable timer 5
external
osc1toosc3,osc3toosc1
external
vdd_ngf
public
pulsout_init
;
br_io
equ
0ffh
;base reg. address (set i/o area)
pt_mode0
equ
00ff30h
;programmable timer mode set reg. 0
pt_mode1
equ
00ff31h
;programmable timer mode set reg. 1
rld0
equ
00ff33h
;programmable timer 0 reload data
rld1
equ
00ff34h
;programmable timer 1 reload data
hzr2
equ
00ff71h
;r2x output control reg.
r2d
equ
00ff75h
;r2x output data
;
intr_pr1
equ
00ff21h
;interrupt priority reg. 1
intr_en1
equ
00ff23h
;interrupt enable reg. 1
intr_fac1
equ
00ff25h
;interrupt factor flag reg. 1
;
code
(5) 16-bit reload timer pulse output
;pulse output=66.4ms(approx. 15hz)
timerdata16:
dw
33200
;timer16 reload data (33.2ms at 4mhz/4)
;************************************************************************
;*
*
;*
pulse out (16-bit) control
*
;*
*
;************************************************************************
;*** initialize routine
pulsout_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,pulsout_init00
;
or
[br:low r2d],#10000000b
;r27="h" (enable ptout)
and
[br:low hzr2],#01111111b
;r27=complementary output
;mode16=16-bit,chsel=timer0,ptout=off,cksel1=don't care,cksel0=fosc3
ld
[br:low pt_mode0],#00011001b
ld
ba,[loc timerdata16]
;set 16-bit counter data (timer 0 & 1)
ld
[lod rld0],ba
;pt0:evcnt=timer,fcsel=normal timer,plpol=don't care,psc=fosc3/4,rlmd0=reload
;pset0=preset
ld
[br:low pt_mode1],#00001110b
or
[br:low pt_mode1],#00000001b
;start timer 0
or
[br:low pt_mode0],#00000100b
;start ptout
;************************************************************************
;*** start pulse out (16-bit)
;
(user program)
;
;************************************************************************
;*** end processing
and
[br:low pt_mode0],#11111011b
;stop ptout
and
[br:low pt_mode1],#11111110b
;stop timer 0
pulsout_init00:
carl
osc3toosc1
;change osc3 to osc1 ***
ret
end