View Single Post
Old 04-10-2009, 03:58 PM   #843 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Seattle, WA
Posts: 1,594

Michael's Electric Beetle - '71 Superbeetle 500000
Thanks: 62
Thanked 26 Times in 17 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!
__________________
As I watch the old man walk on the sidewalk below my window, I think "Some day old man, I will be like you. So why not give me your coat?" Then I go downstairs to get his coat, but he's gone. Hey, maybe he was Zorro.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
  Reply With Quote