…neorzumím té obsluze…myslel jsem si, že by stačilo gettemp(1);//nebo 2/3
Každopádně to nejde použít!!
Takhle vypadá funkce pro zjištění teploty: (ty podfunkce jsou dost dlouhý…tak by to vypadalo asi dost katastrofálně + počet řádků by se ztrojnásobil…)
[code]
double ds18b20_gettemp() {
#define DS18B20_DQ PA0
uint8_t temperature_l;
uint8_t temperature_h;
double retd = 0;
#if DS18B20_STOPINTERRUPTONREAD == 1
cli();
#endif
ds18b20_reset(); //reset
ds18b20_writebyte(DS18B20_CMD_SKIPROM); //skip ROM
ds18b20_writebyte(DS18B20_CMD_CONVERTTEMP); //start temperature conversion
while(!ds18b20_readbit()); //wait until conversion is complete
ds18b20_reset(); //reset
ds18b20_writebyte(DS18B20_CMD_SKIPROM); //skip ROM
ds18b20_writebyte(DS18B20_CMD_RSCRATCHPAD); //read scratchpad
//read 2 byte from scratchpad
temperature_l = ds18b20_readbyte();
temperature_h = ds18b20_readbyte();
#if DS18B20_STOPINTERRUPTONREAD == 1
sei();
#endif
//convert the 12 bit value obtained
retd = ( ( temperature_h << 8 ) + temperature_l ) * 0.0625;
return retd;
}[/code]
Zbývá teda jenom druhá možnost…a té moc neorzumím