我新手,我也不太明白,这个只是别人出的题目,这是我编的,不知哪里错了unsigned char num[]={0XC0,0XF9,0XA4,0XB0,0X99,0X92,0X82,0XF8,0X80,0X90,0X88,0X83,0XC6,0XA1,0X86,0X8E};unsigned char buff[6]={0XFF,0XFF,0XFF,0XFF,0XFF,0XFF};void main(){ unsigned int cnt=0; unsigned long sec=0; int i=0; P11=0; TMOD=0X01; TH0=0XF5; TL0=0X96; TR0=1; while(1) { TF0=0;TH0=0XF5;TL0=0X96;cnt++;if(cnt>=1000){cnt=0;sec++;buff[0]=num[sec%10];buff[1]=num[sec/10%10];buff[2]=num[sec/100%10];buff[3]=num[sec/1000%10];buff[4]=num[sec/10000%10];buff[5]=num[sec/100000%10];}switch(i){case 0:P22=0;P21=0;P20=0;i++;P0=num[0];break;case 1:P22=0;P21=0;P20=1;i++;P0=num[1];break; case 2:P22=0;P21=1;P20=0;i++;P0=num[2];break;case 3:P22=0;P21=1;P20=1;i++;P0=num[3];break;case 4:P22=1;P21=0;P20=0;i++;P0=num[4];break;case 5:P22=1;P21=0;P20=1;i++;P0=num[5];break;}}}