<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代碼進(jìn)化版顯示時(shí),分,秒

          128*64代碼進(jìn)化版顯示時(shí),分,秒

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

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

          芯片晶振11.0592

          #include

          #define uchar unsigned char
          #define uint unsigned int

          #define dataport P0 //數(shù)據(jù)口
          sbit CS1=P2^4; //左顯引腳
          sbit CS2=P2^3; //右顯引腳
          sbit RST=P2^2; //復(fù)位引腳
          sbit rs=P2^7; //數(shù)據(jù)或指令寄存器引腳
          sbit rw=P2^6; //讀或?qū)懖僮饕_
          sbit en=P2^5; //讀寫時(shí)能引腳
          void delay(unsigned long v); //延時(shí)
          void wcode(uchar c,uchar csl,uchar csr); //寫指令
          void wdata(uchar c,uchar csl,uchar csr); //寫數(shù)據(jù)
          void set_startline(uchar i); //設(shè)置起始行
          void set_xy(uchar x,uchar y); //設(shè)置X,Y方向
          void dison_off(uchar k); //顯示器開或關(guān)
          void reset();//復(fù)位
          void lcd_init(); //顯示器初始化
          void lw(uchar x,uchar y,uchar dd); //將數(shù)據(jù)寫入左右半屏
          void display_hz(uchar xx,uchar yy,uchar n,uchar fb); //顯示漢字函數(shù)
          uchar code hz[]; //漢字字摸
          uchar code asc[];//數(shù)字字摸
          uchar hour1,hour0;
          uchar minute1,minute0;
          uchar sec1,sec0;
          uchar hour=0,minute=0,sec=0;
          uchar osc=0;

          void Timer0(void)//設(shè)定定時(shí)器0 50ms
          {
          TMOD = 0x01;
          TH0 = 0x3C;
          TL0 = 0x0B0;
          EA = 1;
          ET0 = 1;
          TR0 = 1;
          }
          void time0init()interrupt 1 //定時(shí)器中斷執(zhí)行,時(shí),分,秒計(jì)算
          {
          TR0=0;
          osc++;
          if(osc==20){sec++;osc=0;}
          if(sec==60){minute++; sec=0;}
          if(minute==60){hour++;minute=0;}
          if(hour==24){hour=0;}
          hour1=hour/10;
          hour0=hour%10;
          minute1=minute/10;
          minute0=minute%10;
          sec1=sec/10;
          sec0=sec%10;
          TH0=0x3c;
          TL0=0x0B0;
          EA=1;
          ET0=1;
          TF0=0;
          TR0=1;
          }

          #include "12864hh.h"

          void main(void)
          {
          lcd_init();
          delay(1000);
          Timer0();
          while(1)
          {

          display_hz(2,0,0,0);
          display_hz(4,0,1,0);
          display_hz(6,0,2,0);
          display_hz(8,0,3,0);
          display_hz(10,0,4,0);
          display_hz(0,4,5,0);
          display_hz(6,4,6,0);
          display_hz(12,4,7,0);
          display_asc(2,4,hour1,0);
          display_asc(3,4,hour0,0);
          display_asc(8,4,minute1,0);
          display_asc(9,4,minute0,0);
          display_asc(14,4,sec1,0);
          display_asc(15,4,sec0,0);

          }
          delay(60000);
          }


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

          關(guān)鍵詞: 128*64代碼進(jìn)化版顯

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