OneWire + DS18X20 Library
Basic functions for OneWire operations + specific DS18x20 operations
 All Functions Groups Pages
Macros | Functions
DS18X20 FUNCTIONS

Macros

#define ds18B20_convert_t(x)   ds18x20_convert_t(x)
 
#define ds18S20_convert_t(x)   ds18x20_convert_t(x)
 
#define ds18B20_read_scratchpad(x)   ds18x20_read_scratchpad(x)
 
#define ds18S20_read_scratchpad(x)   ds18x20_read_scratchpad(x)
 
#define ds18B20_copy_scratchpad(x)   ds18x20_copy_scratchpad(x);
 
#define ds18S20_copy_scratchpad(x)   ds18x20_copy_scratchpad(x);
 
#define ds18B20_recall_E2(x)   ds18x20_recall_E2(x)
 
#define ds18S20_recall_E2(x)   ds18x20_recall_E2(x)
 
#define ds18B20_read_power_supply(x)   ds18x20_read_power_supply(x)
 
#define ds18S20_read_power_supply(x)   ds18x20_read_power_supply(x)
 

Functions

void ds18x20_convert_t (uint8_t parasitic_power)
 start temperature conversion More...
 
uint8_t ds18B20_read_temp (int16_t *temperature)
 Read temperature from DS18B20 (9-12 bit resolution) More...
 
uint8_t ds18S20_read_temp (int16_t *temperature)
 Read temperature from DS18S20 (9 bit + enhanced resolution, effective 12 bits) More...
 
void ds18x20_read_scratchpad (uint8_t *buffer)
 Read complete scratchpad of DS18x20 (9 bytes) More...
 
void ds18S20_write_scratchpad (int8_t tl, int8_t th)
 write tl and th of DS18S20 More...
 
void ds18B20_write_scratchpad (int8_t tl, int8_t th, uint8_t adc_resolution)
 write tl, th and configuration of DS18B20 More...
 
void ds18x20_copy_scratchpad (uint8_t parasitic_power)
 copy scratchpad to EEPROM, busy waiting (10ms), More...
 
void ds18x20_recall_E2 (void)
 copy EEPROM to scratchpad, busy waiting (1ms) More...
 
uint8_t ds18x20_read_power_supply (void)
 read power supply More...
 

Detailed Description

standard functions

Function Documentation

void ds18x20_convert_t ( uint8_t  parasitic_power)

start temperature conversion

Parameters
parasitic_powerset true if device has parasitic power supply
Returns
none

Definition at line 25 of file ds18x20.cpp.

uint8_t ds18B20_read_temp ( int16_t *  temperature)

Read temperature from DS18B20 (9-12 bit resolution)

Parameters
*temperaturepointer to temperature variable in 1/10 C (fixed point)
Returns
error code
ONEWIRE_OK no error
ONEWIRE_CRC_ERROR CRC error when reading temperature

Definition at line 37 of file ds18x20.cpp.

uint8_t ds18S20_read_temp ( int16_t *  temperature)

Read temperature from DS18S20 (9 bit + enhanced resolution, effective 12 bits)

Parameters
*temperaturepointer to temperature variable in 1/10 C (fixed point)
Returns
error code
ONEWIRE_OK no error
ONEWIRE_CRC_ERROR CRC error when reading temperature

Definition at line 59 of file ds18x20.cpp.

void ds18x20_read_scratchpad ( uint8_t *  buffer)

Read complete scratchpad of DS18x20 (9 bytes)

Parameters
*bufferpointer to data array
Returns
none

Definition at line 80 of file ds18x20.cpp.

void ds18S20_write_scratchpad ( int8_t  tl,
int8_t  th 
)

write tl and th of DS18S20

Parameters
tllower temperature limit (1 C resolution)
thupper temperature limit (1 C resolution)
Returns
none

Definition at line 89 of file ds18x20.cpp.

void ds18B20_write_scratchpad ( int8_t  tl,
int8_t  th,
uint8_t  adc_resolution 
)

write tl, th and configuration of DS18B20

Parameters
tllower temperature limit (1 C resolution)
thupper temperature limit (1 C resolution)
adc_resolutionADC resolution in bits (9-12)
Returns
none

Definition at line 96 of file ds18x20.cpp.

void ds18x20_copy_scratchpad ( uint8_t  parasitic_power)

copy scratchpad to EEPROM, busy waiting (10ms),

parasitic power switching is completely handled inside the function, no need for further user action

Parameters
parasitic_powerset true if device has parasitic power supply
Returns
none

Definition at line 111 of file ds18x20.cpp.

void ds18x20_recall_E2 ( void  )

copy EEPROM to scratchpad, busy waiting (1ms)

Parameters
none
Returns
none

Definition at line 125 of file ds18x20.cpp.

uint8_t ds18x20_read_power_supply ( void  )

read power supply

Parameters
none
Returns
power mode
0: normal power
1: parasitic power

Definition at line 130 of file ds18x20.cpp.