这是我的代码,数码管的电平是一直有变化的,但就是不显示数字
- #include <reg52.h>
- #include <intrins.h>
- #define uchar unsigned char
- #define uint unsigned int
- uchar code shuzi[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
- void delayms (uint z)
- { uint x,y;
- for(x=z;x<=110;x++)
- for(y=110;y<110;y++);
- }
- void display()
- {
- uint i,wela=0X80;
-
- for(i=0;i<8;i++)
- { P2=0xff;
- P0=shuzi[i];
- wela=_crol_(wela,1);
- P2=wela;
- delayms(30);
- }
- }
- void main()
- {
- while(1)display();
- }
复制代码 |