The frequency of PWM events is controlled by the
time-base period register (EPWM_TBPRD) and the mode of the time-base counter. Figure 12-179 shows the period (Tpwm) and frequency (Fpwm) relationships
for the up-count, down-count, and up-down-count time-base counter modes when the
period is set to 4 (EPWM_TBPRD[15-0] TBPRD = 0x4). The time increment for each step
is defined by the time-base clock (TBCLK) which is a prescaled version of the system
clock (FICLK).
The time-base counter has three modes of operation
selected by the time-base control register (EPWM_TBCTL):
- Up-Down-Count Mode: In
up-down-count mode, the time-base counter starts from zero and increments
until the period (TBPRD) value is reached. When the period value is reached,
the time-base counter then decrements until it reaches zero. At this point
the counter repeats the pattern and begins to increment.
- Up-Count Mode: In this
mode, the time-base counter starts from zero and increments until it reaches
the value in the period register (TBPRD). When the period value is reached,
the time-base counter resets to zero and begins to increment once
again.
- Down-Count Mode: In
down-count mode, the time-base counter starts from the period (TBPRD) value
and decrements until it reaches zero. When it reaches zero, the time-base
counter is reset back to the period value and it repeats this pattern.