<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于PIC16F877A單片機(jī)設(shè)計(jì)的萬年歷程序

          基于PIC16F877A單片機(jī)設(shè)計(jì)的萬年歷程序

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

          /*----------------------------------------------------*/
          //寫顯示數(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;
          }
          /*---------------------------------------------------*/
          //設(shè)定頁(yè)地址----X:0--7
          void SetLine(unsigned char line)
          {
          line=line0x07; //0
          //設(shè)定列地址----Y:0--63
          void SetColumn(unsigned char column)
          {
          column=column0x3f; //0
          //設(shè)定開始行
          void SetStartLine(unsigned char startline)
          {
          startline=startline0x3f; //0
          //開關(guān)顯示
          //1:開顯示 0:關(guān)顯示
          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
          //顯示一個(gè)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); //設(shè)置起始列
          SetLine(line); //設(shè)置行
          for(i=0;i=64) //如果列>=64,則選通右屏
          {
          SlectScreen(2);
          column=column%64; //設(shè)置右屏起始列
          SetColumn(column);
          SetLine(line);
          }
          WriteData(*pt); //寫數(shù)據(jù)
          *pt++;//
          column++;
          }
          SlectScreen(1);
          SetLine(line+1); //設(shè)置漢字下半部分顯示頁(yè)
          column=column_temp;
          SetColumn(column);
          for(i=0;i=64)
          {
          SlectScreen(2);
          column=column%64;
          SetColumn(column);
          SetLine(line+1);
          }
          WriteData(*pt);
          *pt++;
          column++;
          }
          }
          /*-------------------------------------------------------*/
          //顯示一個(gè)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); //設(shè)置起始列
          SetLine(line); //設(shè)置行
          for(i=0;i=64) //如果列>=64,則選通右屏
          {
          SlectScreen(2);
          column=column%64; //設(shè)置右屏起始列
          SetColumn(column);
          SetLine(line);
          }
          WriteData(*pt|0x01); //寫數(shù)據(jù)
          *pt++;
          column++;
          }
          SlectScreen(1);
          SetLine(line+1); //設(shè)置漢字下半部分顯示頁(yè)
          column=column_temp;
          SetColumn(column);
          for(i=0;i=64)
          {
          SlectScreen(2);
          column=column%64;
          SetColumn(column);
          SetLine(line+1);
          }
          WriteData(*pt);
          *pt++;
          column++;
          }
          }
          /*-------------------------------------------------------*/
          //顯示一個(gè)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); //設(shè)置起始列
          SetLine(line); //設(shè)置行
          for(i=0;i=64) //如果列>=64,則選通右屏
          {
          SlectScreen(2);
          column=column%64; //設(shè)置右屏起始列
          SetColumn(column);
          SetLine(line);
          }
          WriteData(*pt); //寫數(shù)據(jù)
          *pt++;
          column++;
          }
          SlectScreen(1);
          SetLine(line+1); //設(shè)置漢字下半部分顯示頁(yè)
          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++;
          }
          }
          /*-------------------------------------------------------*/
          //顯示一個(gè)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); //設(shè)置起始列
          SetLine(line); //設(shè)置行
          for(i=0;i=64) //如果列>=64,則選通右屏
          {
          SlectScreen(2);
          column=column%64; //設(shè)置右屏起始列
          SetColumn(column);
          SetLine(line);
          }
          WriteData(*pt); //寫數(shù)據(jù)
          *pt++;
          column++;
          }
          SlectScreen(1);
          SetLine(line+1); //設(shè)置漢字下半部分顯示頁(yè)
          column=column_temp;
          SetColumn(column);
          for(i=0;i=64)
          {
          SlectScreen(2);
          column=column%64;
          SetColumn(column);
          SetLine(line+1);
          }
          WriteData(*pt);
          *pt++;
          column++;
          }
          }
          /*-------------------------------------------------------*/
          //顯示一個(gè)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); //設(shè)置起始列
          SetLine(line); //設(shè)置行
          for(i=0;i=64) //如果列>=64,則選通右屏
          {
          SlectScreen(2);
          column=column%64; //設(shè)置右屏起始列
          SetColumn(column);
          SetLine(line);
          }
          WriteData(*pt|0x01); //寫數(shù)據(jù)
          *pt++;
          column++;
          }
          SlectScreen(1);
          SetLine(line+1); //設(shè)置漢字下半部分顯示頁(yè)
          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++;
          }
          }


          關(guān)鍵詞: PIC16F877A 萬年歷 KS0108系列

          評(píng)論


          相關(guān)推薦

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

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();