/******** read temp *************/ u16 getTemp(){ u8 LSB,MSB; u16 temp; DS1B20CT(); DS1B20ReadCmd(); LSB = DS18B20Read(); MSB = DS18B20Read(); temp = ((int)MSB << 8) + LSB; return temp; }
void loop() { DS18B20_Temperature t; if (DS18B20Read(ONEWIREBUS, SKIPROM, RES12BIT, &t)) CDCprintf("%d.%d°C \r", t.integer, t.fraction); Delayms(5000); }