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 CCS Technical Support

Setting RTC

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



Joined: 27 Sep 2007
Posts: 5

View user's profile Send private message

Setting RTC
PostPosted: Thu Oct 04, 2007 7:19 am     Reply with quote

Hi

Having done endless searches, I have found lots of information on reading and writing to RTCs (In particular the DS1307 I'm using). Whilst this is good, I have found nothing on the subject of actually setting the RTC in the first place to the correct time/date.

I assume this has to have some sort of user interface, but I'm getting stuck at working out how to do this efficiently with appropriate error handling - for example setting incorrect number of days for given month).

Can anyone help me out ?

(I have several buttons and an LCD display available!)
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Thu Oct 04, 2007 8:29 am     Reply with quote

Yes. If you need to regularly set the RTC, you will need an 'external' interface to the world. It can be anything from a set of switches to toggle between fields and increase or decrease values. Or you can add a serial interface that will accept input for setting the RTC. Or, when I don't have an external interface I add a temporary set function to my firmware for one load. I time it so I power up the part at the precise time that will be set. (You've also got to ensure that you have your battery backup in place.)

Decide what your system will allow... simple push-buttons, serial interface, etc., and then it will be easy to help.

John

Here is a good example of a command parser:

http://www.ccsinfo.com/forum/viewtopic.php?t=28159&highlight=command+parser
TobyHarris



Joined: 27 Sep 2007
Posts: 5

View user's profile Send private message

PostPosted: Thu Oct 04, 2007 8:52 am     Reply with quote

Hi John

As stated there are a couple of push to make switches and a 16x2 LCD display. There is no external serial interface present, therefore my solution needs to be entirely on-board using the buttons and LCD.

My problem is how to form a nice user interface which takes into consideration that the user might set the day to 31 and then set the month to one which only has 30 days...
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