8-Bit Pwm Output Operation (Timers 50 To 52) - NEC mPD178054 Series User Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

6.4.4 8-bit PWM output operation (timers 50 to 52)

The 8-bit timer/event counter can be used for PWM output when bit 6 (TMC5n6) of 8-bit timer mode control register
5n (TMC5n) is set to 1.
A pulse with a duty factor determined by the value set in 8-bit compare register 5n (CR5n) is output from TO5n.
Set the active level width of the PWM pulse to CR5n. The active level is selected by bit 1 (TMC5n) of TMC5n.
The count clock can be selected by bits 0 to 2 (TCL5n0 to TCL5n2) of timer clock select register n (TCL5n).
PWM output can be enabled or disabled by bit 0 (TOE5n) of TMC5n.
Caution The value of CR5n can be rewritten only once in one cycle in the PWM mode.
Remark n = 0 to 2
(1) Basic operation of PWM output
[Setting]
<1> Set port latches (P130 and P131) to 0.
<2> Select the active level width using the 8-bit compare register (CR5n).
<3> Select the count clock by using timer clock select register 5n (TCL5n).
<4> Select the active level using bit 1 (TMC5n1) of TMC5n.
<5> When bit 7 (TCE5n) of TMC5n is set to 1, the count operation is started.
To stop the count operation, reset TCE5n to 0.
[Operation of PWM output]
<1> When the count operation is started, the PWM output (output from TO5n) remains inactive until an
overflow occurs.
<2> When an overflow occurs, the active level set in step <1> above is output. This active level is output
until the value of CR5n matches the count value of 8-bit timer counter 5n (TM5n).
<3> The PWM output remains inactive after CR5n and the count value of TM5n match, until an overflow
occurs again.
<4> After that, <2> and <3> are repeated until the count operation is stopped.
<5> When the count operation is stopped because TCE5n is cleared to 0, PWM output becomes inactive.
Remark n = 0 to 2
CHAPTER 6 8-BIT TIMER/EVENT COUNTERS 50 TO 53
User's Manual U15104EJ2V0UD
111

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mpd178053Mpd178054Mpd178f054

Table of Contents