PWM, a few questions (PIC)

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Hello and thanks always.

Some time ago, I finished and you helped me finishing a project dealing with PWM.

Now I would like to ask something related to this.

We all know the theory of PWM, that through changing the duty cycle we can provide something akin a analog value through only digital outputs. For example I changed the brightness of a LED by connecting it to a digital pin outputing PWM and controlling its duty cycle. So far so good

But what happens if I change the other parameter: the period of the PWM signal??? What effect will it have on the load??

----------------------------------

(I ask this because I was using the internal oscillator with Fosc = 1MHz . But now I am going to use a crystal and through several postscalers the Fosc=48MHz.

Now, PWM Period= [(PR2+1)].4.Tosc.(Tmr2prescale) so PWM is gonna change too...
 

ErnieM

Joined Apr 24, 2011
8,377
As long as it is still "fast enough" there is no change.

As illustration, you PWM a LED to change the brightness, but if you go too slow you loose the illusion of constantly on and just get a blinkie light.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
As long as it is still "fast enough" there is no change.

As illustration, you PWM a LED to change the brightness, but if you go too slow you loose the illusion of constantly on and just get a blinkie light.
What if I get "too fast"?

(I am going from 1MHz to 16 or 48MHz).
 

AllVol

Joined Nov 22, 2005
55
Don't mean to sound flippant or impertinent, Kansi, but try it and see for yourself. Answering "what if" questions by trial and error is a good way to learn, especially with low voltage and micro projects.
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Don't mean to sound flippant or impertinent, Kansi, but try it and see for yourself. Answering "what if" questions by trial and error is a good way to learn, especially with low voltage and micro projects.
Well yes I will but I dont want to burn or explote anything....
Take into account I am a software guy... this hardware world scares me :D (half joking)
Anyway I found a way to reduce the frequency by software and I am going to try it and see thanks
 

Thread Starter

KansaiRobot

Joined Jan 15, 2010
324
Well I ve tried it and it seems everything is ok. Obviously watching it with an oscilloscope the period is decreased from 1024μs to 21μs but the LED strip seems to work so far...
This increase in frequency won't increase the temperature in the PIC or the transistor, will it??

Thanks for all the help
 
Top