|
#include "reg52.h"
sfr AUXR=0x8e;
unsigned char command=0x00;
void Inituart()
{TCON=0x20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
SCON=0x50;
AUXR=0x00;
ES=1;
EA=1;
}
void uartserive()interrupt 4
{if(RI==1)
{command=SBUF;
RI=0;
}
}
void send(unsigned char dat)
{SBUF=dat;
while(TI==0);
TI=0;
}
void sendstring(unsigned char *str)
{while(*str!='\0')
{
send(*str++);
}
}
void main()
{ Inituart();
sendstring("welcome to system!\r\n");
while(1)
{
}
} |
|