
reu05b0023_m16cap| Application Note
APPLICATION NOTE
M16C/62
Using the M16C/62 Timer in Pulse Period/Width Measurement Mode
1.0 Abstract
Measuring the frequency (1/period) or the pulse width of an input signal is useful in applications such as tachometers, DC motor control, power usage calculations, and so on. The following article describes how to use timer B to measure the period and pulse width of an input waveform, referred to as "Pulse Period/Pulse Width Measurement Mode".
2.0 Introduction
The M16C/62 is a 16-bit MCU, based on the M16C CPU core, with an impressive list of features including 10-bit A/D, D/A, UARTS, timers, DMA, etc., and up to 256k bytes of user flash. The MCU has 6 B timers and all 6 timers can operate in Pulse Period/Pulse Width Measurement Mode. Timer B has the following additional modes of operation: Timer Mode Event Counter Mode Figure 1 illustrates the operation of timer B. The remainder of this article focuses on setting up timer B0 to measure pulse width, and timer B1 to measure pulse period.
Data bus high-order bits Data bus low-order bits
Clock source selection
f1 f8 f32 fC32
TBiIN (i = 0 to 5)
Low-order 8 bits
High-order 8 bits
Timer Pulse period/pulse width measurement
Reload register (16)
Clock selection
Event counter
Polarity switching and edge pulse
Counter (16)
Count start flag
(address 038016)
Counter reset circuit
Can be selected in only event counter mode TBj overflow (j = i 1. Note, however, j = 2 when i = 0, j = 5 when i = 3)
TBi Timer B0 Timer B1 Timer B2 Timer B3 Timer B4 Timer B5 Address 039116 039016 039316 039216 039516 039416 035116 035016 035316 035216 035516 035416 TBj Timer B2 Timer B0 Timer B1 Timer B5 Timer B3 Timer B4
Figure 1 Block Diagram of Timer B
REU05B0023-0100Z
June 2003
Page 1 of 10
reu05b0023_m16cap Application Note renesas Download PDF
Add this permalink to your bookmarks for future download of reu05b0023_m16cap ApplicationNote
Permalink: http://application.emcelettronica.com/renesas/reu05b0023_m16cap