Re: HPWM/HPWM2/HPWM3 hardware PWM modules
Posted: Fri Nov 17, 2023 12:37 pm
And thanks for that! I hadn't noticed the two register writes so I've modified the files to account for it.I just thought i would report it in case anyone else has this problem.
The registers are double-buffered, but I think one of the issues is that it can take several cycles to perform the duty cycle programming,
and if you get a timer rollover (TMRIF) during that you could end up with partial data. This is alluded to in the "Setup for PWM Operation" section of the CCP...
Step 6 shows syncing the update to right after a TMRIF occurs. In any case, you now have an #option to select whether you want that to occur or not.In order to send a complete duty cycle and period on the first PWM
output, the above steps must be included in the setup sequence. If it is not critical to
start with a complete PWM signal on the first output, then step 6 may be ignored.
New files will be included in the next update (due Real Soon Now).
Right now I'm working on a similar version for devices with the 16-bit PWM module. They have their own dedicated timers (and a lot more features). Each module has two outputs so you can end up with 4-8 PWM outputs and still have all the timers and CCP modules available too.