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

Problems with function definitions

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



Joined: 25 Mar 2011
Posts: 7

View user's profile Send private message

Problems with function definitions
PostPosted: Mon May 23, 2011 4:42 pm     Reply with quote

Hi. I'm defining a function as follows, when I compile the program I not have errors,
Code:

int Modem_Wait_Rpta(char Buffer_TX,char Buffer_RX,int Nro_char) {

printf(Buffer_TX);                 // Mensaje a ser enviado al Modem
delay_ms(2000);

if (flag_RX_Modem){                // Hay datos en el UART
    sprintf(Token,Buffer_RX);      // Mensaje esperado del modem
    if(!strncmp(Buffer_Modem,Token,Nro_char))
       return 1;
    else
       return 0;
  }
else
  return 0;
}

.
.
.
but when I call the function ...
Code:
while (Modem_Wait_Rpta("AT+SBD","+SBDI:1",9));


the compiler gives me the following error
Quote:
*** Error 90 "Modem_4x.c" Line 428(37,38): Attempt to create a pointer to a constant


Someone could tell me what my error and how to fix this.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon May 23, 2011 5:27 pm     Reply with quote

To fix the error message, add the #device statement shown in bold below:
Quote:

#include <16F877.H>
#device PASS_STRINGS=IN_RAM
#fuses XT, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)



Also, you are passing char pointers as your function parameters. So the
parameters should be declared as char pointers, as shown below in bold.
Quote:

int Modem_Wait_Rpta(char *Buffer_TX, char *Buffer_RX, int Nro_char)
{
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