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

📄 lcd_demo.lst

📁 LPC2142 LCD12232的显示动画 keil环境
💻 LST
📖 第 1 页 / 共 5 页
字号:
  300          void clrscr(void)
  301          {
  302   1      uchar i;
  303   1      uchar page;
  304   1      for (page=0;page<4;page++)
  305   1      {
  306   2      SetPage(page,page);
  307   2      SetAddress(0,0);
  308   2      for (i=0;i<61;i++){PutCharR(0);PutCharL(0);}
  309   2      }
  310   1      } 
  311          
  312          
  313          //-----------------------------------------------------------
  314          //图片显示
  315          //采用字模2生成或字模3生成的都可以.
  316          //-----------------------------------------------------------
  317          void DrawBmp1(uint x_add, uchar width,unsigned char const *bmp)
  318          {
  319   1      uchar x,address,i=0;     //address表示显存的物理地址
  320   1      uchar page=0;   //page表示上下两页
  321   1      uchar window=0;  //window表示左右两页
  322   1      //putcharR  //右边
ARM COMPILER V2.42,  Lcd_Demo                                                              05/01/06  14:35:51  PAGE 6   

  323   1      //putcharL  //左边
  324   1      for (x=width;x>1;x--)
  325   1      {
  326   2      if (x_add>60) {window=1;address=x_add%61;}
  327   2      else address=x_add; 
  328   2      
  329   2      
  330   2          SetPage(2,2);
  331   2          SetAddress(address,address);
  332   2          if(window==1)PutCharR(bmp[i]);
  333   2          else    PutCharL(bmp[i]);
  334   2          SetPage(3,3);
  335   2          SetAddress(address,address);
  336   2          if(window==1)PutCharR(bmp[i+width]);
  337   2          else    PutCharL(bmp[i+width]);
  338   2          
  339   2          
  340   2          SetPage(0,0);
  341   2          SetAddress(address,address);
  342   2          if(window==1)PutCharR(bmp[i+width+width]);
  343   2          else    PutCharL(bmp[i+width+width]);
  344   2          SetPage(1,1);
  345   2          SetAddress(address,address);
  346   2          if(window==1)PutCharR(bmp[i+width+width+width]);
  347   2          else    PutCharL(bmp[i+width+width+width]); 
  348   2          i++;
  349   2          x_add++;
  350   2         
  351   2      }
  352   1      }
  353          
  354          //---------------------------------------------------------------
  355          //---------------------------------------------------------------
  356          //采用zimo2  显示汉字,以汉字的显示方式
  357          //void Draw_word(uchar d_where,uint x_add,bit layer,uchar width)
  358          //d_where表示在码表中第几个汉字,x_add横坐标位置,layer显示的层, width显示的宽度。
  359          //---------------------------------------------------------------
  360          
  361          
  362          void Draw_word(uchar d_where,uint x_add,uchar layer,uchar width)
  363          {
  364   1      uchar x,i=0,address;     //address表示显存的物理地址
  365   1      uchar page=0;   //page表示上下两页
  366   1      uchar window=0;  //window表示左右两页
  367   1      //putcharR  //右边
  368   1      //putcharL  //左边
  369   1      d_where=d_where*32;
  370   1      
  371   1      for (x=width;x>1;x--)
  372   1      {
  373   2      if (x_add>60) {window=1;address=x_add%61;}
  374   2      else address=x_add; 
  375   2      
  376   2      if(layer==0)    //显示一行八个字
  377   2          {
  378   3          
  379   3          SetPage(0,0);
  380   3          SetAddress(address,address);
  381   3          if(window==1)PutCharR(bmp001[d_where]);//右边
  382   3          else    PutCharL(bmp001[d_where]);//左边
  383   3          SetPage(1,1);
  384   3          SetAddress(address,address);
  385   3          if(window==1)PutCharR(bmp001[d_where+width]);
  386   3          else    PutCharL(bmp001[d_where+width]);
  387   3      
  388   3          }
ARM COMPILER V2.42,  Lcd_Demo                                                              05/01/06  14:35:51  PAGE 7   

  389   2      else
  390   2          {   //显示第二行八个汉字
  391   3          SetPage(2,2);
  392   3          SetAddress(address,address);
  393   3          if(window==1)PutCharR(bmp001[d_where]);//右边
  394   3          else    PutCharL(bmp001[d_where]);//左边
  395   3          SetPage(3,3);
  396   3          SetAddress(address,address);
  397   3          if(window==1)PutCharR(bmp001[d_where+width]);
  398   3          else    PutCharL(bmp001[d_where+width]);
  399   3      
  400   3          }
  401   2          x_add++;
  402   2         d_where++;
  403   2      }
  404   1      }
  405          /*
  406          //------------------------------------------------------------------
  407          //字模2显示一个汉字
  408          //纵向取模,字节倒序
  409          void    disp_one(bit top_low,bit widows,uchar address,uchar width,uchar*bmp)
  410          {   
  411          if(top_low==0)
  412              {
  413              SetPage(0,0);
  414              SetAddress(address,address);
  415              if(window==1)PutCharR(bmp001[next][i]);
  416              else    PutCharL(bmp001[next][i]);
  417              SetPage(1,1);
  418              SetAddress(address,address);
  419              if(window==1)PutCharR(bmp001[next][i+width]);
  420              else    PutCharL(bmp001[next][i+width]);
  421              }
  422          else
  423              {
  424              SetPage(0,0);
  425              SetAddress(address,address);
  426              if(window==1)PutCharR(bmp001[next][i]);
  427              else    PutCharL(bmp001[next][i]);
  428              SetPage(1,1);
  429              SetAddress(address,address);
  430              if(window==1)PutCharR(bmp001[next][i+width]);
  431              else    PutCharL(bmp001[next][i+width]);
  432              }
  433          }
  434          */
  435          
  436          
  437          
  438          
  439          //液晶显示规则
  440          //  M(左)       S(右)
  441          //  page        page
  442          //  0   |   0
  443          //  1   |   1
  444          //  2   |   2
  445          //  3   |   3
  446          
  447          void    delay1s(unsigned char i)
  448          {
  449   1          while(i>1)
  450   1          {
  451   2              i--;
  452   2              delayms(20);
  453   2          }
  454   1      }
