
CHAPTER 6 TIMER ARRAY UNIT TAUS
User’s Manual U19678EJ1V1UD
346
6.8.2 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 TDRn (master) + 1}
× Count clock period
Duty factor [%] = {Set value of TDRm (slave)}/{Set value of TDRn (master) + 1}
× 100
0% output:
Set value of TDRm (slave) = 0000H
100% output: Set value of TDRm (slave)
≥ {Set value of TDRn (master) + 1}
Remark
The duty factor exceeds 100% if the set value of TDRm (slave) > (set value of TDRn (master) + 1), it
summarizes to 100% output.
The master channel operates in interval timer mode. If the channel start trigger bit (TSn) of timer channel start
register 0 (TS0) is set to 1, an interrupt (INTTMn) is output, the value set to timer data register n (TDRn) is loaded to
timer counter register n (TCRn), and the counter counts down in synchronization with the count clock. When the
counter reaches 0000H, INTTMn is output, the value of the TDRn register is loaded again to the TCRn register, and
the counter counts down. This operation is repeated until the channel stop trigger bit (TTn) of timer channel stop
register 0 (TT0) is set to 1.
If two channels are used to output a PWM waveform, the period until the master channel counts down to 0000H is
the PWM output (TOm) cycle.
The slave channel operates in one-count mode. By using INTTMn from the master channel as a start trigger, the
TCRm register loads the value of the TDRm register and the counter counts down to 0000H. When the counter
reaches 0000H, it outputs INTTMm and waits until the next start trigger (INTTMn from the master channel) is
generated.
If two channels are used to output a PWM waveform, the period until the slave channel counts down to 0000H is
the PWM output (TOm) duty.
PWM output (TOm) goes to the active level one clock after the master channel generates INTTMn and goes to the
inactive level when the TCRm register of the slave channel becomes 0000H.
Caution
To rewrite both TDRn of the master channel and TDRm of the slave channel, a write access is
necessary two times. The timing at which the values of TDRn and TDRm are loaded to TCRn and
TCRm is upon occurrence of INTTMn of the master channel. Thus, when rewriting is performed
split before and after occurrence of INTTMn of the master channel, the TOm pin cannot output
the expected waveform. To rewrite both TDRn of the master and TDRm of the slave, therefore, be
sure to rewrite both the registers immediately after INTTMn is generated from the master
channel.
Remark
n = 00, 02, 04, 06, 08, 10 (78K0R/IB3: n = 02, 04, 06 and 10)
m = n + 1