void ADC_init(void)
ADMUX |= _BV(REFS0); ADCSRA |= _BV(ADEN) | _BV(ADATE) |_BV(ADPS1) |_BV(ADPS2)| _BV(ADPS0);
int ADC_get(uint8_t channel)
ADMUX = _BV(REFS0); ADMUX |= channel; ADCSRA |= _BV(ADSC); loop_until_bit_is_set(ADCSRA, ADIF); return ADC;
Aflare temperatura:
int temp; temp=(46*ADC_get(0))/10; temp=temp-2730; // autmatically reload page every minute: plen=fill_tcp_data_p(buf,0,PSTR("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nPragma: no-cache\r\nRefresh: 60\r\n\r\n")); plen=fill_tcp_data_p(buf,plen,PSTR("</h2>\n")); plen=fill_tcp_data_p(buf,plen,PSTR("<pre>\n")); plen=fill_tcp_data_p(buf,plen,PSTR("<h2>Temperatura in acest moment este:</h2> ")); itoa(temp,buffer,10); Point(buffer); plen=fill_tcp_data(buf,plen,buffer); plen=fill_tcp_data_p(buf,plen,PSTR("'C ")); plen=fill_tcp_data_p(buf,plen,PSTR("</pre>\n"));
Probleme intampinate:
LCD-ul a fost implementat pentru a ma ajuta la debugging si a-mi da seama mai usor unde intampineam probleme.
Proiect:homemonitoringsystem.zip
Datasheet LM335:http://www.datasheetcatalog.org/datasheet/nationalsemiconductor/DS005698.PDF
Datasheet Atmega16: http://elf.cs.pub.ro/pm/wiki/_media/doc2466.pdf