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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 128*64代碼進化版顯示時,分,秒

          128*64代碼進化版顯示時,分,秒

          作者: 時間:2016-11-30 來源:網絡 收藏

          //-------------------------中文字字模------------------------------
          uchar code hz[]={
          0x20,0x04,0x20,0x04,0x22,0x42,0x22,0x82,0xFE,0x7F,0x21,0x01,0x21,0x01,0x20,0x10,
          0x20,0x10,0xFF,0x08,0x20,0x07,0x22,0x1A,0xAC,0x21,0x20,0x40,0x20,0xF0,0x00,0x00,/*"我",0*/

          本文引用地址:http://www.ex-cimer.com/article/201611/323923.htm

          0x00,0x40,0x40,0x20,0xB2,0xA0,0x96,0x90,0x9A,0x4C,0x92,0x47,0xF6,0x2A,0x9A,0x2A,
          0x93,0x12,0x91,0x1A,0x99,0x26,0x97,0x22,0x91,0x40,0x90,0xC0,0x30,0x40,0x00,0x00,/*"愛",1*/

          0x00,0x08,0x00,0x08,0xF8,0x0B,0x28,0x09,0x29,0x09,0x2E,0x09,0x2A,0x09,0xF8,0xFF,
          0x28,0x09,0x2C,0x09,0x2B,0x09,0x2A,0x09,0xF8,0x0B,0x00,0x08,0x00,0x08,0x00,0x00,/*"單",2*/

          0x00,0x80,0x00,0x40,0x00,0x30,0xFE,0x0F,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x01,
          0x10,0x01,0x1F,0x01,0x10,0x01,0x10,0xFF,0x10,0x00,0x18,0x00,0x10,0x00,0x00,0x00,/*"片",3*/

          0x08,0x04,0x08,0x03,0xC8,0x00,0xFF,0xFF,0x48,0x00,0x88,0x41,0x08,0x30,0x00,0x0C,
          0xFE,0x03,0x02,0x00,0x02,0x00,0x02,0x00,0xFE,0x3F,0x00,0x40,0x00,0x78,0x00,0x00, /*機",4*/


          0x00,0x00,0xFC,0x07,0x44,0x04,0x44,0x04,0x44,0x04,0xFC,0x07,0x10,0x00,0x90,0x00,
          0x10,0x03,0x10,0x40,0x10,0x80,0xFF,0x7F,0x10,0x00,0x10,0x00,0x10,0x00,0x00,0x00,/*"時",0*/

          0x80,0x00,0x40,0x80,0x20,0x40,0x98,0x20,0x87,0x10,0x82,0x0F,0x80,0x00,0x80,0x00,
          0x83,0x20,0x84,0x40,0x98,0x3F,0x30,0x00,0x60,0x00,0xC0,0x00,0x40,0x00,0x00,0x00,/*"分",1*/

          0x12,0x04,0x12,0x03,0xD2,0x00,0xFE,0xFF,0x91,0x00,0x11,0x83,0xC0,0x80,0x38,0x40,
          0x10,0x40,0x00,0x20,0xFF,0x23,0x00,0x10,0x08,0x08,0x10,0x04,0x60,0x03,0x00,0x00};/*"秒",2*/
          //------------------------------數字字摸----------------------------------
          uchar code asc[]={
          0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00,/*"0",0*/

          0x00,0x00,0x10,0x20,0x10,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,/*"1",1*/

          0x00,0x00,0x70,0x30,0x08,0x28,0x08,0x24,0x08,0x22,0x88,0x21,0x70,0x30,0x00,0x00,/*"2",2*/

          0x00,0x00,0x30,0x18,0x08,0x20,0x88,0x20,0x88,0x20,0x48,0x11,0x30,0x0E,0x00,0x00,/*"3",3*/

          0x00,0x00,0x00,0x07,0xC0,0x04,0x20,0x24,0x10,0x24,0xF8,0x3F,0x00,0x24,0x00,0x00,/*"4",4*/

          0x00,0x00,0xF8,0x19,0x08,0x21,0x88,0x20,0x88,0x20,0x08,0x11,0x08,0x0E,0x00,0x00,/*"5",5*/

          0x00,0x00,0xE0,0x0F,0x10,0x11,0x88,0x20,0x88,0x20,0x18,0x11,0x00,0x0E,0x00,0x00,/*"6",6*/

          0x00,0x00,0x38,0x00,0x08,0x00,0x08,0x3F,0xC8,0x00,0x38,0x00,0x08,0x00,0x00,0x00,/*"7",7*/

          0x00,0x00,0x70,0x1C,0x88,0x22,0x08,0x21,0x08,0x21,0x88,0x22,0x70,0x1C,0x00,0x00,/*"8",8*/

          0x00,0x00,0xE0,0x00,0x10,0x31,0x08,0x22,0x08,0x22,0x10,0x11,0xE0,0x0F,0x00,0x00,/*"9",9*/

          0x00,0x00,0xE0,0x0F,0x10,0x10,0x08,0x20,0x08,0x20,0x10,0x10,0xE0,0x0F,0x00,0x00};/*"0",10*/

          //------------------------------庫函數---------------------------

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

          void lcd_busy() //繁忙標志
          {
          rs=0;
          rw=1;
          dataport=0xff;
          while(1)
          {
          en=1;
          if(dataport<0x80)break;
          en=0;
          }
          en=0;
          }

          void wcode(uchar c,uchar csl,uchar csr)//寫指令
          {
          CS1=csl;
          CS2=csr;
          lcd_busy();
          rs=0;
          rw=0;
          dataport=c;
          en=1;
          en=0;
          }

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

          void lw(uchar x,uchar y,uchar dd) //寫一個字節(jié)進芯片
          {
          if(x>=64)
          {
          set_xy(x-64,y);
          wdata(dd,0,1);
          }
          else
          {
          set_xy(x,y);
          wdata(dd,1,0);
          }
          }
          void set_startline(uchar i) //設定起始行
          {
          i=0xc0+i;
          wcode(i,1,1);
          }

          void set_xy(uchar x,uchar y) //定位x,y位置
          {
          x=x+0x40;
          y=y+0xb8;
          wcode(x,1,1);
          wcode(y,1,1);
          }

          void dison_off(uchar k) //開,關顯示
          {
          k=k+0x3e;
          wcode(k,1,1);
          }

          void reset()
          {
          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) //顯示漢字逐列式
          {
          uchar i,dx;
          for(i=0;i<16;i++)
          {dx=hz[2*i+n*32];
          if(fb)dx=255-dx;
          lw(xx*8+i,yy,dx);
          dx=hz[(2*i+1)+n*32];
          if(fb)dx=255-dx;
          lw(xx*8+i,yy+1,dx);
          }
          }

          void display_asc(uchar xx,uchar yy,uchar n,uchar fb) //顯示數字逐列式
          {
          uchar i,dx;
          for(i=0;i<8;i++)
          {
          dx=asc[2*i+n*16];
          if(fb)dx=255-dx;
          lw(xx*8+i,yy,dx);
          dx=asc[2*i+1+n*16];
          if(fb)dx=255-dx;
          lw(xx*8+i,yy+1,dx);
          }
          }


          上一頁 1 2 下一頁

          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁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); })();