第1个回答 2014-11-11
#include "reg51.h"
void initUart(void)
{
TMOD|=0x20;
SCON=0x50;
TH1=0xfd;
TL1=0xfd;
TR1=1;
ES=1;
}
void uart(void) interrupt 4
{
if(RI)
{
RI=0;
//add your code here.
}
else
TI=0;
}
void int0(void) interrupt 0
{
}
void int1(void) interrupt 2
{
}
void main(void)
{
IT0=1;
EX0=1;
IT1=1;
EX1=1;
PS=1;
initUart();
EA=1;
}