PDA

View Full Version : HPWM Question



manwolf
- 21st July 2008, 16:03
I am using HPWM to run CCP1 and can't find the answer in the ugly green book. If I change the freq. do I need to reset the PWM or does the command handle that?

Also if I decide to use use Darrel's SPWM how would I go about changing the freq real time. I am thinking that setting SPWM_FREQ might do the trick, but got to late last night to test.

markedwards
- 21st July 2008, 18:36
After you initialize your PWM hardware and just change your PWM speed on the fly.
0 or 255 is your on or off setting and 1 to 254 is your variable speed.

for fanspeed=0 to 255 step 25
hpwm 1,fanspeed,20000 ' PWM Fan Duty Cycle @ 20,000 Hz
PAUSE 7 ' Delay speed ramp up
next

Raflex
- 22nd July 2008, 08:12
I am using HPWM to run CCP1 and can't find the answer in the ugly green book. If I change the freq. do I need to reset the PWM or does the command handle that?

Also if I decide to use use Darrel's SPWM how would I go about changing the freq real time. I am thinking that setting SPWM_FREQ might do the trick, but got to late last night to test.

Interesting question. I can't find anything about it. However, i think that you can change the freq at any time without reset the pwm or change duty cycle. With hpwm command seems to work