View Single Post
Old 05-26-2009, 08:06 AM   #1434 (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 267 Times in 210 Posts
It shouldn't matter (assuming the existing code works). ORing is the same as adding if the relevant bits start at zero anyway. I was replicating the existing code a "bit" .
PHP Code:
void ReadTemperature(void) {...
    
ADMUX &= (128+64+32+16);    // = 11110000.  So, this sets MUX to 0000, and leaves the top 4 bits unchanged.
    
ADMUX++;        // This sets MUX to 0001, setting the A/D converter input to PIN 24, the temperature monitor.
...

void ReadThrottle(void) {...
    
ADMUX &= (128+64+32+16);
...

void ReadCurrent(void) {...
    
ADMUX &= (128+64+32+16);    // = 11110000.  So, this sets MUX to 0000, and leaves the top 4 bits unchanged.
    
ADMUX+=2;        // This sets MUX to 0002, setting the A/D converter input to PIN 25, the current monitor
... 
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 05-26-2009 at 08:21 AM..
  Reply With Quote