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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 128*64液晶簡(jiǎn)單單片機(jī)代碼

          128*64液晶簡(jiǎn)單單片機(jī)代碼

          作者: 時(shí)間:2016-11-30 來(lái)源:網(wǎng)絡(luò) 收藏

          0x00,0x00,0x00,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x10,0x04,0x10,
          0x04,0x10,0x04,0x10,0x04,0x10,0x06,0x10,0x04,0x10,0x00,0x18,0x00,0x10,0x00,0x00,/*"二",0*/

          0x00,0x04,0x0C,0x04,0x04,0x04,0x55,0x0A,0x55,0x0A,0x55,0x09,0x85,0x2A,0x7F,0xCC,
          0x85,0x28,0x55,0x19,0x55,0x09,0x55,0x02,0x05,0x06,0x0C,0x02,0x04,0x02,0x00,0x00,/*"零",1*/

          0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
          0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xC0,0x00,0x80,0x00,0x00,0x00,/*"一",2*/

          0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
          0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xC0,0x00,0x80,0x00,0x00,0x00,/*"一",3*/
          0x40,0x04,0x20,0x04,0x10,0x04,0x0C,0x04,0xE3,0x07,0x22,0x04,0x22,0x04,0x22,0x04,
          0xFE,0xFF,0x22,0x04,0x22,0x04,0x22,0x04,0x22,0x04,0x02,0x04,0x00,0x04,0x00,0x00};/*"年",4*/

          //---------------------------12864.h-----------函數(shù)庫(kù)------------

          void delay(unsigned long v) //延時(shí)子函數(shù)
          {
          while(v--);
          }

          void lcd_busy() //判斷是否繁忙函數(shù)
          {
          rs=0;
          rw=1;
          dataport=0xff;
          while(1)
          {
          en=1;
          if(dataport<0x80)break; //并口最高位為1時(shí)表示芯片正在工作
          en=0;
          }
          en=0;
          }

          void wcode(uchar c,uchar csl,uchar csr) //寫指令函數(shù)
          {
          CS1=csl; //顯示左屏變量
          CS2=csr; //顯示右屏變量
          lcd_busy();
          rs=0;
          rw=0;
          dataport=c;
          en=1;
          en=0;
          }

          void wdata(uchar c,uchar csl,uchar csr) //寫數(shù)據(jù)子函數(shù)
          {
          CS1=csl;
          CS2=csr;
          lcd_busy();
          rs=1;
          rw=0;
          dataport=c;
          en=1;
          en=0;
          }

          void lw(uchar x,uchar y,uchar dd)// 寫1個(gè)字節(jié)進(jìn)RAM函數(shù)
          {
          if(x>=64) //列大于64說(shuō)明是右半屏操作
          {
          set_xy(x-64,y);
          wdata(dd,0,1);
          }
          else
          {//否則左半屏
          set_xy(x,y);
          wdata(dd,1,0);
          }
          }
          void set_startline(uchar i) //設(shè)置起始行
          {
          i=0xc0+i;
          wcode(i,1,1);
          }

          void set_xy(uchar x,uchar y) //列,行定位函數(shù)
          {
          x=x+0x40;
          y=y+0xb8;
          wcode(x,1,1);
          wcode(y,1,1);
          }

          void dison_off(uchar k) //液晶關(guān),開函數(shù)
          {
          k=k+0x3e;
          wcode(k,1,1);
          }

          void reset() //復(fù)位函數(shù)
          {
          RST=0;
          delay(40);
          RST=1;
          delay(40);
          }

          void lcd_init(void)//液晶初始化
          {uchar x,y;
          reset();
          set_startline(0);
          dison_off(0);
          for(y=0;y<8;y++)
          {
          for(x=0;x<128;x++)lw(x,y,0);
          }
          dison_off(1);
          }

          void display_hz(uchar xx, uchar yy, uchar n, uchar fb) //中文字顯示函數(shù) 掃描方法采用逐列式
          {
          uchar i,dx;
          for(i=0;i<16;i++) //一個(gè)漢字列掃描值
          {dx=hz[2*i+n*32];//漢字上半部分掃描
          if(fb)dx=255-dx;//反顯
          lw(xx*8+i,yy,dx);//數(shù)據(jù)寫入芯片
          dx=hz[(2*i+1)+n*32];//漢字下半部分掃描
          if(fb)dx=255-dx; //反顯
          lw(xx*8+i,yy+1,dx);//數(shù)據(jù)寫入芯片
          }
          }


          上一頁(yè) 1 2 下一頁(yè)

          關(guān)鍵詞: 128*64液晶單片

          評(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); })();