⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main6_2.lst

📁 64x32led单元板的89s51显示控制程序,可以完成静太显示,向上平移,向右平移的动态显示.
💻 LST
📖 第 1 页 / 共 2 页
字号:
 137   1              if(row_count==16)row_count=0;  //行地址满16,地址重置
 138   1      }
 139          //*************************databuf 更新
 140          void full_databuf(uchar effict)
 141          {       
 142   1              uchar i;
 143   1              uchar *ptr;
 144   1              if(fulldata_flag==1)
 145   1              {
 146   2                      clrscree();
 147   2                      if(effict==staticdis||effict==left)//静止或左移数据buf刷新
 148   2                      {
 149   3                              for(i=0;i<18;i+=2)
 150   3                              {
 151   4                                      ptr=dataindex[i/2];
 152   4                                      if(ptr==0)break;
 153   4                                      databuf[i]=*(ptr+row_count*2);
 154   4                                      databuf[i+1]=*(ptr+row_count*2+1);
 155   4                              }
 156   3                              if(effict==left)
 157   3                              {
 158   4                                      l_databuf(shift_add); //数据左移处理 shift_add左移位数
 159   4                              }
C51 COMPILER V7.06   MAIN6_2                                                               05/23/2008 09:48:34 PAGE 4   

 160   3                      }
 161   2                      else if(effict==up)     //上移数据buf刷新
 162   2                      {
 163   3                              for(i=0;i<18;i+=2)
 164   3                              {
 165   4                                      ptr=dataindex[i/2];
 166   4                                      if(ptr==0)break;
 167   4                                      if((shift_add+row_count)>15)//当扁移超过本字位数
 168   4                                      {
 169   5                                      databuf[i]=*(ptr+134+(shift_add+row_count-15)*2);
 170   5                                      databuf[i+1]=*(ptr+134+(shift_add+row_count-15)*2+1);           
 171   5                                      }
 172   4                                      else//当扁移在本字位数内
 173   4                                      {
 174   5                                      databuf[i]=*(ptr+(shift_add+row_count)*2);
 175   5                                      databuf[i+1]=*(ptr+(shift_add+row_count)*2+1);
 176   5                                      }
 177   4                              }               
 178   3                      }
 179   2                      fulldata_flag=0;
 180   2              }
 181   1      }
 182          void l_databuf(uchar i)//左移时数据BUF处理
 183          {
 184   1              uchar h;
 185   1              int j,k;
 186   1              if(i>=8)
 187   1              {
 188   2                      for(h=0;h<17;h++)
 189   2                      databuf[h]=databuf[h+1];
 190   2                      i-=8;
 191   2              }
 192   1              for(h=0;h<16;h++)
 193   1              {
 194   2                      j=databuf[h];
 195   2                      k=databuf[h+1];
 196   2                      j=j<<i;
 197   2                      k=k>>(8-i);
 198   2                      databuf[h]=j|k;
 199   2              }       
 200   1      }
 201          
 202          void full_index(uchar *prt,uchar effict)
 203          {
 204   1              uchar str1,str2;
 205   1              uchar *prt2;
 206   1              int i,j;
 207   1              if(fullindex_flag==1)
 208   1              {
 209   2                      if(effict==staticdis)indexprt=prt;  //文字号索引:静态不变 、左移加1、上移加4(一行的文字为四个)
 210   2                      else if(effict==up)indexprt=prt+8;
 211   2                      else if(effict==left)indexprt=prt+2;
 212   2                      clrindex();
 213   2                      for(i=0;i<12;i++,prt=prt+2)
 214   2                      {
 215   3                              str1=*prt;
 216   3                              str2=*(prt+1);
 217   3                              if(str1=='\0') {disen=1;break;}
 218   3                              for(j=0;j<sizeof(GB_16)/sizeof(GB_16[0]);j++)
 219   3                              {
 220   4                                      if(str1 == GB_16[j].Index[0]&&str2 == GB_16[j].Index[1]) //索引相应文字
 221   4                                      break;
C51 COMPILER V7.06   MAIN6_2                                                               05/23/2008 09:48:34 PAGE 5   

 222   4                              }
 223   3                              prt2=GB_16[j].Msk; //把文字字模数组首地址给文字索引数组
 224   3                              dataindex[i]=prt2;
 225   3                      }
 226   2                      fullindex_flag=0;
 227   2              }               
 228   1      }
 229          void timeIRQ(void) interrupt 1
 230          {
 231   1              TH0=(65535-600)/256;
 232   1              TL0=(65535-600)%256;
 233   1              if(fulldata_flag!=1)
 234   1              {
 235   2                      row_dis();   //行显示
 236   2                      shift_count--;  //移位数据
 237   2                      if(!shift_count)
 238   2                      {
 239   3                              shift_count=speed;
 240   3                              shift_add++;
 241   3                              if(shift_add==16)
 242   3                              {
 243   4                                      shift_add=0;
 244   4                                      fullindex_flag=1;               
 245   4                              }                       
 246   3                      }
 247   2              }
 248   1      }
 249          
 250          void display(uchar *a,uchar effict,char speed)//*a文字索引数组首地址  effict:显示效果
 251          {
 252   1              indexprt=a;
 253   1              speed=speed;
 254   1              disen=0;
 255   1              fullindex_flag=1;
 256   1              fulldata_flag=1;
 257   1              clrscree();
 258   1              clrindex();
 259   1              shift_add=0;
 260   1              row_count=0;
 261   1              while(!disen)
 262   1              {
 263   2                      full_index(indexprt,effict);    
 264   2                      full_databuf(effict);
 265   2              }
 266   1      }
 267          void staticdisplay(uchar *a,int time)//*a文字索引数组首地址  effict:显示效果
 268          {       
 269   1              bit end_flag;
 270   1              indexprt=a;
 271   1              fullindex_flag=1;
 272   1              fulldata_flag=1;
 273   1              clrscree();
 274   1              clrindex();
 275   1              end_flag=1;
 276   1              full_index(indexprt,staticdis);
 277   1              while(end_flag)
 278   1              {       
 279   2                      full_databuf(staticdis);
 280   2                      time--;
 281   2                      if(!time)end_flag=0;
 282   2              }
 283   1      }
C51 COMPILER V7.06   MAIN6_2                                                               05/23/2008 09:48:34 PAGE 6   



MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1046    ----
   CONSTANT SIZE    =    726    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     65      22
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -