Click here to Skip to main content
15,893,663 members

Comments by pmk_1969 (Top 11 by date)

pmk_1969 11-Apr-11 11:40am View    
Hi Cpallini,

I solved the problem. Thanks to you for the help provided.
pmk_1969 11-Apr-11 11:39am View    
I can't able to differentiate C++ from C. Because I am new to C and C++. It works well on PIC Compiler(HI-TECH C PRO Compiler / MPLAB IDE v8.63). Thanks a lot once again.
pmk_1969 9-Apr-11 13:17pm View    
thanks Albert Holguin.

I solved the problem. As you told, I started to check GSM_DATA step by step. I located the problem. I declared variable i as global variable. I removed that and declare inside for loop.

That is, problem is here:

for(i = start;i < stop; i++){

Just I modified as follows:

for(int i = start;i < stop; i++){

Now, Everything works fine.

Thanks once again Mr.Albert Holguin
pmk_1969 9-Apr-11 10:46am View    
I have checked GSM_DATA output. correct data received. It works fine if i did not do anything other than just display the result. But if I start validate the GSM_DATA then only onetime validation done and simply sits. I have to restart the device to process next command. I don't know why?

The following code works fine:

void showGSM_DATA(char GSM_DATA[]){ //to show the GSM OUTPUT after eliminating the chars '\r' and '\n'

if (strcmp(GSM_DATA, "OK") == 0){
OK = 1;

if (strcmp(NextCmd, "CMGF") == 0){
strcpy(NextCmd, "CLIP");
puts("AT+CMGF=1");
putch(0X0D);

}
if (strcmp(NextCmd, "CLIP") == 0){
*NextCmd = 0;
puts("AT+CLIP=1");
putch(0X0D);

}
return;
}

if (strcmp(GSM_DATA, "ERROR") == 0){
Error = 1;
*GSM_DATA = 0;
return;
}
if(strlen(GSM_DATA) > 6){

lcd_clear();
lcd_goto(0);
lcd_puts(GSM_DATA);
}
*GSM_DATA = 0;
return;

} // end function showGSM_DATA

But following code executes only one time and sits.

(Just only I added substring function):

void substring(size_t start, size_t stop, char src[]){

int j = 0;

if (start >= stop){

return;
}

for(i = start;i < stop; i++){
substringOfInput[j] = src[i];
j++;
}

substringOfInput[j] = '\x00';
lcd_clear();
lcd_goto(0);
lcd_puts(substringOfInput);
*src=0;
*substringOfInput=0;
j=0;
return;
}

if(strlen(GSM_DATA) > 6){
substring(0,5,GSM_DATA);
//lcd_clear();
//lcd_goto(0);
//lcd_puts(GSM_DATA);
}
pmk_1969 8-Apr-11 8:36am View    
Hi Cpallini,

I have changed the code as follows to limit the chars. But still the same result.

default: // if characters received
if (i < 13){
gsmInput[i] = input;
i++;
}

break;