-
Notifications
You must be signed in to change notification settings - Fork 8
ds18b20
The DS18B20 is a 1-Wire digital temperature sensor from Maxim IC.
The sensor reports degrees C with 9 to 12-bit precision from -55C to 125C (+/- 0.5C).
Each sensor has a unique 64-Bit Serial number etched into it. This allows for a number of sensors to be used on one data bus. This sensor is used in many data-logging and temperature control projects.
Reading the temperature from a DS18B20 takes up to 750ms(max).
To use the DS18B20 driver the following is required to added to the Great Cow BASIC source file.
#include <DS18B20.h>
Note the Great Cow BASIC commands do not work with the older DS1820 or DS18S20 as they have a different internal resolution.
These commands are not designed to be used with parasitically powered DS18B20 sensors.
Command | Usage | Returns |
---|---|---|
ReadDigitalTemp |
Returns two global variables. As follows:
|
Byte variables: String variable: |
ReadTemp |
The temperature is read back in whole degree steps, and the sensor operates from -55 to + 125 degrees Celsius.;  Note that bit 7 is 0 for positive temperature values and 1 for negative values (ie negative values will appear as 128 + numeric value). |
Word variable via the ReadTemp() function |
ReadTemp12 |
The temperature is read back as the raw 12 bit data into a word variable (0.0625 degree resolution).;  The user must interpret the data through mathematical manipulation. See the DS18B20 datasheet for more information on the 12 bit temperature/data information construct. |
Word variable via the ReadTemp12() function |
For more help, see ReadDigitalTemp, ReadTemp or ReadTemp12