在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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>

            新聞中心

            EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 2051的比較器模擬AD源程序(C語言)

            2051的比較器模擬AD源程序(C語言)

            作者: 時間:2011-05-17 來源:網(wǎng)絡 收藏

            2051的(C)

            本文引用地址:http://www.biyoush.com/article/150738.htm

            /* io分配: *
            ;* OUTPUT: *
            ;* P1.0 ...... 量輸入 *
            ;* P1.1 ...... DA輸入基準電壓 *
            ;* P1.2~7..... R-2R DA電阻網(wǎng)絡 *
            ;* P3.7 ...... LED 亮度輸出 *
            ;* CPU CLOCK EQU 6M */
            //xiaoqi last edit in 2001.11
            //#pragma src
            #i nclude AT89x051.h
            #i nclude stdlib.h>
            #i ncludemath.h>
            #i ncludeintrins.h>

            //變量類型標識的宏定義,大家都喜歡這么做
            #define Uchar unsigned char
            #define Uint unsigned int

            #define Ledlight() (P3 = 0x7f)
            #define Leddark() (P3 |= 0x80)

            sbit P36 = P3^6; // 器內(nèi)部判斷腳
            sbit LED = P3^7; // 一個發(fā)光二級管觀察亮度變化

            // 內(nèi)部標志位定義
            bit less; // 比較是否大于 1.小于,0.大于

            // 全局變量定義
            Uchar timer1, // 通用延時計數(shù)器
            timer2, // 按鍵蜂鳴器反應定時器
            adcdata, // ad轉(zhuǎn)換變量
            pwm1; // PWM輸出比例

            // 函數(shù)列表
            void DelayMs(unsigned int number); // 毫秒延時
            void timers0(); // 在定時器中斷中做數(shù)碼管的掃描顯示(ct0)
            void Initall(void); // 系統(tǒng)初始化
            void timers1(void); // TC1定時器中斷用于掃描顯示與鍵盤
            Uchar adcread(void); // adc轉(zhuǎn)換程序

            void main(void) using 0
            {
            DelayMs(120);
            Initall();
            pwm1 = adcread();
            LED=1;
            while(1)
            {
            pwm1 = adcread();
            timer2=10;
            while (timer2);
            }
            }

            // 毫秒延時
            void DelayMs(unsigned int number)
            {
            unsigned char temp;

            for(;number!=0;number--)
            for(temp=112;temp!=0;temp--);
            }

            /*************************************
            在定時器中斷中做LED的PWM輸出
            *************************************/
            void timers0() interrupt 1 using 1
            {
            TH0 = 0xff;
            TL0 = 0xd0;
            timer1--;
            if (timer1==pwm1)LED=0;
            if (timer1==0){
            LED=1;
            timer1=0x40;
            timer2--;
            };
            }

            比較器相關(guān)文章:比較器工作原理


            塵埃粒子計數(shù)器相關(guān)文章:塵埃粒子計數(shù)器原理
            蜂鳴器相關(guān)文章:蜂鳴器原理

            上一頁 1 2 下一頁

            關(guān)鍵詞: 語言 源程序 AD 模擬 比較

            評論


            相關(guān)推薦

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

            關(guān)閉