mpc82g516a Megawin Technology, mpc82g516a Datasheet - Page 72

no-image

mpc82g516a

Manufacturer Part Number
mpc82g516a
Description
8-bit Microcontroller
Manufacturer
Megawin Technology
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
mpc82g516aE
Manufacturer:
MEGAWIN
Quantity:
1 200
Part Number:
mpc82g516aF
Manufacturer:
MEGAWIN
Quantity:
20 000
14.4.4 PWM Mode
All of the PCA modules can be used as PWM outputs. The frequency of the output depends on the clock source
for the PCA timer. All of the modules will have the same frequency of output because they all share the PCA
timer.
th
The duty cycle of each module is determined by the module’s capture register CCAPnL and the extended 9
bit,
ECAPnL. When the 9-bit value of { 0, [CL] } is less than the 9-bit value of { ECAPnL, [CCAPnL] } the output will
be low, and if equal to or greater than the output will be high.
When CL overflows from 0xFF to 0x00, { ECAPnL, [CCAPnL] } is reloaded with the value of { ECAPnH,
[CCAPnH] }. This allows updating the PWM without glitches. The PWMn and ECOMn bits in the module’s
CCAPMn register must be set to enable the PWM mode.
Using the 9-bit comparison, the duty cycle of the output can be improved to really start from 0%, and up to 100%.
The formula for the duty cycle is:
Duty Cycle = 1 – { ECAPnH, [CCAPnH] } / 256.
Where, [CCAPnH] is the 8-bit value of the CCAPnH register, and ECAPnH (bit-1 in the PCAPWMn register) is 1-
bit value. So, { ECAPnH, [CCAPnH] } forms a 9-bit value for the 9-bit comparator.
For examples,
a. If ECAPnH=0 & CCAPnH=0x00 (i.e., 0x000), the duty cycle is 100%.
b. If ECAPnH=0 & CCAPnH=0x40 (i.e., 0x040) the duty cycle is 75%.
c. If ECAPnH=0 & CCAPnH=0xC0 (i.e., 0x0C0), the duty cycle is 25%.
d. If ECAPnH=1 & CCAPnH=0x00 (i.e., 0x100), the duty cycle is 0%.
Figure 14-7. PCA PWM Mode
MPC82G516A Data Sheet
72
MEGAWIN

Related parts for mpc82g516a