NEC UPD703116 User Manual page 396

32-bit single-chip microcontrollers
Table of Contents

Advertisement

(3) Cycle measurement
By setting the TMC30 and TMC31 registers as shown in Figure 9-100, timer 3 can measure the cycle of
signals input to the INTP30 pin or INTP31 pin.
The valid edge of the INTP30 pin is selected according to the IES301 and IES300 bits of the SESC register,
and the valid edge of the INTP31 pin is selected according to the IES311 and IES310 bits of the SESC
register. Either the rising edge, the falling edge, or both edges can be selected as the valid edges of both
pins.
If the CC30 register is set to a capture register and TM3 is started, the valid edge input of the INTP30 pin is
set as the trigger for capturing the TM3 register value in the CC30 register. When this value is captured, an
INTCC30 interrupt is generated.
Similarly, if the CC31 register is set to a capture register and TM3 is started, the valid edge input of the
INTP31 pin is set as the trigger for capturing the TM3 register value in the CC31 register. When this value is
captured, an INTCC31 interrupt is generated.
The cycle of signals input to the INTP30 pin is calculated by obtaining the difference between the TM3
register's count value (Dx) that was captured in the CC30 register according to the x-th valid edge input of the
INTP30 pin and the TM3 register's count value (D(x+1)) that was captured in the CC30 register according to
the (x+1)-th valid edge input of the INTP30 pin and multiplying the value of this difference by the cycle of the
clock control signal.
The cycle of signals input to the INTP31 pin is calculated by obtaining the difference between the TM3
register's count value (Dx) that was captured in the CC31 register according to the x-th valid edge input of the
INTP31 pin and the TM3 register's count value (D(x+1)) that was captured in the CC31 register according to
the (x+1)-th valid edge input of the INTP31 pin and multiplying the value of this difference by the cycle of the
clock control signal.
Figure 9-100. Contents of Register Settings When Timer 3 Is Used for Cycle Measurement
TM3OVF
CS2
0/1
0/1
TMC30
OST ENT1 ALV
TMC31
0
0/1
Remark
0/1: Set to 0 or 1 as necessary
396
CHAPTER 9 TIMER/COUNTER FUNCTION
CS1
CS0
TM3CETM3CAE
0/1
0/1
0
0
ETI
CCLR
ECLR
CMS1 CMS0
0/1
0/1
0/1
0/1
User's Manual U14492EJ5V0UD
1
1
Supply input clocks to internal units
Enable count operation
0
0
Use CC30 register as capture register
(when measuring the cycle of INTP30 input)
Use CC31 register as capture register
(when measuring the cycle of INTP31 input)
Continue counting after TM3 register
overflows

Advertisement

Table of Contents
loading

Table of Contents