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 CCS Technical Support

DSPIC compiling error help needed

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



Joined: 22 Sep 2008
Posts: 1

View user's profile Send private message

DSPIC compiling error help needed
PostPosted: Mon Sep 22, 2008 7:56 am     Reply with quote

Hello..
Im trying to program dspic 4013 I'm running a 4.057
I get 9 errors

Code:
#include "C:\Program Files\PICC\test.h"
void main()

int16 value;
int1 done;
   setup_adc_ports(AN0|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1););
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   setup_low_volt_detect(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillotar Config tab

   // TODO: USER CODE!!

set_adc_channel(0);
read_adc(ADC_START_ONLY);
done = adc_done();
while(!done) {   
done = adc_done();
}
value = read_adc();
printf("value = %LX\n\r", value);
}


Code:

#include <30F4013.h>
#device adc=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES LP                       //Low power osc < 200 khz
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPSB1                    //Watch Dog Timer PreScalar B 1:1
#FUSES WPSA1                    //Watch Dog Timer PreScalar A 1:1
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV20                   //Brownout reset at 2.0V
#FUSES LPOL_HIGH                //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
   //PWM module low side output pins have active high output polar
#FUSES HPOL_HIGH                //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
   //PWM module high side output pins have active high output polarity
#FUSES NOPWMPIN                 //PWM outputs drive active state upon Reset
#FUSES NOMCLR                   //Master Clear pin used for I/O
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOCOE                    //Device will reset into operational mode
#FUSES ICS0                     //ICD communication channel 0

#use delay(clock=10000000)
#use rs232(baud=9600,parity=N,xmit=PIN_F0,rcv=PIN_F1,bits=8)
#use rs232(baud=9600,parity=N,xmit=PIN_B0,rcv=PIN_B0,bits=8)

please tell me what is the error
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Sep 22, 2008 8:09 am     Reply with quote

Should we comment on the number nine or any particular error. In the latter case, it would be easier, if you tell them.
Guest








PostPosted: Mon Sep 22, 2008 8:19 am     Reply with quote

like it shows me error on 9 places..
Code:

UNDEFINED identifier AN0
UNDEFINED identifier ADC_OFF
UNDEFINED identifier setup_psp
UNDEFINED identifier setup_timer0
UNDEFINED identifier setup_timer0
UNDEFINED identifier setup_timer0
UNDEFINED identifier setup_comparator
UNDEFINED identifier setup_vref
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Sep 22, 2008 8:49 am     Reply with quote

To start with the first two errors: The compiler manual tells
Quote:
Constants are defined in the devices .h file

You can easily verify, that the said constants are not valid for 30F4013. Ar worst, it may be necessary to read the processor datasheet to learn about the underlying hardware features.

Also the built-in function syntax is partially different between PCD and 8-bit compilers.
Guest








PostPosted: Mon Sep 22, 2008 8:53 am     Reply with quote

HOW DO I CORRECT THEM..
IM NEW TO THIS DSPIC THING SO PLEASE TELL ME
Ttelmah
Guest







PostPosted: Mon Sep 22, 2008 9:10 am     Reply with quote

First, a comment that is not causing an error, but is a future problem. If you are declaring two RS232 ports, these _must_ have different 'stream' names, or only the last will be used.
Second. Look in the data sheet. Does the chip _have_ a 'timer0'?....
Then, does it have a comparator?....
Then, does it have a programmable Vef, for a comparator?...
Then, for the remaining functions, as has been pointed out, look in the include file for the processor. It will tell you, what constants ar available for each function. These are not the same for the DSPIC.
You _need_ to start by looking at what hardware is available in the chip, then what functions are used to support this. You can't just 'fire' a set of functions for other hardware at the chip, and hope they will work...

Best Wishes
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