DS1307 lib

Hi,

I am using DS1307 mini board to keep date and time and display it on my LCD screen.

Yesterday, after many reboots of arduino board, the date and time were correct. Then arduino board power off... sleeping.

Today, I power on my arduino+LCD+DS1307 mountage. All data from DS1307 are correct out of "DAY OF WEEK".

RTC.get(DS1307_DOW, false) returns me 7 and I attempt for 0 to 6 int value.

Is anyone has had the same problem ?

Thank you

How is the library determining the day of week?

If it is getting it from the DS1307 0x03 register, you should know that the DS1307 counts from 1 through 7, not zero through 6. I mean, the chip doesn't actually calculate the day of the week, it simply counts from the value that you give it. Maybe you should set the day accordingly, using and interpreting values 1-7 instead of 0-6.

Where did you get the library?

Regards,

Dave

I know that I have to set time date and DOW and yesterday it was working well.

I have got the lib from here http://code.google.com/p/ds1307/downloads/detail?name=DS1307.rar&can=2&q=

Code:

RTC.get(DS1307_DOW, false)

returns me 7 and I attempt for 0 to 6 int value.

maybe a simple %7 helps?

No I think davekw7x got the problem.

I had badly set the DOW and then interpreted value from 0 to 6.

So today it returns me 7 'cause of badly set and I displayed "bad day".

Si I have set DOW to 1 and change my array of String

            String days[8]={ "Jour NaN", "Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi","Dimanche" };

            return days[RTC.get(DS1307_DOW, false)];

I will try again:

The day-of-week register in the DS1307 counts from 1 through 7. It doesn't know anything about Sunday, Monday, etc. It's just a counter that is incremented every day at midnight.

If you want the first day of the week to be Sunday and today is Sunday, set the day-of-week to the value 1. If today is Monday, set the day-of-week to the value 2, etc. Then, every time you read the day of week from the DS1307, 1 ==> Sunday 2 ==> Monday . . . 7 ==> Saturday

That's the way that many of my U.S. friends work calendars.

For many of my European friends:

If you want the first day of the week to be Monday and today is Monday, you set day-of-week register to the value 1.

Then when you read the day-of-week register on the DS1307 1 ==> Monday 2 ==> Tuesday . . . 7 ==> Sunday

Regards,

Dave

I had understood that's why I said

 have set DOW to 1 and change my array of String

and I will see tomorrow if it is ok

Thanks a lot