#include "reg52.h"
typedef unsigned char u8;
typedef unsigned int u16;
u8 str[]=“請輸入文字";
void delay100ms(void)
{
unsigned char a,b,c;
for(c=19;c>0;c--)
for(b=20;b>0;b--)
for(a=130;a>0;a--);
}
void UartInit() //?????????????????
{
TMOD=0x20; //
TH1=0xf3;
TL1=0xf3;
PCON=0x80;
TR1=1;
SCON=0x50;
ES=1;
EA=1;
}
void UartSend(char *Data,char len)
{
u8 i;
for(i=0;i<len;i++)
{
SBUF=*Data++;
while(!TI);
TI=0;
}
delay100ms();
}
void main() //??????
{
while(1)
{
UartInit();
UartSend(str,10);
}
}
|