Control And Operation Of 16-Bit Programmable Timer; Controlling Clock Output - Epson CMOS 32-Bit Single Chip Microcomputer S1C33L03 Technical Manual

Cmos 32-bit single chip microcomputer
Table of Contents

Advertisement

III PERIPHERAL BLOCK: 16-BIT PROGRAMMABLE TIMERS

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.
Timer
Timer 0 16-bit timer 0 clock control register (0x40147)
Timer 1 16-bit timer 1 clock control register (0x40148)
Timer 2 16-bit timer 2 clock control register (0x40149)
Timer 3 16-bit timer 3 clock control register (0x4014A)
Timer 4 16-bit timer 4 clock control register (0x4014B)
Timer 5 16-bit timer 5 clock control register (0x4014C)
The division ratio can be selected from among eight types as shown in Table 4.3.
P16TS = 7
P16TS = 6
f
/4096 f
PSCIN
PSCIN
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.
B-III-4-4
Table 4.2 Setting the Internal Clock
Control register
Table 4.3 Input Clock Selection
P16TS = 5
P16TS = 4
/1024
f
/256
f
PSCIN
PSCIN
Division ratio select bit
P16TS0[2:0] (D2:0])
P16TS1[2:0] (D2:0])
P16TS2[2:0] (D2:0])
P16TS3[2:0] (D2:0])
P16TS4[2:0] (D2:0])
P16TS5[2:0] (D2:0])
P16TS = 3
P16TS = 2
/64
f
/16
f
PSCIN
PSCIN
f
: Prescaler input clock frequency
PSCIN
EPSON
Clock control bit
P16TON0 (D3)
P16TON1 (D3)
P16TON2 (D3)
P16TON3 (D3)
P16TON4 (D3)
P16TON5 (D3)
P16TS = 1
P16TS = 0
/4
f
/2
f
PSCIN
PSCIN
S1C33L03 FUNCTION PART
/1

Advertisement

Table of Contents
loading

Table of Contents