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

DS1302 time advancing

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



Joined: 06 May 2008
Posts: 14

View user's profile Send private message

DS1302 time advancing
PostPosted: Wed May 03, 2017 3:09 am     Reply with quote

Dear Friends;
I am using DS1302 for clock and calender.
Everything is working except some time advancement after couple of days.
Like 1 minute in 1week.
What should i do?
I have read some of the articles on it which says that it is because of poor crystal.
how could i improve the situation with an ease.
Thanks.
Ttelmah



Joined: 11 Mar 2010
Posts: 19262

View user's profile Send private message

PostPosted: Wed May 03, 2017 4:05 am     Reply with quote

It could be the crystal, but it could also be board layout, capacitance etc..
Do you have the correct loading capacitance on your crystal?. The chip is designed for a crystal with a specified load capacitance of 6pF. Is the crystal you have specified for this capacitance?.

Common problems are digital lines crossing the clock lines (pickup), which then adds extra clock pulses....

The chip manufacturers give very detail advice notes on layout, including a picture of the recommended tracks, and a ground plane below the crystal, and a guard ring around the pins. This is to stop such problems. How is your circuit laid out?.

A well chosen crystal, should give a few seconds a day reliably. A minute a weeks is about 1 in 10000. A reasonably good crystal should get perhaps 5* better than this.
ashrafkhatri



Joined: 06 May 2008
Posts: 14

View user's profile Send private message

PostPosted: Wed May 03, 2017 4:38 am     Reply with quote

Thanks for your suggestions.
There is nothing mentioned on the crystal about loading capacitance. it is blanked as i got it from the market. So do not know anything about it.

I will check my layout later in the evening.

If it will not work then what will be the best equivalent to this ds1302. I mean no more code work will be required.

or suggest me any other accurate IC for this task which will be simple in coding using our ccs compiler.

Thanks
temtronic



Joined: 01 Jul 2010
Posts: 9135
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed May 03, 2017 5:08 am     Reply with quote

There is a SW RTC program in the 'code library' here that is accurate BUT the PIC must have power 24/7. That might be an option for you.
There are several RTC modules for sale, most with the DS1307 and battery,some with EEPROM as well, They are premade, cheap, easy to use. This may work for you.
As Mr. T points out , there are several factors that can cause your problem. Depending on what the project is it might be better to fix your current hardware?

Jay
temtronic



Joined: 01 Jul 2010
Posts: 9135
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat May 06, 2017 5:25 am     Reply with quote

Some oher points about upgrading to the ds1307.
1) It has more battery backed RAM than the 1302, great for storing data.
2) It has a 'programmable square wave' output. I use this as a 1Hz interrupt for a main() 'clock' or 'tick'.
3) For less than $2, you can get it, xtal, rs, bat holder on a PCB ! I can't buy all the parts for that !!

If you're into 'projects', buy in qty x5, x10 and have on hand.

Jay
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