Hi,
I'm new to the world of Arduino and struggling to get my iButton RTC up and running. The iButton is a DS1904 - 1 wire interface with xtal on board.
I wrongly assumed it would be as simple as building a base from some existing 1wire examples, for the last few nights I've been pulling my hair out!
I can search the bus and get the 8 byte device address.
From looking at the datasheet I need to send a bus reset, send 0xCC (to skip ROM CRC check) then send 0x66 to read the clock then read back the clock data.
So I've built the following code:
byte ibutton[8] = {0x24, 0x35, 0x61, 0x33, 0x00, 0x00, 0x00, 0x01};
ds.reset(); // bus master sends reset
ds.select(ibutton); // select scanned device addr
ds.write(0xCC); // skip rom CCh
delay(1000);
ds.write(0x66); // read clock 66h
for (byte i=0;i<32;i++) { //get data
data = ds.read();
_ Serial.print (data*, HEX); // debug*_
};
And this is where I get a bit stuck!
The debug print just throws back FF FF FF FF etc...
It did dawn on me that I probably need to turn on the internal oscillator and set the clock to '0' - but I'm a bit sketchy on how to push that to the iButton.
Apologies for my newbie-ness but I'd rather work at this that take the easy option and buy a prebuilt board from sparkfun etc!
Any tips would be greatly appreciated.