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

Another DS1307 driver
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
marko88



Joined: 22 Sep 2014
Posts: 2

View user's profile Send private message

PostPosted: Mon Sep 22, 2014 12:48 pm     Reply with quote

Hi guys, I have some problems with this rtc module. I'm using the Tiny RTC module and I use the code posted here. I split in 2 files, one ds1307.c and other for the main and my program. I already can change and put the data and read it correctly, the problem is not counting after that, it means, always is show the same data and hours. In main program basically I make how I see here, init_rtc, config_rtc, write rtc, in while(1) with delay_ms(1000) read_rtc and show. Could someone help me? I appreciate.

Best regards!
marko88



Joined: 22 Sep 2014
Posts: 2

View user's profile Send private message

PostPosted: Mon Sep 22, 2014 2:00 pm     Reply with quote

More fast I post it more fast I solved xD The problem was the crystal, some bad soldering in module. Anyway stay here the solution for who have similar problem.
esa



Joined: 31 Jan 2008
Posts: 19

View user's profile Send private message

PostPosted: Sat Jan 24, 2015 8:51 am     Reply with quote

I just try it 10 years later your first post and it works.

But, When I reset the the µP (16F877) the day is reset to '0'.

If I comment the line "ds1307_init();" then the day stay right after a Soft Reset.

Can you help please?

Thank
chacal



Joined: 25 Sep 2016
Posts: 1

View user's profile Send private message

PostPosted: Sun Sep 25, 2016 7:35 am     Reply with quote

Hello! Unfortunately don´t work for me. Looks my .h file:

#include <16F886.h>
#device adc=10


#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES PUT //Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOCPD //No EE protection
#FUSES NOBROWNOUT //No brownout reset
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOWRT //Program memory not write protected
#FUSES BORV40 //Brownout reset at 4.0V

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)
#include <ds1307.c>
esa



Joined: 31 Jan 2008
Posts: 19

View user's profile Send private message

PostPosted: Sun Sep 25, 2016 9:08 am     Reply with quote

In the source code, do you comment the line

#define RTC_SDA PIN_C4
#define RTC_SCL PIN_C3
#use i2c(master, sda=RTC_SDA, scl=RTC_SCL)

Are you sure I2C works for other devices?
I use soft I2C
#use i2c(Master,sda=PIN_C1,scl=PIN_C2,restart_wdt,force_sw)

If you buy the module on ebay, then it is maybe a hardware problem. I remember that I have to put a pull up resistor on SDA and SCL.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
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