1
\$\begingroup\$

I am trying to interface SIM900 with PIC18F2520. I need to send SMS to a particular cell number. According to AT commands, AT+CMGS="number" is used to send SMS. After sending this command, we have to write our message and then press Ctrl+Z to terminate it. SIM 900 will then send the SMS.

I am doing the same thing as above but not able to send SMS. Following is the code:

putrsUSART("AT+CMGS=\"96********\"\r);   //command with number
putrsUSART("Hello");    //message content
putrsUSART("0x1A");     /to terminate it

but after sending these commands I am not receiving any SMS. I am confused with how to send 0x1A to SIM900. How to actually send hex numbers via UART?

Edit:

I am able to send sms but the sms is empty. I have attached a image of the response:

enter image description here

\$\endgroup\$
  • \$\begingroup\$ To put 0x1A into a string you use an escape sequence like this putrsUSART("\x1A"); \$\endgroup\$ – Steve G Jul 25 '16 at 10:31
  • \$\begingroup\$ Also, I'm not sure that "AT+CMGS=\"96********\"\r makes any sense. Surely it should be "AT+CMGS=96*****\r" \$\endgroup\$ – Steve G Jul 25 '16 at 10:36
  • \$\begingroup\$ @SteveG I have included `("\x1A") and now I am able to send sms but the problem it doesnt have any text. I mean empty SMS. \$\endgroup\$ – S Andrew Jul 25 '16 at 10:42
  • \$\begingroup\$ What is the response or error code from the SIM900? \$\endgroup\$ – Steve G Jul 25 '16 at 10:51
  • \$\begingroup\$ @SteveG I have attached an image of the response \$\endgroup\$ – S Andrew Jul 25 '16 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.