单片机通过无线透传模块向电脑发送数据的程序,为什么显示一直不正确 50
#include<reg51.h>unsignedchari=0;unsignedchara[13]="hello";voidinit(){PCON=0X00;SCON=...
#include<reg51.h>
unsigned char i=0;
unsigned char a[13]="hello";
void init()
{
PCON = 0X00;
SCON = 0X50;
TMOD=0X20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
ES=1;
EA=1;
TI=1;
}
void main()
{
init();
while(1)
{
if(i == 6) {
i = 0;
TI = 1;
}
}
}
void uart() interrupt 4
{
if(RI == 1) RI = 0;
if(TI == 1) {SBUF = a[i++]; TI = 0;}
} 展开
unsigned char i=0;
unsigned char a[13]="hello";
void init()
{
PCON = 0X00;
SCON = 0X50;
TMOD=0X20;
TH1=0xfd;
TL1=0xfd;
TR1=1;
ES=1;
EA=1;
TI=1;
}
void main()
{
init();
while(1)
{
if(i == 6) {
i = 0;
TI = 1;
}
}
}
void uart() interrupt 4
{
if(RI == 1) RI = 0;
if(TI == 1) {SBUF = a[i++]; TI = 0;}
} 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询