Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

RTC not changing time values.

$
0
0
Hello all!

I am using a pic 18f24j11, and I am trying to get the Real-Time clock going. I can't seem to however. Here is my code:

Code (Text):
  1.  
  2. char sec;
  3.  
  4. void main(){
  5.      EECON2 = 0x55;
  6.      EECON2 = 0xAA;
  7.  
  8.      RTCCFG.RTCEN = 1;
  9.      RTCCFG.RTCWREN = 1;
  10.      RTCCFG.RTCSYNC = 0;
  11.      RTCCFG.HALFSEC = 0;
  12.      RTCCFG.RTCOE = 1;
  13.      RTCCFG.RTCPTR0 = 0;
  14.      RTCCFG.RTCPTR1 = 0;
  15.  
  16.      RTCCAL = 0x00;
  17.  
  18.      ALRMCFG.ALRMEN = 0;
  19.  
  20.      TRISB = 0x00;
  21.      
  22.      RTCVALL = 0x05;
  23.      
  24.      do{
  25.         sec...
RTC not changing time values.

Viewing all articles
Browse latest Browse all 4923

Trending Articles