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

Can the DS1307 lose about 3 seconds in 18 hours?

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



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

Can the DS1307 lose about 3 seconds in 18 hours?
PostPosted: Sat Dec 19, 2009 12:56 am     Reply with quote

Hi all,

I made a alarm clock using ds1307. I am losing 3 seconds in 18 hours.
Is it something that happens ? If so what should I do to avoid this ?

Thanks and regards,
jaikumar.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Dec 19, 2009 2:27 am     Reply with quote

Describe your crystal circuit. Post the manufacturer and part number of
your crystal.
jaikumar



Joined: 15 Dec 2006
Posts: 109

View user's profile Send private message

Here is the info.
PostPosted: Sat Dec 19, 2009 4:52 am     Reply with quote

Crystal is directly connected between pin 1 & 2 of DS1307. No Caps used.
Crystal is close to DS1307.
Crystal Spec:

Frequency: 32.768Khz
Freq Stability: -0.034+/-0.006ppm
temp: -20 to 70 degC
Load Cap: 12.5pF
Make: CITIZEN AMERICA.

I am using the computer clock to measure.

Also let me know if the
ds1307_init() is required every time we power up, or only one time to set
via computer. Because i kept losing a second on power up every time.



Regards
Jai Kumar.


Last edited by jaikumar on Sat Dec 19, 2009 5:07 am; edited 3 times in total
asmallri



Joined: 12 Aug 2004
Posts: 1635
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: Can the DS1307 lose about 3 seconds in 18 hours?
PostPosted: Sat Dec 19, 2009 4:52 am     Reply with quote

jaikumar wrote:
Hi all,

I made a alarm clock using ds1307. I am losing 3 seconds in 18 hours.
Is it something that happens ? If so what should I do to avoid this ?

Thanks and regards,
jaikumar.


Not if the hardware is configured correctly. The uses a crystal with a 12.5pf load. You do not need to add capacitors as they are built in. Common mistakes when designing with the ds1307 are to use the wrong crystal or to add load capacitors that are not required.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Ttelmah
Guest







PostPosted: Sat Dec 19, 2009 11:13 am     Reply with quote

First, Double check your computer clock. Use one of the internet time servers, and reset this, before taking each reading. PC clocks are often _appalling_. Unfortunately, some software functions in the PC can interfere with the clocks, making things worse, and the crystals used are often very poor accuracy. So, start from an accurate source, before deciding there is a problem with the DS1307. It is common for PC clocks to be several minutes fast in a week. Have a look on the web, and you will find that the PC is not a good timekeeping reference.

Then, assuming there still is a problem, how is the PCB laid out round the crystal legs?. What is the PCB substrate, what clearances have been used etc. etc..
Your crystal 'looks right' for the chip (which is designed to work directly with crystals requiring 12.5pF loading capacitance). Your error, is 1:21600, or 46.3PPM, which is many times worse than you should be able to achieve...
Are you sure that your battery on the DS1307, is within the required voltage range?. There is a common problem, with people trying to use _rechargeable_ nominal 3v lithium cells which can give a voltage above 3.5v on charge....
The init code should not cause a time loss.

Best Wishes
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