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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于C8051F的金鵬LCD19264(帶字庫)程序

          基于C8051F的金鵬LCD19264(帶字庫)程序

          作者: 時(shí)間:2016-12-01 來源:網(wǎng)絡(luò) 收藏
          //-------------------------------------------------------------------------*

          //文件名: LCD.h (LCD頭文件) *
          //-------------------------------------------------------------------------*
          #include "C8051F340.h"
          #include
          #define uint unsigned int
          #define uchar unsigned char

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

          sbit rw = P2^1; //H=read; L=write;
          //sbit e1 = P2^2; //up input enable;
          sbit e2 = P2^2; //down input enable;
          sbit rs = P2^0; //H=data; L=command;
          //sbit rst= P3^0; //Reset Signal 低電平有效
          void init_lcd ();
          void clrram ();
          void string_disp (uchar up,uchar down,uchar addr,uchar length,uchar code *pp); //顯示字符串
          void number_disp (uchar up,uchar down,uchar addr,uchar length,uchar number1,uchar number2); //顯示數(shù)字

          //up:上半屏 down:下半屏
          //up為1,控制上半屏,down為1,控制下半屏
          uchar Math_Subwith(uchar dat) //線序反轉(zhuǎn)
          {
          uchar i,temp;
          temp = 0x00;
          for(i=0;i<8;i++)
          {
          temp >>= 1;
          if((dat< {
          temp |= 0x80;
          }
          else
          {
          temp &= 0x7F;
          }
          }
          return temp;
          }
          //*******************************
          //判忙
          //*******************************
          void chk_busy (uchar up,uchar down)
          {
          if(up==1)
          {
          P1 = Math_Subwith(0xff);
          rs=0;
          rw=1;
          //e1=1;
          P4 = P4|0x01;
          while(P1 & 0x01);
          //e1=0;
          _nop_();_nop_();_nop_();_nop_();
          P4 = P4&0xfe;
          }
          if(down==1)
          {
          P1 =Math_Subwith(0xff);
          rs=0;
          rw=1;
          e2=1;
          while(P1& 0x01);
          _nop_();_nop_();_nop_();_nop_();
          e2=0;
          }
          }
          //********************************************
          //寫命令
          //********************************************
          void send_c (uchar up,uchar down,uchar comm)
          {
          chk_busy (up,down);
          rs=0; //command
          rw=0; //write
          if(up==1)
          {
          P1 = Math_Subwith(comm); //output comm
          //e1=1;
          P4 = P4|0x01;
          _nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
          //e1=0;
          P4 = P4&0xfe;
          }
          if(down==1)
          {
          P1 = Math_Subwith(comm); //output comm
          e2=1;
          _nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
          e2=0;
          }
          }


          上一頁 1 2 下一頁

          關(guān)鍵詞: C8051FLCD1926字

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