NEC PD78P214 Manuale Utente

Pagina di 487
161
Chapter 7   Timer/Counter Units
7
(4) External event counter
Eight-bit timer/counter 2 counts clock pulses (CI pin input pulses) applied to the external interrupt input pin
(INTP2).
Table 7-14 indicates the clock signals that can be applied to 8-bit timer/counter 2.
Table 7-14  Clock Signals That Can Be Applied to 8-Bit Timer/Counter 2
Maximum frequency
Minimum pulse width
Note
(high and low level)
When occurrences of both
edges are counted
f
CLK
/32 (187.5 kHz)
16/f
CLK
 (2.67 
µ
s)
When occurrences of one
edge only are counted
f
CLK
/24 (250 kHz)
12/f
CLK
 (2 
µ
s)
Note  The values in parentheses are based on f
CLK
 = 6 MHz.
7.3.2  Configuration
Eight-bit timer/counter 2 consists of one 8-bit timer 2 (TM2), two 8-bit compare registers (CR20, CR21), and one
8-bit capture register (CR22).
Fig. 7-66 shows the block diagram of 8-bit timer/counter 2.
(1) 8-bit timer 2 (TM2)
TM2 is a timer for counting up with the count clock specified by external interrupt mode register 0 (INTM0)
or the lower 4 bits of prescaler mode register 1 (PRM1).  Either an internal count clock or an external count
clock can be selected.
TM2 allows only read operation using an 8-bit manipulation instruction.  The count operation of TM2 can be
enabled or disabled by timer control register 1 (TMC1).
When the RESET signal is applied, TM2 is cleared to 00H, and count operation stops.
(2) Compare registers (CR20, CR21)
The CR20 and CR21 registers are 8-bit registers for holding a value that determines the period of interval timer
operation.
When the values of the CR20 and CR21 registers coincide with the value of TM2, interrupt requests (INTC20,
INTC21) and timer output control signals are generated.  Count value clear operation can also be performed
when the value of CR21 coincides with the value of TM2.
The CR20 and CR21 registers allow both read and write operations using an 8-bit manipulation instruction.
When the RESET signal is applied, the CR20 and CR21 registers become undefined.
(3) Capture register (CR22)
The CR22 register is an 8-bit register for capturing the value of TM2.
Capture operation is performed on a valid edge (capture trigger) occurring on the external interrupt request
(INTP1) input pin.  The value of CR22 register is held until the next capture trigger occurs or the value of the
CR22 register is read.  After being read, the CR22 register is undefined until a value is set in the CR22 register
when the next capture trigger occurs.  After a capture operation, TM2 can be cleared.
The CR22 register allows only read operation using an 8-bit manipulation instruction.  When the RESET signal
is applied, the CR22 register becomes undefined,
(4) Edge detector
The edge detector detects a valid edge of an external input signal.
When the edge detector detects, on the INTP1 input pin, a valid edge specified in external interrupt mode
register 0 (INTM0), INTP1 and a capture trigger are generated.  When the edge detector detects a valid edge
on the external interrupt request (INTP2) input pin, a TM2 count clock and INTP2 are generated.