
II-74
EPSON
S1C88348/317/316/308 TECHNICAL SOFTWARE
12 PROGRAMMABLE TIMER
Flowchart
(5) 16-bit reload timer pulse output
pulsout_init
Switches to OSC3
(Has not clock been switched to OSC3 ?)
TOUT output enabled
16-bit count, Pulse output on (timer 0)
Prescaler input clock = fOSC3
33200 = 33.2 msec (fOSC3 = 4 MHz, x1/4)
Normal timer, Reload mode
Clock = fOSC3 x 1/4, Presets reload data
Switches to OSC1
N
Y
(BR setting)
osc1toosc3
VDD NG
R27
← HIGH setting
Sets R27 to complementary output
Programmable timer
mode setting
Sets 16 bits reload data
Timer 0 mode setting
Starts timer 0
Turns TOUT output on
(Time adgustment processing)
Turns TOUT output off
Stops timer 0
osc3toosc1
ret
Notes
(1)
External routines are called for switching to OSC3 and OSC1. (external call: osc1toosc3, osc3toosc1)
(2)
Switching the operating mode when the supply voltage is lower than the VD1 setting may cause a
malfunction. Hence, the example routine checks the supply voltage when switching to the normal
mode (OSC3) and terminates as a supply voltage error remains unprocessed if the supply voltage is
lower than the VD1 setting. For this determination, vdd_ngf flag is used. (See "4 OSCILLATION
CIRCUIT".)
(3)
When switching from OSC3 to OSC1 (VD1 = 2.2 V
→ 1.3 V), the program example does not perform
special checking of the supply voltage of SVD if the supply voltage is already more than the VD1
setting.
(4)
To reset the interrupt factor flag, write "1" into the corresponding flags alone, using the AND or LD
instruction. When the OR logic operation instruction has been used, "1" is written for the interrupt
factor flags that have been set to "1" within the same address and those flags are then clear.
(5)
The interrupt flags (I1 and I0) have not been reset in the interrupt processing routine of this
program example, so an interrupt lower than IRQ3 level is disabled at the time of generation. When
you wish to accept the next interrupt after an interrupt has been generated, re-setting of the
interrupt flags or resetting the interrupt factor flag is necessary after due consideration for the
nesting level.