现在的问题是:如果我成功显示了数字2,但是我在不复位的情况下,不能再次通过串口通信来让数码管显示数字3。希望大家教我一下。谢谢大家!!
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit du=P2^6;
sbit we=P2^7;
uchar a;
char code table []={0x3f,0x06,0x5b,0x4f,0x66,0x6d, 0x7d,0x07,0x7f,0x6f,0x77,0x7c, 0x39,0x5e,0x79,0x71};
void main()
{
SCON=0X50;
PCON=0x00;
TMOD=0X20;
EA=1;
ES=1;
TL1=0Xfd;
TH1=0Xfd;
TR1=1;
du=0;
we=0;
while(1) ;
}
void zhongduan() interrupt 4
{
ES=0;
RI=0;
a=SBUF;
we=1;
P0=0x00;
we=0;
P0=0xff;
du=1;
P0=table[a];
du=0;
EA=1;
}
|