cehngxu.lst

来自「液晶显示电压proteus」· LST 代码 · 共 359 行 · 第 1/2 页

LST
359
字号
 168   1              lcdrs=0;        //command
 169   1              P0=com;
 170   1              delay(1);
 171   1              en=1;
 172   1              delay(5);
 173   1              en=0;
 174   1      }
 175          
 176           void write_data(uchar date)
 177           {
 178   1                lcdrs=1;
 179   1                P0=date;
C51 COMPILER V8.02   CEHNGXU                                                               04/28/2012 11:25:16 PAGE 4   

 180   1                delay(5);
 181   1                en=1;                         //液晶写数据
 182   1                delay(5);
 183   1                en=0;
 184   1      
 185   1       }
 186           //***********************************************************
 187                  void init()          //初始化
 188          {
 189   1              
 190   1              
 191   1              en=0;                //液晶使能端
 192   1              P2=0XFF;        
 193   1              cs=0;            //ad cs端至低   
 194   1              write_com(0x38); 
 195   1              write_com(0x0c); //设计开显示,不显示光标
 196   1              write_com(0x06); //写一个字符后地址指针加一
 197   1              write_com(0x01);//显示清零              
 198   1      }
 199          //**************************************************************
 200          void delay(uint z)      //延时子函数
 201          {
 202   1              uint x,y;
 203   1              for(x=z;x>0;x--)
 204   1                      for(y=110;y>0;y--);
 205   1      }
 206          //*****************************************************************
 207          //*********************显示函数************************************
 208          void displayV5(uchar zhengs, uchar shifw, uchar baifw,uchar qianfw)
 209          {
 210   1                  
 211   1                     
 212   1                     write_com(0x80+0x44);
 213   1                   write_data(0x30+zhengs);//0x30代表数字0
 214   1      
 215   1                     write_com(0x80+0x45);
 216   1                   write_data('.');
 217   1      
 218   1                      write_com(0x80+0x46);
 219   1                   write_data(0x30+shifw);
 220   1                                         
 221   1                                        write_com(0x80+0x47);
 222   1                   write_data(0x30+baifw);
 223   1      
 224   1                                 write_com(0x80+0x48);
 225   1                   write_data(0x30+qianfw);
 226   1      
 227   1                                write_com(0x80+0x49);
 228   1                   write_data(0x30);
 229   1      
 230   1                               write_com(0x80+0x4a);
 231   1                   write_data('V');
 232   1      
 233   1                                 write_com(0x80+0x4b);
 234   1                   write_data(' ');
 235   1      
 236   1      
 237   1      }
 238          
 239           void displayO(uchar wan, uchar qian, uchar bai,uchar shi,uchar ge)
 240          {
 241   1                 
C51 COMPILER V8.02   CEHNGXU                                                               04/28/2012 11:25:16 PAGE 5   

 242   1                     
 243   1                     write_com(0x80+0x44);
 244   1                   write_data(0x30+wan);//0x30代表数字0
 245   1      
 246   1                     write_com(0x80+0x45);
 247   1                   write_data(0x30+qian);
 248   1                                
 249   1                                write_com(0x80+0x46);
 250   1                              write_data('.');
 251   1                                         
 252   1                                        write_com(0x80+0x47);
 253   1                   write_data(0x30+bai);
 254   1      
 255   1                                 write_com(0x80+0x48);
 256   1                   write_data(0x30+shi);
 257   1      
 258   1      
 259   1                                      write_com(0x80+0x49);
 260   1                   write_data(0x30+ge);
 261   1      
 262   1                               write_com(0x80+0x4A);
 263   1                   write_data(0x30);
 264   1      
 265   1                                       write_com(0x80+0x4b);
 266   1                   write_data('k');
 267   1      
 268   1      }
 269          
 270          
 271             void displayV15(uchar zhengs1,uchar zhengs2, uchar shifw, uchar baifw,uchar qianfw)
 272          {
 273   1                  
 274   1                     
 275   1                     write_com(0x80+0x44);
 276   1                   write_data(0x30+zhengs1);//0x30代表数字0
 277   1      
 278   1                                write_com(0x80+0x45);
 279   1                   write_data(0x30+zhengs2);
 280   1      
 281   1                     write_com(0x80+0x46);
 282   1                   write_data('.');
 283   1      
 284   1                      write_com(0x80+0x47);
 285   1                   write_data(0x30+shifw);
 286   1                                         
 287   1                                        write_com(0x80+0x48);
 288   1                   write_data(0x30+baifw);
 289   1      
 290   1                                 write_com(0x80+0x49);
 291   1                   write_data(0x30+qianfw);
 292   1      
 293   1                                write_com(0x80+0x4a);
 294   1                   write_data(0x30);
 295   1      
 296   1                               write_com(0x80+0x4b);
 297   1                   write_data('V');
 298   1      
 299   1                      //         write_com(0x80+0x4b);
 300   1              //     write_data(' ');
 301   1      
 302   1      
 303   1      }
C51 COMPILER V8.02   CEHNGXU                                                               04/28/2012 11:25:16 PAGE 6   

 304          
 305          void display()
 306          {
 307   1                                 
 308   1                                 write_com(0x80+0X03);
 309   1                                 for(num=0;num<8;num++)
 310   1                                 {
 311   2                                        write_data(table1[num]);
 312   2                                        delay(5);
 313   2                                      }
 314   1      
 315   1                  
 316   1                               write_com(0x80+0x44);
 317   1                                 for(num=0;num<10;num++)
 318   1                                 {
 319   2                                        write_data(table2[num]);
 320   2                                        delay(5);
 321   2                                      }
 322   1                 
 323   1      
 324   1      }
 325          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1521    ----
   CONSTANT SIZE    =     21    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     35      22
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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