View Single Post
Old 05-25-2009, 11:46 PM   #1428 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location: ÿ
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 269 Times in 212 Posts
Quote:
Originally Posted by MPaulHolmes View Post
Holy hanna montana that's fast!
Well, it is just scheduling the adc conversions and returning. The adc conversions happen in the hardware and the main loop will march forward till the adc complete interrupt says ("OK, I read that last channel").

The top of the main loop halts interrupts briefly, makes its own copies of the interesting variables, then re-enables interrupts. It can't use the global versions directly because they could get updated in the middle of a computation.

Max ADC rate is about 10khz, and there is only one channel at a time, so a lot of the timer1 calls will auto-return, but it is what it is and the bulk of the processing (32 bit math?) can happen in the main loop outside of interrupts.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote