1
\$\begingroup\$

I am using a PIC16F15345 which has 4 10-bit PWM modules. In order to minimize electromagnetic interference I tried to use the PWM-modules on different frequencies working simultaneously, but it did not work.

According to the data sheet (page 328) "each module has an independent selection of clock source."

However, the Timer2 is shared by all 4 modules and the PWM period value is stored in the T2PR (PR2) register. As the Timer2 require FOSC/4 as the clock source for PWM I don't see how I can vary the PWM period, via T2PR register, individually per PWM module.

In my trials, the PWM period changes for all 4 modules each time T2PR changes.

Any ideas how to do it or is it not possible?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Take a look at 16F1574 It has four 16-bit PWM in an otherwise similar chip. Ultimately, all four clock sources can be traced to a common source (Fosc perhaps). But their PWM signal edges can be made non-synchronous. Your PWM code would have to be re-written since 16F1574's PWM module is completely different, and very much more versatile. \$\endgroup\$
    – glen_geek
    Oct 14 '20 at 13:14
  • 1
    \$\begingroup\$ Many thanks glen_geek!! I will download the PIC16F1574 and look into it! \$\endgroup\$
    – GoranF
    Oct 14 '20 at 15:27
2
\$\begingroup\$

Thanks to glen_geek I have managed to conclude that the PIC16F15345 do not allow for different frequencies on different PWM-modules running in parallel. The PIC16F1574, which glen_geek refers to, can do this by varying phase and offset per PWM-module. Furthermore, the clock source/prescaler can be selected per PWM-module.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.