
146
Chapter 7
8-Bit Timer/Event Counters 50 and 51
User’s Manual U16504EE1V1UD00
7.4.4 PWM output operations
Setting the 8-bit timer mode control registers (TMC50 and TMC51) as shown in Figure 8-14 allows
operation as PWM output. Pulses with the duty rate determined by the values preset in 8-bit compare
registers (CR50 and CR51) output from the TO50/P34/527/TI50 or TO51/P91/522/TI51 pin.
Select the active level of PWM pulse with bit 1 of the 8-bit timer mode control register 50 (TMC50) or bit
1 of the 8-bit timer mode control register 51 (TMC51).
This PWM pulse has an 8-bit resolution. The pulse can be converted into an analog voltage by integrat-
ing it with an external low-pass filter (LPF). Count clock of the 8-bit timer register 50 (TM50) can be
selected with the timer clock select register 50 (TCL50) and count clock of the 8-bit timer register 51
(TM51) can be selected with the timer clock select register 51 (TCL51).
PWM output enable/disable can be selected with bit 0 (TOE50) of TMC50 or bit 0 (TOE51) of TMC51.
Figure 7-16:
8-Bit Timer Control Register Settings for PWM Output Operation
Setting Method
(1)
(2)
(3)
(4)
(5)
Set the port latch and port mode register to "0".
Set the active level width in the 8-bit compare register n (CR5n).
Select the count clock in the timer clock selection register n (TCL5n).
Set the active level in bit 1 (TMC5n1) of TMC5n.
If bit 7 (TCE5n) of TMC5n is set to "1", counting starts.
When counting starts, set TCE5n to "0".
Remarks: 1.
n = 50, 51
2.
x: don’t care
PWM Output Operation
(1)
When counting starts, the PWM output (output from TO5n) outputs the inactive level until an
overflow occurs.
When the overflow occurs, the active level specified in step (1) in the setting method is output. The
active level is output until CR5n and the count of the 8-bit counter n (TM5n) match.
The PWM output after CR5n and the count match is the inactive level until an overflow occurs
again.
Steps (2) and (3) repeat until counting stops.
If counting is stopped by TCE5n = 0, the PWM output goes to the inactive level.
(2)
(3)
(4)
(5)
Remarks: 1.
n = 50, 51
2.
TMC5n4 is only available at TM51.
1
TCEn
1
TMCn6
0
0
x
LVSn LVRn TMCn1 TOEn
TMCn
x
0/1
1
TOn output enable
Sets active level
PWM mode
TMn operation enable
8-bit timer/event counter mode
TMCn4