Hi, guys,
I know this sounds lazy, but still please, who ever share his macros is greatly appreciated!
Hi, guys,
I know this sounds lazy, but still please, who ever share his macros is greatly appreciated!
What macros? I can give you some working ADC C code if you like?
great!!! please
// select channel 1 and AVcc reference ADMUX = (1<<REFS0) + 1; // 0xD5, precale = /32 = 250Khz, enable and start ADCSRA = (1<< ADEN) | (1<<ADSC) | (1<<ADIF) | (5<<ADPS0); // Gonna wait for first conversion to complete but discard (as it's usually inaccuarate) do { // keep waiting } while((ADCSRA & (1 << ADSC))); // Wait for A/D conversion to finish // Then start the REAL conversion we're interested in.... ADCSRA |= (1 << ADSC); // start another conversion (discard the first reading) do { // keep waiting } while((ADCSRA & (1 << ADSC))); // Wait for A/D conversion to finish adc_val = ADC;
thanks