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

📄 lcd.lst

📁 可视门铃的主机软件
💻 LST
📖 第 1 页 / 共 2 页
字号:
 217   1        mLcdRs=0;
 218   1        mLcdClk=1;
 219   1        LCD377=wrdata;
 220   1        mLcdClk=0;
 221   1      }
 222          /**********************************************/
 223          void writedata(uchar wrdata)        /*写数据到LCD RAM*/
 224          {
 225   1        mLcdRs=1;
 226   1        mLcdClk=1;
 227   1        LCD377=wrdata;
 228   1        mLcdClk=0;
 229   1      }
 230          /***********************************************/
 231          void initlcd(void)
 232          {
 233   1        mLCDRST=0;
 234   1        OUTB=cOutDataB;
 235   1        delays10ms();
 236   1        delays10ms();
 237   1        watchdog();
 238   1        delays10ms();  
 239   1        watchdog();
 240   1        delays10ms();  
 241   1        mLCDRST=1;
C51 COMPILER V6.02  LCD                                                                    03/10/2006 14:34:51 PAGE 5   

 242   1        OUTB=cOutDataB;
 243   1        delays10ms();
 244   1        writereg(FUNSET);
 245   1        delays100us();
 246   1        writereg(FUNSET);
 247   1        delays100us();
 248   1        writereg(DISON);
 249   1        delays100us();
 250   1        writereg(CLEAR);
 251   1        delays10ms();
 252   1        writereg(ENTER);
 253   1        delays10ms();
 254   1      }
 255          /***********************************************/
 256          void disclr(void)
 257          {
 258   1       #if LCDRSTTWICE
 259   1       initlcd();
 260   1       #endif
 261   1       firstlineW_bit=0;
 262   1       secondlineW_bit=0;
 263   1       threelineW_bit=0;
 264   1       fourlineW_bit=0;
 265   1       writereg(CLEAR);
 266   1       delays10ms();
 267   1      }
 268          /***********************************************/
 269          void white(uchar linenum)               /*反白显示程序*/
 270          {
 271   1        writereg(ADDFUN);                        /*设置扩充指令集*/
 272   1        delays100us();
 273   1        switch(linenum)
 274   1          {
 275   2           case 1:    writereg(WHITEBLACK1); delays100us();                       break;  /*第一行反白显示*/
 276   2           case 2:    writereg(WHITEBLACK2); delays100us();                       break;  /*第二行反白显示*/
 277   2           case 3:    writereg(WHITEBLACK3); delays100us();                       break;  /*第三行反白显示*/
 278   2           case 4:    writereg(WHITEBLACK4); delays100us();                       break;  /*第四行反白显示*/
 279   2           default:                                                               break;
 280   2          }
 281   1        writereg(FUNSET);                         /*返回普通指令集*/
 282   1      }
 283          /***********************************************/
 284          void diswhite(uchar i)         /*反白显示函数,I为1第一行反白显示,为2第二行反*/
 285          {
 286   1       switch(i)
 287   1         {
 288   2          case 1:
 289   2            {
 290   3             if(!firstlineW_bit)
 291   3                {
 292   4                 firstlineW_bit=1;
 293   4                 white(1);
 294   4                }
 295   3             if(secondlineW_bit)
 296   3                {
 297   4                 secondlineW_bit=0;
 298   4                 white(2);
 299   4                }
 300   3             if(threelineW_bit)
 301   3                {
 302   4                 threelineW_bit=0;
 303   4                 white(3);
C51 COMPILER V6.02  LCD                                                                    03/10/2006 14:34:51 PAGE 6   

 304   4                }
 305   3             if(fourlineW_bit)
 306   3                {
 307   4                 fourlineW_bit=0;
 308   4                 white(4);
 309   4                }
 310   3            }  break;
 311   2          case 2:
 312   2            {
 313   3             if(firstlineW_bit)
 314   3                {
 315   4                 firstlineW_bit=0;
 316   4                 white(1);
 317   4                }
 318   3             if(!secondlineW_bit)
 319   3                {
 320   4                 secondlineW_bit=1;
 321   4                 white(2);
 322   4                }
 323   3             if(threelineW_bit)
 324   3                {
 325   4                 threelineW_bit=0;
 326   4                 white(3);
 327   4                }
 328   3             if(fourlineW_bit)
 329   3                {
 330   4                 fourlineW_bit=0;
 331   4                 white(4);
 332   4                }
 333   3            }  break;
 334   2          case 3:
 335   2            {
 336   3             if(firstlineW_bit)
 337   3                {
 338   4                 firstlineW_bit=0;
 339   4                 white(1);
 340   4                }
 341   3             if(secondlineW_bit)
 342   3                {
 343   4                 secondlineW_bit=0;
 344   4                 white(2);
 345   4                }
 346   3             if(!threelineW_bit)
 347   3                {
 348   4                 threelineW_bit=1;
 349   4                 white(3);
 350   4                }
 351   3             if(fourlineW_bit)
 352   3                {
 353   4                 fourlineW_bit=0;
 354   4                 white(4);
 355   4                }
 356   3            }  break;
 357   2          case 4:
 358   2            {
 359   3             if(firstlineW_bit)
 360   3                {
 361   4                 firstlineW_bit=0;
 362   4                 white(1);
 363   4                }
 364   3             if(secondlineW_bit)
 365   3                {
C51 COMPILER V6.02  LCD                                                                    03/10/2006 14:34:51 PAGE 7   

 366   4                 secondlineW_bit=0;
 367   4                 white(2);
 368   4                }
 369   3             if(threelineW_bit)
 370   3                {
 371   4                 threelineW_bit=0;
 372   4                 white(3);
 373   4                }
 374   3             if(!fourlineW_bit)
 375   3                {
 376   4                 fourlineW_bit=1;
 377   4                 white(4);
 378   4                }
 379   3            }  break;
 380   2          case 5:
 381   2            {
 382   3             if(firstlineW_bit)
 383   3                {
 384   4                 firstlineW_bit=0;
 385   4                 white(1);
 386   4                }
 387   3             if(secondlineW_bit)
 388   3                {
 389   4                 secondlineW_bit=0;
 390   4                 white(2);
 391   4                }
 392   3             if(threelineW_bit)
 393   3                {
 394   4                 threelineW_bit=0;
 395   4                 white(3);
 396   4                }
 397   3             if(fourlineW_bit)
 398   3                {
 399   4                 fourlineW_bit=0;
 400   4                 white(4);
 401   4                }
 402   3            }  break;
 403   2          default:   break;
 404   2         }
 405   1      }
 406          /***********************************************/
 407          
 408          void display(uchar linenum,uchar *disaddr)
 409          {
 410   1       uchar i;
 411   1       ET0=0; //关闭TIME0 TIMEE2中断
 412   1       ET2=0;
 413   1       writereg(linenum);
 414   1       delays100us();
 415   1       for(i=0;i<20;i++)
 416   1         {
 417   2          writedata(*(disaddr+i));
 418   2          delays100us();
 419   2         }
 420   1       ET0=1; //重新开中断
 421   1       ET2=1;
 422   1      }
 423          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1013    ----
C51 COMPILER V6.02  LCD                                                                    03/10/2006 14:34:51 PAGE 8   

   CONSTANT SIZE    =    440    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       7
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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