Nothing, because the HPWM won't go that low in frequency. Instead, one would use the Compare part of the CCPx module(i.e. the hardware PWM).
Haven't used the comparator this way personally. Set up Timer1 using an oscillator and prescaler that meets your needs per http://sourceforge.net/forum/forum.php?thread_id=2061852&forum_id=579125
Presumably, the setting and clearing of the CCP1 pin is kept track of in the interrupt routine by writing to the CCP1CON register per the data sheet. Also you would need to preload the TMR1H and TMR1L registers again to match your calculated frequency per the example.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I implemented a 30 Hz PWM using an interrrupt with the PIC12 series chip. The advantage is other things can be done, instead of being blocked by a software PWM. Getting the interrrupt to work properly on some PIC's has a couple issues, depending on the PIC, that are not handled by GCBasic.
In your interrrupt routine, just toggle the output bit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A little off topic (sorry) but to the person who implemented an interrupt PWM would you be willing to share the code. I really need a PWM routine that doesn't hold up the program, but can also run on a PIC without a hardware PWM
Cheers!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
what changes do I need to make to the pwm.h file to get the hardware pwm to operate in hz instead of khz, ex: 10-20 hz
Nothing, because the HPWM won't go that low in frequency. Instead, one would use the Compare part of the CCPx module(i.e. the hardware PWM).
Haven't used the comparator this way personally. Set up Timer1 using an oscillator and prescaler that meets your needs per http://sourceforge.net/forum/forum.php?thread_id=2061852&forum_id=579125
Presumably, the setting and clearing of the CCP1 pin is kept track of in the interrupt routine by writing to the CCP1CON register per the data sheet. Also you would need to preload the TMR1H and TMR1L registers again to match your calculated frequency per the example.
can I run the soft pwm as slow as 10 hz and if so how?
I implemented a 30 Hz PWM using an interrrupt with the PIC12 series chip. The advantage is other things can be done, instead of being blocked by a software PWM. Getting the interrrupt to work properly on some PIC's has a couple issues, depending on the PIC, that are not handled by GCBasic.
In your interrrupt routine, just toggle the output bit.
A little off topic (sorry) but to the person who implemented an interrupt PWM would you be willing to share the code. I really need a PWM routine that doesn't hold up the program, but can also run on a PIC without a hardware PWM
Cheers!
See the contributors sections for an example interrupt based PWM