ZS1BFE
Member level 1
- Joined
- Nov 17, 2007
- Messages
- 40
- Helped
- 1
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Cape Town South Africa
- Activity points
- 1,612
I cannot manage to get the info I need from the DS1302 datasheet ?? Not so clear for novices>
I use the driver included in PCW PIC C to work my RTC.
32,768mhz x-tal
no pull ups & no caps on X-tal
DS1302.c from driver library
I can read the sec & min, correctly, BUT nothing of the other VARs from the DS1302 is correct.
To confirm what I read from Ds1302 , I have written the time(hour,day,mth,etc) to Port C. The values displayed on Port C is not correct ,the hours count up within 3or 4 counts and end up with all 8 bits high.
Some things thast are not so clear from the library:
Does the DS1302 driver use
12hr or 24hr mode?
Burst mode read & write ?
It is configured to use Port A0, A1 ,A2
Is it possible to move this to port C3 , C4, C5 ?
In the code , I declare all time / date variables as “int”
I can post my code here, but not sure if I can just paste into this message??
Thx for great forum.
- - - Updated - - -
relevant part of my code.
THX
I use the driver included in PCW PIC C to work my RTC.
32,768mhz x-tal
no pull ups & no caps on X-tal
DS1302.c from driver library
I can read the sec & min, correctly, BUT nothing of the other VARs from the DS1302 is correct.
To confirm what I read from Ds1302 , I have written the time(hour,day,mth,etc) to Port C. The values displayed on Port C is not correct ,the hours count up within 3or 4 counts and end up with all 8 bits high.
Some things thast are not so clear from the library:
Does the DS1302 driver use
12hr or 24hr mode?
Burst mode read & write ?
It is configured to use Port A0, A1 ,A2
Is it possible to move this to port C3 , C4, C5 ?
In the code , I declare all time / date variables as “int”
I can post my code here, but not sure if I can just paste into this message??
Thx for great forum.
- - - Updated - - -
relevant part of my code.
Code:
#fuses NOLVP
#include <DS1302.C>
#include <LCD.C>
void main() {
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_spi(FALSE);
setup_psp(PSP_DISABLED);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
rtc_init();
lcd_init();
rtc_set_datetime(8,9,19,0,4,30);
while(1)
{
rtc_get_time(hour,min,sec); // rtc_get_time(hr,min,sec)
rtc_get_date(day,mth,year,dow) ;
output_c(hour);
}
THX