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 support@ccsinfo.com

ds1302 and pic16f877 problem

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







ds1302 and pic16f877 problem
PostPosted: Mon Jan 30, 2006 5:01 am     Reply with quote

i want to use ds1302 with 16f877. i have a problem. I saw on Lcd all times

165/165/165
165:165:165

it doesn't change

my code is here, ı couldnt find the problem.



#include "C:\Program Files\PICC\rrr.h"
#include <math.h>
#include <stdlib.h>
#include<ds1302.c>
#include<LCD.c>
int n=0;
int day,mth,year,dow;
int hour,min,sec;
char address;
char data;
void main()
{

setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);

rtc_init();
lcd_init();
rtc_set_datetime(11,11,05,11,11,11);
while (1) {
lcd_putc('\f');
rtc_get_date( day, mth, year, dow);
rtc_get_time( hour, min, sec );
printf(lcd_putc,"%2u/%2u/%2u\n%2u:%2u:%2u",mth,day,year,hour,min,sec);
delay_ms(250);
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 01, 2006 2:29 pm     Reply with quote

Quote:
i want to use ds1302 with 16f877. i have a problem. I saw on Lcd all times
165/165/165
165:165:165

When an RTC chip gives you these types of values, it's typically
because you forgot to connect a 3v lithium battery to the Vbat pin.
See the following thread. The first person has the battery problem
and the 2nd person has a crystal problem. Check your board
for these problems:
http://www.ccsinfo.com/forum/viewtopic.php?t=19926
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