Philips 8-bit microcontroller with two-clock 80C51 core UM10109 Manual Do Utilizador

Página de 133
 
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
User manual
Rev. 02 — 23 May 2005 
51 of 133
Philips Semiconductors
UM10109
P89LPC932A1 User manual
 
in basic timer mode. In basic timer mode, writing a one to TCOU2 will cause the values to 
be latched immediately and the value of TCOU2 will always read as zero. In PWM mode, 
writing a one to TCOU2 will cause the contents of the shadow registers to be updated on 
the next CCU Timer overflow. As long as the latch is pending, TCOU2 will read as one and 
will return to zero when the latch takes place. TCOU2 also controls the latching of all the 
Output Compare registers as well as the Timer Overflow Reload registers - TOR2.
9.5 Input capture
Input capture is always enabled. Each time a capture event occurs on one of the two input 
capture pins, the contents of the timer is transferred to the corresponding 16-bit input 
capture register ICRAH:ICRAL or ICRBH:ICRBL. The capture event is defined by the 
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).
Table 36:
Event delay counter for input capture
ICECx2
ICECx1
ICECx0
Delay (numbers of edges)
0
0
0
0
0
0
1
1
0
1
0
2
0
1
1
3
1
0
0
4
1
0
1
5
1
1
0
7
1
1
1
15