UM10310_1 © NXP B.V. 2008. All rights reserved.
User manual Rev. 01 — 1 December 2008 52 of 139
NXP Semiconductors UM10310
P89LPC9321 User manual
Input Capture Edge Select - ICESx bit (x being A or B) in the CCCRx register. The user
will have to configure the associated I/O pin as an input in order for an external event to
trigger a capture.
A simple noise filter can be enabled on the input capture input. When the Input Capture
Noise Filter ICNFx bit is set, the capture logic needs to see four consecutive samples of
the same value in order to recognize an edge as a capture event. The inputs are sampled
every two CCLK periods regardless of the speed of the timer.
An event counter can be set to delay a capture by a number of capture events. The three
bits ICECx2, ICECx1 and ICECx0 in the CCCRx register determine the number of edges
the capture logic has to see before an input capture occurs.
When a capture event is detected, the Timer Input Capture x (x is A or B) Interrupt Flag -
TICF2x (TIFR2.1 or TIFR2.0) is set. If EA and the Timer Input Capture x Enable bit -
TICIE2x (TICR2.1 or TICR2.0) is set as well as the ECCU (IEN1.4) bit is set, the program
counter will be vectored to the corresponding interrupt. The interrupt flag must be cleared
manually by writing a logic 0 to it.
When reading the input capture register, ICRxL must be read first. When ICRxL is read,
the contents of the capture register high byte are transferred to a shadow register. When
ICRxH is read, the contents of the shadow register are read instead. (If a read from ICRxL
is followed by another read from ICRxL without ICRxH being read in between, the new
value of the capture register high byte (from the last ICRxL read) will be in the shadow
register).
9.6 PWM operation
PWM Operation has two main modes, asymmetrical and symmetrical. These modes of
timer operation are selected by writing 10H or 11H to TMOD21:TMOD20 as shown in
Section 9.3 “Basic timer operation.
In asymmetrical PWM operation, the CCU Timer operates in downcounting mode
regardless of the setting of TDIR2. In this case, TDIR2 will always read 1.
In symmetrical mode, the timer counts up/down alternately and the value of TDIR2 has no
effect. The main difference from basic timer operation is the operation of the compare
module, which in PWM mode is used for PWM waveform generation. Tabl e 42 shows the
behavior of the compare pins in PWM mode.
Table 41. Event delay counter for input capture
ICECx2 ICECx1 ICECx0 Delay (numbers of edges)
0000
0011
0102
0113
1004
1015
1107
11115