Quote Originally Posted by Darrel Taylor View Post
I'd be interested to know how you could do that.
And since Malcolm was attempting to use MY software PWM routines based on interrupts, I guess you could say I'm familiar with them.

Let's see, 4 channels @ 3.9khz with 8-bit resolution.

That'll take (3900 *256) = 998,400 interrupts per second.
With a PIC running at 4mhz, it'll execute 1,000,000 intructions per second.
That leaves, 1.0016... instructions per interrupt.

You wouldn't have a code example for that would you?
<br>
Well, yes, I've seen your PWM routines, and fine routines they are, as are most of possibly 100% of the items you post...........ppppfffffffttttttt (that's me fizzling out)

AND I had a brain fart! I had a whole paragraph typed out explaining my position when I realized I forgot the final divide by 256 for the software PWM. Yep, 15.25hz is about the top for 4mhz. That is unless you start sacrificing resolution for speed...but it still doesn't get you up into the khz range, which is what I did to get a 4khz PWM signal in the blower motor project...then again, I only needed slow, fast and a few speeds in between for that one.