![Cmsemicon BAT32G1 9 Series Скачать руководство пользователя страница 216](http://html1.mh-extra.com/html/cmsemicon/bat32g1-9-series/bat32g1-9-series_user-manual_2627609216.webp)
BAT32G1x9 user manual | Chapter 6 Universal timer unit Timer4/8
216 / 1149
Rev.1.02
6.9.2
Operates as a PWM function
Pairing 2 channels generates pulses of any period and duty cycle. The period and duty cycle of the output
pulse can be calculated using the following calculation equation:
Note: When the setpoint of TDRmp
(slave) > the setpoint
of
{TDRmn
(master)
+1}, the duty cycle exceeds
100%,
but it is
100%
output.
The master channel is used as an interval timer mode. If the channel start trigger bit (TSmn) of the timer
channel start register m(TSm) is placed "1", just output interrupt (INTTMmn), and then load the setpoint of the timer
data register mn (TDRmn) into the timer count register mn(TCRmn), and the count is decremented by the counting
clock. When the count reaches "0000H", the value of the TDRmn register is loaded into the TCRmn register again
after the intTMmn is output, and the count is decremented. This run is then repeated before the channel stop trigger
bit (TTmn) of the timer channel stop register m(TTm) is set to "1".
When used as a PWM function, the master channel counts down and counts as the PWM output (TOmp) cycle
during the period of counting up to "0000H". The slave channel is used as a single count pattern. Starting with the
INTMmn of the master channel, the value of the TDRmp register is loaded into the TCRmp register and counted
down until "0000H". When "0000H" is counted, INTMmp is output and waits for the next start to trigger (INTMmn of
the master channel).
When used as a PWM function, the slave channel counts down to the duty cycle of the PWM output (TOmp)
during the count until "0000H".
After generating INTMmn from the master channel and passing 1 clock, the PWM output (TOmp) becomes the
effective level, and the value of the TCRmp register in the slave channel is "0000H" becomes invalid.
Remark: To overwrite both the timer data register mn (TDRmn) of the master channel and the TDRmp register of the slave
channel, 2 write accesses are required. Because the values of the TDRmn registers and TDRmp registers are loaded
into the TCRmn registers and TCRmp registers when the master channel generates INTTMmn, Therefore, if you
rewrite it before and after the main control channel generates INTMmn, the TOmp pin cannot output the expected
waveform. Therefore, to rewrite both the master's TDRmn registers and the slave's TDRmp registers, the two
registers must be rewritten immediately after the master channel generates INTMmn.
Note: m: Unit number (m=0,1)n: Master channel number (n=0,
2, 4, 6).
p: Slave channel number (m=0Time:n
<
p≤3
,
m=1Time:n
<
p≤7)
Pulse period = {TDRmn (master control) of the set value + 1}
counting time Clock cycle
Duty cycle[%] = {TDRmp (dependent) of the set value}/{ The setting of TDRmn (master) is +1}
100
0% output
: TDRmp (dependent) set = 0 000H
100% output : TDRmp (dependent) set value
≥ the setting value of {TDRmn (master) +1}