189
CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 50, 51, 52
User
’
s Manual U14701EJ3V0UD
8.5.4 PWM output operation
The 8-bit timer/event counter operates as PWM output when bit 6 (TMC5n6) of 8-bit timer mode control register
5n (TMC5n) is set to 1.
The duty rate pulse determined by the value set to 8-bit timer compare register 5n (CR5n) is output from TO5n.
Set the active level width of the PWM pulse to CR5n, and the active level can be selected with bit 1 (TMC5n1)
of TMC5n.
The count clock can be selected with bits 0 to 2 (TCL5n0 to TCL5n2) of timer clock select register 5n (TCL5n).
Enable/disable for PWM output can be selected with bit 0 (TOE5n) of TMC5n.
Caution CR5n can be rewritten only once a cycle in PWM mode.
Remark
n = 0 to 2
(1) PWM output basic operation
[Setting]
<1>
<2>
<3>
<4>
<5>
Set the port latches (P33, P34, and P72) and port mode registers 3, 7 (PM33, PM34, and PM72) to 0.
Set the active level width with the 8-bit timer compare register (CR5n).
Select the count clock with timer clock select register 5n (TCL5n).
Set the active level with bit 1 (TMC5n1) of TMC5n.
The count operation starts when bit 7 (TCE5n) of TMC5n is set to 1.
Set TCE5n to 0 to stop the count operation.
[PWM output operation]
<1>
PWM output (output from TO5n) outputs an inactive level after the count operation starts until overflow is
generated.
<2>
When overflow is generated, the active level set in <1> of [Setting] is output.
The active level is output until CR5n matches the count value of 8-bit timer counter 5n (TM5n).
<3>
After CR5n matches the count value, PWM output outputs the inactive level again until overflow is
generated.
<4>
Operations <2> and <3> are repeated until the count operation stops.
<5>
When the count operation is stopped with TCE5n = 0, PWM output changes to the inactive level.
Remark
n = 0 to 2