tg12232b.lst

来自「STC51系列的源码」· LST 代码 · 共 667 行 · 第 1/3 页

LST
667 行
字号
 208   1          _nop_();
 209   1          _nop_();
 210   1      }
 211          
 212          /********************************************************************************/
 213          /* fun_name : LCDP_write_wait_status()                                          */
 214          /* version  : v1.00                                                             */
 215          /* created  : xillinx                                                           */
 216          /* descript : write a command to chip 1 and chip 2 of LCD module                */
 217          /********************************************************************************/
 218          void LCDP_write_wait_status(unsigned char chip)
 219          {   if( chip==0x00)
 220   1          {   while(LCDP_rd_chip_1_cmd&0x80)
 221   2              {   LCDP_sdelay();
 222   3              }
 223   2          }
 224   1          else
 225   1          {   while(LCDP_rd_chip_2_cmd&0x80)
 226   2              {   LCDP_sdelay();
 227   3              }
 228   2          }
 229   1      }
 230          /********************************************************************************/
 231          /* fun_name : LCDP_write_command()                                              */
 232          /* version  : v1.00                                                             */
 233          /* created  : xillinx                                                           */
 234          /* descript : write a command to chip 1 and chip 2 of LCD module                */
 235          /********************************************************************************/
 236          void LCDP_write_command(unsigned char command)
 237          {   LCDP_write_wait_status(0x00);
 238   1          LCDP_sdelay();
 239   1          LCDP_wr_chip_1_cmd=command;
 240   1          LCDP_sdelay();
C51 COMPILER V8.02   TG12232B                                                              09/26/2008 15:18:08 PAGE 5   

 241   1          LCDP_write_wait_status(0x01);
 242   1          LCDP_sdelay();
 243   1          LCDP_wr_chip_2_cmd=command;
 244   1          LCDP_sdelay();
 245   1      }
 246          
 247          /********************************************************************************/
 248          /* fun_name : LCDP_write_ram_data()                                             */
 249          /* version  : v1.00                                                             */
 250          /* created  : xillinx                                                           */
 251          /* descript : write a data to chip x 's RAM                                     */
 252          /********************************************************************************/
 253          void LCDP_write_ram_data(unsigned char chip,unsigned char value)
 254          {   if( chip==0x0)
 255   1          {   LCDP_write_wait_status(0x00);
 256   2              LCDP_sdelay();
 257   2              LCDP_wr_chip_1_data=value;
 258   2              LCDP_sdelay();
 259   2          }
 260   1          else
 261   1          {   LCDP_write_wait_status(0x01);
 262   2              LCDP_sdelay();
 263   2              LCDP_wr_chip_2_data=value;
 264   2              LCDP_sdelay();
 265   2          }
 266   1      }
 267          
 268          /********************************************************************************/
 269          /* fun_name : LCDP_write_one_byte()                                             */
 270          /* version  : v1.00                                                             */
 271          /* created  : xillinx                                                           */
 272          /* descript : write a one byte to chip 1 and chip 2 of LCD module               */
 273          /********************************************************************************/
 274          #if 0
              void LCDP_write_one_byte(unsigned char page,unsigned char column,unsigned char value)
              {   LCDP_set_page(page&0x03);
                  LCDP_set_column(column);
                  LCDP_write_ram_data(page>3,value);
              
              }
              #endif
 282          
 283          /********************************************************************************/
 284          /* fun_name : LCDP_write_one_page()                                             */
 285          /* version  : v1.00                                                             */
 286          /* created  : xillinx                                                           */
 287          /* descript : write a one page data                                             */
 288          /********************************************************************************/
 289          #if 0
              void LCDP_write_one_page(unsigned char page, unsigned char * buffer)
              {   unsigned char i;
                  unsigned char chip=0x0;
                  LCDP_set_page(page&0x3);
                  LCDP_set_column(0x0);
                  if( page>0x3)
                  {   chip=0x1;
                  }
                  for(i=0x0;i<61;i++)
                  {   LCDP_write_ram_data(chip,buffer[i]);
                  }
              }
              #endif
