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

RTCC 18F26J11

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



Joined: 17 Jun 2009
Posts: 4
Location: POLAND

View user's profile Send private message

RTCC 18F26J11
PostPosted: Wed Jun 17, 2009 3:19 am     Reply with quote

Hi,

I have a problem with starting hardware of RTC clock. Anyone have the demonstration program? Please help. I apologise for my English Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 17, 2009 2:05 pm     Reply with quote

I don't want to write a driver for you, but the built-in RTCC does require
an unlock procedure to allow writing to the RTCC registers. The PIC
data sheet gives an ASM routine to do this. Here is the unlock routine
written in CCS:
Code:
#include <18F26J11.h>
#fuses HS,NOWDT 
#use delay(clock=20000000)

#byte EECON2 = 0xFA7
#byte RTCCFG = 0xF3F

void RTCC_unlock(void)
{
#asm ASIS
movlb 0x0F
movlw 0x55
movwf EECON2
movlw 0xAA
movwf EECON2
bsf RTCCFG,5
#endasm
}

//==================================
void main()
{

RTCC_unlock();  // Allow writing to RTCC registers


while(1);
}
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