
reu05b0022_m16cap| Application Note
APPLICATION NOTE
M16C/62
Using the M16C/62 Timers in One-Shot Mode
1.0 Abstract
One-shots are commonly found in designs because they are useful for debouncing switches, "cleaning" up sensor inputs, and so on. The A timers on the M16C/62 can be configured as one-shots, reducing the need for external components. These one-shots have advantages over their hardware counterparts because they are not susceptible to RC drift, and the pulse widths can be varied under program control allowing for new applications such as fuel injection control and ignition control. The following article describes how to configure the M16C/62 A timers as one-shots, referred to as One-Shot Mode.
2.0 Introduction
The M16C/62 is a 16-bit MCU, based on the M16C CPU core, with features including 10-bit A/D, D/A, UARTS, timers, DMA, etc., and up to 256KB of user flash. The MCU has 5 Timer A's. All 5 timers can operate in One-Shot Mode. Timer A has the following additional modes of operation: Event Counter Mode PWM Mode Timer Mode Figure 1 illustrates the operation of timer A. The remainder of this document will focus on setting up timer A0 in One-Shot Mode using an external trigger.
Clock source selection
Data bus high-order bits
f1 f8 f32 fC32
Polarity selection
TAiIN (i = 0 to 4)
Timer One shot PWM Timer (gate function) Event counter
Data bus low-order bits
Clock selection
Low-order 8 bits Reload register (16)
High-order 8 bits
Counter (16) Clock selection
Up count/down count Always down count except in event counter mode TAi Timer A0 Timer A1 Timer A2 Timer A3 Timer A4 Addresses 038716 038616 038916 038816 038B16 038A16 038D16 038C16 038F16 038E16 TAj Timer A4 Timer A0 Timer A1 Timer A2 Timer A3 TAk Timer A1 Timer A2 Timer A3 Timer A4 Timer A0
Count start flag
(Address 038016)
TB2 overflow TAj overflow
(j = i 1. Note, however, that j = 4 when i = 0)
To external trigger circuit
Down count
TAk overflow
(k = i + 1. Note, however, that k = 0 when i = 4)
Up/down flag
(Address 038416)
TAiOUT
(i = 0 to 4)
Pulse output
Toggle flip-flop
Figure 1 Bock Diagram of Timer A
REU05B0022-0100Z
June 2003
Page 1 of 8
reu05b0022_m16cap Application Note renesas Download PDF
Add this permalink to your bookmarks for future download of reu05b0022_m16cap ApplicationNote
Permalink: http://application.emcelettronica.com/renesas/reu05b0022_m16cap