Pulse Width Measurement Mode - Renesas M16C Series Hardware Manual

16-bit microcopmuter
Hide thumbs Also See for M16C Series:
Table of Contents

Advertisement

R8C/11 Group

12.1.4 Pulse Width Measurement Mode

In this mode, the timer measures the pulse width of an external signal fed to INT1/CNTR0 pin (See
"Table 12.5 Pulse Width Measurement Mode Specifications"). Figure 12.7 shows the TXMR register
in pulse width measurement mode. Figure 12.8 shows an operation example in pulse width measure-
ment mode.
Table 12.5 Pulse Width Measurement Mode Specifications
Item
Count source
Count operation
Count start condition
Count stop condition
Interrupt request
generation timing
INT1/CNTR
pin function
0
CNTR
pin function
0
Read from timer
Write to timer
Select function
T i m e r X m o d e r e g i s t e r
b 7 b 6 b 5 b4 b 3 b 2 b 1 b 0
0 0
0
0
N O T E S :
1 . I T h e I R b i t i n t h e I N T 1 I C r e g i s t e r m a y b e s e t t o " 1 " ( i n t e r r u p t r e q u e s t e d ) w h e n t h e R 0 E D G b i t i s r e w r i t t e n .
R e f e r t o t h e p a r a g r a p h 1 9 . 2 . 5 " C h a n g i n g I n t e r r u p t F a c t o r " i n t h e U s a g e N o t e s R e f e r e n c e B o o k .
Figure 12.7 TXMR Register in Pulse Width Measurement Mode
Rev.1.20
Jan 27, 2006
REJ09B0062-0120
f
, f
, f
, f
1
2
8
32
• Down-count
• Continuously counts the selected signal only when the measurement pulse is "H" level,
or conversely only "L" level.
• When the timer underflows, the contents in the reload register is reloaded and the count
is continued.
Write "1" (count start) to TXS bit in TXMR register
Write "0" (count stop) to TXS bit in TXMR register
• When Timer X underflows [Timer X interruption]
• Rising or falling of CNTR0 input (end of measurement period) [INT1 interrupt]
Measurement pulse input
Programmable I/O port
Count value can be read by reading TX register
Same applies to PREX register.
Value written to TX register is written to both reload register and counter.
Same applies to PREX register.
_____
• INT1/CNTR
polarity switching function
0
"H" or "L" level duration can be selected with R0EDG bit as the input pulse measurement
S y m b o l
T X M R
1
1
B i t s y m b o l
B i t n a m e
O p e r a t i o n m o d e
T X M O D 0
s e l e c t b i t 0 , 1
T X M O D 1
I N T 1 / C N T R
s w i t c h i n g b i t
R 0 E D G
T i m e r X c o u n t
T X S
s t a r t f l a g
S e t t o " 0 " i n p u l s e w i d t h m e a s u r e m e n t m o d e
T X O C N T
TXMOD2
S e t t o " 0 " i n p u l s e w i d t h m e a s u r e m e n t m o d e
T X E D G
S e t t o " 0 " i n p u l s e w i d t h m e a s u r e m e n t m o d e
T X U N D
S e t t o " 0 " i n p u l s e w i d t h m e a s u r e m e n t m o d e
page 76 of 204
Specification
A d d r e s s
A f t e r r e s e t
0 0 8 B
0 0
1 6
1 6
F u n c t i o n
b 1 b 0
1 1 : Pulse width measurement mode
[CNTR0]
p o l a r i t y
0
0 : Measures "H" level width
(1 )
1 : Measures "L" level width
[INT1]
0 : Rising edge
1 : Falling edge
0 : Stops counting
1 : Starts counting
12.1 Timer (Timer X)
R W
R W
R W
R W
R W
R W
RW
RW
RW

Advertisement

Table of Contents
loading

This manual is also suitable for:

R8c/11 seriesR8c/tiny series

Table of Contents