#include "reg52.h"
typedef unsigned int uint;
typedef unsigned char uchar;
uchar zifuchuan[]="6544 ";
void delay(unsigned char i)
{
unsigned char j,k;
for(j=i;j>0;j--)
{
for(k=90;k>0;k--);
}
}
void ustartinit()
{
SCON=0X50; //???????1
TMOD=0X20; //?????????2
PCON=0X80; //?????
TH1=0XF3; //????????,??????4800?
TL1=0XF3;
ES=1; //??????
EA=1; //?????
TR1=1; //?????
}
void send(uchar d)
{
SBUF=d;
TI=1;
while(!TI);
TI=0;
}
void sendc(uchar *pd)
{
while((*pd)!='\0')
{
send(*pd);
pd++;
}
}
void main()
{
ustartinit();
while(1)
{
sendc(zifuchuan);
}
}
void uart(void) interrupt 4
{
uchar receiveData;
receiveData=SBUF;//????????
RI = 0;//?????????
SBUF=receiveData;//???????????????
while(!TI); //????????
TI=0;
}
|