ARM COMPILER V2.42,  Lcd_Demo                                                              05/01/06  14:35:51  PAGE 8   

  455          
  456          //显示动态的等待图标
  457          void    wait1(unsigned char i)
  458          {
  459   1          clrscr(); //
  460   1          DrawBmp1(0,60,Bmptc); //
  461   1          for(;i>1;i--)
  462   1          {delay1s(2);
  463   2          DrawBmp1(76,19,Bmpt1); //
  464   2          delay1s(2);
  465   2          DrawBmp1(76,19,Bmpt2); //
  466   2          delay1s(2);
  467   2      
  468   2      //  DrawBmp1(0,60,Bmptc); //
  469   2          DrawBmp1(76,19,Bmpt3); //
  470   2          delay1s(2);
  471   2      
  472   2      //  DrawBmp1(0,60,Bmptc); //
  473   2          DrawBmp1(76,19,Bmpt4); //
  474   2          delay1s(2);
  475   2      
  476   2      //  DrawBmp1(0,60,Bmptc); //
  477   2          DrawBmp1(76,19,Bmpt5); //
  478   2          delay1s(2);
  479   2      
  480   2      //  DrawBmp1(0,60,Bmptc); //
  481   2          DrawBmp1(76,19,Bmpt6); //
  482   2          delay1s(2);
  483   2      
  484   2      //  DrawBmp1(0,60,Bmptc); //
  485   2          DrawBmp1(76,19,Bmpt7); //
  486   2          }
  487   1      
  488   1      }
  489          
  490           void init_port(void)
  491           {
  492   1       //port initialized
  493   1       IODIR1=0x00FF0000;
  494   1       IODIR0=0x40600010;
  495   1       }
  496           
  497           
  498          //演示程序
  499          void main()                                                                                              
             -                            
  500          {                
  501   1      //unsigned int i;
  502   1       init_port();
  503   1       //while(1)
  504   1      // {
  505   1       // for(i=1;i<=128;i<<=1 )
  506   1       // {
  507   1      //  OUT_DATA(i);
  508   1      //  delayms(10);
  509   1      //  }
  510   1        //for (j = 0x010000; j < 0x800000; j <<= 1) { /* Blink LED 0,1,2,3,4,5,6 */
  511   1        //    IOSET1 = j;                               /* Turn on LED */
  512   1        //    delayms (10);                                  /* call wait function */
  513   1        //    IOCLR1 = j;                               /* Turn off LED */
  514   1        //  }
  515   1      // }                                                                                                    
  516   1       lcdini(); //reset                                                   
  517   1       clrscr(); //clr          
  518   1       
  519   1                                                    
ARM COMPILER V2.42,  Lcd_Demo                                                              05/01/06  14:35:51  PAGE 9   

  520   1       Draw_word(0,0,0,16); //
  521   1       Draw_word(1,16,0,16); //
  522   1       Draw_word(2,32,0,16); //
  523   1       Draw_word(3,48,0,16); //
  524   1       Draw_word(0,64,0,16); //
  525   1       Draw_word(1,80,0,16); //
  526   1       Draw_word(2,96,0,16); //
  527   1      
  528   1        clrscr(); //
  529   1       DrawBmp(0,112,ARMKIT_bmp);
  530   1       DrawBmp(1,119,Bmp002); //
  531   1      
  532   1       clrscr(); //
  533   1       delay1s(3);
  534   1       DrawBmp1(0,122,Bmp012); //LOGO
  535   1       while(1)
  536   1          {
  537   2          delay1s(3);
  538   2      
  539   2          clrscr(); //
  540   2          DrawBmp1(10,101,Bmp07); //
  541   2          delay1s(8);
  542   2          clrscr(); //
  543   2          wait1(3);
  544   2          DrawBmp1(0,122,Bmp04); //
  545   2          delay1s(8);
  546   2          clrscr(); //
  547   2          wait1(3);
  548   2          DrawBmp1(0,122,Bmp03); //超前科技
  549   2          delay1s(8);
  550   2          clrscr(); //
  551   2          wait1(3);
  552   2          clrscr(); //
  553   2          DrawBmp1(10,101,Bmp05); //
  554   2          delay1s(8);
  555   2          clrscr(); //
  556   2          wait1(3);
  557   2          clrscr(); //
  558   2          DrawBmp1(10,101,Bmp06); //
  559   2          delay1s(8);
  560   2          clrscr(); //
  561   2          wait1(3);
  562   2          clrscr(); //
  563   2          DrawBmp1(10,101,Bmp08); //
  564   2          delay1s(8);
  565   2          clrscr(); //
  566   2          wait1(3);
  567   2          clrscr(); //
  568   2          DrawBmp1(0,122,Bmp01); //
  569   2          wait1(8);
  570   2          }                                                        
  571   1       }                
  572           
  573                                                   