C51 COMPILER V8.02   TG12232B                                                              09/26/2008 15:18:08 PAGE 6   

 303          /********************************************************************************/
 304          /* fun_name : LCDP_display_text()                                               */
 305          /* version  : v1.00                                                             */
 306          /* created  : xillinx                                                           */
 307          /* descript : LCD dispaly operate                                               */
 308          /********************************************************************************/
 309          void LCDP_display_text(unsigned char xpos,unsigned char ypos,unsigned char * buffer)
 310          {   unsigned char chip;
 311   1          unsigned char i;
 312   1          xpos%=20;
 313   1          ypos%=4;
 314   1          if( xpos>=10)
 315   1          {   xpos-=10;
 316   2              ypos+=4;
 317   2          }
 318   1          if( ypos>0x3)
 319   1          {   chip=0x1;
 320   2          }
 321   1          else
 322   1          {   chip=0x0;
 323   2          }
 324   1          LCDP_set_page(ypos%4);
 325   1          LCDP_set_column(xpos*6);
 326   1          for(i=0;i<6;i++)
 327   1          {   LCDP_write_ram_data(chip,buffer[i]);
 328   2          }
 329   1      }
 330          
 331          /********************************************************************************/
 332          /* fun_name : LCDP_display_hz16x16()                                            */
 333          /* version  : v1.00                                                             */
 334          /* created  : xillinx                                                           */
 335          /* descript : 汉字取模: 从左到右从上到下取模,低位在上,高位在下                */
 336          /********************************************************************************/
 337          void LCDP_display_hz16x16(
 338              unsigned char xpos,
 339              unsigned char ypos,
 340              unsigned char *buffer)
 341          {   unsigned char * mdata;
 342   1          unsigned char i,wr;
 343   1          if(ypos>0x1)
 344   1          {   return;
 345   2          }
 346   1          mdata=buffer;
 347   1          wr=(xpos<<0x4);
 348   1          LCDP_set_page((ypos<<0x1)+0x0);
 349   1          for(i=0x0;i<0x10;i++)
 350   1          {   if(wr>=61)
 351   2              {   LCDP_set_column(wr-61);
 352   3                  LCDP_write_ram_data(0x1,*mdata++);
 353   3              }
 354   2              else
 355   2              {   LCDP_set_column(wr);
 356   3                  LCDP_write_ram_data(0x0,*mdata++);
 357   3              }
 358   2              wr++;
 359   2          }
 360   1          wr=(xpos<<0x4);
 361   1          LCDP_set_page((ypos<<0x1)+0x1);
 362   1          for(i=0x0;i<0x10;i++)
 363   1          {   if(wr>=61)
 364   2              {   LCDP_set_column(wr-61);
C51 COMPILER V8.02   TG12232B                                                              09/26/2008 15:18:08 PAGE 7   

 365   3                  LCDP_write_ram_data(0x1,*mdata++);
 366   3              }
 367   2              else
 368   2              {   LCDP_set_column(wr);
 369   3                  LCDP_write_ram_data(0x0,*mdata++);
 370   3              }
 371   2              wr++;
 372   2          }
 373   1      }
 374          
 375          /********************************************************************************/
 376          /* fun_name : LCDP_clear_display_buffer()                                       */
 377          /* version  : v1.00                                                             */
 378          /* created  : xillinx                                                           */
 379          /* descript : 清除LCD的显示缓冲区                                               */
 380          /********************************************************************************/
 381          void LCDP_clear_display_buffer(void)
 382          {   unsigned char i,bytes=80;
 383   1          LCDP_set_page(0x00);
 384   1          LCDP_set_column(0x00);
 385   1          for(i=0x0;i<bytes;i++)
 386   1          {   LCDP_write_ram_data(0x0,0x0);
 387   2              LCDP_write_ram_data(0x1,0x0);
 388   2          }
 389   1          LCDP_set_page(0x01);
 390   1          LCDP_set_column(0x00);
 391   1          for(i=0x0;i<bytes;i++)
 392   1          {   LCDP_write_ram_data(0x0,0x0);
 393   2              LCDP_write_ram_data(0x1,0x0);
 394   2          }
 395   1          LCDP_set_page(0x02);
 396   1          LCDP_set_column(0x00);
 397   1          for(i=0x0;i<bytes;i++)
 398   1          {   LCDP_write_ram_data(0x0,0x0);
 399   2              LCDP_write_ram_data(0x1,0x0);
 400   2          }
 401   1          LCDP_set_page(0x03);
 402   1          LCDP_set_column(0x00);
 403   1          for(i=0x0;i<bytes;i++)
 404   1          {   LCDP_write_ram_data(0x0,0x0);
 405   2              LCDP_write_ram_data(0x1,0x0);
 406   2          }
 407   1      }
 408          
 409          /********************************************************************************/
 410          /* fun_name : LCDP_get_index()                                                  */
 411          /* version  : v1.00                                                             */
 412          /* created  : xillinx                                                           */
 413          /* descript : 获取字符的索引                                                    */
 414          /********************************************************************************/
 415          unsigned char LCDP_get_index(unsigned char szText)
 416          {   unsigned char i;
 417   1          for(i=0;i<128;i++)
 418   1          {   if( szText==lcd_table[i])
 419   2              {   return i;
 420   3              }
 421   2          }
 422   1          return 0x0;
 423   1      }
 424          

⌨️ 快捷键说明

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