Код
// Read the 8 most significant bits
// of the AD conversion result
unsigned char read_adc(unsigned char adc_input){
ADMUX=adc_input|ADC_VREF_TYPE;
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;}
while (1){....
ta++;if(ta==21)ta=0;
tempADC=(read_adc(0)/5);
tempADC1=tempADC+(read_adc(0)/5);
if(ta==20)temp=tempADC1/2;tempADC=0;tempADC1=0;
т.е. показывать на индикаторе среднее число из 20 вычислений,но все равно не так сглаженно получается.
// of the AD conversion result
unsigned char read_adc(unsigned char adc_input){
ADMUX=adc_input|ADC_VREF_TYPE;
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;}
while (1){....
ta++;if(ta==21)ta=0;
tempADC=(read_adc(0)/5);
tempADC1=tempADC+(read_adc(0)/5);
if(ta==20)temp=tempADC1/2;tempADC=0;tempADC1=0;