ARM COMPILER V2.42,  Lcd_Demo                                                              05/01/06  14:35:51  PAGE 10  

ASSEMBLY LISTING OF GENERATED OBJECT CODE



*** EXTERNALS:
 EXTERN DATA (Bmpt1)
 EXTERN DATA (Bmpt2)
 EXTERN DATA (Bmpt3)
 EXTERN DATA (Bmpt4)
 EXTERN DATA (Bmpt5)
 EXTERN DATA (Bmpt6)
 EXTERN DATA (Bmpt7)
 EXTERN DATA (Bmptc)
 EXTERN DATA (bmp001)
 EXTERN DATA (Bmp08)
 EXTERN DATA (Bmp07)
 EXTERN DATA (Bmp06)
 EXTERN DATA (Bmp05)
 EXTERN DATA (Bmp04)
 EXTERN DATA (Bmp03)
 EXTERN DATA (Bmp01)
 EXTERN DATA (Bmp012)
 EXTERN DATA (Bmp002)
 EXTERN DATA (ARMKIT_bmp)
 EXTERN CODE16 (?C?SDIV?T)
 EXTERN CODE16 (?C?UDIV?T)
 EXTERN NUMBER (__startup)



*** PUBLICS:
 PUBLIC         Io_Set?T

⌨️ 快捷键说明

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