#include<reg52.h> 
#define unit unsigned int             为啥按下P10键两三次或者四五次之后数码管显示数字才加1啊?而且此处delay函数去掉和不去掉显示现象为什么会没有区别呢??求大神指教 
#define uchar unsigned char 
sbit P21=P2^1; 
sbit P10=P1^1;                          
uchar table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x02,0xf8,0x80,0x90}; 
void delay(unit x) 
{ 
        unit i,j; 
        for(i=0;i<x;i++) 
        for(j=0;j<110;j++); 
} 
void main() 
{ 
    int num=0; 
        P21=0; 
        while(1) 
        { 
           if(P10==0) 
           { 
            if(num<9) 
                { 
                 delay(10); 
                 if(P10==0) 
                 { 
                   P0=table[num]; 
                   num++; 
                 } 
                 } 
 
                } 
          while(!P10); 
        } 
} |  
  
 
 
 
 
 |   
 |  
  
 |