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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于STC12C5410AD的字庫(kù)型12864的使用

          基于STC12C5410AD的字庫(kù)型12864的使用

          作者: 時(shí)間:2012-08-13 來(lái)源:網(wǎng)絡(luò) 收藏

          #include intrins.h>

          sbit E_CLK =P1^2; //時(shí)鐘使能

          sbit RW_SID=P1^1;//串行數(shù)據(jù)輸入、輸出端

          sbit RS_CS =P1^0;//片選端


          //宏定義

          #define uint unsigned int

          #define uchar unsigned char

          //下面是數(shù)組定義

          uchar code ts[]={"黃河遠(yuǎn)上白云間"};

          uchar code tw[]={"一片孤城萬(wàn)仞山"};

          uchar code ta[]={"羌笛何須怨楊柳"};

          uchar code tb[]={"春風(fēng)不度玉門關(guān)"};


          //延時(shí)子函數(shù)

          void delay(unsigned int xms)

          {

          unsigned int i,j;

          for(i=0; ixms; i++)

          for(j=0;j110;j++)

          {};

          }

          //串行發(fā)送一字節(jié)數(shù)據(jù)

          void Send_Byte(unsigned char dat)

          {

          unsigned char i;

          for(i=0;i8;i++)

          {

          delay(1);

          P1M0=0;

          P1M1=1;

          E_CLK=0; //時(shí)鐘線拉低

          if(dat0x80)

          RW_SID=1;

          else

          RW_SID=0;

          E_CLK=1;

          dat=dat1;

          }

          }

          //控制命令

          void Send_command(unsigned char dat)

          {

          P1M0=0;

          P1M1=1;

          RS_CS=1;

          Send_Byte(0xF8);//11111,00,0 RW=0,RS=0 同步標(biāo)志

          Send_Byte(dat0xF0);//高四位

          Send_Byte((dat0x0F)4);//低四位

          RS_CS=0;

          }

          //顯示數(shù)據(jù)或單字節(jié)字符

          void Send_Dat(unsigned char dat)

          {

          RS_CS=1;

          Send_Byte(0xFA);//11111,01,0 RW=0,RS=1

          Send_Byte(dat0xF0);//高四位

          Send_Byte((dat0x0F)4);//低四位

          RS_CS=0;

          }


          void display_1()

          {

          uchar a;

          Send_command(0x80);

          for(a=0;a14;a++)

          {

          Send_Dat(ts[a]);

          }

          }


          void display_2()

          {

          uchar b;

          Send_command(0x90);

          for(b=0;b14;b++)

          {

          Send_Dat(tw[b]);

          }

          }

          void display_3()

          {

          uchar c;

          Send_command(0x88);

          for(c=0;c14;c++)

          {

          Send_Dat(ta[c]);

          }

          }

          void display_4()

          {

          uchar d;

          Send_command(0x98);

          for(d=0;d14;d++)

          {

          Send_Dat(tb[d]);

          }

          }


          //初始化 LCD

          void init(void)

          {

          P1M0=0;

          P1M1=1;

          RS_CS=0;

          delay(1);

          Send_command(0x30);//功能設(shè)置,一次送8位數(shù)據(jù),基本指令集

          Send_command(0x0c);//0000,1100 整體顯示,游標(biāo)on,游標(biāo)位置on

          Send_command(0x01);//0000,0001 清

          Send_command(0x02);//0000,0010 地址歸位

          Send_command(0x80);//1000,0000 設(shè)定 7位地址000,0000到地址計(jì)數(shù)器AC

          }


          void main(void)

          {

          init();

          delay(1);

          display_1();

          display_2();

          display_3();

          display_4();

          while(1);

          }


          上一頁(yè) 1 2 下一頁(yè)

          關(guān)鍵詞: STC12C5410AD 12864 DDRAM

          評(píng)論


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