English
Language : 

M16C1N Datasheet, PDF (90/238 Pages) Renesas Technology Corp – RENESAS 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/10 SERIES
M16C/1N Group
12. Timers
12.2.4 Pulse Width Measurement Mode
In this mode, the timer measures the pulse width of an external signal fed to CNTR0 pin.
(See Table 12.6) Figure 12.9 shows the Timer X mode register in pulse width measurement mode.
Figure 12.10 shows an operation example in pulse width measurement mode.
Table 12.6 Specifications of pulse width measurement mode
Item
Specification
Count source
f1, f8, f32, fC32
Count operation
• Down count
• Continuously counts the selected signal only when the measurement pulse is "H" level,
or conversely only "L" level.
• When the timer underflows, it reloads the reload register contents before continuing
counting
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]
CNTR0 pin function
Measurement pulse input
TXOUT pin function
Programmable I/O port
Read from timer
Count value can be read out by reading Timer X register.
Same applies to Prescaler X register.
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 pulse input can be selected to be "H" level width or "L" level width by
software.
Timer X mode register
b7 b6 b5 b4 b3 b2 b1 b0
00
11
Symbol
TXMR
Address
008B16
When reset
0016
Bit symbol
Bit name
Function
RW
TXMOD0 Operation mode
select bit 0, 1
b1 b0
1 1 : Pulse width measurement mode
RW
TXMOD1
(Note 1)
RW
R0EDG
CNTR0 polarity 0 : Measures "L" level width (Interrupt at rising edge)
switching bit (Note 1) 1 : Measures "H" level width (Interrupt at falling edge) RW
TXS
TXOCNT
Timer X count
start flag
P30/TXOUT
select bit
0 : Stops counting
1 : Starts counting
RW
0 : Set to "0" in pulse width measurement mode RW
TXMOD2 Operation mode
select bit 2
0 : Set to "0" in pulse width measurement mode RW
TXEDG
Effectual edge
reception flag
Invalid in pulse width measurement mode.
When write, set "0". When read, this contents RW
is indeterminate.
TXUND
Timer X under
flow flag
Invalid in pulse width measurement mode.
When write, set "0". When read, this contents RW
is indeterminate.
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.
Figure 12.9 Timer X mode register in pulse width measurement mode
Rev.1.00 Oct 20, 2004 page 78 of 222
REJ09B0007-0100Z