umity Guest
|
ds1302 and pic16f877 problem |
Posted: Mon Jan 30, 2006 5:01 am |
|
|
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);
}
} |
|