|
|
View previous topic :: View next topic |
Author |
Message |
Alejandro
Joined: 25 Mar 2011 Posts: 7
|
Problems with function definitions |
Posted: Mon May 23, 2011 4:42 pm |
|
|
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
|
|
Posted: Mon May 23, 2011 5:27 pm |
|
|
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)
{
|
|
|
|
|
|
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
|