UM10346_1
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 01 — 2 November 2009
47 of 132
NXP Semiconductors
UM10346
LPC980/982 User manual
7.6 Timer overflow toggle output
Timers 0 and 1 can be configured to automatically toggle a port output whenever a timer
overflow occurs. The same device pins that are used for the T0 and T1 count inputs and
PWM outputs are also used for the timer toggle outputs. This function is enabled by
control bits ENT0 and ENT1 in the AUXR1 register, and apply to Timer 0 and Timer 1
respectively. The port outputs will be a logic 1 prior to the first timer overflow when this
mode is turned on. In order for this mode to function, the C/T bit must be cleared selecting
PCLK as the clock source for the timer.
8.
Timers 2, 3 and 4
The P89LPC980/982 has three external 16-bit timers/counters. All can be configured to
operate either as timers or event counters. An option to automatically toggle the Tx pin
upon timer overflow has been added.
In the ‘Timer’ function, the timer is incremented every PCLK.
In the ‘Counter’ function, the register is incremented in response to a 1-to-0 transition on
its corresponding count input pin (T2/T3/T4). The count input is sampled once during
every machine cycle. When the pin is high during one cycle and low in the next cycle, the
count is incremented. The new count value appears in the register during the cycle
following the one in which the transition was detected. Since it takes two machine cycles
(four CPU clocks) to recognize a 1-to-0 transition, the maximum count rate is
1
⁄
4
of the
CPU clock frequency. There are no restrictions on the duty cycle of the count input signal,
but to ensure that a given level is sampled at least once before it changes, it should be
held for at least one full machine cycle.
Only external Timer 2/3/4 has the external input pin TxEX (x=2, 3 or 4). When EXENx = 1,
a 1-to-0 transition on this pin can trigger a reload or capture event.
Timer 2, Timer 3 and Timer 4 have three operating modes, which are selected by PWMx
(TxCON.4), C/NTx (TxCON.1) and CP/NRLx (TxCON.0) in TxCON (where x = 2, 3 or 4 for
Timers 2, 3 or 4 respectively).
Fig 18. Timer/counter 0 or 1 in mode 6 (PWM auto-reload)
002aaa923
PCLK
TRn
Gate
INTn pin
C/T = 0
TLn
(8-bits)
THn
(8-bits)
TFn
control
ENTn
Tn pin
toggle
overflow
interrupt
reload THn on falling transition
and (256-THn) on rising transition
Table 36.
Timer/Counter x Control(TxCON - where x = 2, 3 or 4) bit allocation
Bit
7
6
5
4
3
2
1
0
Symbol
PSELx
ENTx
TIENx
PWMx
EXENx
TRx
C/NTx
CP/NRLx
Reset
0
0
0
0
0
0
0
0