ste2006
Advanced Member level 4
I am writing some code in C and i have written some code to send a pointer to a string to a function but its not working. I am trying to keep the code down a little and i thought what i have written would work but it wont, it compiles fine but the array does not seem to contain anything.
Here is the code calling the function:
Function Prototype:
Here is the start of the function
I have ran through it with the debugger and it seems to get to the function fine but as the pointer to str seems to contain nothing useful,
Anyone any thoughts??
Thanks
Here is the code calling the function:
Function Prototype:
Code:
unsigned char SendCommand (unsigned char *str);
Code:
ModemStatusFlag=SendCommand("AT+WS46=12");
Here is the start of the function
Code:
unsigned char SendCommand (unsigned char *str)
{
unsigned char ModemStatus = 0x00;
unsigned char i = 0x00;
unsigned char RxData[9] = {0};
char CReturn = 0x0D;
// Start 1 Second Timer in case USART Locks Up
if (RCSTA2bits.OERR2 = 1) // Check for Overflow Error
{
RCSTA2bits.CREN2 = 0;
RCSTA2bits.CREN2 = 1;
}
while(*str != '\0')
Send2Byte(*str++);
Send2Byte(CReturn);
for (i=0;i < 2; i++)
I have ran through it with the debugger and it seems to get to the function fine but as the pointer to str seems to contain nothing useful,
Anyone any thoughts??
Thanks