8/2/10

SENDING SMS MESSAGES FROM A COMPUTER / PC USING AT COMMANDS (AT+CMGS, AT+CMSS)

Either of the AT commands +CMGS (command name in text: Send Message) and +CMSS (command name in text: Send Message from Storage) can be used to send SMS messages from a computer / PC. The key difference between them is that the +CMGS AT command takes the SMS message to be sent as a parameter, while the +CMSS AT command takes the index number that specifies the location of the SMS message in the message storage area as a parameter. Following is an example for illustrating the difference.
EXAMPLE
Suppose we want to send the text message "Sending text messages is easy." from a computer / PC to the mobile phone number 91234567 using the +CMGS AT command in SMS text mode. Here is the command line to be used:
AT+CMGS="91234567"Sending text messages is easy.
To send the same text message using the +CMSS AT command, first we have to use the AT command +CMGW (command name in text: Write Message to Memory) to write the text message to the message storage area. In SMS text mode, the command line should be:
AT+CMGW="91234567"Sending text messages is easy.
DELETING SMS MESSAGES FROM MESSAGE STORAGE (AT+CMGD)
The AT command +CMGD (command name in text: Delete Message) is used to delete SMS message(s) from message storage. The message storage area from which SMS messages are

deleted is specified by the +CPMS AT command (command name in text: Preferred Message Storage).
EXAMPLE
Demonstrating How to Use the +CMGD AT Command to Delete SMS Text Messages
Now let's see an example that demonstrates how to use the +CMGD AT command to delete an SMS text message from the message storage area. Suppose we have written an SMS text message to the message storage area by the +CMGW AT command like this:
AT+CMGW="+85291234567" > A simple demo of SMS text messaging. +CMGW: 1 OK
The information response of the +CMGW AT command tells us that the SMS text message is stored in the memory location at index 1. To delete the SMS text message, specify 1 to the index parameter of the +CMGD AT command, like this:
(Important note: Make sure you are writing text messages to and deleting text messages from the same message storage area. If not, we may delete the wrong text message.
AT+CMGD=1 OK
The final result code OK indicates the SMS text message "A simple demo of SMS text messaging." was deleted successfully. If the operation fails, the final result code returned will either be ERROR or +CMS ERROR.

SMS TEXT MODE & PDU MODE
OPERATING MODE: SMS TEXT MODE AND SMS PDU MODE

The SMS specification has defined two modes in which a GSM/GPRS modem or mobile phone can operate. They are called SMS text mode and SMS PDU mode. (PDU stands for Protocol Data Unit.) The mode that a GSM/GPRS modem or mobile phone is operating in determines the syntax of some SMS AT commands and the format of the responses returned after execution. These two AT commands are useful to you only if SMS text mode is used:
• +CSMP (Set Text Mode Parameters)
• +CSDH (Show Text Mode Parameters)
Comparison of SMS Text Mode and SMS PDU Mode
Below we compare SMS text mode and SMS PDU mode from various aspects. The comparison should help you to learn the differences between these two modes and decide which mode should be used by your SMS messaging application.
Syntax of SMS AT Commands and Responses
When the GSM/GPRS modem or mobile phone is operating in different modes, the syntax of certain SMS AT commands and the responses returned after command execution is different. Here's an example for illustration. Let's say we would like to send the SMS message "It is easy to send text messages." to the mobile phone number +85291234567. In SMS text mode, this is the command line that you should enter:
AT+CMGS="+85291234567"It is easy to send text messages.
However, if the GSM/GPRS modem or mobile phone is operating in SMS PDU mode, executing the above command line will cause an error to occur. This is because the syntax of the +CMGS AT command is different in SMS PDU mode. To do the same task, the following command line should be used instead:
AT+CMGS=4207915892000000F001000B915892214365F7000021493A283D0795C3F33C88FE06CDCB6E32885EC6D341EDF27C1E3E97E72E

2 comments:

  1. Excellent post. I want to thank you for this informative read, I really appreciate sharing this great post.

    Ocala mobile advertising agency

    ReplyDelete
  2. The article is good to read and worth sharing
    send sms from pc

    ReplyDelete