R01UH0136EJ0210 Rev.2.10
Page 286 of 800
Jul 31, 2012
M16C/64A Group
17. Timer A
17.3.6
Pulse Width Modulation (PWM) Mode
In PWM mode, the timer outputs pulses of a given width in succession. The counter functions as either
a 16-bit pulse width modulator or 8-bit pulse width modulator. Table 17.14 lists PWM Mode
Specifications. Table 17.15 lists Registers and the Setting in PWM Mode. Figure 17.11 and Figure
17.12 show Operation Example in 16-Bit Pulse Width Modulation Mode and Operation Example in 8-Bit
Pulse Width Modulation Mode, respectively.
Table 17.14
PWM Mode Specifications
Item
Specification
Count sources
f1TIMAB, f2TIMAB, f8TIMAB, f32TIMAB, f64TIMAB, fOCO-S, fC32
Count operations
•
Decrement (operating as an 8-bit or a 16-bit pulse width modulator)
•
The timer reloads the reload register value at a rising edge of PWM pulse and
continues counting.
•
The timer is not affected by a trigger that occurs during counting.
16-bit PWM
•
Pulse width
•
Cycle time
n: set value of the TAi register
fj: count source frequency
8-bit PWM
•
Pulse width
•
Cycle time
m: set value of the TAi register lower address
n: set value of the TAi register upper address
fj: count source frequency
Count start condition
•
The TAiS bit of the TABSR register is set to 1 (start counting).
•
The TAiS bit is 1 and external trigger input from the TAiIN pin
•
The TAiS bit is 1 and one of the following triggers occurs
Timer B2 overflow or underflow
Timer Aj overflow or underflow (j = i - 1, except j = 4 if i = 0)
Timer Ak overflow or underflow (k = i + 1, except k = 0 if i = 4)
Count stop condition
The TAiS bit is set to 0 (stop counting).
Interrupt request
generation timing
On the falling edge of the PWM pulse
TAiIN pin function
I/O port or trigger input
TAiOUT pin function
Pulse output
Read from timer
An undefined value is read when reading the TAi register.
Write to timer
•
When not counting
Value written to the TAi register is written to both the reload register and counter.
•
When counting
Value written to the TAi register is written to only the reload register
(transferred to counter when reloaded next time).
Selectable functions
•
Output polarity control
The output polarity of the TAiOUT pin is inverted. (While the TAiS bit is set to 0 (stop
counting), a high-level signal is output).
i = 0 to 4
n
fj
---
n
2
16
- 1
2
16
1
–
(
)
fj
----------------------
n
m
1
+
(
)
×
fj
-----------------------------
n
×
(m + 1)
(2
8
- 1)
×
(m + 1)
2
8
1
–
(
)
m
1
+
(
)
×
fj
----------------------------------------------
Содержание M16C/60 Series
Страница 853: ...M16C 64A Group R01UH0136EJ0210...