- #include <REGX52.H>
- #define uchar unsigned char
- #define shu P0
- unsigned char code a[]={0x3f,0x6,0x5b,0x4f,0x66,0x6d,0x7d,0x7,0x7f,0x6f};
- uchar j,k;
- void delay(uchar i)
- {
- for(j=i;j>0;j--)
- for(k=125;k>0;k--);
- }
- void xian(uchar shi,uchar ge)
- {
- P2=0xE7;
- shu=a[shi];
- delay(5);
- shu=0x00;
- P2=0xe3;
- shu=a[ge];
- delay(5);
- }
- uchar i=0,shi1=0,ge1=0,ji=0;
- void main()
- {
- i=0;
- while(i<60)
- {
- i++;
- shi1=i/10;
- ge1=i%10;
- while(ji<50)
- {
- ji++;
- xian(shi1,ge1);
- }
- }
- }
复制代码 这个程序写的总是卡在01就不进行了。不知道哪里错了有大佬看看吗
|