41
8Bit Single Chip Microcontroller
DMC73C167
5.5.1.7 Notes on Timer Usage
In Timer 1, the most significant byte (MSB) read-out latch is shared between the MSB of the
decrementer and the MSB of the capture latch to be sampled at one moment. The Timer 1
MSB read-out latch can be read from both P20 and P23. Reading the LSB of the decrementer
or capture latch will always update the contents of the read-out latch. In order to read correctly
the entire 16-bit value of the decrementer or capture latch, the LSB must be read first, which
will load the MSB read-out latch. The MSB read-out latch must be read and stored after
reading the LSB of either the decrementer or capture latch.
5.5.2 Timer 2 / Timer 3
Timer 2 and Timer 3 are 8-bit timers that contain a 2-bit prescaler and an 8-bit decrementer.
The clock source of Timer 2 is determined by the T2SRC bit of the T2CTL register (P25.5),
and the clock source of Timer 3 determined by the T3SRC bit of the T3CTL register (P27.6).
Setting the T2SRC or T3SRC bits to 0 selects the internally generated Fosc/4 clock and
places the timer in real-time clock mode. Setting the T2SRC bit to 1 selects the external clock
source and places Timer 2 in event counter mode. Setting the T3SRC bit to 1 selects the
Timer 2 underflow for the Timer 3 clock source, and makes Timer 2 and Timer 3 cascadable.
When 0 is written to the START bit, the timer chain is disabled or frozen at the current count
value. When 1 is written to the START bit, regardless of whether it was previously a 0 or a 1,
the prescaler and counter decrementers are loaded with the corresponding latch values,
and the timer/event counter operation begins.
When the prescaler and counter decrement through zero thogether, an interrupt flag is set,
and the prescaler and counter decrementers are immediately and automatically reloaded
with the corresponding latch values.
The interrupt levels generated by the timers are INT2_1 for Timer 2 and INT3_1 for Timer 3
Timer 2 and Timer 3 each have a respective associated 8-bit capture latch that captures
the current value of the counter whenever 8-bit capture latch that captures the current value
of the counter whenever Port A4 (INT3_0) for Timer 2 or Port A5 (INT5_0) for Timer 3 are
activated.
Figure 5-6. Timer 2 Block Diagram
££á££×££
Pin A2
I/O Port A2/Event
Counter Clock Input
2- bit
Prescaler
Fosc/4
T2SRC
START(P25.7)
Capture Latch
External A4 Pin
INT3_0
Timer 2
Interrupt
(INT2_1)
Timer 3
Clock
8- bit
Decrementer