4169 views|7 replies

70

Posts

0

Resources
The OP

51 MCU controls SIM300 to send and receive data [Copy link]

Dear experts, I want to use 51 to control SIM300 to send and receive data through the serial port. Now I have connected the SIM300 module and 51 experimental board through the serial port, but the module does not respond after writing the program. I don't know why. Do I need to initialize the module? I posted the program here to trouble you to see if there is any problem. In addition, I want to use the serial port to receive a string and determine whether the received string is the one I want. How can I do it? I have tried several methods but none of them worked. #include
#define unchar unsigned char #define unint unsigned int unchar *re; void chushihua() { TMOD=0x20; TH1=0xfd; TL1=0xfd; TR1=1; SM0=0; SM1=1; REN=1; EA=1; ES=1; PCON=0x00; } void send_byte(unchar c) { SBUF=c; while(TI!=1); TI=0; } void send_string(unchar *str) { while(*str!='\0') { send_byte(*str++); } } chuli() { if(re=="error")//Judge whether the received string is "error" (I don't know if this is the right way to do it)——! { send_string("ATD4302099"); send_byte(0x0d); } } main() { chushihua(); send_string("ATD4302099"); delay(); send_byte(0x0d); chuli(); } void reveive() interrupt 4 { if(RI) { *re=SBUF; re++; RI=0; } }
This post is from Embedded System

Latest reply

It seems that you initialize the pin   Details Published on 2008-7-8 11:45

81

Posts

0

Resources
2
Let me tell you a good method: go to the Internet to download a serial port debugging assistant, and you can see at a glance what you sent and what you received~~
This post is from Embedded System

70

Posts

0

Resources
3
I have used this software, sending and receiving are normal, but the module just doesn’t respond, I am so depressed. . . . .
This post is from Embedded System

69

Posts

0

Resources
4
As long as the baud rate is set correctly and the serial port is open, there should be no problem. You can send the two characters AT. Of course, don't forget to add the carriage return after it, that is, \r~~~ If successful, it will return ok. If not, it depends on whether your hardware has a problem.
This post is from Embedded System

70

Posts

0

Resources
5
This is not wireless, right?
This post is from Embedded System

90

Posts

0

Resources
6
The RTS line of SIM300 Serial port 1 is not pulled low, or use Serial port 2. Port 1 is a seven-wire system, and port 2 is a two-wire system.
This post is from Embedded System

63

Posts

0

Resources
7
After booting, wait until Call Ready appears before sending the ATD command. It is best to use the serial port assistant to debug the module first, and then write the program, which will save debugging time.
This post is from Embedded System

74

Posts

0

Resources
8
It seems that you initialize the pin
This post is from Embedded System

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list