中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)精華之利用內(nèi)置定時(shí)器對(duì)外部按鍵進(jìn)行計(jì)數(shù)

        單片機(jī)精華之利用內(nèi)置定時(shí)器對(duì)外部按鍵進(jìn)行計(jì)數(shù)

        作者: 時(shí)間:2016-11-21 來(lái)源:網(wǎng)絡(luò) 收藏
        問(wèn)題描述:

        前面焊好的板子,按鍵按下10次以后,點(diǎn)亮led

        本文引用地址:http://www.antipu.com.cn/article/201611/319250.htm

        上代碼:

        #include

        sbit led = P1^0;

        unsigned int counter = 0;

        void init(void)
        {
        led = 0;
        TMOD = 0x06; // counter and 8-bit auto-reload
        TH0 = 256 - 1;
        TL0 = 256 - 1;
        ET0 = 1;
        EA = 1;
        TR0 = 1;
        }

        void key_counter() interrupt 1
        {
        counter ++;
        if(counter >= 3)
        {
        led = 1;
        }
        if(counter >=6)
        {
        counter = 0;
        }

        }


        void main()
        {
        init();
        while(1);
        }

        注意此時(shí)外部脈沖輸入的界限是P3.4口



        評(píng)論


        技術(shù)專區(qū)

        關(guān)閉