Page 1 of 1

DS1307 RTC Problem

Posted: Sun Jun 02, 2013 9:14 pm
by mervinm
Hi,

I connected up a DS1307 RTC to a 16F8ffA as per the following discussion thread:
viewtopic.php?f=29&t=8607&p=46788&hilit=rtc#p46788

I am managing to download the code to the 16F887A and I get the LCD displaying "DS1307 programmed", but when I do a read to obtain the date, I just get zero's displayed for the date. I am not sure if the DS1307 is actually being programmed. How can test if the pic is actually communicating with the DS1307.
DS1307 is connected to PORTC, LCD to PORTB. I am running the DS1307 RTC Programmer code by John, and using his read routine to read from the DS1307. I am also running the Keypad version of the code by Enamul and getting the same result.

I am using the DT-26 oscillator. Is this the correct one for the RTC? Can somebody perhaps suggest the correct oscillator to use (part number).

Thanks.

Re: DS1307 RTC Problem

Posted: Sun Jun 02, 2013 9:19 pm
by dazz
Hi
A quick way would be to connect an led to the sqw out pin on the 1307 and set it to work so you will see if its enabled, for the 1307 to keep time you need a back up battery as if theres not one there it will lose its settings, the crystal you have is fine

Regards
Dazz

Re: DS1307 RTC Problem

Posted: Tue Jun 04, 2013 7:55 pm
by mervinm
Hi Dazz,

Thanks for the response. I figured out what the problem was; I was using the home edition of Flowcode 5, so when I compiled the code, FC5 did not generate the C code for the I2C component. Okay, I feel like an idiot, because I spent a few hours trying to find out what was causing the problem!! I bought the professional version and everything worked perfectly after I downloaded to the chip.

I have decided to use the DS1305 instead of the DS1307, because it has two programmable alarms. I have picked up a small problem using SPI, so I will post another call for help!

Thanks
Mervin

Re: DS1307 RTC Problem

Posted: Tue Jun 04, 2013 8:18 pm
by dazz
Hi mervin

We've all been caught out for days at one time or another, glad you sorted it

Regards
Dazz