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

📄 lcd_fucntion.lst

📁 RFID读卡器TRH031开发源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
 228   4                              }
 229   3                      }
 230   2      
 231   2      //Error Check
 232   2                      temp = Read(0x03);
 233   2                      if((temp&0x04)>>2)
 234   2                      {
 235   3                              temp=Read(0x0a);
 236   3                              if((temp&0x10)>>4)
 237   3                              {
 238   4                                      Line1_Display();
 239   4                                      String_Out("ERR Overfl");
 240   4                                      Delay_ms(1000);
 241   4                                      Lcd_Clear();
C51 COMPILER V7.20   LCD_FUCNTION                                                          11/02/2005 12:55:38 PAGE 5   

 242   4                              }
 243   3                              if((temp&0x08)>>3)
 244   3                              {
 245   4                                      Line1_Display();
 246   4                                      String_Out("ERR CRCErr");
 247   4                                      Delay_ms(1000);
 248   4                                      Lcd_Clear();
 249   4                              }
 250   3                              if((temp&0x02)>>1)
 251   3                              {
 252   4                                      Line1_Display();
 253   4                                      String_Out("ERR ParityErr");
 254   4                                      Delay_ms(1000);
 255   4                                      Lcd_Clear();
 256   4                              }
 257   3                              if((temp&0x01))
 258   3                              {
 259   4                                      Line1_Display();
 260   4                                      String_Out("ERR CollErr");
 261   4                                      Delay_ms(1000);
 262   4                                      Lcd_Clear();
 263   4                              }
 264   3                      }
 265   2              }
 266   1      }
 267          
 268          
 269          void DisplayLCD(void)
 270          {
 271   1      
 272   1          unsigned int i;     
 273   1          i = 0;
 274   1              
 275   1              LCDBuf[15] = '\0';      
 276   1              
 277   1              switch(LCDType)
 278   1              {
 279   2              case 0x01       :       // REQA Display
 280   2                                                              for (i=0; i<2; i++) {   
 281   3                                                              Hex2Char(&CIDBuf[i]);
 282   3                                                              LCDBuf[i*3] = msc;
 283   3                                                                      LCDBuf[i*3+1] = lsc;
 284   3                                                                      LCDBuf[i*3+2] = ' ';
 285   3                                                              }
 286   2                                                              LCDBuf[6] = '\0';
 287   2                                                              Instruction_Out(0x01);
 288   2                                      Instruction_Out(0x80);
 289   2                                          String_Out("REQA O.K!!");
 290   2                                          Instruction_Out(0xC0);
 291   2                                                              String_Out("Answer : ");
 292   2                                          String_Out(&LCDBuf);
 293   2                                          //delay_ms(10);                                                     
 294   2                                                              //instruction_out(0x01);             //LCD CLEAR
 295   2                                      break;
 296   2      
 297   2              case 0x02          :     // A-Type ID Display 
 298   2                                                              for (i=0; i<5; i++) {   
 299   3                                                              Hex2Char(&CIDBuf[i]);
 300   3                                                              LCDBuf[i*3] = msc;
 301   3                                                                      LCDBuf[i*3+1] = lsc;
 302   3                                                                      LCDBuf[i*3+2] = ' ';
 303   3                                                              }       
C51 COMPILER V7.20   LCD_FUCNTION                                                          11/02/2005 12:55:38 PAGE 6   

 304   2                                                              Instruction_Out(0x01);
 305   2                                      Instruction_Out(0x80);
 306   2                                                              String_Out("A-Type Read O.K!! ");
 307   2                                          Instruction_Out(0xC0);
 308   2                                                              //String_Out(" ");
 309   2                                          String_Out(&LCDBuf);
 310   2                                          //delay_ms(100);
 311   2                                                              break;     
 312   2        
 313   2               case 0x03        :      
 314   2                                  for (i=0; i<4; i++) {       
 315   3                                                              Hex2Char(&CIDBuf[i+1]);
 316   3                                                              LCDBuf[i*3] = msc;
 317   3                                                                      LCDBuf[i*3+1] = lsc;
 318   3                                                                      LCDBuf[i*3+2] = ' ';
 319   3                                                              }
 320   2                                                              LCDBuf[12] = '\0';      
 321   2                                                              Instruction_Out(0x01);
 322   2                                      Instruction_Out(0x80);
 323   2                                                              String_Out("B-Type Read O.K!! ");
 324   2                                          Instruction_Out(0xC0);
 325   2                                                              //String_Out("ID : ");
 326   2                                          String_Out(&LCDBuf);
 327   2                                          //delay_ms(100);
 328   2                                                              break;     
 329   2        
 330   2                        case 0x04        :      
 331   2                                  for (i=0; i<5; i++) {       
 332   3                                                              Hex2Char(&CIDBuf[i]);
 333   3                                                              LCDBuf[i*3] = msc;
 334   3                                                                      LCDBuf[i*3+1] = lsc;
 335   3                                                                      LCDBuf[i*3+2] = ' ';
 336   3                                                              }
 337   2                                                              Instruction_Out(0x01);
 338   2                                      Instruction_Out(0x80);
 339   2                                                              String_Out("15693 Read O.K!! ");
 340   2                                          Instruction_Out(0xC0);
 341   2                                                              //String_Out("ID : ");
 342   2                                          String_Out(&LCDBuf);
 343   2                                          //delay_ms(100);
 344   2                                                              break;     
 345   2                       case 0x05        :      
 346   2                                  for (i=0; i<5; i++) {       
 347   3                                                              Hex2Char(&CIDBuf[i]);
 348   3                                                              LCDBuf[i*3] = msc;
 349   3                                                                      LCDBuf[i*3+1] = lsc;
 350   3                                                                      LCDBuf[i*3+2] = ' ';
 351   3                                                              }
 352   2                                                              Instruction_Out(0x01);
 353   2                                      Instruction_Out(0x80);
 354   2                                                              String_Out("Tag-It Read O.K!! ");
 355   2                                          Instruction_Out(0xC0);
 356   2                                                              //String_Out("ID : ");
 357   2                                          String_Out(&LCDBuf);
 358   2                                          //delay_ms(100);
 359   2                                                              break;     
 360   2                default             :  
 361   2                               
 362   2                                                      break;
 363   2              }
 364   1      
 365   1          return;
C51 COMPILER V7.20   LCD_FUCNTION                                                          11/02/2005 12:55:38 PAGE 7   

 366   1              
 367   1      }
 368          
 369          
 370          void Hex2Char(BYTE *bhp)
 371          { 
 372   1          BYTE bh;
 373   1              unsigned char k;
 374   1              bh = *bhp;
 375   1           
 376   1              k = (bh << 4);
 377   1                                                              
 378   1                      if (bh < 0x10)  
 379   1                                      msc = '0';                      
 380   1                      else if (bh < 0x20)  
 381   1                                      msc = '1';
 382   1                      else if (bh < 0x30)  
 383   1                                      msc = '2';
 384   1                              else if (bh < 0x40)  
 385   1                                      msc = '3';
 386   1                              else if (bh < 0x50)  
 387   1                                      msc = '4';
 388   1                              else if (bh < 0x60)  
 389   1                                      msc = '5';
 390   1                              else if (bh < 0x70)  
 391   1                                      msc = '6';
 392   1                              else if (bh < 0x80)  
 393   1                                      msc = '7';
 394   1                              else if (bh < 0x90)  
 395   1                                      msc = '8';
 396   1                              else if (bh < 0xA0)  
 397   1                                      msc = '9';
 398   1                              else if (bh < 0xB0)  
 399   1                                      msc = 'A';
 400   1                              else if (bh < 0xC0)  
 401   1                                      msc = 'B';
 402   1                              else if (bh < 0xD0)  
 403   1                                      msc = 'C';
 404   1                              else if (bh < 0xE0)  
 405   1                                      msc = 'D';
 406   1                              else if (bh < 0xF0)  
 407   1                                      msc = 'E';
 408   1                              else  
 409   1                                      msc = 'F';
 410   1                              
 411   1                              if (k == 0x00)  
 412   1                                      lsc = '0';                      
 413   1                              else if (k == 0x10)  
 414   1                                      lsc = '1';
 415   1                              else if (k == 0x20)  
 416   1                                      lsc = '2';
 417   1                              else if (k == 0x30)  
 418   1                                      lsc = '3';
 419   1                              else if (k == 0x40)  
 420   1                                      lsc = '4';
 421   1                              else if (k == 0x50)  
 422   1                                      lsc = '5';
 423   1                              else if (k == 0x60)  
 424   1                                      lsc = '6';
 425   1                              else if (k == 0x70)  
 426   1                                      lsc = '7';
 427   1                              else if (k == 0x80)  
C51 COMPILER V7.20   LCD_FUCNTION                                                          11/02/2005 12:55:38 PAGE 8   

 428   1                                      lsc = '8';
 429   1                              else if (k == 0x90)  
 430   1                                      lsc = '9';
 431   1                              else if (k == 0xA0)  
 432   1                                      lsc = 'A';
 433   1                              else if (k == 0xB0)  
 434   1                                      lsc = 'B';
 435   1                              else if (k == 0xC0)  
 436   1                                      lsc = 'C';
 437   1                              else if (k == 0xD0)  
 438   1                                      lsc = 'D';
 439   1                              else if (k == 0xE0)  
 440   1                                      lsc = 'E';
 441   1                              else  
 442   1                                      lsc = 'F';
 443   1      
 444   1                              return;
 445   1              }
 446          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1838    ----
   CONSTANT SIZE    =    338    ----
   XDATA SIZE       =   ----      23
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   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 + -