Hi Bert.
The point that confussed me more was that the chip was not set by me. It was set by Maxim or another person far far away from me in a different time zone, before winter time.
As you can see by the attached picture above, it has 0-1 seconds difference from my PC! Amazing. There must be a trick.
I found this C program but could not understand what really does.
Code:
void loop(void) {
byte i;
byte present = 0;
byte data[8];
byte addr[8];
uint32_t timestamp;
int seconds = 0;
if ( !ds.search(addr)) {
//Serial.print("No more addresses found.\n");
ds.reset_search();
delay(500); // for readability
return;
}
present = ds.reset();
ds.select(addr);
ds.write(0x66,1); // read RTC
for ( i = 0; i < 5; i++) {
data[i] = ds.read();
}
timestamp = data[1];
timestamp = timestamp << 8;
timestamp |= data[2];
timestamp = timestamp << 8;
timestamp |= data[3];
timestamp = timestamp << 8;
timestamp |= data[4];
Serial.println(timestamp);
delay(1000);
}
Ioannis
Bookmarks