
R01UH0336EJ0102 Rev.1.02
Page 828 of 1538
Jul 17, 2014
V850E2/PG4-L
Section 15 TSG2 (TSG20)
15.11.1
PWM Mode
Overview
A PWM signal is output at the TSG2nO1 to TSG2nO6 pins according to set
timing/clear timing of TSnCMP1 to TSnCMP12 registers with the PWM period
set in the TSnCMP0 register.
Prerequisites
• Set the set timing to the compare register with an even number:
TSnCMP2 (set timing of the TSG2nO1 output), TSnCMP4 (set timing of the
TSG2nO2 output), TSnCMP6 (set timing of the TSG2nO3 output),
TSnCMP8 (set timing of the TSG2nO4 output), TSnCMP10 (set timing of
the TSG2nO5 output) and TSnCMP12 (set timing of the TSG2nO6 output)
• Set the clear timing to the compare register with an odd number:
TSnCMP1 (clear timing of the TSG2nO1 output), TSnCMP3 (clear timing of
the TSG2nO2 output), TSnCMP5 (clear timing of the TSG2nO3 output),
TSnCMP7 (clear timing of the TSG2nO4 output), TSnCMP9 (clear timing of
the TSG2nO5 output) and TSnCMP11 (clear timing of the TSG2nO6 output)
Functional
description
Set the PWM period and set/clear timing of the TSG2nO1 to TSG2nO6
outputs. Set TSnTRG0.TSnTS = 1 to start the timer counter.
The TSG2nO1 to TSG2nO6 outputs are set to the inactive state at the same
time the counting begins. The outputs are set to the active state by the match
of the buffer registers TSnCMP2, TSnCMP4, TSnCMP6, TSnCMP8,
TSnCMP10, and TSnCMP12 with the 16-bit counter.
Next, the TSG2nO1 to TSG2nO6 outputs are set to the inactive state by the
match of the buffer registers TSnCMP1, TSnCMP3, TSnCMP5, TSnCMP7,
TSnCMP9, and TSnCMP11 with the 16-bit counter.
During counting, a compare match interrupt (INTTSG2nI00 to INTTSG2nI12)
is generated by the match of the buffer register TSnCMP0 to TSnCMP12 with
the 16-bit counter.
Caution
Reload is executed when writing to the TSnCMP1 register at
TSnCTL3.TSnRMC = 0. Therefore, even when it is needed to rewrite only the
value of the TSnCMP0 register, a write operation to the TSnCMP1 register is
necessary. When only the TSnCMP0 register is rewritten, reload is not done.
Note
The PWM mode is set when TSnCTL0.TSnMD1 and TSnMD0 = 00
B
.