25. 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. Suppose you 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"<CR>Sending
text messages is easy.<Ctrl+z>
To
send the same text message using the +CMSS AT command, first you 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"<CR>Sending
text messages is easy.<Ctrl+z>
Let's
say the SMS text message is now located at index 3 of the message
storage area. You can use the +CMSS AT command to send the text
message to the message center by the following command line:
AT+CMSS=3
As
storage space is limited, if every SMS text message sent is left in
the message storage area, there will come a time when no more SMS
text messages can be written. To free some storage space, you can use
the AT command +CMGD (command
name in text: Delete Message) to delete the SMS text message from the
message storage area, like this:
AT+CMGD=3
As
you can see above, sending an SMS message by the +CMSS AT command is
a bit cumbersome, since it involves more steps and AT commands.
However, a copy of the sent SMS message can be saved in the message
storage area. This is not achievable with the +CMGS AT command.
In
some situations, it is more convenient to send SMS messages by the
+CMSS AT command than the +CMGS AT command. For example, if you have
to send the same SMS message to multiple recipients, using the +CMSS
AT command is more convenient:
AT+CMSS=3,"91234567"
AT+CMSS=3,"97777777"
AT+CMSS=3,"96666666"
...
Note:
To keep things simple in the above examples, we assume that the same
message storage area is used by the AT commands +CMSS, +CMGW, +CMGD
and for receiving SMS messages. But this may not be true in real
situations. To learn how to set the message storage areas to be used
by different SMS operations, please refer to the earlier section
"Preferred Message Storage
(AT+CPMS)" of this SMS tutorial.
25.1. Comparison
Table of the AT Commands +CMGS and +CMSS
The
comparison table below summarizes the differences between the AT
commands +CMGS and +CMSS that are discussed in the previous section.
|
+CMGS
AT command
|
+CMSS
AT command
|
Parameters
|
+CMGS
takes the SMS message to be sent as a parameter.
|
+CMSS
takes the index number that specifies the location of the SMS
message in the message storage area as a parameter.
|
Sending
new SMS messages
|
Using
+CMGS is more convenient. +CMGS can be used to send new SMS
messages without the help of other AT commands.
However,
no copy of the SMS message sent is saved in the message storage
area.
|
+CMSS
has to be used together with +CMGW and +CMGD for sending new SMS
messages. As a result, the process involves more steps and is a
bit cumbersome.
However,
a copy of the SMS message sent can be saved in the message
storage area.
|
Sending
the same SMS message to multiple recipients
|
Using
+CMGS is less convenient.
|
Using
+CMSS is more convenient.
|
Feedback Form (ExpandCollapse)
|
|