پاسخ : سوال در مورد LM35
این چرا خالیه؟
باید اینجوری باشه
کد:
data = read_adc();
باید اینجوری باشه
کد:
data = read_adc(1);
ADMUX = adc_input|(0xE0&0xFF);
#define ADC_VREF_TYPE 0xC0 unsigned int read_adc(unsigned char adc_input) { ADMUX=adc_input | (ADC_VREF_TYPE & 0xff); // Delay needed for the stabilization of the ADC input voltage delay_us(10); // Start the AD conversion ADCSRA|=0x40; // Wait for the AD conversion to complete while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; return ADCW; }
data=read_adc(1); data= data*.25; t1=data/10%10; t2=data%10;
1024*.25=256
1024*.25=256
دیدگاه