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

📄 lm3228.lst

📁 别人的C51菜单程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
 214                  DATA_PORT=addr>>8;
 215                  check_code_data();
 216                  COMMAND_PORT=0x24;
 217                  check_code_data();
 218                  DATA_PORT=str;
 219                  check_code_data();
 220                  COMMAND_PORT=0xc4;
 221          }*/     
 222          /********************************************************************************************/
 223          //显示字符
 224           void text_display(uchar str)   //reentrant
 225          {
 226   1              //set_point(SET_ADDRESS_POINTER,lowaddr,highaddr);
 227   1              //set_once_read_write(write_address_add,str-0x20);
 228   1              set_autoreadwrite(AUTOWRITE);
 229   1              check_auto_write();
 230   1              DATA_PORT=str-0x20;
 231   1              set_autoreadwrite(AUTOSTOP);
 232   1      }
 233          /********************************************************************************************/
 234          //显示字符串
 235          void string_display(uchar data *str,uchar lowaddr,uchar highaddr) //reentrant
 236          {
 237   1              set_point(SET_ADDRESS_POINTER,lowaddr,highaddr);
 238   1              set_autoreadwrite(AUTOWRITE);
 239   1              while(*str!='\0')
 240   1                      //set_once_read_write(write_address_add,str[i]-0x20);
 241   1                      {check_auto_write();
C51 COMPILER V8.08   LM3228                                                                06/30/2007 15:23:46 PAGE 5   

 242   2                      DATA_PORT=*str-0x20;
 243   2                      str++;
 244   2                      }       
 245   1              set_autoreadwrite(AUTOSTOP);
 246   1      }
 247          /********************************************************************************************/
 248          //显示代码区中的字符串
 249          void string_display_code(uchar num,uchar code *str,uchar lowaddr,uchar highaddr) //reentrant
 250          {
 251   1              uchar i;
 252   1              set_point(SET_ADDRESS_POINTER,lowaddr,highaddr);
 253   1              set_autoreadwrite(AUTOWRITE);
 254   1              if(num==0)
 255   1              {
 256   2                      while(*str!='\0')
 257   2                              {       
 258   3                              check_auto_write();
 259   3                              DATA_PORT=*str-0x20;
 260   3                              str++;
 261   3                              }
 262   2              }
 263   1              else
 264   1                      for(i=0;i<num;i++)
 265   1                      {
 266   2                              check_auto_write();
 267   2                              DATA_PORT=*str-0x20;
 268   2                              str++;
 269   2                      }       
 270   1              set_autoreadwrite(AUTOSTOP);
 271   1      }
 272          /********************************************************************************************/
 273          //显示汉字
 274          void hanzi_display(uchar *str,uint  num,uchar  lowaddr,uchar  highaddr)                  //data data   data
 275          {                                                                                                                                                                         
 276   1              uchar  i,j,k,haddr,addr,caddr;   //      data
 277   1              haddr=0;addr=0;caddr=0;                                                                                                            
 278   1              for(k=0;k<(num/32);k++)           //显示多少字因为一个字是16*16点阵,所以占32字节空间
 279   1              {                                                       //256*256液晶的地址                        //0x00 00  0x10 01 ..............0x10 0f 0x10 10 .............0x10 1f//
 280   2                      caddr=lowaddr;                                                                             //0x00 20                                                                                                     0x10 3f//
 281   2                      lowaddr=lowaddr+2;                                                                         //...
 282   2                      haddr=highaddr;                                                                            //...
 283   2                                                                                                                                 //0x1f e0
 284   2      #if(SCREEN_WIDTH==0x20)                                                                            //0x1f f0
 285   2      
 286   2                      if(lowaddr>0x1e)                        //换行
 287   2                      {
 288   3                              lowaddr=0x00;                   //低地址
 289   3                              highaddr=highaddr+2;;                   //高位地址
 290   3                      }
 291   2      #else 
                      if(SCREEN_WIDTH==0x10)                  //注意不要和#else在一行
                              if(lowaddr>0x0e)                        //换行
                              {
                                      lowaddr=0x00;                   //低地址
                                      highaddr=highaddr+1;;                   //高位地址
                              } 
              #endif
 299   2      
 300   2                      for(i=0;i<16;i++)
 301   2                      {       
 302   3      #if(SCREEN_WIDTH==0x20)
 303   3                              addr=caddr+32*i;
C51 COMPILER V8.08   LM3228                                                                06/30/2007 15:23:46 PAGE 6   

 304   3                              if(i==8)
 305   3                              haddr++;
 306   3      #else 
                      if(SCREEN_WIDTH==0x10)
                                      addr=caddr+16*i;
              #endif
 310   3                              set_point(SET_ADDRESS_POINTER,addr,haddr);
 311   3                              set_autoreadwrite(AUTOWRITE);
 312   3                              for(j=0;j<2;j++)
 313   3                              {
 314   4                                      check_auto_write();
 315   4                                      DATA_PORT=*str;
 316   4                                      str++;
 317   4      
 318   4                              }
 319   3                              set_autoreadwrite(AUTOSTOP);
 320   3                      }
 321   2              }
 322   1      }
 323          /********************************************************************************************/
 324          //清图形显示缓冲区
 325          void clrgraphic(void)
 326          {
 327   1              uint j;
 328   1              
 329   1              set_point(SET_ADDRESS_POINTER,0x00,0x04);
 330   1              set_autoreadwrite(AUTOWRITE);
 331   1              for(j=0;j<4096;j++)
 332   1              {
 333   2                      check_auto_write();
 334   2                      DATA_PORT=0x00;
 335   2              }
 336   1              set_autoreadwrite(AUTOSTOP);            
 337   1      
 338   1      }
 339          /********************************************************************************************/
 340          //清字符显示缓冲区
 341          void clrtext(void)
 342          {
 343   1              uint j;
 344   1              set_point(SET_ADDRESS_POINTER,0x00,0x30);
 345   1              set_autoreadwrite(AUTOWRITE);
 346   1              for(j=0;j<1024;j++)
 347   1              {
 348   2                      check_auto_write();
 349   2                      DATA_PORT=0x00;
 350   2              }
 351   1              set_autoreadwrite(AUTOSTOP);            
 352   1              
 353   1      }
 354          /********************************************************************************************/
 355          //图片显示
 356          volatile void picture_display(Picture *point1,uchar lowaddr,uchar highaddr,bit inverse) 
 357          {
 358   1              uchar data i,j,laddr;
 359   1              Picture *point;
 360   1              point=point1;
 361   1              laddr=lowaddr; 
 362   1              CY=0;
 363   1              for(i=0;i<(point->length);i++)
 364   1              {
 365   2                      CY=0;
C51 COMPILER V8.08   LM3228                                                                06/30/2007 15:23:46 PAGE 7   

 366   2                      if(i)
 367   2                      laddr=laddr+32;
 368   2                      if(CY)
 369   2                              highaddr=highaddr+1;
 370   2                       
 371   2                      set_point(SET_ADDRESS_POINTER,laddr,highaddr); 
 372   2                      set_autoreadwrite(AUTOWRITE);
 373   2                      for(j=0;j<(point->width/8);j++)
 374   2                      {
 375   3                              if((laddr!=0x00)&&(j!=0))  //如果没j!=0,当laddr=0x20、0x40..时,显示不正常
 376   3                                      if((laddr+j)%32==0)
 377   3                                      {
 378   4                                              (point->picturecode)=(point->picturecode)+(point->width/8-j);
 379   4      
 380   4                                              break;
 381   4                                      }
 382   3      
 383   3                              check_auto_write();
 384   3                              if(!inverse)
 385   3                                      DATA_PORT=*(point->picturecode);
 386   3                              else
 387   3                                      DATA_PORT=~*(point->picturecode);
 388   3                              (point->picturecode)++;
 389   3      
 390   3                      }
 391   2                              set_autoreadwrite(AUTOSTOP);
 392   2                              
 393   2              }
 394   1      }
 395                          
 396          /********************************************************************************************/  
 397          
 398          //初始化lcd
 399          void init_lcd(void)
 400          {
 401   1      
 402   1              
 403   1              //uint i,j;
 404   1              set_display_area(TEXT_ADDRESS,0x00,0x30);
 405   1              set_display_area(TEXT_WIDTH,SCREEN_WIDTH,0x00); //因为3228是128*64,显示的字符为8*8,所以字符宽度为16
 406   1              set_display_area(GRAPHIC_ADDRESS,0x00,0x00);
 407   1              set_display_area(GRAPHIC_WIDTH,SCREEN_WIDTH,0x00);
 408   1              set_display(TEXTON|GRAPHICON);   //CURSORBLINK|CURSORON|
 409   1              set_point(SET_ADDRESS_POINTER,0x00,0x00);
 410   1              //set_point(SET_CURSOR_POINTER,0x4e,0x30);
 411   1              set_display_mode(LOGIC_OR);
 412   1              //set_point(SET_ADDRESS_POINTER,0x1c,0x2e);
 413   1              
 414   1      
 415   1      
 416   1      
 417   1      }                       


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    928    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      25
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       3
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
C51 COMPILER V8.08   LM3228                                                                06/30/2007 15:23:46 PAGE 8   

END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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