The AT command is used between the single-chip microcomputer and the GSM engine, so it is necessary to understand the format of the AT command and several common instructions. More detailed information can be referred to the GSM07.05 and GSM07.07 specification.
The AT instruction sent by the single chip microcomputer is used to establish a communication link, and the command format frame of the AT instruction set is started with AT, and below is a few common AT instructions.
1. Set short message center
AT CSCA = " 8613800270500" Enter (the specific number is determined by the local operator.)
2. Receive short messages
CMTI: "SM", X (x indicates a SIM card storage number receiving short message)
AT CMGR = X Enter (read short message from the X memory)
AT CMGD = X Enter (remove short messages from X storage area)
3. Send a short message
AT CMGF = 1 Enter (send in text format, if using PDU format, AT CMGF = 0)
AT cmgs = " 8613xxxxxxxx" Enter
> Enter a short message. CRTL z ends and sent.
4. Important instruction
ATZ; E Enter Echo Off
ATZ; E1 Enter Echo On
AT CREG? Enter x (x = 2 off-network, x = 1 registration, x = 0 is unknown)
AT COPS? Enter to indicate whether the SIM card is accepted by the network
AT COPS =? Enter all available networks.
5. Establish a voice call
AT CREG? Enter (Whether online registration)
ATD13XXXXXXXXXXX; Enter (voice call and data call establishment) on the semicolon received after the number)
6. Change and save parameters
AT IPR = 2400 Enter (change RS232 port speed to 2400bps)
AT & W Enter (save the modified parameters)
7. Enter the PIN code
AT cpin = "xxxx"
After the communication link is established, the microcontroller can send an information unit frame, and the frame format of the information is as follows:
Where the frame head starting with the flag frame is 10h and 02h, the flag information ends 10h and 03h, and the last two is the result of the data part and the results of the mold in the subsequent sample, and use the check bit. For the data bits, in order to avoid the end flags of the error, it is specified that each of the 10h codewords will appear, and an empty character 00h is inserted. If the information is received, the empty character should be removed accordingly. If the data portion and the BCS portion received by the receiving end are not equal to 0, it means that the transmission is an error, and the received information is lost.