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

Built-in RTCC with dsPIC33 and PCD compiler

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



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

Built-in RTCC with dsPIC33 and PCD compiler
PostPosted: Sat Nov 13, 2010 4:38 pm     Reply with quote

I have been trying to get the internal RTCC functions to compile with the version 4.114 PCD compiler without success. In the June 2010 reference manual (page 82) is a section describing the RTCC function but when I tried to compile the simple code, it doesn't appear to recognize the setup_rtc() command. My complete test program is as follows:

Code:

#include <33fj128gp706.h>
#include <time.h>

#fuses HS
#fuses NOWDT
#fuses NODEBUG
#fuses PR_PLL

// ---- system and I/O specifics ----
#use delay(clock=80000000)
#use rs232(baud=38400, UART2)

#word CLKDIV = getenv("sfr:CLKDIV")
#bit PLLPOST0 = CLKDIV.6
#bit PLLPOST1 = CLKDIV.7
#word PLLFBD = getenv("sfr:PLLFBD")
#word OSCCON = getenv("sfr:OSCCON")
#bit LOCK = OSCCON.5

time_t my_RTCC; // time/date struct for reading/writing internal RTCC

void main()
{
   setup_adc_ports(NO_ANALOGS);
   setup_adc_ports2(NO_ANALOGS);
   
   // ---- set up the PLL for 80.000MHz (40 MIPS) operation ----
   CLKDIV = 1;    // N1 : PLLPRE
   PLLPOST0 = 0;  // N2 : PLLPOST
   PLLPOST1 = 0;
   PLLFBD = 38;   // M : PLLDIV (M = PLLFBD + 2 : 38 + 2 = 40)
   
   while(!LOCK)   // wait for lock
     ;
   
   delay_ms(10);
   
   setup_rtc(RTC_ENABLE | RTC_OUTPUT_SECONDS, 0x00);

   my_RTCC.tm_year = 0x08; //init date and time
   my_RTCC.tm_mon = 0x01;
   my_RTCC.tm_mday = 0x01;
   my_RTCC.tm_wday = 0x02;
   my_RTCC.tm_hour = 0x0C;
   my_RTCC.tm_min = 0x00;
   my_RTCC.tm_sec = 0x00;

   rtc_write(&my_RTCC); //update internal RTCC with date and time
   
   delay_ms(100);
   
   while(TRUE)
   {

   }
}


When I tried to compile this I get the following error:
Error 12 "dsp_rtc_test.c" Line 58[13,14]: Unidentified Identifier -- setup_rtc

and some other errors, which state Error 57, Expecting a structure/union.

It also has an Error 12 for the unidentified identifier for rtc_write.

I have had the compiler configuration successfully working when creating a different application for the dsPIC33FJ128GP716 chip on the CCS DSP Analog Development Board.

Is there something else I have to do with the compiler configuration to get the compiler to recognize the built-in RTC functions?

From what I can tell, the external 32.768KHz crystal is to be tied to pins 47 and 48 of the dsPIC33FJ128GP706 64-pin package for operation of the internal RTCC function? These are the SOSCO and SOSCI pins.

Any help would be much appreciated.

Dave
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Nov 14, 2010 9:04 am     Reply with quote

I'm not sure, if the rtcc built-in function are correctly implemented for those dsPIC33 chips, that have a hardware RTCC, but 33fj128gp706 surely hasn't it.
starfire151



Joined: 01 Apr 2007
Posts: 195

View user's profile Send private message

PostPosted: Mon Nov 15, 2010 9:10 am     Reply with quote

Thanks.
Rolling Eyes
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