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

I can't get the time with internal RTCC with PIC18F66J94

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



Joined: 17 Feb 2015
Posts: 2

View user's profile Send private message

I can't get the time with internal RTCC with PIC18F66J94
PostPosted: Tue Jun 02, 2015 5:38 pm     Reply with quote

Hello, I'm using internal RTC in my pic18F66J94 but when i use rtc_read(&read_clock); i get the same data which i already configured the clock. I have a 32.768 KHz crystal in the SOSC pins RC0 and RC1, with 15pf ceramic capacitors. The Vbat pin has a 3v CR2032 Battery installed, but the internal RTC doesn't start.
Anybody can help me?

http://www.ccsinfo.com/forum/viewtopic.php?t=46528

CCS compiler is 5.009

This is the configuration fuses in main.h:
Code:

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES NOCKSNOFSM               //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES VREGSLEEP_SW             //Ultra low-power regulator is enabled
#FUSES DSWDTOSC_SOSC

#use delay(internal = 8000000)

And this is the code:
Code:

void main (){
   setup_lcd(LCD_DISABLED); 
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_4);         //131 ms overflow
    setup_rtc(RTC_ENABLE , 0);
    wizardTempTime.tm_year = 15;
    wizardTempTime.tm_mon = 6;
    wizardTempTime.tm_mday = 2;
    wizardTempTime.tm_wday = 2;
    wizardTempTime.tm_hour = 17;
    wizardTempTime.tm_min = 58;
    wizardTempTime.tm_sec = 2;
    rtc_write(&wizardTempTime);
 
   while(true){
       rtc_read(&read_clock);        //reads clock value from RTCC
            fprintf(UART1, "\r%02u/%02u/20%02u %02u:%02u:%02u \n\r",read_clock.tm_mon,read_clock.tm_mday,read_clock.tm_year,read_clock.tm_hour,read_clock.tm_min,read_clock.tm_sec);
            delay_ms(1000);
   }

 }
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