Jump to content

jimk3038

Members
  • Content Count

    6
  • Joined

  • Last visited


Reputation Activity

  1. Like
    jimk3038 got a reaction from OzGrant in [Energia Library] OneWire DS18B20 (430 & Stellaris)   
    Grant,
     
    Thanks for a great library - saved me a bunch of time. 
     
    I added the following function so now I can read temperatures from multiple sensors on the same wire.  Seems "GetData" and "GetData10" functions are designed to read from a single sensor on the bus.  WIth multiple sensors, all the sensors try to respond and step on each other.  The function "GetNodeData" fixes that.
     
    Thanks again,
    Jim
    int32_t DS18B20::GetNodeData( uint8_t rom[8] ) {     uint8_t i;     uint16_t temp;     reset();     write_byte(0x55);            // Choose ROM     for ( i = 0; i < 8; i++ ) write_byte(rom[i]);     //write_byte(0xcc); // skip ROM command     write_byte(0x44); // convert T command     OW_HI     delay(750);        // had incorrectly used delayMicroseconds()     reset();     write_byte(0x55);            // Choose ROM     for ( i = 0; i < 8; i++ ) write_byte(rom[i]);     //write_byte(0xcc); // skip ROM command     write_byte(0xbe); // read scratchpad command     temp = ReadDS1820();     int16_t stemp = (int16_t)temp;     return((int32_t)stemp*625/1000); }
×
×
  • Create New...