Public Documentation
  • Introduction
  • Getting started
    • Introduction
    • 1. Welcome Page
    • 2. Introduction (Beginner's Guide)
  • Portal Tools
    • Blocko
      • Ůvod do blocka
      • Flip-flop
      • REST-API bloček
    • Grid
      • Úvod do GRID
      • Základní Tlačítko (základy GRID)
      • vylepšený Přepínač (stylování a pokročilé možnosti GRID)
      • text generátor button (messeage type, two elements one widget)
      • graf (pokročilé funkce GRID)
      • Slider (User class v GRIDu)
      • Styly a jejich použití
  • Cloud
    • Cloud
    • Instancies
    • Rest-Api
  • General
    • What we plan
  • Hardware a programování
    • Úvod
      • Nahrání prvního programu
    • Konektivita
      • Specifikace zdroje internetu
      • GSM
      • 6LowPAN
      • Komunikace s portálem
      • Přepínání mezi servery
    • Hardware
      • Základní jednotky
        • IODAG3E
          • Rozhraní a periférie
          • Konektor X a Y
          • Napájení
          • Připojení zdroje k VBAT
          • Paměti
          • Technické specifikace
          • Schémata
        • IODAG3L
      • Rozšiřující moduly
        • GSM shield
        • LED shield
        • Relay shield
        • RFID shield
        • Ultrasonic shield
        • Meteo shield
        • Movement shield
        • PIR shield
        • RGB Displej shield
        • Serial shield
      • Ostatní
        • DevKitG3
          • Schéma
        • TK3G
          • Schéma
        • ZPPG3
          • Schéma
        • WEXP
    • Programování HW
      • Architektura FW
        • Aktualizace FW
        • Autobackup
      • Struktura programu
      • Byzance API
        • Vstupy a výstupy do Portálu
        • Callback Busy
        • Odložený restart
        • Callbacky připojení
        • Uživatelská makra
      • MBED API
        • Vstupy a výstupy
        • Komunikační rozhraní
        • Časování
        • RTOS
      • Knihovny
        • DHT
        • DS1820
        • Dali
        • EdgeStruct
        • I2CWrapper
        • Knock
        • MFRC522
        • MFRC522::MIFARE_Key
        • MPU9150
        • ms5637
        • OneWire
        • PCA9536
        • RGB_matrix
        • RollerDrive
        • SHT21
        • ST7565
        • Servo
        • TCA6424A
        • TLC59116
        • TripleSevenSeg
        • MFRC522::Uid
        • WS2812
        • WakeUp
      • Offline programování
        • Vlastní IDE
        • Upload kódu z GUI
        • Upload kódu z konzole
        • Upload kódu Drag&drop
    • Tutoriály
      • Datum a čas (RTC)
      • Komunikace po sériové lince (UART) s PC
        • Konfigurace sériové linky v PC
        • Programování sériové linky
      • Základní tutoriály
        • Digital Read
        • Analog Read/Write
        • PWM Fade
        • Timer/Ticker
        • State Change Detection
        • Ovládání LED modulu
        • BusOut
        • HC-SR04 Senzor
      • Pokročilé
    • Správa a diagnostika
      • Zdroj restartu
      • LED modul
      • Identifikace zařízení
      • Monitoring parametrů
      • Vytížení zařízení
      • Webové rozhraní
        • Základní přehled
        • Správce firmware
        • Vlákna
        • Definované vstupy
        • Konfigurace MQTT
        • Nastavení
      • Bootloader
        • Režimy bootloaderu
        • Command mód
        • Další vlastnosti bootloaderu
      • Webová konzole
      • Konfigurace zařízení
        • Confighash
      • Omezení konfigurace
        • Konfigurace
        • Binárky
        • Omezení MQTT
        • Lowpan
    • Knowledge base
      • Náhodná čísla
      • Watchdog
      • Paměť RAM
Powered by GitBook
On this page
  • Public Functions
  • Public Functions Documentation
  • function DS1820
  • function DS1820
  • function begin
  • function isPresent
  • function setResolution
  • function startConversion
  • function read
  • function read
  1. Hardware a programování
  2. Programování HW
  3. Knihovny

DS1820

PreviousDHTNextDali

Last updated 6 years ago

Driver to control 1-Wire temperature sensor.

Public Functions

Type

Name

bool

bool

void

void

float

uint8_t

Public Functions Documentation

function

DS1820::DS1820 (
    PinName pin
)

Constructs a generic sensor.

Note:

Parameters:

  • pin Name of data pin

Return value:

DS1820::DS1820 (
    char model,
    PinName pin
)

Constructs a specific model.

Note:

Parameters:

  • model One character model name: 'S', 's', 'B' or 'b' pin: Name of data pin

Return value:

bool DS1820::begin (
    void 
)

Note:

Parameters:

bool DS1820::isPresent ()

Note:

Parameters:

void DS1820::setResolution (
    uint8_t res
)

Sets temperature-to-digital conversion resolution.

Note:

The configuration register allows the user to set the resolution of the temperature-to-digital conversion to 9, 10, 11, or 12 bits. Defaults to 12-bit resolution for DS18B20. DS18S20 allows only 9-bit resolution.

Parameters:

  • res Resolution of the temperature-to-digital conversion in bits.

Return value:

void DS1820::startConversion (
    void 
)

Starts temperature conversion.

Note:

The time to complete the converion depends on the selected resolution: 9-bit resolution -> max conversion time = 93.75ms 10-bit resolution -> max conversion time = 187.5ms 11-bit resolution -> max conversion time = 375ms 12-bit resolution -> max conversion time = 750ms

Parameters:

float DS1820::read (
    void 
)

Reads temperature from the chip's Scratchpad.

Note:

Parameters:

uint8_t DS1820::read (
    float & temp
)

Reads temperature from chip's scratchpad.

Note:

Verifies data integrity by calculating cyclic redundancy check (CRC). If the calculated CRC dosn't match the one stored in chip's scratchpad register the temperature variable is not updated and CRC error code is returned.

Parameters:

  • temp The temperature variable to be updated by this routine. (It's passed as reference to floating point.)

Return value:

  • error code: 0 - no errors ('temp' contains the temperature measured) 1 - sensor not present ('temp' is not updated) 2 - CRC error ('temp' is not updated)

The documentation for this class was generated from the following file: D:/w/hw-libs/\_libs\_/libraries/DS1820.h

(PinName pin) Constructs a generic sensor.

(char model, PinName pin) Constructs a specific model.

(void) Detects and initializes the actual model.

() Informs about presence of a sensor.

(uint8_t res) Sets temperature-to-digital conversion resolution.

(void) Starts temperature conversion.

(void) Reads temperature from the chip's Scratchpad.

(float & temp) Reads temperature from chip's scratchpad.

must be called to detect and initialize the actual model

function

No need to call to detect and initialize the model

function

Detects and initializes the actual model.

function

Informs about presence of a sensor.

shall be called before using this function if a generic instance was created by the user. No need to call for a specific instance.

function

function

function

function

DS1820
DS1820
DS1820
DS1820
DS1820
begin()
DS1820
begin()
begin
isPresent
DS1820
DS1820
begin()
begin()
setResolution
startConversion
read
read
DS1820
DS1820
DS1820
DS1820
begin
DS1820
isPresent
setResolution
startConversion
read
read