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

          新聞中心

          proteus 1602液晶程序

          作者: 時(shí)間:2016-11-13 來(lái)源:網(wǎng)絡(luò) 收藏
          proteus1602液晶是LM016L

          #include
          #include
          #include
          #define uchar unsigned char
          #define uint unsigned int
          #pragma data:code
          const uchar table[]="I LOVE CHINA";
          const uchar table1[]="MADE BY LYQ" ;
          void delay(uint ms)
          {
          uint i,j;
          for(i=0;ifor(j=0;j<1141;j++);
          }
          void write_com(uchar com)
          {
          PORTD&=~BIT(4); // RS
          PORTD&=~BIT(5);// RW
          PORTB=com;
          //PORTD&=~BIT(6);// E
          PORTD|=BIT(6);
          delay(1);
          PORTD&=~BIT(6);

          }

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

          void write_data(uchar data)
          {
          PORTD|=BIT(4); // RS
          PORTD&=~BIT(5);// RW
          PORTB=data;
          //PORTD&=~BIT(6);// E
          PORTD|=BIT(6);
          delay(1);
          PORTD&=~BIT(6);
          }

          void main()
          {
          uchar i;
          DDRB=0XFF;
          DDRD|=BIT(4)|BIT(5)|BIT(6);
          PORTD&=~BIT(6);

          write_com(0x38);
          delay(5);
          write_com(0x01);//clear screen//清屏命令非常重要,沒(méi)有出現(xiàn)亂碼
          delay(5);
          write_com(0x0f);
          delay(5);
          write_com(0x06);
          delay(5);
          write_com(0x80+0x10);
          delay(5);

          for(i=0;i<12;i++)
          {
          write_data(table[i]);
          delay(1);
          }
          write_com(0x80+0x40+0x10);
          delay(5);

          for(i=0;i<11;i++)
          {
          write_data(table1[i]);
          delay(1);
          }
          delay(1000);
          for(i=0;i<16;i++)
          {
          write_com(0x1c);//屏幕左移16次,不是0x18
          delay(200);

          }

          }



          關(guān)鍵詞: proteus1602液

          評(píng)論


          技術(shù)專(zhuān)區(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); })();