Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[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....
 

milan.rajik

Banned
Joined
Apr 1, 2013
Messages
2,528
Helped
540
Reputation
1,078
Reaction score
523
Trophy points
1,393
Activity points
0
Use Serial receive interrupt to receive the responses.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top