点阵显示的移动

1017896469   2010-6-3 14:20 楼主

  #include <reg51.h>
#include <absacc.h>

#define uchar unsigned char
#define uint  unsigned int
#define hang0  XBYTE[0X7FFF]
#define hang1  XBYTE[0XbFFF]
#define lie    XBYTE[0XDFFF]


char code tabley[]={

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x30,0x40,0x28,0xC3,0x20,0x42,0x20,0x44,0x20,0x48,0x20,0x50,0x2F,0xC0,
0x60,0x70,0xAC,0x48,0x29,0xC4,0x31,0x42,0x22,0x42,0x20,0x41,0x30,0x41,0x08,0x40,
0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x3F,0xF8,0x00,0x00,0x00,0x00,
0xFF,0xF0,0x00,0x0C,0x00,0x0A,0x00,0x05,0x33,0xFE,0x22,0x00,0x42,0x00,0x02,0x00,
0x00,0x00,0x00,0x00,0x40,0x00,0xFF,0xFE,0x41,0x01,0x4B,0x42,0x59,0xFC,0x49,0x44,
0x7F,0x44,0x49,0x44,0x49,0x7E,0x49,0x00,0x41,0x00,0x7F,0xF8,0x00,0x04,0x00,0x02,
0x00,0x00,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,   
0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x01,0x80,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0E,0x10,0x02,0x3F,0xE2,0x12,0x42,0x12,0x42,0x12,0x42,
0x12,0x42,0xFF,0xFC,0x12,0x40,0x12,0x40,0x12,0x40,0x12,0x40,0x1F,0xE0,0x00,0x00,
0x00,0x00,0x01,0x00,0x03,0x00,0x01,0x00,0x61,0x00,0x51,0x00,0x49,0x00,0x45,0x00,
0x47,0xFE,0x41,0x01,0x41,0x02,0x41,0x00,0x41,0x00,0x41,0x00,0x01,0x00,0x01,0x00,
0x00,0x00,0x04,0x02,0x04,0x03,0x05,0x82,0xF9,0x64,0x81,0x14,0x81,0x08,0x81,0x34,
0xF9,0xC2,0x05,0x02,0x02,0x09,0x00,0x05,0x33,0xFE,0x42,0x00,0x02,0x00,0x02,0x00,
0x00,0x00,0x02,0x00,0x06,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0xFF,0xFF,0x02,0x00,
0x02,0x00,0x02,0x10,0x02,0x08,0x00,0x04,0x33,0xFE,0x42,0x00,0x02,0x00,0x02,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x03,0xC0,0x0C,0x30,0x10,0x08,0x20,0x04,0x40,0x02,0x00,0x00,0x00,0x00,
0x00,0x00,0x20,0x40,0x60,0xFF,0x20,0x41,0x2F,0x40,0x29,0x5E,0x29,0x52,0x29,0x52,
0x69,0x52,0xA9,0x52,0x29,0x52,0x29,0x5E,0x2F,0x40,0x20,0x40,0x20,0x7F,0x20,0x00,
0x00,0x00,0x00,0x04,0x40,0x06,0xFC,0xFA,0x42,0x8A,0x44,0x8A,0x40,0x8A,0x7C,0x8A,
0x42,0xFA,0x41,0x02,0x12,0x42,0x12,0x44,0xFF,0xF8,0x12,0x08,0x12,0xFC,0x02,0x02,
0x00,0x00,0x00,0x00,0x40,0x02,0x20,0x04,0x10,0x08,0x0C,0x30,0x03,0xC0,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};


