Joke Collection Website - Public benefit messages - How to control SIM300 with single chip microcomputer (function: send English information to the set mobile phone)? Seek procedures.
How to control SIM300 with single chip microcomputer (function: send English information to the set mobile phone)? Seek procedures.
Program description:
This program realizes sending an English short message and sending the instruction of 10086 to this number.
1. All our programs communicate with SIM300 through serial port 2 of single chip microcomputer. Serial port 1 is used to download programs and observe the data returned by SIM300.
(The data returned by SIM300 received by serial port 2 will be sent to the computer through serial port 1 for data observation). In use, if not,
There is no need to replace the jumper cap if there are special requirements.
2. Put the mobile phone card on the development board, connect the antenna, turn on the power and connect the earphone.
3. The compiler is downloaded to the single chip microcomputer and downloaded by STC—ISP. Please refer to the tutorial for details.
4. Press button 4 to send an instruction to query the current service status. When the service status shows China Mobile, it proves that the network has been found and can be connected normally.
Yes, if 0,0 is displayed, press button 4 again until China movement appears.
5. Press key 5 to send the instruction setting 10086. The phone number was sent by text message.
6. At this point, the serial port will reply' >'
6. Press button 6, set the sending content, send short messages, and return to +CMGS through the serial port after success. ..
*************************************************************/
# including "stc 12c5a.h"
# contains "systerm.h"
# includes "gprs.h"
# contains "timer.h"
void main()
{
//Adjust the loading value of the input function to change the baud rate of the serial port.
//UART 1 init(0, 1, 184); //Initialize the serial port and set the baud rate to 4800.
//UART 2 init(0, 1,220); //Initialize the serial port and set the baud rate to 9600.
//UART 2 init(0, 1,232); //Initialize the serial port and set the baud rate to 14400.
//UART 1 init(0, 1,253); //Initialize the serial port and set the baud rate to 1 15200.
timer 0 init();
Uart 1Init(0, 1,220); //Initialize the serial port and set the baud rate to 9600.
Uart2Init(0, 1,220); //Initialize the serial port and set the baud rate to 9600.
//It takes about 3 seconds to start the Sim300 by pressing the reset key.
GPRS _ RST = 0; //The reset key of //Sim300 is pulled low.
Dreisek (3); //Delay for 3 seconds
GPRS _ RST = 1; //The reset key of //Sim300 is pulled high.
//Sim300 startup is complete.
LED5 _ OFF
LED6 _ OFF
LED7 _ OFF
LED8 _ OFF
while( 1)
{
If(KEY4_PRESS)// key 4 sends an instruction to query the current service status.
{
While (key 4 _ pressed)
{
LED8 _ ON
}
LED8 _ OFF
Uart2Sends("at+cops? \ r "); //Send an instruction to query the current service status.
}
If(KEY5_PRESS)// Press key 5 to send an instruction to send a phone number 10086.
{
While (key 5 _ pressed)
{
LED7 _ ON
}
LED7 _ OFF
UART 2 sends(" AT+CMGF = 1 \ r "); //Set the English mode to send. Of course, AT+CMGF=0 can also be used in Chinese, but the sending mode is different. Please refer to relevant procedures for details.
Dreisek (1);
UART 2 sends(" AT+CMGS = \ " 10086 \ " \ r "); //Send instruction setting 10086 The phone is the number sent by SMS.
}
If(KEY6_PRESS)// Press 6 to send the content.
{
While (key 6 _ pressed)
{
LED6 _ ON
}
LED6 _ OFF
UART 2 sends(" 103 "); // 103 is the content sent.
UART 2 send(0x 1a); //End with 0x 1a, indicating the end of the content, and send a short message.
}
}
}
- Previous article:What if the in-laws are eccentric?
- Next article:30 1.7 How much is the deduction from Shang Hui Bank?
- Related articles
- Why can't I set the background for text messages on Lenovo a820t? It used to be possible. After I deleted the useless text messages, the background became white?
- Blessings for the Year of the Tiger in 2022. In this year, will everyone have everything they wish for and have good luck?
- How to send some encouraging messages to my girlfriend on her first day at work?
- Official portal of Zhumadian Vehicle Violation Inquiry System
- Looking for some blank sentences or paragraphs that describe characters.
- Mobile phone automatically sends 156 1 to 10086 Why?
- Go to SMS update log
- How does Shandong Airlines stipulate to bring cosmetics?
- Words of thanking customers in the New Year (46 sentences)
- What information do I need to write on the envelope? Can I write the contact number of the recipient?