单片机 GSM模块
代码:
#include
#include
#define uchar unsigned char
#define uint unsigned int
***it P10=P1^0;
***it P11=P1^1;
***it P12=P1^2;
***it P13=P1^3;
***it P14=P1^4;
***it P15=P1^5;
***it P16=P1^6;
***it P17=P1^7;
#define FOSC_110592M
//#define FOSC 12000000L
uchar rec_data[50];
uchar rec_num;
static uchar phonenum[50]="454646564";
//uchar sendsms[25];
uchar flag;
void SerialInti()
{
TMOD=0x20;
#ifdef FOSC_12M
TH1=0xf3;
TL1=0xf3;
#else
TH1=0xfd;
TL1=0xfd;
#endif
TR1=1;
SM0=0;
SM1=1;
REN=1;
EA=1;
ES=1;
}
void DelaySec(int sec)
{
uint i , j= 0;
for(i=0; i
{
for(j=0; j<65535; j++)
{
}
}
}
void Serial_interrupt() interrupt 4
{
uchar temp;
temp=SBUF;
rec_data[rec_num++]=temp;
if(rec_num>=50)
rec_num=0;
else
;
RI=0;
//¢P16=0;
//DelaySec(1);
//P16=1;
}
void Uart1Sends(uchar *str)
{
while(*str!='