Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with clock in DS1337 and 16F877a circuit

Status
Not open for further replies.

kandy71

Newbie level 4
Joined
Apr 8, 2007
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Hi,
I using the DS1337 with the DS32KHZ connected with the 16F877a, however, the clock is loosing 1second every minutes. I cannot understand why.
I did something wrong? I can calibrate the clock?

Thank you
 

ds1337.h

You have not really given us a lot to go on, it could be a software issue or hardware issue, I had the same problem sometime agobut mine was between1-8 minutes and found it was a software issuse (bug) correct it and it worked ok

what language are you usinf ASM picbaisc ?

wizpic
 

code pic16f ds1337

Hi,
thank you for your answer
I used CCS with the driver for the ds1307
 

ds1307 16f877a

Sorry if I post again. But anyone knows how to solve this ?
 

Re: DS1337 and 16F877a

This is my code

Code:
#include <16F877A.h>
#device *=16
#device ICD=TRUE
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES WRT_50%                  //Lower half of Program Memory is Write Protected

#use delay(clock=18432000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#ifndef DS1337_SDA
#define DS1337_SDA  PIN_C4
#define DS1337_SCL  PIN_C3
#endif

#use i2c(master, sda=DS1337_SDA, scl=DS1337_SCL)
#include <LCD.C>
#include "ds1337.h"



// Main Program
void main(void)
{
   date_time_t dt;
   ds1337_init();
   dt.month   = 12;    // December
   dt.day     = 31;    // 31
   dt.year    = 06;    // 2006
   dt.hours   = 23;    // 23 hours (11pm in 24-hour time)
   dt.minutes = 59;    // 59 minutes 
   dt.seconds = 50;    // 50 seconds
   ds1337_set_datetime(&dt);
      
   DS1337_read_datetime(&dt);
   
   lcd_init();
   printf("Start\n\r"); 
   
   
   while(true)
   {
      delay_ms(300);
      ds1337_read_datetime(&dt);
      printf(lcd_putc,"\f\%02d/\%02d/\%02d\n",dt.day,dt.month,dt.year);
      printf(lcd_putc,"\%02d:\%02d:\%02d", dt.hours,dt.minutes,dt.seconds); 
   }
}


And this is the ds1337.h

https://www.ccsinfo.com/forum/viewtopic.php?p=69975
 

Re: DS1337 and 16F877a

Any idea?
 

Re: DS1337 and 16F877a

Any idea?
dt.month = 12; // December
dt.date = 31, //DAY MONTH
dt.day = 1; // DAY OF THE WEEK
dt.year = 14; // 2006
dt.hours = 23; // 23 hours (11pm in 24-hour time)
dt.minutes = 59; // 59 minutes
dt.seconds = 50; // 50 seconds
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top