#include <reg52.h> #define uint unsigned int #define uchar unsigned char uchar duan[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; sbit w1=P2^0; sbit w2=P2^1; uint num=0; void delay(uint n) { while(n--); } main() { while(1) { w1=0; w2=0; P3=duan[num%10]; P2=duan[num/10]; delay(50000); num++; if(num==99) { num=0; } } }