View Single Post
Old 04-10-2009, 04:58 PM   #843 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,362
Thanked 1,202 Times in 765 Posts
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!
__________________
kits and boards
  Reply With Quote