View previous topic :: View next topic |
Author |
Message |
maxrate
Joined: 01 Jan 2007 Posts: 38 Location: Mississauga, Ontario, Canada
|
Embedded Serial Busses dev kit DS1305 |
Posted: Mon May 27, 2019 8:45 pm |
|
|
Hi folks,
I'm using the CCS Embedded Serial Busses dev kit to cut my teeth on the integrated DS1305 RTC clock part. Working thru the examples, things are going fairly well, but ran into something that's got me puzzled. Trouble is, I'm not sure where to start diagnosing further, could use some advice from users of the DS1305 part.
I can set the time/date, and read the correct time/date. The problem is when I power cycle the dev board; the clock survives but the date resets to Month 1, Day 1, year 00.
Anyone else encounter this? I've been reviewing the DS1305.c file, and nothing is evident (to me). I presume the chip will retain the date as well as the time (when set). There is a backup battery for the RTC chip.
I like to do my own homework and solve my own problems, but I'm struggling with this one. Any ideas would be appreciated.
Thank you! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Tue May 28, 2019 12:07 am |
|
|
You do realise, that the 'get_date' command, is separate from the 'get_time'
command?.
It's an oddity, but the command to 'set' the values, is rtc_set_datetime, which
does both the date and time, in one command, but when reading, there are
two separate commands, one reading the time only, and the other the date...
Sounds to me rather as if you are only reading the time. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9232 Location: Greensville,Ontario
|
|
Posted: Tue May 28, 2019 4:31 am |
|
|
I copied the DS1307 driver then modified the copy to have a 'get_datetime' function. As well I reordered the variables to yer,mth,day,dow,hrs,min,sec, which is far more logical to an old guy like me !
I understand the getting of only date or time info but really getting all only take a few more microseconds so might as well have a current data.
Jay |
|
|
maxrate
Joined: 01 Jan 2007 Posts: 38 Location: Mississauga, Ontario, Canada
|
|
Posted: Tue May 28, 2019 6:32 am |
|
|
Good morning fellas,
That was the problem. I was reading only the time. I suppose the date was being printed on the serial port because the variables were set by the clock set up questions when the PIC is first powered on. Reading the date independently was certainly required. I was too busy looking in the driver file for trouble and neglected to look at the main loop.
Using the demo code in the book, I figured everything was 100% and maybe this was some problem with the DS1305 chip itself. Lesson learned!
The clarity of thought you guys (temtronic and Ttelmah) have never ceases to impress me. It's a rainy day in Mississauga today, but I'm one happy camper. Many thanks as always. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9232 Location: Greensville,Ontario
|
|
Posted: Tue May 28, 2019 6:49 am |
|
|
yeah, raining here 40KM west of you...sigh.... I'd love 3 days in a row without rain ! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19529
|
|
Posted: Tue May 28, 2019 9:49 am |
|
|
Glad we hit the nail on the head (as opposed to our thumbs...). |
|
|
maxrate
Joined: 01 Jan 2007 Posts: 38 Location: Mississauga, Ontario, Canada
|
|
Posted: Tue May 28, 2019 9:50 am |
|
|
On to the next problem! Many thanks! |
|
|
|