请问高手,我错在哪里

2019-07-15 16:14发布

用了两个外部中断,想用其中一个做计数,数码管显示不正常,还有按键消抖不会用,请指点,谢谢
#include<reg52.h>
  #include<intrins.h>
#define uint unsigned int
#define uchar unsigned char

sbit bai=P2^2;
sbit shi=P2^1;
sbit ge=P2^0;
sbit RST_0 = P3^0;
uint num;
void dispiay();
uchar code DIS_SEG7[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
void display( num)
{
P0=DIS_SEG7[num/100];
bai=0;
delay(3);


P0 = DIS_SEG7[num%100 / 10]; //输出段码
shi=0; //显示位置
delay(3); //显约3ms


P0 = DIS_SEG7[num % 10];
ge =0;
delay(3);

}void display(uint num)
{
P2 = 0;
P0 = DIS_SEG7[num/100];
P2=0xfb;
delay(3);
P2 = 0;
P0 = DIS_SEG7[num%100 / 10]; //输出段码
P2=0xfd; //显示位置
delay(3); //显约3ms
P2 = 0;
P0 = DIS_SEG7[num % 10];
P2=0xfe;
delay(3);
}

  void main()
        {  P1=0xfb;P2=0xf8;num=0;
EA=1;IT0=1;IT1=1;EX0=1;EX1=1;while(1);
}

if (RST_0 == 0) {
delay(10);

if (RST_0 == 0) num = 0;
while(RST_0== 0) delay(10);}

void k1() interrupt 0
{  P1=0xfc;delay(250);P1=0xfb;
num++;
display(num);
if (num >= 1000) num = 0;delay(10);}
void k2() interrupt 2
{         P1=0xf7;delay(250);
P1=0xfb;delay(400);
P1=0xef;delay(250);
P1=0xfb; }

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。