Epson S1C33L03 User Manual

Page of 631
III PERIPHERAL BLOCK: CLOCK TIMER
B-III-7-4
EPSON
S1C33L03 FUNCTION PART
Setting alarm function
The clock timer has an alarm function, enabling an interrupt to be generated at a specified time and day. This
specification can be made in minutes, hours, and days for each alarm or a combination of multiple alarms.
Use TCASE[2:0] (D[4:2) / Clock timer interrupt control register (0x40152) for this specification.
Table 7.3  Alarm Factor Selection
TCASE2
TCASE1
TCASE0
Alarm factor
X
X
1
Minutes alarm
X
1
X
Hours alarm
1
X
X
Day alarm
0
0
0
None
For example, if TCASE is set to "001", only a minutes alarm is enabled and an alarm is generated at a
specified minute every hour. If TCASE is set to "111", an alarm is generated on each specified day at each
specified hour and minute. If alarms are not to be used, set TCASE to "000".
An interrupt can be generated every minute, every hour, and every day through the use of the counter's
interrupt function instead of the alarm function.
To specify a day, hours, and minutes, use the registers shown below:
To specify minutes: TCCH[5:0] (D[5:0]) / Minute-comparison data register (0x40159)
0 to 59 minutes*
To specify hours:
TCCD[4:0] (D[4:0]) / Hour-comparison data register (0x4015A)
0 to 23 hours*
To specify day:
TCCN[4:0] (D[4:0]) / Day-comparison data register 0x4015B)
0 to 31 days after
The minute-comparison data register (6 bits) and hour-comparison data register (5 bits) can be set for up to 63
minutes and 31 hours, respectively. Note that even when the data set in these registers exceeds 59 minutes or
23 hours, the data is not considered invalid.
The values set in these registers are compared with those of each counter, and when they match, the alarm
factor generation flag TCAF (D0) / Clock timer interrupt control register (0x40152) is set to "1". If clock
timer interrupts have been enabled using the interrupt controller, an interrupt is generated when the flag is set.
The day-comparison data register is a 5-bit register, and its value is compared with the five low-order bits of
the day counter. Therefore, an alarm can be generated for up to 31 days after the register is set.
Interrupt Function
Clock timer interrupt factors
The clock timer can generate an interrupt using a 32-Hz, 8-Hz, 2-Hz, 1-Hz (1-second), 1-minute, 1-hour, or 1-
day signal. The interrupt factor to be used from among these signals can be selected using the interrupt factor
selection bit TCISE[2:0] (D[7:5]) / Clock timer interrupt control register (0x40152).
Table 7.4  Selecting Interrupt Factor
TCISE2
TCISE1
TCISE0
Interrupt factor
1
1
1
None
1
1
0
1  day
1
0
1
1 hour
1
0
0
1 minute
0
1
1
1  Hz
0
1
0
2  Hz
0
0
1
8  Hz
0
0
0
32  Hz
An interrupt factor is generated at intervals of a selected signal (each falling edge of the signal).
If interrupts based on these signals are not to be used, set TCISE to "111".
When a selected interrupt factor is generated, the interrupt factor generation flag TCIF (D1) / Clock timer
interrupt control register (0x40152) is set to "1". At the same time, the clock timer interrupt factor flag FCTM
(D1) / Port input 4–7, clock timer, A/D interrupt factor flag register (0x40287) also is set to "1". At this time,
if the interrupt conditions set by the interrupt control registers are met, an interrupt to the CPU is generated.