余章健
級(jí)別: 探索解密
![]() |
編寫(xiě)一個(gè)C語(yǔ)言程序,要求:在數(shù)碼管上顯示9~0的數(shù),每位數(shù)顯示時(shí)間為2秒鐘,循環(huán)往復(fù);且第一次按下按鍵后點(diǎn)亮LED1,第二次按下按鍵后點(diǎn)亮LED2,第三次按下按鍵后LED1、LED2全部熄滅,第四次按下按鍵后回到第一次按下后的狀態(tài)。 #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);} } } 求上述中的中斷函數(shù)如何編寫(xiě)。 [ 此帖被余章健在2012-11-20 13:38重新編輯 ] |
---|---|
|