[SOLVED] 18B20 timing problem

Ah, found some of my code for driving this chip - you should be able to use start_conversion() and read_conversion_result() separately to drive the DS18B20 asynchronously. You might want to suggest to the DallasTemperature library maintainer to add asynchronous conversion...

#include "Wire.h"
#include "OneWire.h"

#define DS18B20_PIN 8

OneWire ds(DS18B20_PIN) ;
 
byte addr[8];

void setup_tempsense ()
{
  
  if (!ds.search (addr))
  {
    Serial.println("No more addresses.") ;
    ds.reset_search () ;
    delay (250) ;
    return ;
  }
  
  Serial.print ("R=") ;
  for (byte i = 0 ; i < 8 ; i++)
  {
    Serial.print (addr[i], HEX) ;
    Serial.print (" ") ;
  }
  Serial.println () ;
  long unique = 0L ;
  for (byte i = 6 ; i >= 1 ; i--)
  {
    unique = (unique << 8) | addr [i] ;
  }
  Serial.print ("Unique=") ; Serial.println (unique, HEX) ;
    
  if (OneWire::crc8 (addr, 7) != addr[7])
  {
    Serial.println ("CRC is not valid!") ;
    return ;
  }
  if (addr[0] != 0x28)
  {
    Serial.println ("Device is not a DS18B20 family device.") ;
    return ;
  }
 
 int temp = read_temp () ;
 Serial.print (((float) temp) * 0.0625) ;
 Serial.println ("C") ;

}

int start_conversion ()
{
  // The DallasTemperature library can do all this work for you!

  ds.reset () ;
  ds.select (addr) ;
  ds.write (0x44) ;         // start conversion, with parasite power on at the end
}


int read_conversion_result ()
{
  byte present = ds.reset () ;
  ds.select (addr) ;    
  ds.write (0xBE) ;         // Read Scratchpad

  byte data[12];
  for (byte i = 0 ; i < 9 ; i++)           // we need 9 bytes
  {
    data[i] = ds.read();
  }
  int temp = (data [1] << 8) | data[0] ;
  return temp ;
}

int read_temp ()
{
  start_conversion () ;
  delay (800) ;     // maybe 750ms is enough, play safe
  return read_conversion_result () ;
}


void setup ()
{
  Serial.begin (57600) ;
  setup_tempsense () ;
}



void loop ()
{
  float degC = (float) read_temp () ;
  degC *= 0.0625 ;
  Serial.println (degC) ;
  delay (2000) ;
}