Joke Collection Website - Blessing messages - Is there a programming and connection diagram of GSM module tc35i controlled by AT89C5 1 single chip microcomputer, including the external circuit of TC35i? My email address is 25448652 1@qq.com, than
Is there a programming and connection diagram of GSM module tc35i controlled by AT89C5 1 single chip microcomputer, including the external circuit of TC35i? My email address is 25448652 1@qq.com, than
# include & ltintrins.h & gt
# include & ltstdio.h & gt
# include & ltmath.h & gt
# include & ltstdlib.h & gt
# include & ltstring.h & gt
# Define uint unsigned integer
# Define uchar unsigned characters
# Define uint unsigned integer
//void init(void);
//char j = ' \ 0 ';
char RS buf[40];
char code AT_SK[]= " >;
char Code AT _ Code[]= " OK ";
Bit flag = 0;
uchar RS point = 0;
sbit led 1=p2^3;
sbit led2=p2^2;
sbit led3=p2^ 1;
sbit led4=p2^0;
Invalid delay (unit z)
{
uint x,y;
for(x = z; x & gt0; x -)
for(y = 125; y & gt0; y-);
}
/***************************************8
***************************************/
void ClrRsBuf(char *p,int tt)
{
int I;
And (tt-)
{
* p = ' \ 0
p++;
}
}
//////////////////////////////////////
void Send_AT(void)
{uchar code mode [] = "at";
Ucal I;
Unsigned char * p;;
while( 1)
{
ClrRsBuf(RsBuf,sizeof(RS buf));
for(I = 0; I<2; i++)
{
SBUF = mode [I]; //Send table [i] to the send buffer.
And (! TI); //Wait for the transmission to complete
TI = 0;
}
SBUF = ' \ r
And (! TI); //Wait for the transmission to complete
TI = 0;
ES = 1; //
Delay (500);
p=strstr(RsBuf,AT _ Code);
If (p! = NULL)break;
}
}
/***********************************************************
:CMGF
:TXET? :? :?
***********************************************************/
void Send_CMGF
{ uchar I;
Uchar code mode [] = "at+cmgf =1";
Unsigned char * p;;
while( 1)
{
ClrRsBuf(RsBuf,sizeof(RS buf));
for(I = 0; I<9; i++)
{
SBUF = mode [I]; //Send table [i] to the send buffer.
And (! TI); //Wait for the transmission to complete
TI = 0;
}
SBUF = ' \ r
And (! TI); //Wait for the transmission to complete
TI = 0;
ES = 1; //
Delay (500);
p=strstr(RsBuf,AT _ Code);
If (p! = NULL)break;
}
}
/* * * * * * * * * * * * CSCS * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 8
********************************************/
Invalid CSCS (invalid)
{
Ucal I;
Uchar code mode [] = "at+CSCS = \" GSM \ "";
for(I = 0; I< 14; i++)
//while()
{
SBUF = mode [I]; //Send table [i] to the send buffer.
And (! TI); //Wait for the transmission to complete
TI = 0;
}
SBUF = ' \ r
And (! TI);
TI = 0;
SBUF = ' \ n
And (! TI); //Wait for the transmission to complete
TI = 0;
}
/***********************************************************
:CMGS
:SIM:? :?
***********************************************************/
void Send_CMGS
{
Ucal I;
Uchar code telephone [] = "at+cmgs = \"13474305153 \ "";
Unsigned char * p;;
while( 1)
{
ClrRsBuf(RsBuf,sizeof(RS buf));
for(I = 0; I<2 1; i++){
SBUF = phone[I]; //Send table [i] to the send buffer.
And (! TI); //Wait for the transmission to complete
TI = 0;
}
SBUF = ' \ r
And (! TI); //Wait for the transmission to complete
TI = 0;
ES = 1; //
Delay (500);
p=strstr(RsBuf,AT _ SK);
If (p! = NULL)break;
}
}
Void sending (void)
{
uchar I = 0;
Uchar code sms[]= "Gao Shuai 8553069 \ x1a"; //SMS? ,\x0 1a? Ctrl+Z
While (SMS [i]! ='\0')
{
SBUF = SMS[I]; //Send table [i] to the send buffer.
And (! TI); //Wait for the transmission to complete
TI = 0;
i++;
}
//SBUF = ' \ n ';
// while(! TI); //Wait for the transmission to complete
//TI = 0;
}
void init(){
TMOD = 0x 20;
th 1 = 0x FD; //bit=9600
TL 1 = 0x FD;
tr 1 = 1;
Ren =1; //Allow acceptance
SM0 = 0;
sm 1 = 1;
EA = 1;
ES = 1; //Open serial port interrupt
}
///////////////////////////////
/*void SendMsgStart(void)
{
Unsigned char *p, I =10;
ES = 1;
When (I-)
{
Delay (100); //Get " >
p=strstr(RsBuf,SK); //" >
If (p! = empty)
{
ClrRsBuf(RsBuf,sizeof(RS buf));
Delay (150); //Get " >
led 4 = 1;
Break;
}
}
}
*/
////////////////////////////
void main(){
init();
flag = 0;
led 1 = 0;
led 2 = 0;
led 3 = 0;
led 4 = 0;
Delay (50);
ES = 0;
Delayed (2000);
send _ AT();
led 1 = 1;
Delay (1000);
Send _ cmgf ();
led 2 = 1;
//Delay( 1000);
//CSCS();
Delay (1000);
Send _ cmgs (); //
led 3 = 1;
Delay (1000);
SEND();
led 4 = 1;
//SendMsgStart();
while( 1);
}
Invalid ser () interrupt 4
{
if(RI== 1)
{
RI = 0;
RS buf[RS point++]= SBUF;
if(RS point & gt; =sizeof(RsBuf))
{
RS point = 0; //flag RS485 = 0;
} //
}
}
I tried it myself, and there was no problem.
- Previous article:Usually I make more phone calls. What card should I use?
- Next article:How to set up Huawei mobile phone handwriting?
- Related articles
- Love words between men and women
- What was the last message left by Leslie Cheung?
- Others send text messages many times.
- How to print tobacco running water
- Yixin-The number of free text messages has increased from 10 to 50 per day. What is going on?
- The mobile phone has been hacked by someone else. Can't he see the message?
- How to send group messages to Apple's mobile phone WeChat?
- How to get rid of ants at home?
- Lines from the sketch "Buying Shoes"
- Penetrating and persuasive inspirational sayings (46 items)