編寫一個C語言程序,要求:在數碼管上顯示9~0的數,每位數顯示時間為2秒鐘,循環往復;且第一次按下按鍵后點亮LED1,第二次按下按鍵后點亮LED2,第三次按下按鍵后LED1、LED2全部熄滅,第四次按下按鍵后回到第一次按下后的狀態。
       #include "reg51.h"
             #define uint unsignet  int
             sbit  SB=P3^0;
             void mDelay(uint Delay)
             {uint  j;
             for(;  Delay>0;Delay--)
             {for(j=0;j<=125;j++)
             {;}   }   }
             voidmain()
{ unsigned char  i,SEG[    ]={0x90,0x8,0xf8,0x82,0x92,0x99,0xb0,0xa4,0xf9,0xc0};
             for(;;)
             {for(i=9;i>=0;i--)
             {P1=SEG[ i ]mDelay(20000);}    
     }          }
                 求上述中的中斷函數如何編寫。
[ 此帖被余章健在2012-11-20 13:38重新編輯 ]