View previous topic :: View next topic |
Author |
Message |
starfire151
Joined: 01 Apr 2007 Posts: 195
|
Built-in RTCC with dsPIC33 and PCD compiler |
Posted: Sat Nov 13, 2010 4:38 pm |
|
|
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
|
|
Posted: Sun Nov 14, 2010 9:04 am |
|
|
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
|
|
Posted: Mon Nov 15, 2010 9:10 am |
|
|
Thanks.
|
|
|
|