#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code tr[]={'w',0x0d,0x0a,0x00} ;
void init();
void send(uchar *txt) ;
void delay1ms(uint i) ;
void main()
{ while(1)
{init();
send(tr);
}
}
void init()
{
TMOD=0x20;
PCON=0x00;
TH1=TL1=0xfd;
SCON=0x40;
TR1=1;
}
void send(uchar *txt)
{ uchar *p;
p=txt;
while(1)
{while(*p!=0x00)
{ SBUF=*p;
while(!TI);
TI=0;
p++;
}
delay1ms(500);
}
}
void delay1ms(uint i)
{
uchar j ;
while(i--)
{
for(j=115;j>0;j--)
{;
}
}
}
此帖出自
小平头技术问答
一周热门 更多>