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

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

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

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

      2. 新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 51單片機(jī)中定時(shí)器的小程序

        51單片機(jī)中定時(shí)器的小程序

        作者: 時(shí)間:2013-03-04 來源:網(wǎng)絡(luò) 收藏

        今天我開始了對51中的進(jìn)行了學(xué)習(xí),并寫了一個(gè)小程序。

        #i nclude

        sbit P0_1=P0^1; //定義位變量

        /*********************************************************

        *

        * 16個(gè)循環(huán)為1秒

        *

        **********************************************************/

        void Delay(count)

        {

        int i;

        while(--count != 0)

        {

        for(i = 0; i 125; i++); // ";" 表示空語句,CPU空轉(zhuǎn)。

        } // i 從0加到125,在12M晶體下CPU大概耗時(shí)1毫秒

        }

        /*********************************************************

        中斷子程序

        ************************************************************/

        void time0_server_(void) interrupt 2

        {static time0_server_count;

        time0_server_count++;

        if(time0_server_count==16)

        {P0_1=~P0_1;

        time0_server_count=0;

        }

        TF0=0;

        Delay(20);

        }

        main()

        { TH0=0x0B;

        TL0=0xDC;

        P0_1=0;

        EA=1;

        ET0=1;

        TR0=1;

        while(1);

        }

        該程序主要是用來了解的運(yùn)行規(guī)律,并對他進(jìn)行必要的應(yīng)用。

        通過對其進(jìn)行實(shí)驗(yàn),我大致的對其有了一些了解,其主要用途有定時(shí),記數(shù),中斷。等等。



        評論


        相關(guān)推薦

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

        關(guān)閉