Hi John, As far as I know there are no libraries in jal for 'software pwm'. There are however libraries up to CCP9, which suggests there are PICs with a lot of PWM pins. But that doesn't help if you already selected your target pic...
At one time, I experimented with software pwm, called from a fixed ISR. The basic approach is to have a timer incremented at a fixed interval, say 2 kHz, from 0 to 15. This will give you a pwm frequency of 2kHz/16= 125 Hz and a resolution of 16 steps (4 bits). This basically points out the limitation of this approach: low resolution and low frequency. If this is a problem depend on the application. For my application (robot motor control) it was, so I abandoned it. It is possible to increase the frequency for many of the values using the Bresenham algorithm. On average, this will be much better. However, on the extreme, the performance will be similar to the previous method. An approach similar to the servo library is more complex but provides higher frequency and resolution at lower cpu load. What you basically do is set the timer to interrupt you when the next event (line toggle) is due. The servo lib has the advantage that a servo pulse has only up to 12.5% duty cycle, so 8 pulses can put consecutive in one cycle. If all 4 signals can have the full duty cycle range, you have to consider them simultaneously. Hope this helps a bit. If not, please share some details about your application and it's requirements in terms of resolution and frequency. Regards, Joep -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
