Joke Collection Website - Blessing messages - Usage of AT command
Usage of AT command
AT command is a string starting with AT and ending with characters. The response data packet of AT command is in . Each instruction has a corresponding return whether it is executed successfully or not. For other unexpected information (such as someone dialing in, no signal on the line, etc.), the module will have corresponding information prompts, and the receiving end can handle it accordingly.
Example: CDMA modem DTE
AT< CR>
< LF> OK < LF>
ATTEST< CR> p>
< CR> ERROR < LF>
If the AT command is executed successfully, the "OK" string is returned;
If the AT command syntax error or the AT command execution fails,
The "ERROR" string is returned.
The GSM AT commands related to SMS (from GSM07.05) are shown in Table 1:
Table 1 Related GSM AT commands
AT commands
Function
AT+CMGC
Send an SMS command
AT+CMGD
Delete SMS message SMS message in SIM card memory)
AT+CMGF
Select SMS message format (select SMS message format: 0-PDU; 1-text)
AT+CMGL
List SMS message from preferred store (List SMS message PDU/text in SIM card: 0/"REC UNREAD"-unread, 1/"REC READ"-read, 2 /"STO UNSENT"-to be sent, 3/"STO SENT"-sent, 4/"ALL"-all)
AT+CMGR
Read SMS message (read SMS message)
AT+CMGS
Send SMS message (Send SMS message)
AT+CMGW
Write SMS message to memory (Write the short message to be sent to the SIM memory)
AT+CMSS
Send SMS message from storage (Send the short message from the SIN|M memory)
AT+CNMI
New SMS message indications (display newly received short messages)
AT+CPMS
Preferred SMS message storage (select short message storage) Message memory)
AT+CSCA
SMS service center address (short message center address)
AT+CSCB
Select cell broadcast messages (select cellular broadcast messages)
AT+CSMP
Set SMS text mode parameters (set short message text mode parameters)
AT+CSMS
Select Message Service
There are three modes for controlling short messages:
Block Mode
Based on AT Command PDU Mode
Text Mode based on AT commands
Using Block mode requires mobile phone manufacturers to provide driver support. Currently, PDU Mode has replaced Block Mode, and Text Mode is relatively simple. This article The focus is on mode PDU Mode, taking Siemens product TC35T as an example. (1) RS232 serial port connection
Since TC35T comes with its own RS232 serial port cable, you only need to connect it to the computer serial port. Open the HyperTerminal, select the corresponding serial port, and set the port parameters as: rate—4800, parity bit—none, data bit—8, stop bit—1, and flow control—hardware.
(2) Connection test
Input "AT" and press Enter. "OK" returned on the screen indicates that the computer and TC35T have been successfully connected and TC35T can work normally. At this time, you can test various AT commands.
When testing the command "AT+CMGS=?", if "OK" is returned, it indicates that TC35T supports this command.
The complete syntax of this command is as follows:
If TC35T is in PDU Mode at this time (i.e. "AT+CMGF?" returns "0")
AT+CMGS=PDU is given<^ Z/ESC>
If the short message is sent successfully, "OK" will be returned and the information number will be displayed:
+CMGS: [,]
If the short message If the message fails to be sent, the following information number will be returned:
+CMS ERROR:
If TC35T is in Text Mode at this time (i.e. "AT+CMGF?" returns "1")
p>AT+CMGS=[,toda]text is entered<^Z/ESC>
If the short message is sent successfully, "OK" will be returned and the information number will be displayed:
+CMGS: [,]
If the short message fails to be sent, the following information number will be returned:
+CMS ERROR:
In addition, due to the use The one is TC35T. When a new short message arrives, TC35T needs to generate a prompt and use the command "AT+CNMI". The complete syntax of this command is as follows:
AT+CNMI=[][,][,][,][,]
If a new short message arrives, TC35T The following prompt will be returned automatically:
+CMTI: "SM",
Read it at this time, and then use the "AT+CMGR" command to read the short message content. For example, we want to send the character "Hi" to the destination "13678099"
The PDU string is:
⑵91—Short message center number type. 91 means that TON/NPI complies with the International/E.164 standard, which means that a ‘+’ sign needs to be added before the number; there are other values, but 91 is the most commonly used.
91—10010001
BIT No.
7
6
5
4
3
2
1
Name
1
Value Type
Number identification
Type of Number: 000—unknown, 001—international, 010—domestic, 111—reserved for expansion;
Numbering plan identification: 0000—unknown, 0001—ISDN/telephone number (E.164/E.163), 1111—reserved for expansion;
⑶683108701305F0—Short message center number. Due to slight processing in position, the actual number should be: the letter F refers to the length minus 1). This needs to be modified accordingly according to different regions.
⑴, ⑵, ⑶ are commonly known as the Address of the SMSC.
⑷11—File header bytes.
11&h=00010001&b
BIT No.
7
6
5
4
3
2
1
Name
TP-RP
TP-UDHI
TP-SPR
TP-VFP
TP-RD
TP-MTI
value
1
1
Response path—TP-RP (TP-Reply-Path): 0—not set; 1—set
User data header identifier—TP-UDHL (TP-User-Data-Header-Indicator): 0—does not contain any header information; 1—contains header information
Status reporting requirements—TP- SPR (TP-Status-Report-Request): 0—Report required; 1—No report required
Validity period format—TP-VPF (TP-Validity-Period-Format): 00—Not provided (Not present); 10—Integer (standard); 01—Reserved; 11—Provide half of the 8-bit byte (Semi-Octet Represented)
Reject duplication—TP-RD (TP-Reject-Duplicates ): 0—Accept copy; 1—Reject copy
Message type prompt—TP-MTI (TP-Message-Type-Indicator): 00—Read (Deliver); 01—Submit (Submit)< /p>
⑸00—Message type (TP-Message-Reference)
⑹0B—Called number length.
⑺91—Called number type (same as ⑵).
⑻3176378290F9—The called number has undergone displacement processing, and the actual number is "1368099".
⑹, ⑺, and ⑻ are commonly known as destination addresses (TP-Destination-Address).
⑼00—Protocol identification TP-PID (TP-Protocol-Identifier)
BIT No.
7
6
5
4
3
2
1
Bit No.7 and Bit No.6: 00—Assigned Bit No.0—Bit No.5 as defined below; 01—See GSM03.40 protocol identifier for full definition; 10—Reserved; 11—Assigned Bit No. for Service Center (SC) special purpose .0—Bit No.5.
Generally these two bits are set to 00.
Bit No.5: 0—Does not use the remote network, just a protocol between short message devices; 1—Uses the remote network.
Bit No.0—Bits No.4: 00000—implied; 00001—telefax; 00010—group 3 telefax; 00100—voice; 00101—European Radio Information System (ERMES); 00110—domestic System; 10001—Any public information processing system based on X.400; 10010—Email.
⑽00—Data Coding Scheme TP-DCS (TP-Data-Coding-Scheme)
BIT No.
7
6
5
4
3
2
1
Bit No. 7 and Bit No.6: Generally set to 00; Bit No.5: 0—the text is not compressed, 1—the text is compressed using the GSM standard compression algorithm; Bit No.4: 0—indicates Bit No.1 and Bit No.0 It is a reserved bit and does not contain information type information. 1—indicates that Bit No.1 and Bit No.0 contain information type information; Bit No.3 and Bit No.2: 00—default alphabet, 01—8bit, 10— USC2 (16bit), 11—reserved; Bit No.1 and Bit No.0: 00—Class 0, 01—Class 1, 10—Class 2 (SIM card specific information), 11—Class 3.
⑾00—Validity period TP-VP (TP-Valid-Period)
VP value(&h)
Corresponding validity period
00 to 8F
(VP+1)*5 minutes
90 to A7
12 hours+(VP-143)*30 minutes
< p>A8 to C4(VP-166)*1 day
C5 to FF
(VP-192)*1 week
< p>⑿02—User data length TP-UDL (TP-User-Data-Length)⒀C834—User data TP-UD (TP-User-Data) "Hi" Given that TC35 (T) supports TEXT format, which we mainly tested in our experiments.
(1) Set up short message center
(2) Set up short message sending format
AT+CMGF=1 (1-TEXT; 0-PDU) ;
(3) Send a short message (the content of the short message is "test")
> test ^z;
(4) Set the automatic arrival time of the short message Tip: Set the short message arrival prompt. When the short message is received, the command will be obtained: +CMTI:SM,INDEX (information storage location)
AT+CNMI=1,1,0,0,1() ;
(5) Get the short message content (Once more), assuming INDEX=8.
AT+CMGR=8
The return information is as follows:
+CMGR: REC UNREAD,+86135085560,,01/07/16,15:37: 28+32,Once more (1) The short message center will generally not change. If the short message center number changes, when using the "AT+CSCA" statement, remember that TC35 needs to be restarted, otherwise TC35 will not work properly (TC35T does not exist this issue).
(2) Some SIM cards have passwords, and you need to enter the password when starting.
- Related articles
- The API server interface of mobile phone returned an exception.
- Alipay was suddenly pulled into the mass red envelope.
- Is Jiangsu Bank Company Limited a borrower?
- What was the news of the bank's death like?
- What do you mean by self-archiving?
- How to check the credit card points of the bank?
- How about Sichuan Jin Hao Law Firm?
- Where can I check personal payment bills in JD.COM?
- Complete works of funny sketches
- Apple 7 SMS shows unread.