This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem in writing code which performs GPRS support action.

I am trying to send data through GPRS via SIM300 modem. The logic of my program should be.
1) it should send the data till it receives "dieman" from the server.
2) the modem is such that after every command there is a reply.
3) all the communication takes place serially.

Firstly the GPRS commands as tried in hyperterminal

AT
OK
AT+CGATT=1
OK
AT+CGDCONT=1,"IP","airtelgprs.com"
OK
AT+CSTT="airtelgprs.com","",""
OK
AT+CIICR
OK
AT+CIFSR
212.22.22.22                  //EG OF AN IP ADDRESS
AT+CIPSTART="TCP",""80"">http://www.google.com","80"
OK

CONNECT OK
AT+CIPSEND
>THIS IS THE DATA I WANNA SEND             // YOU CAN SEND THE DATA VIA GPRS NOW
 [CTRL+Z]
SEND OK

this is what i want to implement in C in 8052. here OK are the response from the modem.

now i implemented the C version but my code is very inefficient. I could have ignored the response from the modem by simply inserting delays but i want my code such that if the reply from the modem is not "OK" it should transmit the command again.

Parents
  • No, that would be a very bad idea indeed!

    See my comment on "Arbitrary delays" in this thread: http://www.keil.com/forum/18684/

    "i want my code such that if the reply from the modem is not "OK" it should transmit the command again"

    That isn't a very good idea, either!

    You should really make some attempt to determine the reason for the failure and, from that, determine what recovery action is appropriate.

    As also mentioned in the above-mentioned thread, look-up AT+CMEE in your AT Commands manual...

Reply
  • No, that would be a very bad idea indeed!

    See my comment on "Arbitrary delays" in this thread: http://www.keil.com/forum/18684/

    "i want my code such that if the reply from the modem is not "OK" it should transmit the command again"

    That isn't a very good idea, either!

    You should really make some attempt to determine the reason for the failure and, from that, determine what recovery action is appropriate.

    As also mentioned in the above-mentioned thread, look-up AT+CMEE in your AT Commands manual...

Children