在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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) > 設計應用 > 基于PIC16F877A單片機設計的萬年歷程序

            基于PIC16F877A單片機設計的萬年歷程序

            作者: 時間:2012-11-27 來源:網(wǎng)絡 收藏

            /*----------------------------------------------------*/
            //寫顯示數(shù)據(jù)
            //dat:顯示數(shù)據(jù)
            void WriteData(unsigned char dat)
            {
            CheckState();
            DI=1; //寫數(shù)據(jù)
            RW=0;
            PORTB=dat;
            E=1;
            E=0;
            }
            /*---------------------------------------------------*/
            //寫指令
            //command:操作LCD的指令
            void WriteCommand(unsigned char dat)
            {
            CheckState();
            RW=0; //寫指令
            PORTB=dat;
            E=1;
            E=0;
            }
            /*---------------------------------------------------*/
            //設定頁地址----X:0--7
            void SetLine(unsigned char line)
            {
            line=line0x07; //0
            //設定列地址----Y:0--63
            void SetColumn(unsigned char column)
            {
            column=column0x3f; //0
            //設定開始行
            void SetStartLine(unsigned char startline)
            {
            startline=startline0x3f; //0
            //開關顯示
            //1:開顯示 0:關顯示
            void SetOnOff(unsigned char state)
            {
            state=state|0x3e;
            WriteCommand(state);
            }
            /*--------------------------------------------------*/
            //選擇屏幕
            //screen: 1:左屏 2:右屏
            void SlectScreen(unsigned char screen)
            {
            switch(screen)
            {
            case 1: CSA=0;
            CSB=1;//左屏
            break;
            case 2: CSA=1;
            CSB=0;//右屏
            break;
            }
            }
            /*--------------------------------------------------*/
            //清屏
            //screen: 1:左屏 2:右屏
            void ClearScreen(unsigned char screen)
            {
            unsigned char i,j;
            SlectScreen(screen);
            for(i=0;i
            //顯示一個16X16的漢字
            void Show16X16(unsigned char line,unsigned char column,const unsigned char *pt)
            {
            unsigned char i,column_temp;
            column_temp=column;
            SlectScreen(1); //選通左屏
            SetColumn(column); //設置起始列
            SetLine(line); //設置行
            for(i=0;i=64) //如果列>=64,則選通右屏
            {
            SlectScreen(2);
            column=column%64; //設置右屏起始列
            SetColumn(column);
            SetLine(line);
            }
            WriteData(*pt); //寫數(shù)據(jù)
            *pt++;//
            column++;
            }
            SlectScreen(1);
            SetLine(line+1); //設置漢字下半部分顯示頁
            column=column_temp;
            SetColumn(column);
            for(i=0;i=64)
            {
            SlectScreen(2);
            column=column%64;
            SetColumn(column);
            SetLine(line+1);
            }
            WriteData(*pt);
            *pt++;
            column++;
            }
            }
            /*-------------------------------------------------------*/
            //顯示一個16X16的漢字帶上劃線
            void Show16X16_2(unsigned char line,unsigned char column,const unsigned char *pt)
            {
            unsigned char i,column_temp;
            column_temp=column;
            SlectScreen(1); //選通左屏
            SetColumn(column); //設置起始列
            SetLine(line); //設置行
            for(i=0;i=64) //如果列>=64,則選通右屏
            {
            SlectScreen(2);
            column=column%64; //設置右屏起始列
            SetColumn(column);
            SetLine(line);
            }
            WriteData(*pt|0x01); //寫數(shù)據(jù)
            *pt++;
            column++;
            }
            SlectScreen(1);
            SetLine(line+1); //設置漢字下半部分顯示頁
            column=column_temp;
            SetColumn(column);
            for(i=0;i=64)
            {
            SlectScreen(2);
            column=column%64;
            SetColumn(column);
            SetLine(line+1);
            }
            WriteData(*pt);
            *pt++;
            column++;
            }
            }
            /*-------------------------------------------------------*/
            //顯示一個16X16的漢字帶下劃線
            void Show16X16_3(unsigned char line,unsigned char column,const unsigned char *pt)
            {
            unsigned char i,column_temp;
            column_temp=column;
            SlectScreen(1); //選通左屏
            SetColumn(column); //設置起始列
            SetLine(line); //設置行
            for(i=0;i=64) //如果列>=64,則選通右屏
            {
            SlectScreen(2);
            column=column%64; //設置右屏起始列
            SetColumn(column);
            SetLine(line);
            }
            WriteData(*pt); //寫數(shù)據(jù)
            *pt++;
            column++;
            }
            SlectScreen(1);
            SetLine(line+1); //設置漢字下半部分顯示頁
            column=column_temp;
            SetColumn(column);
            for(i=0;i=64)
            {
            SlectScreen(2);
            column=column%64;
            SetColumn(column);
            SetLine(line+1);
            }
            WriteData(*pt|0x80);
            *pt++;
            column++;
            }
            }
            /*-------------------------------------------------------*/
            //顯示一個8X16的字符
            void Show8X16(unsigned char line,unsigned char column,const unsigned char *pt)
            {
            unsigned char i,column_temp;
            column_temp=column;
            SlectScreen(1); //選通左屏
            SetColumn(column); //設置起始列
            SetLine(line); //設置行
            for(i=0;i=64) //如果列>=64,則選通右屏
            {
            SlectScreen(2);
            column=column%64; //設置右屏起始列
            SetColumn(column);
            SetLine(line);
            }
            WriteData(*pt); //寫數(shù)據(jù)
            *pt++;
            column++;
            }
            SlectScreen(1);
            SetLine(line+1); //設置漢字下半部分顯示頁
            column=column_temp;
            SetColumn(column);
            for(i=0;i=64)
            {
            SlectScreen(2);
            column=column%64;
            SetColumn(column);
            SetLine(line+1);
            }
            WriteData(*pt);
            *pt++;
            column++;
            }
            }
            /*-------------------------------------------------------*/
            //顯示一個8X16的字符帶上劃線
            void Show8X16_2(unsigned char line,unsigned char column,const unsigned char *pt)
            {
            unsigned char i,column_temp;
            column_temp=column;
            SlectScreen(1); //選通左屏
            SetColumn(column); //設置起始列
            SetLine(line); //設置行
            for(i=0;i=64) //如果列>=64,則選通右屏
            {
            SlectScreen(2);
            column=column%64; //設置右屏起始列
            SetColumn(column);
            SetLine(line);
            }
            WriteData(*pt|0x01); //寫數(shù)據(jù)
            *pt++;
            column++;
            }
            SlectScreen(1);
            SetLine(line+1); //設置漢字下半部分顯示頁
            colu mn=column_temp;
            SetColumn(column);
            for(i=0;i=64)
            {
            SlectScreen(2);
            column=column%64;
            SetColumn(column);
            SetLine(line+1);
            }
            WriteData(*pt);
            *pt++;
            column++;
            }
            }


            評論


            相關推薦

            技術專區(qū)

            關閉