大神幫我看一下,這個簡單的程序為什么功能是錯誤的,編譯沒有問題。- #include<reg52.h>
- sbit SMG_SEG=P0;
- sbit SMG_GPIO=P2;
- unsigned char code SEG[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
- unsigned char code GPIO[8]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
- unsigned char DisplayData[2];
- void DigDisplay()
- {
- unsigned char i;
- unsigned int j;
- for(i=0;i<2;i++)
- {
- SMG_GPIO = GPIO[i];
- SMG_SEG = DisplayData[i];
- j=50;
- while(j--);
- SMG_SEG =0x00;
- }
- }
- void Display()
- {
- DisplayData[0] = SEG[0];
- DisplayData[1] = SEG[1];
- DigDisplay();
- }
- void main()
- {
- while(1)
- {
- Display();
- }
- }
復制代碼
|