I changed from Fast PWM mode to Phase correct PWM mode, which will have a maximum frequency of 8 KHz at 8 MHz, but... The 16.000 MHz crystals are on their way from China via air mail right as we speak (type). That will allow for a current sample rate of 16 KHz at 16 MHz clock frequency.
I was using the wrong ISR before. Now, I'm using the one that gets called at the start of each new rising edge (16000 rising edges per second), do a tiny itsy bitsy delay (which puts me away from the rising edge), which the ugly, yeller, monkeyturd compiler was optimizing away!!! until I made my delay variable
"volatile int m"
instead of
"int m", which now allows me to turn up the optimizing all the way and is giving me faster code, so I can fit all the stuff I need to inside that interrupt, with plenty of time to spare before the next rising edge.
Phew!
|