Common at instruction Set
At+cnmifor setting a new message indication. Send:at+cnmi=2,1, set a new message prompt when you receive a new
Message, and the SIM card is not full, thesim900a module will return data to the serial port, such as:+cmti: "SM", 2, table
Receive a new message, stored in the SIM card location 2.
AT+CMGFfor setting the short message mode,sim900a supports PDU mode and textmode, etc. 2
mode, send:at+cmgf=1, can be set to text mode.
At+cscs, which sets the TE character Set, defaults to the GSM 7 -bit default character set, when sending plain English text messages
, send:at+cscs= "GSM", set to the default character set. When sending SMS in English, you need to
To send:at+cscs= "UCS2", set to a Universal 8 - byte multiple encoded character set.
AT+CSMP, used to set the text mode parameters of short message , when sending Chinese text messages using UCS2 mode,
Need to send:at+csmp=17,167,2,25, set text mode parameters.
At+cmgr, for reading text messages, such as send:at+cmgr=1, you can read the SIM card stored in the location
1 of SMS.
At+cmgs, used to send text messages, in the "GSM" character set, the maximum can be sent to the English characters of the bytes,
Under the "UCS2" character set, the maximum number of characters (including character / number) can be sent. This instruction is detailed in the following
Shaoxing.
At+cpms, used to query / Set the preferred message memory by sending:At+cpms? , you can query the current SIM
The maximum number of SMS stores supported by the card, and how many SMS messages are currently stored. As returned:+cpms:
The sending of English text messages
In this section, we will use the atk-sim900a module to send an English text message to the designated mobile phone number.
Here, we use the at+cmgs instruction to send text messages, send all English / Digital text messages, we first set up
Set as:"GSM" (at+cscs= "GSM"), Text mode (at+cmgf=1).
Suppose we want to give the phone number: 13922348612, send a text message, send:at+cmgs= "13922348612",
Then the module returns:>, at this point we enter what we need to send:atk-sim900a MSG send TEST,
Note that this can be used without sending a carriage return. After the content is sent, it is finally sent separately in hex (hex) format (no
With add carriage return):1 A(that is , 0X1A)1 , you can start a text message sent.
Note 1:0X1A, the "Ctrl + Z" key value, is used to tell sim900atoperform the send operation. Alternatively, you can send:0X1B,
The key value of "ESC", which tells the sim900atocancel the operation and does not execute the send.
Wait a moment, after the SMS is sent successfully, the module returns such as:+cmgs:156, the confirmation message that
156 , which is a short message counter inside the module, is generally ignored. as shown in 2.3.4.2.1:
As can be seen, we at the end of the text message sent, entered the hexadecimal 1 a, the data sent
After giving the sim900a module, start the SMS send and then send it successfully, the module returns:+cmgs:156, description short
The letter was sent successfully.
Sending SMS in Chinese and English
In this section, we will use the atk-sim900a module to send a Chinese and English text message to the designated mobile phone number.
Similarly, we use the at+cmgs command to send Chinese and English text messages. Text mode, send step
The following:
First, send:at+cmgf=1, set to text mode. Then, send:at+csmp=17,167,2,25,
Sets the text mode parameter. Last send:at+cscs= "UCS2", set to UCS2 coded character set.
At this point, we can send At+cmgs instructions to send the Chinese and English text messages, but because of the use of UCS2
Character set, all characters / numbers / kanji, must use UNICODE encoding.
Suppose we want to give the phone number:13922348612, send a Chinese and English text message, the content is "atk-sim900a
English text message sending test ". The first thing we need to do is to use the UNICODE Interchange tool . exe,
This software will number and send
Send content to a UNICODE string (you need to remove the space manually) to get:
13922348612, the converted UNICODE string (after removing the space) is:
00310033003900320032003300340038003600310032
atk-sim900a in English text message sending test, the converted UNICODE string is:
00410054004b002d00530049004d00390030003000414e2d82f1658777ed4fe153d1900
16d4b8bd5
Then, send:
at+cmgs= "00310038003100370035003600380034003700390039", this means
Order, and then the module returns: >, at this point we enter what we need to send:00410054004b002d00530049004d
00390030003000414e2d82f1658777ed4fe153d190016d4b8bd5,
Note that this can not be sent back to
The car. After the content is sent, the final message is sent separately in hex (hex) format (without adding a carriage return):1 a(i.e.
0X1A), start a text message to send, as shown in 2.3.4.4.1 :
Wait until the module is sent to complete, return such as:+cmgs:158, indicating that the SMS has been successfully sent. At this point, we are in the target
Mobile Phone (13922348612) above, you can see the module sent over the Chinese and English text messages.
SMS Read and send, we introduce here, we are all using textmode to achieve,
Of course, you can also use PDU mode, but the PDU mode is slightly more complex, interested friends, can refer to the relevant information from
The study.
Next we introduce several common at directives:
1, at+cpin?
This instruction is used to query the status of the SIM card, primarily the PIN Code, if the directive returns:+cpin:ready, then
Indicates that the sim card is in good condition and returns other values, it is possible that there is no sim card.
2, at+csq
This instruction is used to query the signal quality and return the received signal strength of the sim900a module, such as return:+csq:24,0,
Indicates that the signal strength is(maximum valid value is ). If the signal strength is too low, check to see if the antenna is properly connected.
3, at+cops?
This directive is used to query the current operator, which only returns to the operator after connecting to the network, otherwise returns NULL,
As returned:+cops:0,0, "China Mobile", indicates that the currently selected carrier is Chinese mobile.
4, at+cgmi
This directive is used to query the module manufacturer, such as return:simcom_ltd, stating that the sim900a module is simcom
Produced by the company.
Simcom_ltd
5, at+cgmm
This instruction is used to query the module model, such as return:simcom_sim900a, indicating that the module model is sim900a.
simcom_sim900a
6, AT+CGSN
This instruction is used to query the product serial number (that is, IMEI number), each module IMEI number is not the same, with a full
Ball uniqueness, such as return:869988012018905, description module product serial number is:869988012018905.
863306026653540
7, at+cnum
This instruction is used to query the native number and must be queried when the SIM card is in place , such as return:+cnum:
"", "15902020353", 129,7,4, indicates that the machine number is:15902020353. In addition, not all SIM cards are
Support This command, there are individual SIM card can not get its number through this command.
How to use atk-sim900a module to send SMS in Chinese and English