初学者,求解答,程序如下
- #include<reg51.h>
- #define uchar unsigned char
- xdata uchar num[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
- void delay(uchar i)
- {
- uchar t;
- while(i--)
- {
- for(t=0;t<120;t++);
- }
- }
- void main()
- {
- uchar i;
- P0=0Xff;
- while(1)
- {
- for(i=1;i<=9;i+=2)
- {
- P0=num[i];
- delay(500);
- }
- for(i=0;i<=8;i+=2)
- {
- P0=num[i];
- delay(500);
- }
- }
- }
复制代码 |