English
Language : 

M16C1N Datasheet, PDF (92/238 Pages) Renesas Technology Corp – RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/10 SERIES
M16C/1N Group
12. Timers
12.2.5 Pulse Period Measurement Mode
In this mode, the timer measures the pulse period of an external signal fed to CNTR0 pin.
Table 12.7 lists specifications of pulse period measurement mode. Figure 12.11 shows the Timer X
mode register in pulse period measurement mode. Figure 12.12 shows the operation example.
Table 12.7 Specifications of pulse period measurement mode
Item
Specification
Count source
f1, f8, f32, fC32
Count operation
• Down count
• After valid edge of measurement pulse is input, the timer X reloads contents in the
reload register and continues counting in underflow of the second prescaler X.
Count start condition
Count start flag is set (=1)
Count stop condition
Count start flag is reset (=0)
Interrupt request generation timing • When Timer X underflows [Timer X interruption]
• Rising (R0EDG=0) or falling (R0EDG=1) of CNTR0 input [CNTR0 interruption or timer X interrupt]
CNTR0 pin function
Measurement pulse input (Note 1)
TXOUT pin function
Programmable I/O port
Read from timer
When reading Timer X register, the count value of buffer for read purpose can be read
out. The buffer of read purpose retains the content of Timer X register upon an active
edge of measurement pulse, and starts to read the content of Timer X register by reading
Timer X.
Write to timer
When a value is written to Timer X register, it is written to both reload register and counter.
Same applies to Prescaler X register.
Select function
• CNTR0 polarity switching function
The measurement period of pulse input can be selected to be a period from one rising
edge to the next rising edge or from one falling edge to the next falling edge by software.
Note 1: Avoid a shorter period pulse input than double prescaler X period. Longer pulse for H width and L width than the
prescaler X period should be input to the CNTR0 pin. If shorter pulse than the period is input to the CNTR0 pin,
the input may be disabled.
Timer X mode register
b7 b6 b5 b4 b3 b2 b1 b0
10
00
Symbol
TXMR
Address
008B16
When reset
0016
Bit symbol
TXMOD0
TXMOD1
R0EDG
TXS
TXOCNT
TXMOD2
Bit name
Function
Operation mode
select bit 0, 1
b1 b0
0 0 : Pulse period measurement mode
(Note 1)
CNTR0 polarity
switching bit
(Note 1)
0 : Measures a measurement pulse from one
rising edge to the next rising edge
(Interrupt at rising edge)
1 : Measures a measurement pulse from one
falling edge to the next falling edge
(Interrupt at falling edge)
Timer X count
0 : Stops counting
start flag (Note 3) 1 : Starts counting
P30/TXOUT
select bit
0 : In pulse period measurement mode, set to "0"
Operation mode
select bit 2 (Note 1)
1 : Pulse period measurement mode
RW
RW
RW
RW
RW
RW
RW
TXEDG
Effectual edge
0 : No effectual edge
reception flag (Note 2) 1 : Effectual edge found
RW
TXUND
Timer X under
flow flag (Note 2)
0 : No under flow
1 : Under flow found
RW
Note 1: This bit should rewrite with inhibiting the CNTR0 interrupt. When using the interrupt, the interrupt must be enabled
after clearing the CNTR0 interrupt request bit to "0" using a MOV instruction.
Note 2: These bits are set to "0" by writing a "0" in a program. (Writing a "1" has no effect.)
Nothing is assigned to the pod probe for M16C/1N group (M301N2T-PRB).
Note 3: Execute the MOV instruction when stopping the timer X while pulse period measurement mode.
Figure 12.11 Timer X mode register in pulse period measurement mode
Rev.1.00 Oct 20, 2004 page 80 of 222
REJ09B0007-0100Z