Demonstrating How to Use the +CMSS AT Command to Send Text Messages
from a Message Storage Area (SMS Text Mode and SMS PDU Mode)
let's see a more detailed example that demonstrates how to use the
+CMSS AT command to send text messages from a message storage area
and how the +CMSS AT command should be used together with other AT
commands. Since the syntax of the +CMSS AT command is the same in
both SMS text mode and SMS PDU mode, the information provided below
applies to both modes.
the Message Storage Area to Write Text Messages to and Send Text
use the +CPMS AT command (command name in text: Preferred Message
Storage) to select the message storage area to write text messages to
(+CMGW AT command) and send text messages from (+CMSS AT command).
For example, to use the message storage area in the SIM card for
writing and sending SMS text messages, assign the string value "SM"
to the second parameter of the +CPMS AT command, like this:
first parameter of the +CPMS AT command is used to select the message
storage area for reading and deleting SMS messages. It has no use to
us here. So, it does not matter what value is assigned to the first
press the Enter key on the keyboard and you should see something
similar to this:
information about the +CPMS AT command is available in the "Preferred
Message Storage (AT+CPMS)" section of this SMS tutorial.
the SMSC Number to be Used to Send SMS Text Messages
use the AT command +CSCA (command name in text: Service Centre
Address) to set the SMSC number to be used to send SMS text messages.
Usually the default setting is correct and you do not need to make
any changes. Below demonstrates how to use the +CSCA AT command to
set "+85290000000" as the SMSC number:
information about the +CSCA AT command can be found in the "Setting
or Reading the Service Center Address / SMSC Address (AT+CSCA)"
section of this SMS tutorial.
use the +CMGW AT command (command line in text: Write Message to
Memory) to write the text message to message storage. Suppose the
recipient mobile phone number is +85291234567. If the GSM/GPRS modem
or mobile phone is operating in SMS text mode, you should enter
something like this in the terminal program and press the Enter key
of the keyboard:
GSM/GPRS modem or mobile phone will return a prompt, as shown below:
enter the body of the SMS text message "It is easy to send text
messages." and press Ctrl+z on the keyboard to finish. You
should see something like this in the terminal program:
It is easy to send text messages.
value 3 in the +CMGW information response is the index that specifies
the location where the text message is stored in the message storage
area. Later, we have to use this index to tell the +CMSS AT command
which text message should be sent.
the GSM/GPRS modem or mobile phone is operating in SMS PDU mode,
here's what you should type and see in the terminal program:
further details the +CMGW AT command, please refer to the earlier
section "Writing SMS Messages to
Memory / Message Storage (AT+CMGW)" of this SMS tutorial.
Text Messages from Message Storage
specify the index "3" to the +CMSS AT command to send the
text message out:
is the message reference number allocated by the GSM/GPRS modem or
mobile phone to the text message. The final result code OK indicates
the text message was sent to the SMSC successfully. If the execution
of the AT command +CMSS fails, the GSM/GPRS modem or mobile phone
will return either the final result code ERROR or +CMS ERROR.
the above example, the address
parameter of the AT command +CMSS is omitted. Thus, the mobile phone
number stored with the SMS text message (i.e. +85291234567) will be
used as the destination address. Suppose you want to send the
text message to another mobile phone number, say +85298765432, you
should assign "+85298765432" to the address
parameter of +CMSS, as shown below:
Feedback Form (ExpandCollapse)