Operation Of Plural Channels Of Timer Array Unit; Operation As Pwm Function - NEC 78K0R/KE3 User Manual

16-bit single-chip microcontrollers
Table of Contents

Advertisement

6.8 Operation of Plural Channels of Timer Array Unit

6.8.1 Operation as PWM function

Two channels can be used as a set to generate a pulse of any period and duty factor.
The period and duty factor of the output pulse can be calculated by the following expressions.
Pulse period = {Set value of TDR0n (master) + 1} × Count clock period
Duty factor [%] = {Set value of TDR0m (slave)}/{Set value of TDR0n (master) + 1} × 100
0% output:
Set value of TDR0m (slave) = 0000H
100% output: Set value of TDR0m (slave) ≥ {Set value of TDR0n (master) + 1}
Remark
The duty factor exceeds 100% if the set value of TDR0m (slave) > (set value of TDR0n (master) + 1),
it summarizes to 100% output.
The master channel operates in the interval timer mode and counts the periods. When the channel start trigger
(TS0n) is set to 1, INTTM0n is output.
synchronization with the count clock. When TCR0n = 0000H, INTTM0n is output. TCR0n loads the value of TDR0n
again. After that, it continues the similar operation.
TCR0m of a slave channel operates in one-count mode, counts the duty factor, and outputs a PWM waveform from
the TO0m pin. TCR0m of the slave channel loads the value of TDR0m, using INTTM0n of the master channel as a
start trigger, and stops counting until the next start trigger (INTTM0n of the master channel) is input.
The output level of TO0m becomes active one count clock after generation of INTTM0n from the master channel,
and inactive when TCR0m = 0000H.
Caution To rewrite both TDR0n of the master channel and TDR0m of the slave channel, a write access is
necessary two times. The timing at which the values of TDR0n and TDR0m are loaded to TCR0n
and TRC0m is upon occurrence of INTTM0n of the master channel. Thus, when rewriting is
performed split before and after occurrence of INTTM0n of the master channel, the TO0m pin
cannot output the expected waveform. To rewrite both TDR0n of the master and TDR0m of the
slave, therefore, be sure to rewrite both the registers immediately after INTTM0n is generated
from the master channel.
Remark
n = 0, 2, 4
m = n + 1
240
CHAPTER 6 TIMER ARRAY UNIT
TCR0n counts down starting from the loaded value of TDR0n, in
User's Manual U17854EJ9V0UD

Advertisement

Table of Contents
loading

Table of Contents