Joke Collection Website - Blessing messages - Find a program that 5 1 single chip microcomputer controls TC35 to send short messages.

Find a program that 5 1 single chip microcomputer controls TC35 to send short messages.

I have my own transmission volume.

/***********************************************************

***********************************************************/

//#include "stc 15.h" // contains stc 15 microcontroller register definition file.

# including "STC 15F2K.h"

//#include "LCD 12864。 h "

# include & ltintrins。 H & gt

Typedef unsigned character unint8

Typedef unsigned charunint16;

#ifndef uchar

# Define uchar unsigned characters

#endif

#ifndef uint

# Define uint unsigned integer

#endif

#define SEND "AT+CMGS=\ "phone number \"\r\n"

Unsigned character qwh

Sbit buzzer = p0^6;;

Sbit relay = p0^4;;

sbit key=p3^2;

Invalid delay (uchar t, uchar y)

{

uint i,j;

for(I = 0; I & lty;; i++)

for(j = 0; j & ltt; j++);

}

Invalid initialization (invalid)

{//9600 bps @ 1 1.0592 MHz

PCON & amp; = 0x7F// Baud rate is different.

SCON = 0x 50; //8-bit data with variable baud rate

AUXR | = 0x40// timer 1 clock is Fosc, that is,1t.

AUXR & amp= 0xFE// serial port 1 select timer 1 as baud rate generator.

TMOD & amp; = 0x0F// Clear timer 1 mode bit.

TMOD | = 0x 20; //Set the timer 1 to 8-bit automatic overload mode.

TL 1 = 0x DC; //Set the timing initial value

th 1 = 0x DC; //Set the timer overload value

et 1 = 0; //Disable timer 1 interrupt.

tr 1 = 1;

ES = 1; //Enable serial interrupt

EA = 1;

}

Void send data (uchar dat)

{

//while(busy _ CK); //Wait for the previous data transmission to be completed.

//busy _ CK = 1;

SBUF = dat// Write data into UART data register.

while(TI = = 0);

TI = 0;

}

/* -

Send string

- */

Void send string (uchar *s)

{

While (*s) // Detect the end of string flag.

{

send data(* s++); //Send the current character

}

}

/****************************************************************************/

Empty fs (empty)

{

int I;

send string(" AT+CMGF = 1 \ r \ n "); //m mode setting

for(I = 0; I & lt50; i++)

Delay (8888, 8888);

SendString; //The phone number is defined at the top.

for(I = 0; I & lt50; i++)

Delay (8888, 88888);

SendString ("Warning! Someone broke into the house! \ r \ n "); //SMS content

for(I = 0; I & lt50; i++)

Delay (8888, 8888);

send data(0x 1a); //terminator

}

Invalid master (invalid)

{

int flage=0,i=0,j = 0;

InitUART();

while( 1)

{

Relay = 0;

P2 = 0xa 0;

P2 = 0x 00;

if(key = = 1 & amp; & ampflage==0)

{

//p 1 = 0x ff;

Relay =1;

P2 = 0xa 0;

P2 = 0x 00;

fs();

flage = 1;

}

if(flage== 1)

{

p 1 = 0x ff;

}

Delay (8888, 8888);

i++;

If (i & gt=500)

{

flage = 0;

I = 0;

}

}

}

Use 1 to invalidate Uart_Isr () interrupt 4.

{

Intermediate frequency (RI)

{

RI = 0; //Clear the reception interrupt flag

//a[pi]= SBUF; //P0 displays UART data.

}

Intermediate frequency (TI)

{

TI = 0; //Clear the send interrupt flag

}

//pi++;

}