III PERIPHERAL BLOCK: CLOCK TIMER
B-III-7-6
EPSON
S1C33210 FUNCTION PART
Examples of Use of Clock Timer
The following shows examples of use of the clock timer and how to control the timer in each case.
To use the clock timer as a timer/counter
Example in which while the CPU is inactive, the clock timer is kept operating in order to start again the CPU
after a specified length of time has elapsed (e.g., three days):
1. Make sure the low-speed (OSC1) oscillation circuit is oscillating stably (SOSC1 = "1").
Wait for approximately three seconds after the oscillation starts for its oscillation to stabilize.
2. Disable the clock timer interrupt using the interrupt controller (ECTM = "0").
3. Stop the clock timer and set "3 days" in the day-comparison register (TCRUN = "0", TCCN = "3").
4. Choose a "day-specified alarm" using the alarm-factor select bit and set "none" in the interrupt-factor
select bit (TCASE = "100", TCISE = "111").
5. Reset the interrupt factor and alarm factor generation flags (FCTM = "0", TCAF = "0").
6. Reenable the clock timer interrupt using the interrupt controller (ECTM = "1").
7. Switch the CPU operating clock to the low-speed (OSC1) clock (CLKCHG = "0").
8. Turn off the high-speed (OSC3) oscillation circuit (SOSC3 = "0").
9. Reset the clock timer (TCRST = "0").
10.Start the clock timer (TCRUN = "1").
11.Execute the halt instruction to stop the CPU.
:
Wait until an interrupt is generated by a day-specified alarm from the clock timer. When an interrupt occurs,
the CPU starts up using the OSC1 clock.
:
12.If necessary, turn on the high-speed (OSC3) oscillation circuit and change the CPU operating clock back to
the OSC3 clock.
In the above example, if the device is reset before a three-day period has elapsed, the device operates as
follows:
• The CPU starts up using the OSC3 clock.
• The clock timer counters are not reset. They remain in the RUN state.
The time during which the CPU has been idle can be checked by reading out the clock timer counters.
For using the clock timer as RTC
Example in which the clock timer is kept operating and an alarm is generated at 10:00 A.M. every day:
1. Disable the clock timer interrupt using the interrupt controller (ECTM = "0").
2. Stop the clock timer (TCRUN = "0").
3. Reset the clock timer (TCRST = "1").
4. Set the current day and time in the minute (TCHD), hour (TCDD), and day (TCND) counters. For the day
counter, set a number of days starting from the reference day (e.g., January 1, 1990). When the count is
read, it is converted into the current date by the software.
5. Set "10:00" in the hour-compare register (TCCD = "0x0A").
6. Select an a "hour-specified alarm" using the alarm factor select bit, and set "none" in the interrupt factor
select bit (TCASE = "010", TCISE = "111").
7. Reset the interrupt factor and alarm-factor generation flags (FCTM = "1", TCAF = "0").
8. Reenable the clock timer interrupt using the interrupt controller (ECTM = "1").
9. Start the clock timer (TCRUN = "1").
:
The clock timer is made to generate an interrupt at 10:00 every day by an hour-specified alarm.
:
In the above example, if any interrupt factor other than an alarm is selected, an interrupt is also generated by
that interrupt factor. To determine which factor caused the interrupt generated, read the interrupt factor
generation flag TCIF and alarm factor generation flag TCAF. If TCAF is set to 1, the interrupt has been
caused by an alarm. If you select an interrupt factor (other than a 1-day factor) along with the hour-specified
alarm, the selected interrupt factor occurs at the same time as the alarm factor.
Содержание S1C33210
Страница 4: ......
Страница 13: ...S1C33210 PRODUCT PART ...
Страница 14: ......
Страница 124: ...APPENDIX B PIN CHARACTERISTICS A 110 EPSON S1C33210 PRODUCT PART THIS PAGE IS BLANK ...
Страница 125: ...S1C33210 FUNCTION PART ...
Страница 126: ......
Страница 127: ...S1C33210 FUNCTION PART I OUTLINE ...
Страница 128: ......
Страница 130: ...I OUTLINE INTRODUCTION B I 1 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 138: ...I OUTLINE LIST OF PINS B I 3 6 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 139: ...S1C33210 FUNCTION PART II CORE BLOCK ...
Страница 140: ......
Страница 142: ...II CORE BLOCK INTRODUCTION B II 1 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 148: ...II CORE BLOCK CPU AND OPERATING MODE B II 2 6 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 152: ...II CORE BLOCK INITIAL RESET B II 3 4 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 224: ...II CORE BLOCK ITC Interrupt Controller B II 5 26 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 234: ...II CORE BLOCK CLG Clock Generator B II 6 10 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 236: ...II CORE BLOCK DBG Debug Unit B II 7 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 237: ...S1C33210 FUNCTION PART III PERIPHERAL BLOCK ...
Страница 238: ......
Страница 240: ...III PERIPHERAL BLOCK INTRODUCTION B III 1 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 266: ...III PERIPHERAL BLOCK 8 BIT PROGRAMMABLE TIMERS B III 3 18 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 292: ...III PERIPHERAL BLOCK 16 BIT PROGRAMMABLE TIMERS B III 4 26 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 296: ...III PERIPHERAL BLOCK WATCHDOG TIMER B III 5 4 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 429: ...S1C33210 FUNCTION PART IV ANALOG BLOCK ...
Страница 430: ......
Страница 432: ...IV ANALOG BLOCK INTRODUCTION B IV 1 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 448: ...IV ANALOG BLOCK A D CONVERTER B IV 2 16 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 449: ...S1C33210 FUNCTION PART V DMA BLOCK ...
Страница 450: ......
Страница 452: ...V DMA BLOCK INTRODUCTION B V 1 2 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 506: ...V DMA BLOCK IDMA Intelligent DMA B V 3 18 EPSON S1C33210 FUNCTION PART THIS PAGE IS BLANK ...
Страница 507: ...S1C33210 FUNCTION PART Appendix I O MAP ...
Страница 508: ......
Страница 557: ......