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

📄 12232.lst

📁 内含LCD驱动源代码大全
💻 LST
📖 第 1 页 / 共 2 页
字号:
 271   1      } 
 272          
 273          //-----------------------------------------------------------
 274          //图片显示
 275          //采用字模2生成或字模3生成的都可以.
 276          //-----------------------------------------------------------
 277          void DrawBmp1(uint x_add, uchar width,uchar *bmp)
 278          {
 279   1      uchar x,address,i=0;     //address表示显存的物理地址
 280   1      uchar page=0;   //page表示上下两页
 281   1      bit window=0;  //window表示左右两页
 282   1      //putcharR      //右边
 283   1      //putcharL      //左边
 284   1      for (x=width;x>1;x--)
 285   1      {
 286   2      if (x_add>60) {window=1;address=x_add%61;}
 287   2      else address=x_add;     
 288   2      
 289   2      
 290   2              SetPage(0,0);
 291   2              SetAddress(address,address);
 292   2              if(window==1)PutCharR(bmp[i]);
 293   2              else    PutCharL(bmp[i]);
 294   2              SetPage(1,1);
 295   2              SetAddress(address,address);
 296   2              if(window==1)PutCharR(bmp[i+width]);
 297   2              else    PutCharL(bmp[i+width]);
 298   2              
 299   2              
 300   2              SetPage(2,2);
 301   2              SetAddress(address,address);
 302   2              if(window==1)PutCharR(bmp[i+width+width]);
 303   2              else    PutCharL(bmp[i+width+width]);
C51 COMPILER V7.07   12232                                                                 10/31/2006 14:32:12 PAGE 6   

 304   2              SetPage(3,3);
 305   2              SetAddress(address,address);
 306   2              if(window==1)PutCharR(bmp[i+width+width+width]);
 307   2              else    PutCharL(bmp[i+width+width+width]);     
 308   2          i++;
 309   2          x_add++;
 310   2         
 311   2      }
 312   1      }
 313          
 314          //---------------------------------------------------------------
 315          //---------------------------------------------------------------
 316          //采用zimo2  显示汉字,以汉字的显示方式
 317          //void Draw_word(uchar d_where,uint x_add,bit layer,uchar width)
 318          //d_where表示在码表中第几个汉字,x_add横坐标位置,layer显示的层, width显示的宽度。
 319          //---------------------------------------------------------------
 320          
 321          
 322          void Draw_word(uchar d_where,uint x_add,bit layer,uchar width)
 323          {
 324   1      uchar x,i=0,address;     //address表示显存的物理地址
 325   1      uchar page=0;   //page表示上下两页
 326   1      bit window=0;  //window表示左右两页
 327   1      //putcharR      //右边
 328   1      //putcharL      //左边
 329   1      d_where=d_where*32;
 330   1      
 331   1      for (x=width;x>1;x--)
 332   1      {
 333   2      if (x_add>60) {window=1;address=x_add%61;}
 334   2      else address=x_add;     
 335   2      
 336   2      if(layer==0)    //显示一行八个字
 337   2              {
 338   3              
 339   3              SetPage(0,0);
 340   3              SetAddress(address,address);
 341   3              if(window==1)PutCharR(bmp001[d_where]);//右边
 342   3              else    PutCharL(bmp001[d_where]);//左边
 343   3              SetPage(1,1);
 344   3              SetAddress(address,address);
 345   3              if(window==1)PutCharR(bmp001[d_where+width]);
 346   3              else    PutCharL(bmp001[d_where+width]);
 347   3      
 348   3              }
 349   2      else
 350   2              {       //显示第二行八个汉字
 351   3              SetPage(2,2);
 352   3              SetAddress(address,address);
 353   3              if(window==1)PutCharR(bmp001[d_where]);//右边
 354   3              else    PutCharL(bmp001[d_where]);//左边
 355   3              SetPage(3,3);
 356   3              SetAddress(address,address);
 357   3              if(window==1)PutCharR(bmp001[d_where+width]);
 358   3              else    PutCharL(bmp001[d_where+width]);
 359   3      
 360   3              }
 361   2          x_add++;
 362   2          d_where++;
 363   2      }
 364   1      }
 365          /*
C51 COMPILER V7.07   12232                                                                 10/31/2006 14:32:12 PAGE 7   

 366          //------------------------------------------------------------------
 367          //字模2显示一个汉字
 368          //纵向取模,字节倒序
 369          void    disp_one(bit top_low,bit widows,uchar address,uchar width,uchar*bmp)
 370          {       
 371          if(top_low==0)
 372                  {
 373                  SetPage(0,0);
 374                  SetAddress(address,address);
 375                  if(window==1)PutCharR(bmp001[next][i]);
 376                  else    PutCharL(bmp001[next][i]);
 377                  SetPage(1,1);
 378                  SetAddress(address,address);
 379                  if(window==1)PutCharR(bmp001[next][i+width]);
 380                  else    PutCharL(bmp001[next][i+width]);
 381                  }
 382          else
 383                  {
 384                  SetPage(0,0);
 385                  SetAddress(address,address);
 386                  if(window==1)PutCharR(bmp001[next][i]);
 387                  else    PutCharL(bmp001[next][i]);
 388                  SetPage(1,1);
 389                  SetAddress(address,address);
 390                  if(window==1)PutCharR(bmp001[next][i+width]);
 391                  else    PutCharL(bmp001[next][i+width]);
 392                  }
 393          }
 394          */
 395          
 396          
 397          
 398          
 399          //液晶显示规则
 400          //      M(左)           S(右)
 401          //      page            page
 402          //      0       |       0
 403          //      1       |       1
 404          //      2       |       2
 405          //      3       |       3
 406          
 407          void    delay1s(unsigned char i)
 408          {
 409   1              while(i>1)
 410   1              {
 411   2                      i--;
 412   2              
 413   2                      delay(65530);
 414   2              }
 415   1      }
 416          
 417          //显示动态的等待图标
 418          void    wait1(unsigned char i)
 419          {
 420   1              for(;i>1;i--)
 421   1              {delay1s(2);
 422   2              clrscr(); //.
 423   2              DrawBmp1(0,60,Bmptc); //.
 424   2              DrawBmp1(76,19,Bmpt1); //.
 425   2              delay1s(2);
 426   2              clrscr(); //.
 427   2              DrawBmp1(0,60,Bmptc); //.
C51 COMPILER V7.07   12232                                                                 10/31/2006 14:32:12 PAGE 8   

 428   2              DrawBmp1(76,19,Bmpt2); //.
 429   2              delay1s(2);
 430   2              clrscr(); //.
 431   2              DrawBmp1(0,60,Bmptc); //.
 432   2              DrawBmp1(76,19,Bmpt3); //.
 433   2              delay1s(2);
 434   2              clrscr(); //.
 435   2              DrawBmp1(0,60,Bmptc); //.
 436   2              DrawBmp1(76,19,Bmpt4); //.
 437   2              delay1s(2);
 438   2              clrscr(); //.
 439   2              DrawBmp1(0,60,Bmptc); //.
 440   2              DrawBmp1(76,19,Bmpt5); //.
 441   2              delay1s(2);
 442   2              clrscr(); //.
 443   2              DrawBmp1(0,60,Bmptc); //.
 444   2              DrawBmp1(76,19,Bmpt6); //.
 445   2              delay1s(2);
 446   2              clrscr(); //.
 447   2              DrawBmp1(0,60,Bmptc); //.
 448   2              DrawBmp1(76,19,Bmpt7); //.
 449   2              }
 450   1      
 451   1      }
 452          
 453          
 454          //演示程序
 455          void main()                                                                                               
             -                           
 456          {                
 457   1       //W_R=0;
 458   1       AUXR=0x02;                                                                                               
             -    
 459   1       lcdini(); //reset                                                   
 460   1       clrscr(); //clr          
 461   1       
 462   1                                                    
 463   1       /*Draw_word(0,0,0,16); //
 464   1       Draw_word(1,16,0,16); //
 465   1       Draw_word(2,32,0,16); //
 466   1       Draw_word(3,48,0,16); //
 467   1       Draw_word(0,64,0,16); //
 468   1       Draw_word(1,80,0,16); //
 469   1       Draw_word(2,96,0,16); //
 470   1      
 471   1       DrawBmp(1,120,Bmp002); //
 472   1       clrscr(); //
 473   1       delay1s(3);
 474   1       DrawBmp1(0,122,Bmp012); //LOGO*/
 475   1       while(1)
 476   1              {
 477   2              if(W_R==0)
 478   2              {
 479   3                      P4 &= 0xFB;
 480   3                      delay(50);
 481   3                      //P4 |= 0xFF;
 482   3                      P4 &= 0xFD;
 483   3                      delay(50);
 484   3                      //P4 |= 0xFF;
 485   3              }
 486   2       Draw_word(0,0,0,16); //.
 487   2       Draw_word(1,16,0,16); //.
C51 COMPILER V7.07   12232                                                                 10/31/2006 14:32:12 PAGE 9   

 488   2       Draw_word(2,32,0,16); //.
 489   2       Draw_word(3,48,0,16); //.
 490   2       Draw_word(0,64,0,16); //.
 491   2       Draw_word(1,80,0,16); //.
 492   2       Draw_word(2,96,0,16); //.
 493   2              
 494   2      /*      delay1s(3);
 495   2              clrscr(); 
 496   2              DrawBmp1(10,101,Bmp07); 
 497   2              
 498   2              //delay1s(8);
 499   2              clrscr(); 
 500   2              //wait1(3);
 501   2              DrawBmp1(0,122,Bmp04); 
 502   2              //delay1s(8);
 503   2              clrscr(); 
 504   2              //wait1(3);
 505   2              DrawBmp1(0,122,Bmp03); //合能电气
 506   2              //delay1s(8);
 507   2              clrscr(); 
 508   2              //wait1(3);
 509   2              clrscr(); 
 510   2              DrawBmp1(10,101,Bmp05); 
 511   2              //delay1s(8);
 512   2              clrscr(); 
 513   2              //wait1(3);
 514   2              clrscr(); 
 515   2              DrawBmp1(10,101,Bmp06); 
 516   2              //delay1s(8);
 517   2              clrscr(); 
 518   2              //wait1(3);
 519   2              clrscr(); 
 520   2              DrawBmp1(10,101,Bmp08); 
 521   2              //delay1s(8);
 522   2              clrscr(); 
 523   2              //wait1(3);
 524   2              clrscr(); 
 525   2              DrawBmp1(0,122,Bmp01); //这仿真器真不错,用过都说好.
 526   2              //wait1(8);*/
 527   2              
 528   2              }                                                        
 529   1       }                
 530           
 531                                                   


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1324    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      26
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       5
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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