BAT32G1x9 user manual | Chapter 8 Timer B
285 / 1149
Rev.1.02
8.4.4 PWM mode
PWM mode pairing uses TBGRA registers and TBGRB registers to output the PWM waveform from the
TBIO0 output pin. For output pins set to PWM mode, the output setting of the TBIOR register is invalid. Set the
"H" level output timing of the PWM waveform to the TBGRA register and the "H" of the PWM waveform to the
TBGRB register L" level output timing.
The source can be cleared by setting the comparison match of the TBGRA register or the TBGRB
register to the counter of the TB register, and the output is 0 to 100% from the TBIO0 pin PWM waveform for
duty cycle.
The specifications of the PWM mode and the combination of PWM output pins and registers are shown
in Table 8-11 and Table 8-12, respectively.
When the setting values of the TBGRA registers and the TBGRB registers are the same, the output
values remain the same even if a comparison match occurs.
Table 8-11
Specifications for PWM mode
project
specification
Count the sources
f
CLK
, f
CLK
/2, f
CLK
/4, f
CLK
/8, f
CLK
/32
TBCLK0
,
an external input signal from the TBCLK1 pin (valid edges are selected
programmatically
).
count
Increment the count
PWM waveform
• Set the "H" level output timing of the PWM waveform to the TBGRA registers.
• Set the "L" level output timing of the PWM waveform to the TBGRB registers.
Count start criteria
Write "1" (start counting) to the TBSTART bit of the TBBR register.
Count stop conditions
Write "0" (stop count) to the TBSTART bit of the TBMR register.
Timing of the generation of
interrupt requests
• Comparison matching (the contents of the TB register and the TBGRj register are the
same).
• Overflow of TB registers
TBIO0 pin function
PWM output
TBIO1 pin function
I/O port
TBCLK0 pin and
Features of the TBCLK1
pin
I/O port or external clock input
Read timer
If you read the TB register, you can read the count value.
Write timer
Can write TB registers.
Select Features
• Timing overflow of TB registers at
"0000H" or comparison matching of
TBGRj registers
•Buffer operation (see "8.4.1(2) Buffer Operation").
Remark
j=A, B
Table 8-12 PWM output pin and register combination
Output pins
"H" level output
"L" level output
TBIO0
TBGRA
TBGRB
TBIO1
Used as an I/O
port.