在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            [C51代碼]4*4鍵盤(pán)掃描

            作者: 時(shí)間:2016-11-10 來(lái)源:網(wǎng)絡(luò) 收藏
            程序如下:
            #include
            #define uint unsigned int
            #define uchar unsigned char
            sbit key3 =P2^0; //按鍵的行檢測(cè)信號(hào)
            sbit key2 =P2^1;
            sbit key1 =P2^2;
            sbit key0 =P2^3;
            sbit dis0 =P2^4;
            sbit dis1 =P2^5;
            sbit dis2 =P2^6;
            sbit dis3 =P2^7;
            sbit dis4 =P3^3;
            uchar keyx,key;
            uchar code disp[17]={0x00,0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
            0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
            void delay(uint i)
            {for(;i>0;i--)
            ;
            }
            uchar keyscan() //數(shù)碼管顯示掃描與鍵盤(pán)檢測(cè)
            {
            static dis=0;
            dis=(dis+1)%5;
            dis0=1;dis1=1;dis2=1;dis3=1;dis4=1;
            switch(dis) //位選碼輸出
            {
            case 0: dis0=0; break;
            case 1: dis1=0; break;
            case 2: dis2=0; break;
            case 3: dis3=0; break;
            case 4: dis4=0; break;
            }
            if(!key0) keyx=dis+1; //鍵盤(pán)的行檢測(cè)與譯碼
            if(!key1) keyx=dis+5;
            if(!key2) keyx=dis+9;
            if(!key3) keyx=dis+13;
            return keyx;
            }
            void main(void)
            { while(1)
            {
            key=keyscan();
            P0=disp[key];
            delay(3000);
            }
            }


            關(guān)鍵詞: C51代碼4*4鍵盤(pán)掃

            評(píng)論


            技術(shù)專(zhuān)區(qū)

            關(guān)閉