selva murugesan
Advanced Member level 4
what is wrong with this following code? i am using 1Mhz clk
there is show no error.but i cant get output.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 void adc_init (void); int adc_read (unsigned char ch_select); void adc_init (void) { ADCSRA |= 0x83; } int adc_read (unsigned char ch_select) { int tenbit_value,adc_low; ADMUX |= ch_select; ADCSRA = ADCSRA | (1<<ADSC); // Start ADC conversion while(!(ADCSRA & (1<<ADIF))) // Wait for AD interrupt flag adc_low = ADCL; tenbit_value = (ADCH << 2 | adc_low>>6); ADCSRA.ADSC |= 0; return tenbit_value; }
there is show no error.but i cant get output.
Last edited by a moderator: