CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Embedded Serial Busses dev kit DS1305

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
maxrate



Joined: 01 Jan 2007
Posts: 34
Location: Mississauga, Ontario, Canada

View user's profile Send private message

Embedded Serial Busses dev kit DS1305
PostPosted: Mon May 27, 2019 8:45 pm     Reply with quote

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: 19234

View user's profile Send private message

PostPosted: Tue May 28, 2019 12:07 am     Reply with quote

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: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 28, 2019 4:31 am     Reply with quote

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: 34
Location: Mississauga, Ontario, Canada

View user's profile Send private message

PostPosted: Tue May 28, 2019 6:32 am     Reply with quote

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: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue May 28, 2019 6:49 am     Reply with quote

yeah, raining here 40KM west of you...sigh.... I'd love 3 days in a row without rain !
Ttelmah



Joined: 11 Mar 2010
Posts: 19234

View user's profile Send private message

PostPosted: Tue May 28, 2019 9:49 am     Reply with quote

Glad we hit the nail on the head (as opposed to our thumbs...). Smile
maxrate



Joined: 01 Jan 2007
Posts: 34
Location: Mississauga, Ontario, Canada

View user's profile Send private message

PostPosted: Tue May 28, 2019 9:50 am     Reply with quote

On to the next problem! Very Happy Many thanks!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group