|
現(xiàn)在的問(wèn)題是:如果我成功顯示了數(shù)字2,但是我在不復(fù)位的情況下,不能再次通過(guò)串口通信來(lái)讓數(shù)碼管顯示數(shù)字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;
}
|
|