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

Problem with functions: Compiling in MPLAB

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



Joined: 01 Aug 2007
Posts: 38
Location: AUckland, NEW ZEALAND

View user's profile Send private message Send e-mail MSN Messenger

Problem with functions: Compiling in MPLAB
PostPosted: Thu Oct 11, 2007 12:00 am     Reply with quote

Just trying to set up a simple function in my program, but MPLAB doesn't like it when compiling. These are the errors:

"Expecting a basic type"
for function declaration line

"Expecting an identifier"
and
"Expecting a declaration"
for within the function.

Heres the code:


Code:
#include <18f452.h>
#include "left.c"
#include "sound11.c"
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT
#use delay (clock=10000000)

#define LED PIN_A1
#define MEM_SELECT PIN_C1 //checked
#define MEM_HOLD PIN_D1 //checked
#define WR_PROTECT PIN_D0 //checked
#define WREN 0x06 //checked
#define WRSR 0x01 //checked
#define RDSR 0x05 //checked
#define READ 0x03 //checked
#define PP 0x02 //checked
#define BE 0xC7 //checked

#define DREQ PIN_D7 //checked
#define BSYNC PIN_D6 //checked       
#define xCS PIN_D5 //checked
#define RESET PIN_C0 //checked


void wren (void); //first problem here


void main(){
   unsigned long int Sound_Pointer;
   unsigned long int Sound_Pointer2;
   int data, value, i, k, m, j;
   ........
}


I call the function by this line "wren();"

Code:

void wren (void){
   int status;

   output_low(MEM_SELECT); //*******SELECTED*******
   spi_write(WREN);
   output_high(MEM_SELECT); //********DESELECTED********
   status=0;
   while(status!=2){
     output_low(MEM_SELECT);
      spi_write(RDSR);
     status=spi_read(0);
     output_high(MEM_SELECT);
   }
}


Any help appreciated
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 11, 2007 12:20 am     Reply with quote

Don't define a constant with the same name as a function.
uni_student



Joined: 01 Aug 2007
Posts: 38
Location: AUckland, NEW ZEALAND

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Thu Oct 11, 2007 12:38 am     Reply with quote

Cheers!!! Fixed now
mattsouthgate



Joined: 28 Nov 2005
Posts: 1

View user's profile Send private message

Helpful
PostPosted: Tue Aug 04, 2009 4:18 am     Reply with quote

I'm an old hand at this but it's the simplest problems like this without help compiler error messages that are the infuriating to find. Thanks for the help.
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