
Originally Posted by
HenrikOlsson
It's not 100% clear what it is you want to do but I THINK that it's not the PWM frequency you want slower (especially NOT a period of 3-4 seconds because then the LED WILL "blink" and not dim/fade) - it's the time between updating the duty cycle you want to change to increase/decrease the total time it takes for the LED to fade. Again, that's what I THINK you mean - which may be wrong of course.
If you really DO mean you want a PWM period in the region of several seconds then, to be practical, I think you need to do the PWM "manually" using something like a 100Hz interrupt in the background.
Finally, using HPWM like you're doing isn't ideal because it actually "restarts" the CCP module each time the command executes and this creates "glitches" in the outout, This may or may not matter in this case but be aware of it, Another drawback is that it only gives you 8 bit of resolution which can be on the low side for nice smooth LED dimming, especially at the lower end. Again, may or may ot matter.
/Henrik.
Bookmarks