
AT32F413
Series Reference Manual
2022.06.27
Page 189
Rev 2.00
PWM mode:
Set CxOCTRL=3’b110/111 to enable PWM mode. Each channel can be
independently configured to output one PWM signal. In this case, the period of the output signal
is configured by the TMRx_PR register, and the duty cycle by the CxDT register. The counter
value is compared with the value of the TMRx_CxDT register, and the corresponding level signal
is sent according to the counting direction. For more information on PWM mode A/B, refer to the
description of the CxOCTRL[2: 0] bit. In up/down counting mode, the OWCDIR bit is used to
indicate the counting direction.
Forced output mode:
Set CxOCTRL=3’b100/101 to enable forced output mode. In this case,
the CxORAW is forced to be the programmed level, irrespective of the counter value. Despite
this, the channel flag bit and DMA request still depend on the compare result.
Output compare mode:
Set CxOCTRL=3’b001/010/011 to enable output compare mode. In this
case, when the counter value matches the value of the CxDT register, the CxORAW is forced
high, low or toggling.
One-pulse mode
:
This is a particular case of PWM mode. Set OCMEN=1 to enable one-pulse
mode. In this mode, the comparison match is performed in the current counting period. The
TMREN bit is cleared as soon as the current counting is completed. Therefore, only one pulse is
output. When configured as in upcounting mode, the configureation must follow the rule:
CVAL<CxDT≤PR; in downcounting mode, CVAL>CxDT is required.
Fast output mode:
Set CxOIEN=1 to enable this mode. If enabled, the CxORAW signal will not
change when the counter value matches the CxDT, but at the beginning of the current counting
period. In other words, the comparison result is advanced, so the comparison result between the
counter value and the TMRx_CxDT register will determine the level of CxORAW in advance.
gives an example of output compare mode (toggle) with C1DT=0x3. When the counter
value is equal to 0x3, C1OUT toggles.
gives an example of the combination between upcounting mode and PWM mode A. The
output signal behaves when PR=0x32 but CxDT is configured with a different value.
gives an example of the combination between up/down counting mode and PWM mode
A. The output signal behaves when PR=0x32 but CxDT is configured with a different value.
gives an example of the combination between upcounting mode and one-pulse PWM
mode B. The counter only counts only one cycle, and the output signal sents only one pulse.
Figure 14-16
C1ORAW toggles when counter value matches the C1DT value
0
1
2
3
...
31
32
0
1
2
3
...
31
32
0
1
2
3
COUNTER
31
32
0
1
...
PR[15:0]
C1ORAW
TMR_CLK
0
DIV[15:0]
32
011
C1OCTRL
[2
:
0]
3
C1DT[15
:
0]