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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 1602液晶8位數(shù)據(jù)口動(dòng)態(tài)顯示

          1602液晶8位數(shù)據(jù)口動(dòng)態(tài)顯示

          作者: 時(shí)間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
          #include
          #define uint unsigned int#define uchar unsigned charsbit rs=P1^0;//數(shù)據(jù)/命令選擇端(H/L)sbit rw=P1^1;//讀/寫選擇端(H/L)sbit en=P1^2;//使能端uchar code zifu1[]="Gui fa zhi *_* !";uchar code zifu2[]="tel: 18778434282";uint i;void delay(uchar time)//延時(shí)函數(shù){uint x,y;for(x=100;x>0;x--)for(y=time;y>0;y--);}void write_com(uchar com) //命令輸入函數(shù){rs=0;P2=com;delay(5);en=1;delay(5);en=0;}void write_date(uchar date)//數(shù)據(jù)輸入函數(shù){rs=1;P2=date;delay(5);en=1;delay(5);en=0;}void chu()//液晶初始化{rw=0;//低電平威脅數(shù)據(jù)或命令en=0;write_com(0x38);//設(shè)置16X2顯示,5X7點(diǎn)陣,8位數(shù)據(jù)口write_com(0x01);//數(shù)據(jù)指針清零write_com(0x0c);//光標(biāo)開啟}void move()//整屏移動(dòng)(0x18是向左移,0x1c是右移){for(i=0;i<16;i++)//移動(dòng)16位{write_com(0x18);delay(500);}}void main()//主函數(shù){chu();write_com(0x80+0x10);//選擇地址for(i=0;i<16;i++){write_date(zifu1[i]);delay(5);}write_com(0x80+0x40+0x10);for(i=0;i<16;i++){write_date(zifu2[i]);delay(5);}while(1){move();}}


          評(píng)論


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