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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > 基于C8051f020吳偉鏢動畫LCD控制顯示

          基于C8051f020吳偉鏢動畫LCD控制顯示

          作者: 時間:2016-11-30 來源:網(wǎng)絡 收藏
          #include
          #define uchar unsigned char
          #define uint unsigned int
          void SYSCLK_Init (void);
          void PORT_Init (void);
          sbit lcdrs=P2^5;
          sbit lcden=P2^7;
          sbit lcdwr=P2^6;
          sbit key1=P2^0;
          sbit key2=P2^1;
          sbit key3=P2^2;
          sbit key4=P2^3;
          unsigned long x;
          uchar CGCODE[]={0x1f,0x11,0x1f,0x00,0x1f,0x04,0x1f,0x0a, //0
          0x01,0x02,0x06,0x0a,0x02,0x02,0x02,0x02, //1
          0x04,0x01f,0x04,0x1f,0x04,0x1f,0x05,0x04, //2
          0x04,0x04,0x04,0x1f,0x0e,0x15,0x04,0x04, //3
          0x00,0x0e,0x00,0x1f,0x0e,0x15,0x0c,0x04, //4
          0x08,0x0c,0x0a,0x09,0x19,0x05,0x03,0x01, //球門 5
          0x04,0x0a,0x0a,0x04,0x0e,0x04,0x0a,0x00,//人 6
          0x00,0x00,0x00,0x00,0x6,0x09,0x09,0x06,//球 7
          };
          uchar tab[]={0x00,0x01,0x02,0x03,0x04, , , , , };
          uchar abc[]={0x32,0x30,0x31,0x31,0x31,0x31,0x38,0x34,0x31,0x32,0x32};
          uchar ren[]={0x06, , , , , , , , , , , ,0x05, , };
          uchar qiu[]={0x6f, };
          uchar zhuhe[]={0x47,0x4f,0x4f,0x44,0x21, };
          void delay(void)
          {
          int a=10000;
          while(a!=0)
          {
          a--;
          }
          }
          void write_com(uchar com)
          {
          lcdrs=0;
          P3=com;
          delay();
          lcden=1;
          delay();
          lcden=0;
          }
          void write_date(uchar dat)
          {
          lcdrs=1;
          P3=dat;
          delay();
          lcden=1;
          delay();
          lcden=0;
          }
          void init()
          {
          lcdwr=0;
          lcden=0;
          write_com(0x38);
          write_com(0x0c);
          write_com(0x06);
          write_com(0x01);
          }
          void main()
          {
          uchar data2;
          uchar i;
          uchar j;
          static unsigned char data1;
          WDTCN = 0xde;
          WDTCN = 0xad;
          SYSCLK_Init ();
          PORT_Init ();
          init();
          lcdrs=0;
          lcdwr=0;
          write_com(0x40);
          for(i=0;i<56;i++)
          {
          write_date(CGCODE[i]);
          }
          write_com(0x80);
          for(i=0;i<9;i++)
          {
          write_date(tab[i]);
          }
          write_com(0x80+0x40);
          for(i=0;i<12;i++)
          {
          write_date(abc[i]);
          }
          while(1)
          {
          if(key1==0)
          {
          key1=1;
          delay();
          if(key1==0)
          {
          while(key1==0);
          write_com(0x01);
          }
          }
          if(key2==0)
          {
          key2=1;
          delay();
          if(key2==0)
          {
          while(key2==0);
          for(j=0;j<=1;j++) //移位16x2循環(huán)
          {
          write_com(0x18); //移位
          delay();
          }
          }
          }
          if(key4==0)
          { write_com(0x01);
          key4=1;
          delay();
          if(key4==0)
          {
          while(key4==0);
          { write_com(0x80);
          for(i=0;i<9;i++)
          {
          write_date(tab[i]);
          }
          write_com(0x80+0x40);
          for(i=0;i<12;i++)
          {
          write_date(abc[i]);
          }
          } }
          }
          if(key3==0)
          {
          key3=1;
          delay();
          if(key3==0)
          {
          while(key3==0);
          write_com(0x01);
          write_com(0x80);
          for(i=0;i<=16;i++)
          {
          write_date(ren[i]);
          }
          for(j=1;j<=9;j++)
          {write_com(0x80+0x01+j) ;
          for(i=0;i<=1;i++)
          {write_date(qiu[i]);
          write_com(0x80+0x01+j-1) ;
          write_date(0xfe);}
          delay();
          if(j==9)
          {write_com(0x01);
          write_com(0x80+0x06);
          for(i=0;i<=5;i++)
          write_date(zhuhe[i]);
          }}
          }
          }
          }
          }
          void SYSCLK_Init (void)
          {
          OSCICN = 0x05;
          }
          void PORT_Init (void)
          {
          XBR0 = 0x00;
          XBR2 = 0x40;
          P2MDOUT = 0xe0;
          }


          關(guān)鍵詞: C8051f020LCD控制顯

          評論


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