Go Down

Topic: DS1307 Real time clock on breadboard (Read 50 times) previous topic - next topic

alm7100

Shiwa, i think the year is only one byte like RTC.set(DS1307_YR,13); = 2013; You also need to set them in order like

Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0x00);
Wire.send(decToBcd(second));    // 0 to bit 7 starts the clock
Wire.send(decToBcd(minute));
Wire.send(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                  // bit 6 (also need to change readDateDs1307)
Wire.send(decToBcd(dayOfWeek));
Wire.send(decToBcd(dayOfMonth));
Wire.send(decToBcd(month));
Wire.send(decToBcd(year));
Wire.endTransmission();

Shiwa

alm 7100 thank you, I will try, if I have some time

GordonEndersby


Sorry, I hadnt seen the updates added to my original post.
I hadnt tried anything higher than 2010 on my setup.

Gordon

Shiwa

I used the next instructions:

 RTC.stop();
 RTC.set(DS1307_SEC,0);
 RTC.set(DS1307_MIN,03);
 RTC.set(DS1307_HR,21);
 RTC.set(DS1307_DOW,7);
 RTC.set(DS1307_DATE,1);
 RTC.set(DS1307_MTH,5);
 RTC.set(DS1307_YR,10);
 RTC.start();

it works fine   ;D , tried again today to be sure..

----------->  BUT if I change :

 RTC.stop();
 RTC.set(DS1307_SEC,0);
 RTC.set(DS1307_MIN,03);
 RTC.set(DS1307_HR,21);
 RTC.set(DS1307_DOW,7);
 RTC.set(DS1307_DATE,1);
 RTC.set(DS1307_MTH,5);
 RTC.set(DS1307_YR,13);   //<--------------- 13 !!
 RTC.start();

I see on the display the year 2000 !!! not 2013... >:(

Perhaps this sort of high level instructions does not work all the way ?

Jeremy1998

#19
Jul 25, 2010, 04:09 am Last Edit: Jul 25, 2010, 04:14 am by Jeremy1998 Reason: 1
From the retail boards that I've seen, there is normally a capacitor (Looks to be 0.1uF.), and two resistors (On the Ladyada version they are 2.2K). What does this do?

From what I understand the resistors are in line with the serial clock and serial data. I also understand that the cap is for power smoothing? I don't know if it's on the battery line, or the regurlar supply... Can someone please confirm or correct this?

EDIT: From what I understand from the datasheet, the resistors are pull up resistors that go from VCC (+5V) to the serial data and the serial clock pins.

Go Up