char code tablez[]={

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,


 0x00,0x00,0x02,0x00,0x03,0x60,0x03,0x60,0x03,0x40,0x01,0xC0,0x01,0xC0,0x0F,0xF8,
0x0F,0xF8,0x0D,0xB0,0x01,0xC0,0x03,0xC0,0x03,0x60,0x03,0x60,0x02,0x60,0x00,0x00,
0x00,0x00,0x00,0x81,0x01,0x01,0x06,0x01,0x18,0x02,0x00,0x02,0x00,0x04,0xFF,0xE8,
0x00,0x10,0x00,0x20,0x10,0x40,0x09,0x80,0x04,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
0x10,0x20,0x0C,0x60,0x00,0x80,0xFF,0xFF,0x02,0x00,0x02,0x04,0x02,0x04,0x02,0x04,
0x02,0x04,0xFF,0xFC,0x02,0x04,0x02,0x04,0x02,0x0C,0x06,0x04,0x02,0x00,0x00,0x00,
0x40,0x00,0x40,0x10,0x40,0x20,0x40,0x40,0x40,0x80,0x41,0x00,0x42,0x00,0x4F,0xFF,
0x70,0x00,0x42,0x00,0x41,0x00,0x40,0x80,0x40,0xC0,0xC0,0x60,0x40,0x00,0x00,0x00,
0x20,0x00,0x24,0x81,0x3C,0xA1,0xE3,0x22,0x22,0x22,0x2D,0x2C,0x30,0xF0,0x00,0x20,
0x30,0xA0,0x29,0x22,0x26,0x21,0x25,0x3E,0x28,0x80,0x30,0xC0,0x00,0x80,0x00,0x00,
0x00,0x00,0x08,0x01,0x08,0x01,0x08,0x01,0x08,0x06,0x08,0x18,0xFF,0xE0,0x08,0x00,
0x08,0x04,0x08,0x02,0x08,0x01,0x08,0x02,0x1F,0xFC,0x08,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x38,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x02,0x02,0x02,0x04,0x12,0x08,0x12,0x10,0x12,0x20,0x12,0x7E,0xFE,0x89,0x13,0x09,
0x32,0x11,0x16,0x11,0x0A,0x21,0x12,0x61,0x32,0x01,0x06,0x07,0x02,0x00,0x00,0x00,
0x04,0x00,0x04,0x02,0x04,0x02,0x04,0x04,0x04,0x08,0x04,0x30,0x05,0xC0,0xFE,0x00,
0x05,0x80,0x04,0x60,0x04,0x10,0x04,0x08,0x04,0x04,0x0C,0x06,0x04,0x04,0x00,0x00,
 0x00,0x40,0x08,0x80,0x11,0x00,0x23,0xFF,0xCC,0x02,0x12,0x0C,0x12,0xF0,0x12,0x08,
0x12,0x04,0xFF,0xFE,0x12,0x42,0x12,0x42,0x32,0xC2,0x16,0x46,0x02,0x04,0x00,0x00,
0x01,0x00,0x02,0x00,0x04,0x00,0x1F,0xFF,0xE4,0x01,0x09,0x02,0x31,0x04,0xD1,0x18,
0x1F,0xE0,0x11,0x02,0x11,0x01,0x11,0x02,0x13,0xFC,0x31,0x00,0x10,0x00,0x00,0x00,
0x41,0x04,0x49,0x18,0x49,0x00,0x49,0x3C,0x49,0x02,0xFF,0x82,0x00,0x22,0x00,0x12,
0x00,0x1A,0xFF,0x82,0x49,0x02,0x49,0x0E,0x59,0x00,0xCB,0x10,0x41,0x0C,0x00,0x00,
0x00,0x00,0x02,0x00,0x03,0x60,0x03,0x60,0x03,0x40,0x01,0xC0,0x01,0xC0,0x0F,0xF8,
0x0F,0xF8,0x0D,0xB0,0x01,0xC0,0x03,0xC0,0x03,0x60,0x03,0x60,0x02,0x60,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00

};

/*********************delay time funcation************************/

void  delay(uchar c)      
    {
    uchar i,j;
    for(i=0;i<c;i++)
        for(j=0;j<10;j++)
            ;
     }

/************************mian funcation*************************/
  void main()             
{
     uchar i,j,k;      //i:每个字的显示循环;j每个字的显示码除以2;k每列刷新次数
     uint  b=0;        //显示偏移控制,char类型最多只能显示14个汉字+一个空白位字符
     uchar a;
  uchar ay;
  uchar iy,jy,ky;
  uint by=0;
  uint cishu=282;
  uint cishuy=250;          //控制移动间隔时间
  while(cishu--)
    {
      j=0;
      if(a==1)           //移动间隔时间;取值0--255
      {
          a=0;
          b+=2;
          if(b==579)   //显示到最后一个字,回头显示,判断值=字数*32
             {
         (b=0);
    
     for(i=64;i>0;i--)
        {
            //unsigned char n;
      lie=i;
            //for(;j<n;j--)
      //{ 
           //清屏
                   hang0=0x00;
       hang1=0x00;
       //hang0=0x00;
       //hang1=0x00;
            //} 
      
           }
             }  
      }
   ///////
      for(i=0;i<64;i++)
      {
          lie=i;
          for(k=0;k<4;k++)
          {
              hang0=tablez[j+b];
              hang1=tablez[j+b+1];
              delay(2);
              hang0=0x00;      //清屏
                 hang1=0x00;
          }
          j+=2;
      }
   //////

         a++;
 
  }

  while(cishuy--)
    {
      jy=0;
      if(ay==1)           //移动间隔时间;取值0--255
      {
          ay=0;
          by+=2;
          if(by==579)   //显示到最后一个字,回头显示,判断值=字数*32
             {
         (by=0);
    
     for(iy=64;iy>0;iy--)
        {
            //unsigned char n;
      lie=iy;
            //for(;j<n;j--)
      //{ 
           //清屏
                   hang0=0x00;
       hang1=0x00;
       //hang0=0x00;
       //hang1=0x00;
            //} 
      
           }
             }  
      }
   ///////
      for(iy=64;iy>0;iy--)
      {
          lie=iy;
          for(ky=0;ky<4;ky++)
          {
              hang0=tabley[jy+by];
              hang1=tabley[jy+by+1];
              delay(2);
              hang0=0x00;      //清屏
                 hang1=0x00;
          }
          jy+=2;
      }
   //////

         ay++;
 

 

 

 

 

 

 


   }
   
    }

 

 

 

 


   

回复评论

暂无评论,赶紧抢沙发吧
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复