- 打卡等级:初来乍到
- 打卡总天数:5
- 最近打卡:2025-05-04 16:43:17
金牌会员
- 积分
- 1347
|
发表于 2024-9-15 14:43:36
|
显示全部楼层
To modify frequency there are limited choices with PCA.
You can select size of PWM count for 6/7/8/10 bits, and use SysCLK divided by CMOD.CPS or clock PCA from Timer0.
If timer0 is set to reload mode that gives more choice on frequency, but it is still coarse at higher PWM frequencies.
eg if you have 24MHz and timer0 reload of 93, PCA 8 bit gives 1008.064516Hz PWM,
Timer0 reload of 92 gives 1019.021739 Hz PWM etc
Or you can vary SYSCLK to vary frequency, but that varies all MCU timing.
Different PWM modules in other STC MCU allow change of the TOP counter, so you can finer tune PWM frequency at the cost of some interaction with PWM set points.
eg a PWM with top choice of 1024/1023/1022 etc can output a 23437.5Hz PWM with 0.1% steps in Hz, but the % duty cycle needs to be adjusted.
|
|