Datasheet

Table Of Contents
ADuC7060/ADuC7061 Data Sheet
Rev. D | Page 66 of 108
TIMERS
The ADuC706x features four general-purpose timer/counters.
Timer0
Timer1 or wake-up timer
Timer2 or watchdog timer
Timer3
The four timers in their normal mode of operation can be either
free running or periodic.
In free running mode, the counter decrements/increments from
the maximum or minimum value until zero/full scale and starts
again at the maximum or minimum value.
In periodic mode, the counter decrements/increments from the
value in the load register (TxLD MMR) until zero/full scale and
starts again at the value stored in the load register. Note that the
TxLD MMR should be configured before the TxCON MMR.
The timer interval is calculated as follows:
If the timer is set to count down then
Interval = (TxLD x Prescaler) / Source Clock
If the timer is set to count up then
Interval = ((Full Scale - TxLD) x Prescaler) / Source Clock.
The value of a counter can be read at any time by accessing its
value register (TxVAL). Timers are started by writing in the
control register of the corresponding timer (TxCON).
In normal mode, an IRQ is generated each time that the value
of the counter reaches zero (if counting down) or full scale (if
counting up). An IRQ can be cleared by writing any value to the
clear register of the particular timer (TxCLRI).
Table 78. Timer Event Capture
Bit Description
0 Reserved
1 Timer0
2 Timer1 or wake-up timer
3 Timer2 or watchdog timer
4 Timer3
5 Reserved
6 Reserved
7 Reserved
8 ADC
9 UART
10 SPI
11 XIRQ0
12 XIRQ1
13 I
2
C master
14
I
2
C slave
15 PWM
16 XIRQ2 (GPIO IRQ2)
17 XIRQ3 (GPIO IRQ3)
HR:MIN:SEC: 1/128 FORMAT
To use the timer in Hr : Min : Sec : hundreds format the 32768
kHz clock and prescaler of 256 should be selected. The
hundreds field does not represent milliseconds but 1/128 of a
second (256/32768).The bits representing the Hour, minute and
second are not consecutive in the register. This arrangement
applies to TxLd and TxVAL when using the Hr : Min : Sec :
hundreds format as set in TxCON[5:4]. See Table 79 for more
details.
Table 79. Hr:Min:Sec: hundreds format
Bit Value Description
31:24 0 to 23 or 0 to 255 Hours
23:22 0 Reserved
21:16 0 to 59 Minutes
15:14 0 Reserved
13:8 0 to 59 Seconds
7 0 Reserved
6:0 0 to 127 1/128 of second