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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于LM032L液晶的電子時(shí)鐘顯示程序

          基于LM032L液晶的電子時(shí)鐘顯示程序

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

          元器件:
          Atmel89c51

          Button

          仿真已經(jīng)測試通過,大家使用只需要自己修改液晶的端口即可.

          點(diǎn)擊瀏覽下一頁

          C程序代碼:
          /* 1062液晶顯示
          * @
          *
          */

          #includereg51.h>#define uchar unsigned char#define uint unsigned intsbit LCD_EN=P3^4;sbit LCD_RS=P3^5;sbit s1=P3^0;sbit s2=P3^1;sbit s3=P3^2;sbit rd=P3^7;uchar count,s1num;char miao,shi,fen;uchar code table[]=" 2010-06-25 FIR";uchar code table1[]="    20:25:00";void delay(uint z){uint x,y;for(x=z;x>0;x--)for(y=110;y>0;y--);}void write_com(uchar com){LCD_RS=0;P1=com;delay(5);LCD_EN=1;delay(5);LCD_EN=0;}void write_data(uchar date){LCD_RS=1;P1=date;delay(5);LCD_EN=1;delay(5);LCD_EN=0;}void init(){uchar num; LCD_EN=0;write_com(0x38);write_com(0x0f);write_com(0x06);write_com(0x01);write_com(0x80);for(num=0;num15;num++){write_data(table[num]);delay(5);}write_com(0x80+0x40);for(num=0;num12;num++){write_data(table1[num]);delay(5);}TMOD=0x01;TH0=(65536-50000)/256;TL0=(65536-50000)%256;EA=1;ET0=1;TR0=1;}void write_sfm(uchar add,uchar date){uchar shi,ge;shi=date/10;ge=date%10;write_com(0x80+0x40+add);write_data(0x30+shi);write_data(0x30+ge);}void keyscan(){rd=0;if(s1==0) {delay(5);if(s1==0){ s1num++;while(!s1);if(s1num==1){TR0=0;write_com(0x80+0x40+10);write_com(0x0f);}}if(s1num==2){write_com(0x80+0x40+7);}if(s1num==3){write_com(0x80+0x40+4);}if(s1num==4){s1num=0;write_com(0x0c);TR0=1;}}if(s1num!=0){if(s2==0){delay(5);if(s2==0){while(!s2);if(s1num==1){miao++;if(miao==60)miao=0;write_sfm(10,miao);write_com(0x80+0x40+10);}if(s1num==2){fen++;if(fen==60)fen=0;write_sfm(7,fen);write_com(0x80+0x40+7);}if(s1num==3){shi++;if(shi==24)shi=0;write_sfm(4,shi);write_com(0x80+0x40+4);}}}if(s3==0){delay(5);if(s3==0){while(!s3);if(s1num==1){miao--;if(miao==-1)miao=59;write_sfm(10,miao);write_com(0x80+0x40+10);}if(s1num==2){fen--;if(fen==-1)fen=59;write_sfm(7,fen);write_com(0x80+0x40+7);}if(s1num==3){shi--;if(shi==-1)shi=23;write_sfm(4,shi);write_com(0x80+0x40+4);}}}}}void main(){init();while(1){keyscan();}}void timer0() interrupt 1{TH0=(65536-50000)/256;TL0=(65536-50000)%256;count++;if(count==18){count=0;miao++;if(miao==60){miao=0;fen++;if(fen==60){fen=0;shi++;if(shi==24){shi=0;}write_sfm(4,shi);}write_sfm(7,fen);}write_sfm(10,miao);} } 


          評論


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