我用串口调试助手向单片机发送数据 并让P2口的数码管显示 我发送了 p2口怎么没有变化啊
#include<reg52.h>#defineucharunsignedchar#defineuintunsignedintuinti=0;uchartable[]={...
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uint i=0;
uchar table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80};
void init();
void display(uchar);
void main()
{
init();
while(1);
}
void init()
{
TMOD=0X02;
TH0=0Xfd;
TL0=0Xfd;
TR0=1;
REN=1;
SM0=0;
SM1=1;
EA=1;
ES=1;
}
void ser() interrupt 4
{
uchar a;
RI=0;
a=SBUF;
display(a);
}
void display(uchar temp)
{
P2=table[temp];
} 展开
#define uchar unsigned char
#define uint unsigned int
uint i=0;
uchar table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80};
void init();
void display(uchar);
void main()
{
init();
while(1);
}
void init()
{
TMOD=0X02;
TH0=0Xfd;
TL0=0Xfd;
TR0=1;
REN=1;
SM0=0;
SM1=1;
EA=1;
ES=1;
}
void ser() interrupt 4
{
uchar a;
RI=0;
a=SBUF;
display(a);
}
void display(uchar temp)
{
P2=table[temp];
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询