III PERIPHERAL BLOCK: 8-BIT PROGRAMMABLE TIMERS
B-III-3-4 EPSON S1C33L03 FUNCTION PART
Control and Operation of 8-Bit Programmable Timer
With the 8-bit programmable timer, the following settings must first be made before it starts counting:
1. Setting the output pin (only when necessary)
2. Setting the input clock
3. Setting the preset data (initial counter value)
4. Setting the interrupt/IDMA/HSDMA
Setting of an output pin is necessary only when the output clock of the 8-bit programmable timer is supplied to
external devices. For details on how to set the pin, refer to "Output Pins of 8-Bit Programmable Timers".
For details on how to set interrupts and DMA, refer to "8-Bit Programmable Timer Interrupts and DMA".
Note: The 8-bit programmable timers 0 through 3 all operate in the same way during counting, and the
structure of their control registers is also the same. The control bit names are assigned the
numerals "0" through "3" to denote the timer numbers. Since all these timers have common
functions, timer numbers here are represented it is by "x" unless necessary to specify a timer
number.
Setting the input clock
The 8-bit programmable timer is operated by the prescaler's output clock. The prescaler's division ratio can be
selected for each timer.
Division ratio select bit Clock control bit Register
8-bit timer 0: P8TS0[2:0] (D[2:0]) P8TON0 (D3) 8-bit timer 0/1 clock control register (0x4014D)
8-bit timer 1: P8TS1[2:0] (D[6:4]) P8TON1 (D7) 8-bit timer 0/1 clock control register (0x4014D)
8-bit timer 2: P8TS2[2:0] (D[2:0]) P8TON2 (D3) 8-bit timer 2/3 clock control register (0x4014E)
8-bit timer 3: P8TS3[2:0] (D[6:4]) P8TON3 (D7) 8-bit timer 2/3 clock control register (0x4014E)
8-bit timer 4: P8TS4[2:0] (D[2:0]) P8TON4 (D3) 8-bit timer 4/5 clock control register (0x40145)
8-bit timer 5: P8TS5[2:0] (D[6:4]) P8TON5 (D7) 8-bit timer 4/5 clock control register (0x40145)
Note that the division ratios differ for each timer (see Table 3.2).
Furthermore, the prescaler input clock can be directly supplied to the 8-bit timer by writing "1" to the
P8TPCKx bit in the 8-bit timer clock select register (0x40146).
Timer 0 clock selection: P8TPCK0 (D0) / 8-bit timer clock select register (0x40146)
Timer 1 clock selection: P8TPCK1 (D1) / 8-bit timer clock select register (0x40146)
Timer 2 clock selection: P8TPCK2 (D2) / 8-bit timer clock select register (0x40146)
Timer 3 clock selection: P8TPCK3 (D3) / 8-bit timer clock select register (0x40146)
Timer 4 clock selection: P8TPCK4 (D0) / 8-bit timer clock select register (0x40140)
Timer 5 clock selection: P8TPCK5 (D1) / 8-bit timer clock select register (0x40140)
When using the divided clock selected by P8TSx, set P8TPCKx to "0".
Table 3.2 Input Clock Selection
Timer P8TSx = 7 P8TSx = 6 P8TSx = 5 P8TSx = 4 P8TSx = 3 P8TSx = 2 P8TSx = 1 P8TSx = 0 P8TPCK = 1
Timer 0 fPSCIN/256 fPSCIN/128 fPSCIN/64 fPSCIN/32 fPSCIN/16 fPSCIN/8 fPSCIN/4 fPSCIN/2 fPSCIN/1
Timer 1 fPSCIN/4096 fPSCIN/2048 fPSCIN/1024 fPSCIN/512 fPSCIN/256 fPSCIN/128 fPSCIN/64 fPSCIN/32 fPSCIN/1
Timer 2 fPSCIN/4096 fPSCIN/2048 fPSCIN/64 fPSCIN/32 fPSCIN/16 fPSCIN/8 fPSCIN/4 fPSCIN/2 fPSCIN/1
Timer 3 fPSCIN/256 fPSCIN/128 fPSCIN/64 fPSCIN/32 fPSCIN/16 fPSCIN/8 fPSCIN/4 fPSCIN/2 fPSCIN/1
Timer 4 fPSCIN/4096 fPSCIN/2048 fPSCIN/64 fPSCIN/32 fPSCIN/16 fPSCIN/8 fPSCIN/4 fPSCIN/2 fPSCIN/1
Timer 5 fPSCIN/256 fPSCIN/128 fPSCIN/64 fPSCIN/32 fPSCIN/16 fPSCIN/8 fPSCIN/4 fPSCIN/2 fPSCIN/1
fPSCIN: Prescaler input clock frequency
The selected clock is output from the prescaler to the 8-bit programmable timer by writing "1" to P8TONx.
Notes:•The 8-bit programmable timer operates only when the prescaler is operating. (Refer to
"Prescaler".)
•Do not use a clock that is faster than the CPU operating clock as the 8-bit programmable timer.
•When setting an input clock, make sure the 8-bit programmable timer is turned off.