View previous topic :: View next topic |
Author |
Message |
ashrafkhatri
Joined: 06 May 2008 Posts: 14
|
DS1302 time advancing |
Posted: Wed May 03, 2017 3:09 am |
|
|
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: 19552
|
|
Posted: Wed May 03, 2017 4:05 am |
|
|
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
|
|
Posted: Wed May 03, 2017 4:38 am |
|
|
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: 9246 Location: Greensville,Ontario
|
|
Posted: Wed May 03, 2017 5:08 am |
|
|
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: 9246 Location: Greensville,Ontario
|
|
Posted: Sat May 06, 2017 5:25 am |
|
|
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 |
|
|
|