Hi Guys,
I want to use the 1-Wire Temperature Sensor DS18B20 from Maxim but i have problem with using its internal EEPROM.
I downloaded the DallasTemperature.h library that is using the OneWire.h library. My problem is, that i want to store a SensorNumber into the LowerTemperature Register.
As far i understood the datasheet, this should be one of the three registers that are stored into the nonvolatile EEPROM, but as soon I disconnect my sensors, the register is empty.
I also tried to recall the data from the EEOROM by using these lines:
_wire->reset();
_wire->select(deviceAddress);
_wire->write(RECALLSCRATCH);
_wire->reset();
but even if I do so, the Scratchpad stays empty.
Does anybody know how to store and load data with this device?
Thanks in advance for your help!
Short Update:
it seems that the Recalling-step is done during every power up of the chip. In that case there must be something wrong with the storing part..
I took the code for that as it was (from the Library)
// writes device's scratch pad
void DallasTemperature::writeScratchPad(uint8_t* deviceAddress, const uint8_t* scratchPad)
{
_wire->reset();
_wire->select(deviceAddress);
_wire->write(WRITESCRATCH);
_wire->write(scratchPad[HIGH_ALARM_TEMP]); // high alarm temp
_wire->write(scratchPad[LOW_ALARM_TEMP]); // low alarm temp
// DS18S20 does not use the configuration register
if (deviceAddress[0] != DS18S20MODEL) _wire->write(scratchPad[CONFIGURATION]); // configuration
_wire->reset();
// save the newly written values to eeprom
_wire->write(COPYSCRATCH, parasite);
if (parasite) delay(10); // 10ms delay
_wire->reset();
}
btw: I am not using the Parasite Powered Mode, Vcc and Gnd are connected to the Arduino's power supply.