Epson S1C33L03 Laptop User Manual


 
III PERIPHERAL BLOCK: 16-BIT PROGRAMMABLE TIMERS
B-III-4-4 EPSON S1C33L03 FUNCTION PART
Control and Operation of 16-Bit Programmable Timer
The following settings must first be made before the 16-bit programmable timer starts counting:
1. Setting pins for input/output (only when necessary)
2. Setting input clock
3. Selecting comparison data register/buffer
4. Setting clock output conditions (signal active level, fine mode)
5. Setting comparison data
6. Setting interrupt/IDMA
For details on how to set clock output conditions and interrupts and DMA, refer to "Controlling Clock Output" and
"16-Bit Programmable Timer Interrupts and DMA".
Setting pin for input/output
The pin must be set for output for the output clock of the 16-bit programmable timer to be fed to external
devices.
The pin for input must be set for the 16-bit programmable timer to be used as an event counter that counts
external clock pulses.
For details on how to set the pin, refer to "I/O Pins of 16-Bit Programmable Timers".
Setting the input clock
The count clock for each timer can be selected from between an internal clock and an external clock. Use the
following control bits to select the input clock:
Timer 0 input clock selection: CKSL0 (D3) / 16-bit timer 0 control register (0x48186)
Timer 1 input clock selection: CKSL1 (D3) / 16-bit timer 1 control register (0x4818E)
Timer 2 input clock selection: CKSL2 (D3) / 16-bit timer 2 control register (0x48196)
Timer 3 input clock selection: CKSL3 (D3) / 16-bit timer 3 control register (0x4819E)
Timer 4 input clock selection: CKSL4 (D3) / 16-bit timer 4 control register (0x481A6)
Timer 5 input clock selection: CKSL5 (D3) / 16-bit timer 5 control register (0x481AE)
An external clock is selected by writing "1" to CKSLx, and the internal clock is selected by writing "0".
At initial reset, CKSLx is set for the internal clock.
An external clock can be used for the timer for which the pin is set for input.
•Internal clock
When the internal clock is selected as a timer, the timer is operated by the prescaler output clock. The
prescaler division ratio can be selected for each timer.
Table 4.2 Setting the Internal Clock
Timer Control register Division ratio select bit Clock control bit
Timer 0 16-bit timer 0 clock control register (0x40147) P16TS0[2:0] (D2:0]) P16TON0 (D3)
Timer 1 16-bit timer 1 clock control register (0x40148) P16TS1[2:0] (D2:0]) P16TON1 (D3)
Timer 2 16-bit timer 2 clock control register (0x40149) P16TS2[2:0] (D2:0]) P16TON2 (D3)
Timer 3 16-bit timer 3 clock control register (0x4014A) P16TS3[2:0] (D2:0]) P16TON3 (D3)
Timer 4 16-bit timer 4 clock control register (0x4014B) P16TS4[2:0] (D2:0]) P16TON4 (D3)
Timer 5 16-bit timer 5 clock control register (0x4014C) P16TS5[2:0] (D2:0]) P16TON5 (D3)
The division ratio can be selected from among eight types as shown in Table 4.3.
Table 4.3 Input Clock Selection
P16TS = 7 P16TS = 6 P16TS = 5 P16TS = 4 P16TS = 3 P16TS = 2 P16TS = 1 P16TS = 0
fPSCIN/4096 fPSCIN/1024 fPSCIN/256 fPSCIN/64 fPSCIN/16 fPSCIN/4 fPSCIN/2 fPSCIN/1
fPSCIN: Prescaler input clock frequency
The selected clock is output from the prescaler to the 16-bit programmable timer by writing "1" to P16TONx.
Notes:•When the internal clock is used, the 16-bit programmable timer operates only when the
prescaler is operating (refer to "Prescaler").
•When setting an input clock, make sure the 16-bit programmable timer is turned off.