GSM, a global mobile communication system, is the most widely and most powerful mobile communication service in China, and its short message function is widely used for its convenience, reliability and low price. If we want to use SMS in embedded device, we should use GSM module to send and receive SMS.
SMS Transceiver Principle
Short Message Service (SMS) is a digital business provided by GSM system to users, and it is the main telecommunication service provided by GSM communication network as well as voice transmission and facsimile. The system structure diagram is as follows:
The access mode of the short message module supports two modes: The text mode based on instruction and the PDU mode based on at instruction. Text mode only supports 7-bit encoding, which can send pure English and digital information. PDU mode supports 7bit, 8bit, and UCS-2 encoding, in addition to the basic information, you can send Chinese messages. PDU mode is generally used.
Using a series of PDU SMS data as an example,
0891683108100005f011000d91685110906474f90008000a534e6e058fdc89c1ff01
The data can be divided into three parts:
-----------------------------------------------------------------------------------------
"0891683108100005f0" Center number segment
"11000D91685110906474F9000800" receiver number segment
"08_80e16d696167513f" Information section
-------------------------------------------------------------------------------------------
08_91_683108200505f0
040d91683119930093f60008800
15141652123044f60597d
0891683108200505f0
040d91683119930093f6000880015141652123044f60597d
To send a text message, you need to set the following number.
1. Center service number, relative to the address of the SMS server. Our SMS is not directly sent to another phone, must go through this SMS server relay. China Mobile Center Service number Encoding rules: +861380+ account area four long distance code +500. Long-distance area code less than 4 bits of the back of 0, such as Beijing for +861380_0100_500, Shenzhen for the +861380_0755_500
Center Service number: 08__91__683108100005F0
91 for the meaning of internationalization, must have.
683108100005f0: The odd bit and even bit flip can be 8613800100500F,PDU encoding rules, mobile phone number is odd, need to be the end of the F. 86 is the China area code.
When the center number terminal is formed, the Center service number is preceded by 86, followed by F, and then parity, and finally the 91 prefix is formed. The first half of the length of the center number represented by 08 is done.
2. Recipient's number
1100_0d91_685110906474f9_000800
The red part of the receiver number is fixed prefix, 0d91 these fields, indicating that the receiver device is mobile phone, 81 is PHS, 0 D is the recipient's mobile phone number length, 13 digits (country code + mobile number). The following number is the receiver mobile phone number, encoding similar, restore the words, first parity exchange, remove the previous country code and F suffix, get the receiver phone number is 15010946479.
3. Send Content
08_80e16d696167513f
Technorati Tags: SMS service
The sending content is encoded in Unicode, with the first byte being half the length of the information field (five characters, 20 bytes, half the length of 10 bytes, or 0A), and a Chinese character consisting of 4 characters.
Use the AT command to send the above SMS fields:
1. At---->ok
2. At+cmgf=0----->ok//set to PDU format
3. AT+CMGS=25//Set Send message length (for the actual transmission length of half, the recipient number + send content)
4. Enter all the SMS Code fields, press CTRL + Z to control the GSM module to send information.
Standard at instruction set communication, commonly used as follows:
In order to realize the Chinese text message, it is necessary to convert the Chinese encoding of GB2312 into the Unicode encoding of the code page CP936. The sender's PDU string differs from the receiver's PDU string.
The MC35 module supports Chinese text messages and supports GPRS functions.
Use SMS service in embedded devices