在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

    
    
    <address id="vxupu"><td id="vxupu"></td></address>

      <pre id="vxupu"><small id="vxupu"></small></pre>
      <dfn id="vxupu"></dfn>
      <div id="vxupu"><small id="vxupu"></small></div>
    1. 新聞中心

      EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > LCD12864指定位置反白顯示程序

      LCD12864指定位置反白顯示程序

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

      /********************************************************************
      函 數(shù) 名:Delay
      入口參數(shù):ms
      出口參數(shù):無
      建立日期:2007年3月3日
      修改日期:
      函數(shù)作用:毫秒級(jí)的延時(shí)程序,當(dāng)晶振為12Mhz時(shí),xtal=12;
      說 明:
      ********************************************************************/
      void Delay(uint ms)
      {
      uint i;
      while(ms--)
      {
      for(i=1;i<(uint)(xtal*143-2);i++)
      ;
      }
      }
      //===================================================================*/
      /********************************************************************
      函 數(shù) 名:Char_Set_XY
      入口參數(shù):x,y,*p
      出口參數(shù):無
      建立日期:2007年8月26日
      修改日期:
      函數(shù)作用:
      說 明:
      ********************************************************************/
      void Char_Set_XY(uchar x, uchar y, uchar *p)
      {
      if(y == 0)
      {
      W_1byte(0,0,(0x80+x));
      }
      if(y == 1)
      {
      W_1byte(0,0,(0x90+x));
      }
      if(y == 2)
      {
      W_1byte(0,0,(0x88+x));
      }
      if(y == 3)
      {
      W_1byte(0,0,(0x98+x));
      }
      while(*p != 0)
      {
      W_1byte(0,1,*p++);
      }
      }
      //===================================================================*/

      /********************************************************************
      函 數(shù) 名:Set_Draw(
      入口參數(shù):無
      出口參數(shù):無
      建立日期:2007年8月26日
      修改日期:
      函數(shù)作用:
      說 明:
      ********************************************************************/
      void Set_Draw(void)
      {
      //W_1byte(0,0,0x01); //清屏
      Delay(20); //延時(shí)
      //W_1byte(0,0,0x34); //8BIT控制界面,擴(kuò)充指令集,,繪圖顯示OFF
      W_1byte(0,0,0x36);
      Delay(20); //延時(shí)
      }
      //===================================================================*/
      /********************************************************************
      函 數(shù) 名:Draw_Pic 128*64
      入口參數(shù):x,y,*Draw
      出口參數(shù):無
      建立日期:2007年8月26日
      修改日期:
      函數(shù)作用:
      說 明:
      ********************************************************************/
      /*************************************************/

      void Draw_Pic(uchar x, uchar y, const uchar *Draw)
      {
      uchar i, j, temp_x, temp_y; //
      temp_x = x; //
      temp_y = y; //
      temp_x |= 0x80; //
      temp_y |= 0x80; //
      for(i=0;i<32;i++ ) //上半屏32行
      {
      W_1byte(0,0,temp_y++); //設(shè)置繪圖區(qū)的Y地址坐標(biāo)0
      W_1byte(0,0,temp_x); //設(shè)置繪圖區(qū)的X地址坐標(biāo)0
      for(j=0;j<16;j++) //
      {
      W_1byte(0,1,*Draw++); //
      }
      }

      temp_x = 0x88; //
      temp_y = 0x80; //
      j = 0; //
      for(;i<64;i++ )
      {
      W_1byte(0,0,temp_y++); //設(shè)置繪圖區(qū)的Y地址坐標(biāo)
      W_1byte(0,0,temp_x); //設(shè)置繪圖區(qū)的X地址坐標(biāo)
      for(j=0;j<16;j++)
      {
      W_1byte(0,1,*Draw++); //
      }
      }

      }
      /**************************************************/
      /**************************************************/
      void Set_White(uchar x,uchar y,uchar end_x,uchar clear)
      {
      uchar i, j, white_x, white_y,white_end_x,clr_x,clr_y; //
      white_end_x = (end_x-x+1);
      white_end_x <<= 1;
      if(y==1)
      {
      white_x = (0x80+x-1);
      white_y = 0x80;
      clr_x = 0x80;
      clr_y = 0x80;
      }
      else if(y==2)
      {
      white_x = (0x80+x-1);
      white_y = 0x90;
      clr_x = 0x80;
      clr_y = 0x90;
      }
      else if(y==3)
      {
      white_x = (0x88+x-1);
      white_y = 0x80;
      clr_x = 0x88;
      clr_y = 0x80;
      }
      else if(y==4)
      {
      white_x = (0x88+x-1);
      white_y = 0x90;
      clr_x = 0x88;
      clr_y = 0x90;
      }
      if(clear==0)//要反白時(shí),先將整行的液晶全部清成不反白(此處行指y)
      {
      for(i=0;i<16;i++ ) //16行
      {
      W_1byte(0,0,clr_y++); //設(shè)置繪圖區(qū)的Y地址坐標(biāo)0
      W_1byte(0,0,clr_x); //設(shè)置繪圖區(qū)的X地址坐標(biāo)0
      for(j=0;j<16;j++) //
      {
      W_1byte(0,1,0x00); //清成不反白
      nop();
      }
      }
      }
      nop();
      for(i=0;i<16;i++ ) //16行,因?yàn)槭?6*16漢字
      {
      W_1byte(0,0,white_y++); //設(shè)置繪圖區(qū)的Y地址坐標(biāo)0
      W_1byte(0,0,white_x); //設(shè)置繪圖區(qū)的X地址坐標(biāo)0
      for(j=0;j {
      if(clear==1)
      {
      W_1byte(0,1,0x00); //取消這一行的8個(gè)點(diǎn)的反白,液晶地址自動(dòng)加1
      //(此處行指一個(gè)一個(gè)液晶點(diǎn)所組成的行)
      }
      else
      {
      W_1byte(0,1,0xff); //反白這一行的8個(gè)點(diǎn),液晶地址自動(dòng)加1
      //(此處行指一個(gè)一個(gè)液晶點(diǎn)所組成的行)
      }
      nop();
      }
      }
      }
      /*************************************************/

      上一頁 1 2 3 下一頁

      關(guān)鍵詞: LCD12864指定位置反白顯

      評(píng)論


      技術(shù)專區(qū)

      關(guān)閉