You're using an 'F87, I used an 'F628A. 15 I/O pins available for me, 2 used for 20Mhz crystal, 2 used for Serial I/O, PGM/MCLR tied as needed, 3 buttons and 6 LEDs (2 RGB), and one spare pin. I was able to do serial at 19,200 without a problem using the hardware module (datasheet says it's 1.7% high, but it worked). Used Timer0 kicking an overflow interrupt at 19.531khz, software PWM for each LED at 76.2Hz, 8 bit resolution. Could get a higher refresh rate at the expense of resolution. Once in a great while, I'd get a slight bit of one-time flicker if I was trying to receive serial data too fast or send it too fast, but that's completely up to the software driving it.
I think that 'looping' PWM will end up kicking your butt in the long run, but that's just me.
Time to learn how to use interrupts to your advantage!
Bookmarks