Page 1 of 1

PWM and Frequency setting

Posted: Fri Aug 19, 2016 1:27 pm
by TedO
Hi Guys

I have never worked with the PWM module before, am trying to get the frequency setting at 100Hz, have changed the clock frequency of the PIC to 100Hz but not sure if this is the correct way?? The help page does not describe the Period etc very well, very vague.

Thanks for assistance
Ted

Re: PWM and Frequency setting

Posted: Fri Aug 19, 2016 1:53 pm
by medelec35
Hi Ted,
Not a good idea to change the clock frequency to 100Hz as it will have a dramatic effect on any other components like LCD RS232 I2C etc.
100Hz is very low for a PWM signal.
The only way to set the 8bit or 10bit PWM to 100Hz is to reduce clock speed to 1MHz.
For PWM frequencies as low as 100Hz it may be better to use bit bang method.
There are numerous examples on these forums of bit bang PWM.
For example here.
If you get suck I can help you further.

Martin

Re: PWM and Frequency setting

Posted: Fri Aug 19, 2016 2:03 pm
by TedO
Hi Martin

Thank you for your help, as always it is greatly appreciated, will try your advice and play around with it.
Will let you know how I go.
Regards
Ted