III PERIPHERAL BLOCK: CLOCK TIMER
B-III-7-6
EPSON
S1C33L03 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.
Summary of Contents for CMOS 32-Bit Single Chip Microcomputer S1C33L03
Page 4: ......
Page 14: ......
Page 15: ...S1C33L03 PRODUCT PART ...
Page 16: ......
Page 147: ...S1C33L03 FUNCTION PART ...
Page 148: ......
Page 149: ...S1C33L03 FUNCTION PART I OUTLINE ...
Page 150: ......
Page 152: ...I OUTLINE INTRODUCTION B I 1 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 162: ...I OUTLINE LIST OF PINS B I 3 8 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 163: ...S1C33L03 FUNCTION PART II CORE BLOCK ...
Page 164: ......
Page 166: ...II CORE BLOCK INTRODUCTION B II 1 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 172: ...II CORE BLOCK CPU AND OPERATING MODE B II 2 6 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 176: ...II CORE BLOCK INITIAL RESET B II 3 4 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 224: ...II CORE BLOCK BCU Bus Control Unit B II 4 48 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 262: ...II CORE BLOCK DBG Debug Unit B II 7 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 263: ...S1C33L03 FUNCTION PART III PERIPHERAL BLOCK ...
Page 264: ......
Page 266: ...III PERIPHERAL BLOCK INTRODUCTION B III 1 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 322: ...III PERIPHERAL BLOCK WATCHDOG TIMER B III 5 4 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 415: ...S1C33L03 FUNCTION PART IV ANALOG BLOCK ...
Page 416: ......
Page 418: ...IV ANALOG BLOCK INTRODUCTION B IV 1 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 434: ...IV ANALOG BLOCK A D CONVERTER B IV 2 16 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 435: ...S1C33L03 FUNCTION PART V DMA BLOCK ...
Page 436: ......
Page 438: ...V DMA BLOCK INTRODUCTION B V 1 2 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 492: ...V DMA BLOCK IDMA Intelligent DMA B V 3 18 EPSON S1C33L03 FUNCTION PART THIS PAGE IS BLANK ...
Page 493: ...S1C33L03 FUNCTION PART VI SDRAM CONTROLLER BLOCK ...
Page 494: ......
Page 531: ...S1C33L03 FUNCTION PART VII LCD CONTROLLER BLOCK ...
Page 532: ......
Page 579: ...S1C33L03 FUNCTION PART Appendix I O MAP ...
Page 580: ......