dxn
Newbie level 4

hi
we are interfacing sim 300 with PIC18f. ,using ccs compiler
if i m sending at commands from microcontroller to modem , it is working perfect. we monitor via hyperterminal.
but if i m checking for 'OK' after each at command, it receives only for 1st at command.
here is my code
for 'AT', it is receiving OK and reading 'K'. and execution goes to next step.
but for AT+CMGF=1, it is receiving OK. but controller couldnot read K.
expected output was
controller stuck with this instruction
c=getc();
it is getting OK command. but not reading' K'.
is it the delay problem? may be OK reply coming fast?
we r connecting max323 rx to gsm tx and vice versa, just for monitoring purpose only.
please help us....
we are interfacing sim 300 with PIC18f. ,using ccs compiler
if i m sending at commands from microcontroller to modem , it is working perfect. we monitor via hyperterminal.
but if i m checking for 'OK' after each at command, it receives only for 1st at command.
here is my code
Code:
void main()
{
char c;
int8 i;
for(i=0;i<10;i++)
delay_ms( 1000 );
while(True)
{
printf("AT");
printf("\r");
do
{
c=getc();
if ( c== 'E')
{
printf("AT");
delay_ms( 10 );
printf("\r");
delay_ms( 10 );
// c=getc();
}
}while(c != 'K');
delay_ms( 1000 );
printf("AT+CMGF=1");
printf("\r");
do
{
c=getc();
if ( c== 'E')
{
printf("AT");
delay_ms( 10 );
printf("\r");
delay_ms( 10 );
// c=getc();
}
}while(c != 'K');
delay_ms( 1000 );
}
}
for 'AT', it is receiving OK and reading 'K'. and execution goes to next step.
but for AT+CMGF=1, it is receiving OK. but controller couldnot read K.
expected output was
controller stuck with this instruction
c=getc();
it is getting OK command. but not reading' K'.
is it the delay problem? may be OK reply coming fast?
we r connecting max323 rx to gsm tx and vice versa, just for monitoring purpose only.
please help us....