[PIC] sim 300 gsm modem interfacing with PIC controller

Status
Not open for further replies.

dxn

Newbie level 4
Joined
Jun 3, 2015
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
31
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
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....
 

Use Serial receive interrupt to receive the responses.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…