在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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) > 設(shè)計應用 > 單片機中斷測量速度的程序帶仿真文件

            單片機中斷測量速度的程序帶仿真文件

            作者: 時間:2016-12-02 來源:網(wǎng)絡(luò) 收藏

            void ddelay(uint k)
            {
            uint i,j;
            for(i=0;i {
            for(j=0;j<60;j++)
            {;}
            }
            }
            /**********寫指令到LCD子函數(shù)************/

            void WriteCommandLCM(uchar WCLCM,uchar BusyC)
            {
            if(BusyC)lcd_wait();
            DATAPORT=WCLCM;
            LCM_RS=0; /* 選中指令寄存器*/
            LCM_RW=0; // 寫模式
            LCM_EN=1;
            _nop_();
            _nop_();
            _nop_();
            LCM_EN=0;

            }

            /**********寫數(shù)據(jù)到LCD子函數(shù)************/

            void WriteDataLCM(uchar WDLCM)
            {
            lcd_wait( ); //檢測忙信號
            DATAPORT=WDLCM;
            LCM_RS=1; /* 選中數(shù)據(jù)寄存器 */
            LCM_RW=0; // 寫模式
            LCM_EN=1;
            _nop_();
            _nop_();
            _nop_();
            LCM_EN=0;
            }

            /***********lcd內(nèi)部等待函數(shù)*************/

            void lcd_wait(void)
            {
            DATAPORT=0xff; //讀LCD前若單片機輸出低電平,而讀出LCD為高電平,則沖突,Proteus仿真會有顯示邏輯黃色
            LCM_EN=1;
            LCM_RS=0;
            LCM_RW=1;
            _nop_();
            _nop_();
            _nop_();
            while(DATAPORT&BUSY)
            { LCM_EN=0;
            _nop_();
            _nop_();
            LCM_EN=1;
            _nop_();
            _nop_();
            }
            LCM_EN=0;

            }

            /**********LCD初始化子函數(shù)***********/
            void initLCM( )
            {
            DATAPORT=0;
            ddelay(15);
            WriteCommandLCM(0x38,0); //三次顯示模式設(shè)置,不檢測忙信號
            ddelay(5);
            WriteCommandLCM(0x38,0);
            ddelay(5);
            WriteCommandLCM(0x38,0);
            ddelay(5);

            WriteCommandLCM(0x38,1); //8bit數(shù)據(jù)傳送,2行顯示,5*7字型,檢測忙信號
            WriteCommandLCM(0x08,1); //關(guān)閉顯示,檢測忙信號
            WriteCommandLCM(0x01,1); //清屏,檢測忙信號
            WriteCommandLCM(0x06,1); //顯示光標右移設(shè)置,檢測忙信號
            WriteCommandLCM(0x0c,1); //顯示屏打開,光標不顯示,不閃爍,檢測忙信號
            }

            /****顯示指定坐標的一個字符子函數(shù)****/

            void DisplayOneChar(uchar X,uchar Y,uchar DData)
            {
            Y&=1;
            X&=15;
            if(Y)X|=0x40; //若y為1(顯示第二行),地址碼+0X40
            X|=0x80; //指令碼為地址碼+0X80
            WriteCommandLCM(X,0);
            WriteDataLCM(DData);
            }

            /*******顯示指定坐標的一串字符子函數(shù)*****/

            void DisplayListChar(uchar X,uchar Y,uchar *DData)
            {
            uchar ListLength=0;
            Y&=0x01;
            X&=0x0f;
            while(X<16)
            {
            DisplayOneChar(X,Y,DData[ListLength]);
            ListLength++;
            X++;
            }
            }


            void display()
            {

            STR();
            DisplayListChar(0,0,str0);
            DisplayListChar(0,1,str1);
            }


            上一頁 1 2 下一頁

            關(guān)鍵詞: 單片機中斷測量速

            評論


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

            關(guān)閉