Extended MaximInterface
Dependents: mbed_DS28EC20_GPIO
DS18B20 Class Reference
DS18B20 Programmable Resolution 1-Wire Digital Thermometer. More...
#include <DS18B20.hpp>
Public Types | |
typedef array_span < uint_least8_t, 8 > | Scratchpad |
Holds the contents of the device scratchpad. | |
Public Member Functions | |
MaximInterface_EXPORT error_code | initialize () |
Initializes the device for first time use. | |
MaximInterface_EXPORT error_code | writeScratchpad (uint_least8_t th, uint_least8_t tl, uint_least8_t res) |
Write Scratchpad Command. | |
MaximInterface_EXPORT error_code | readScratchpad (Scratchpad::span scratchpad) |
Read Scratchpad Command. | |
MaximInterface_EXPORT error_code | copyScratchpad () |
Copy Scratchpad Command. | |
MaximInterface_EXPORT error_code | readPowerSupply (bool &localPower) |
Read Power Supply command. | |
MaximInterface_EXPORT error_code | convertTemperature () |
Convert Temperature Command. | |
MaximInterface_EXPORT error_code | recallEeprom () |
Recall Command. |
Detailed Description
DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements and has an alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor. In addition, the DS18B20 can derive power directly from the data line ("parasite power"), eliminating the need for an external power supply.
Definition at line 52 of file DS18B20.hpp.
Member Typedef Documentation
typedef array_span<uint_least8_t, 8> Scratchpad |
Holds the contents of the device scratchpad.
Definition at line 62 of file DS18B20.hpp.
Member Function Documentation
error_code convertTemperature | ( | ) |
Convert Temperature Command.
This command begins a temperature conversion.
Definition at line 130 of file DS18B20.cpp.
error_code copyScratchpad | ( | ) |
Copy Scratchpad Command.
This command copies from the scratchpad into the EEPROM of the DS18B20, storing the temperature trigger bytes and resolution in nonvolatile memory.
Definition at line 101 of file DS18B20.cpp.
error_code initialize | ( | ) |
Initializes the device for first time use.
Definition at line 44 of file DS18B20.cpp.
error_code readPowerSupply | ( | bool & | localPower ) |
Read Power Supply command.
This command determines if the DS18B20 is parasite powered or has a local supply
- Parameters:
-
[out] localPower True if the device is powered by a local power supply, or false if the device is parasitically powered.
Definition at line 88 of file DS18B20.cpp.
error_code readScratchpad | ( | Scratchpad::span | scratchpad ) |
Read Scratchpad Command.
- Parameters:
-
[out] scratchpad Contents of scratchpad.
Definition at line 62 of file DS18B20.cpp.
error_code recallEeprom | ( | ) |
Recall Command.
This command recalls the temperature trigger values and resolution stored in EEPROM to the scratchpad.
Definition at line 178 of file DS18B20.cpp.
error_code writeScratchpad | ( | uint_least8_t | th, |
uint_least8_t | tl, | ||
uint_least8_t | res | ||
) |
Write Scratchpad Command.
If the result of a temperature measurement is higher than TH or lower than TL, an alarm flag inside the device is set. This flag is updated with every temperature measurement. As long as the alarm flag is set, the DS1920 will respond to the alarm search command.
- Parameters:
-
[in] th 8-bit upper temperature threshold, MSB indicates sign. [in] tl 8-bit lower temperature threshold, LSB indicates sign. [in] res Resolution of the DS18B20.
Definition at line 49 of file DS18B20.cpp.
Generated on Tue Jul 12 2022 23:29:45 by 1.7.2