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

📄 text2.lst

📁 漏气测试12864显示 MCU STC89C51芯片
💻 LST
📖 第 1 页 / 共 3 页
字号:
 323   2        }
 324   1      }
 325          
 326          
 327          /*----------------------------------12864:显示------------------------
 328          
 329          -----------*/
 330          void show_12864(unsigned char *poi)
 331          {
 332   1         unsigned char i;
 333   1         clr_12864();
 334   1      
 335   1         Cs1_12864=0;  Cs2_12864=1;
 336   1         i=*poi/16;
 337   1         show_let_12864(0,24,time_let[i]);    // 显示sec 十位
 338   1         i=*poi%16;
 339   1         show_let_12864(0,32,time_let[i]);      // 显示sec 个位
 340   1         poi+=1;
 341   1      
 342   1         show_let_12864(0,16,dian);              //显示 ":"
 343   1      
 344   1         i=*poi/16;
 345   1         show_let_12864(0,0,time_let[i]);    // 显示min 十位   
 346   1         i=*poi%16;
 347   1         show_let_12864(0,8,time_let[i]);      // 显示min 个位
 348   1         poi+=1;
 349   1      
 350   1         Cs1_12864=1;  Cs2_12864=0;
 351   1         show_let_12864(0,56,dian);              //显示 ":"  
 352   1         i=*poi/16;
 353   1         show_let_12864(0,40,time_let[i]);    // 显示hour 十位
 354   1         i=*poi%16;
 355   1         show_let_12864(0,48,time_let[i]);      // 显示hour 个位
 356   1         
 357   1         
 358   1         show_cha_12864(0,0,time_cha[0]);   // "时"
 359   1         show_cha_12864(0,16,time_cha[1]);  //  "间"
 360   1      }
 361          
 362          
 363          
 364          
 365          void RemIn0(void) interrupt 0  using 0
C51 COMPILER V8.05a   TEXT2                                                                10/12/2007 22:10:38 PAGE 7   

 366          {
 367   1          unsigned char i,j,date      ,x1,x2;
 368   1              bit date1,date2;
 369   1          unsigned int temp;
 370   1      
 371   1      EX0=0;  //打开INT0中断请求
 372   1      
 373   1       TH0=0;
 374   1         TL0=0; 
 375   1         
 376   1            while (!RemPin0); //等待高电平
 377   1          TR0=1;
 378   1          while (RemPin0)  //等待低电平
 379   1              if (TF0==1)  goto end0; //超时就退出;
 380   1          TR0=0;
 381   1          temp=TH0;
 382   1          temp=(temp<<8)+TL0;
 383   1      
 384   1          if (temp>18000 || temp<4000)   //判断同步码的宽度
 385   1          {
 386   2            
 387   2        goto end0;
 388   2          }
 389   1      //同步码检测成功
 390   1        
 391   1         if (temp<18000 && temp>13000) 
 392   1      
 393   1         {
 394   2         x1=4;
 395   2         x2=7;
 396   2          for (i=0; i<3; i++) //解 3*8=24 位码 
 397   2          for (j=0; j<8; j++)
 398   2          {
 399   3              while (!RemPin0);  //等待高电平
 400   3              TH0=0;
 401   3          TL0=0; 
 402   3        TR0=1;
 403   3              while (RemPin0)  //等待低电平
 404   3                  if (TF0==1) goto end0; //超时就退出
 405   3        TR0=0;
 406   3              temp=TH0;
 407   3              temp=((temp<<8)+TL0);
 408   3             if (temp>1200 && temp<1800)
 409   3              { 
 410   4                  receive[i]=receive[i]<<1;
 411   4                  receive[i]=receive[i]+1; //保存 1
 412   4              }
 413   3              else if (temp>300 && temp<702)
 414   3                  {
 415   4                      receive[i]=receive[i]<<1;   //保存0
 416   4                  }
 417   3                  else goto end0;
 418   3          }
 419   2      
 420   2         }
 421   1      
 422   1      
 423   1      
 424   1                 if (temp<13000 && temp>8000) 
 425   1                
 426   1         {x1=3;
 427   2         x2=3;
C51 COMPILER V8.05a   TEXT2                                                                10/12/2007 22:10:38 PAGE 8   

 428   2          for (i=0; i<3; i++) //解 3*8=24 位码 
 429   2          for (j=0; j<8; j++)
 430   2          {
 431   3              while (!RemPin0);  //等待高电平
 432   3              TH0=0;
 433   3          TL0=0; 
 434   3        TR0=1;
 435   3              while (RemPin0)  //等待低电平
 436   3                  if (TF0==1) goto end0; //超时就退出
 437   3        TR0=0;
 438   3              temp=TH0;
 439   3              temp=((temp<<8)+TL0);
 440   3      
 441   3      
 442   3        //      /*
 443   3              if (temp>800 && temp<1200)
 444   3              { 
 445   4                  receive[i]=receive[i]<<1;
 446   4                  receive[i]=receive[i]+1; //保存 1
 447   4              }
 448   3              else if (temp>200 && temp<600)
 449   3                  {
 450   4                      receive[i]=receive[i]<<1;   //保存0
 451   4                  }
 452   3                  else goto end0;
 453   3          }
 454   2      
 455   2         }
 456   1      
 457   1      
 458   1            if (temp<8000 && temp>4000) 
 459   1      
 460   1         {  x1=1;
 461   2            x2=5;
 462   2          for (i=0; i<3; i++) //解 3*8=24 位码 
 463   2          for (j=0; j<8; j++)
 464   2          {
 465   3              while (!RemPin0);  //等待高电平
 466   3              TH0=0;
 467   3          TL0=0; 
 468   3        TR0=1;
 469   3              while (RemPin0)  //等待低电平
 470   3                  if (TF0==1) goto end0; //超时就退出
 471   3        TR0=0;
 472   3              temp=TH0;
 473   3              temp=((temp<<8)+TL0);
 474   3      
 475   3      
 476   3        //      /*
 477   3              if (temp>300 && temp<900)
 478   3              { 
 479   4                  receive[i]=receive[i]<<1;
 480   4                  receive[i]=receive[i]+1; //保存 1
 481   4              }
 482   3              else if (temp>20&& temp<300)
 483   3                  {
 484   4                      receive[i]=receive[i]<<1;   //保存0
 485   4                  }
 486   3                  else goto end0;
 487   3          }
 488   2      
 489   2         }
C51 COMPILER V8.05a   TEXT2                                                                10/12/2007 22:10:38 PAGE 9   

 490   1         clr_12864();
 491   1         Cs1_12864=0;  Cs2_12864=1;
 492   1           show_cha_12864(0,0,ok[2]);  
 493   1               show_cha_12864(0,16,ok[3]);  
 494   1           show_let_12864(2,24,time_let[x1]);
 495   1               show_let_12864(2,32,ok1[1]);    
 496   1               show_let_12864(2,40,time_let[x2]);
 497   1               show_let_12864(2,48,ok1[0]); 
 498   1            
 499   1         Cs1_12864=1;  Cs2_12864=0;
 500   1      
 501   1      
 502   1          show_cha_12864(0,32,ok[0]);  
 503   1              show_cha_12864(0,48,ok[1]); 
 504   1              show_cha_12864(2,0,ok[4]);  
 505   1          show_cha_12864(2,16,ok[5]);
 506   1              show_cha_12864(4,0,ok[6]);  
 507   1              show_cha_12864(4,16,ok[7]);
 508   1              show_cha_12864(6,0,ok[8]);  
 509   1              show_cha_12864(6,16,ok[9]);
 510   1                 
 511   1      
 512   1                show_let_12864(2,32,time_let[3]);   
 513   1                show_let_12864(2,40,time_let[1]);  
 514   1                show_let_12864(2,48,time_let[5]);
 515   1                show_let_12864(2,56,ok1[0]); 
 516   1                
 517   1                        
 518   1                for (i=4; i<6; i++) 
 519   1            {
 520   2                      date1 = (bit)(receive[0] & 0x80);
 521   2                      receive[0]<<= 1;
 522   2                      date2 = (bit)(receive[0] & 0x80);
 523   2                      receive[0]<<= 1;
 524   2                      if(date1==0&&date2==0)
 525   2                  date=0;
 526   2                  else  if(date1==1&&date2==1)
 527   2                  date=1;
 528   2                      else  if(date1==1&&date2==0)
 529   2                  date=10;
 530   2                      else goto RemExit0;
 531   2                 show_let_12864(4,i*8,time_let[date]);
 532   2               }
 533   1                        for (i=6; i<8; i++) 
 534   1            
 535   1                {
 536   2                      date1 = (bit)(receive[0] & 0x80);
 537   2                      receive[0]<<= 1;
 538   2                      date2 = (bit)(receive[0] & 0x80);
 539   2                      receive[0]<<= 1;
 540   2                      if(date1==0&&date2==0)
 541   2                  date=0;
 542   2                  else  if(date1==1&&date2==1)
 543   2                  date=1;
 544   2                      else  if(date1==1&&date2==0)
 545   2                  date=10;
 546   2                      else goto RemExit0;
 547   2                 show_let_12864(4,i*8,time_let[date]);  
 548   2               }
 549   1                Cs1_12864=0;  Cs2_12864=1;
 550   1                        for (i=0; i<2; i++) 
 551   1            
C51 COMPILER V8.05a   TEXT2                                                                10/12/2007 22:10:38 PAGE 10  

 552   1                {
 553   2                      date1 = (bit)(receive[1] & 0x80);
 554   2                      receive[1]<<= 1;
 555   2                      date2 = (bit)(receive[1] & 0x80);
 556   2                      receive[1]<<= 1;
 557   2                      if(date1==0&&date2==0)
 558   2                  date=0;
 559   2                  else  if(date1==1&&date2==1)
 560   2                  date=1;
 561   2                      else  if(date1==1&&date2==0)
 562   2                  date=10;
 563   2                      else goto RemExit0;
 564   2                 show_let_12864(4,i*8,time_let[date]);   
 565   2               }
 566   1              
 567   1               for (i=2; i<4; i++) 
 568   1            
 569   1                {
 570   2                      date1 = (bit)(receive[1] & 0x80);
 571   2                      receive[1]<<= 1;
 572   2                      date2 = (bit)(receive[1] & 0x80);
 573   2                      receive[1]<<= 1;
 574   2                      if(date1==0&&date2==0)
 575   2                  date=0;
 576   2                  else  if(date1==1&&date2==1)
 577   2                  date=1;
 578   2                      else  if(date1==1&&date2==0)
 579   2                  date=10;
 580   2                      else goto RemExit0;
 581   2                 show_let_12864(4,i*8,time_let[date]);   
 582   2               }
 583   1               Cs1_12864=1;  Cs2_12864=0;
 584   1               for (i=4; i<6; i++) 
 585   1      
 586   1                        {
 587   2                      date1 = (bit)(receive[2] & 0x80);
 588   2                      receive[2]<<= 1;
 589   2                      date2 = (bit)(receive[2] & 0x80);
 590   2                      receive[2]<<= 1;
 591   2                      if(date1==0&&date2==0)
 592   2                  date=1;
 593   2                  else  if(date1==1&&date2==1)
 594   2                  date=0;
 595   2                      else  if(date1==1&&date2==0)
 596   2                  date=10;
 597   2                      else goto RemExit0;
 598   2                 show_let_12864(6,i*8,time_let[date]);  
 599   2               }
 600   1               for (i=6; i<8; i++) 
 601   1            
 602   1                {
 603   2                      date1 = (bit)(receive[2] & 0x80);
 604   2                      receive[2]<<= 1;
 605   2                      date2 = (bit)(receive[2] & 0x80);
 606   2                      receive[2]<<= 1;
 607   2                      if(date1==0&&date2==0)
 608   2                  date=1;
 609   2                  else  if(date1==1&&date2==1)
 610   2                  date=0;
 611   2                      else  if(date1==1&&date2==0)
 612   2                  date=10;
 613   2                      else goto RemExit0;
C51 COMPILER V8.05a   TEXT2                                                                10/12/2007 22:10:38 PAGE 11  

 614   2                show_let_12864(6,i*8,time_let[date]);    
 615   2               }
 616   1      
 617   1              goto end0;
 618   1      
 619   1          RemExit0:
 620   1          {
 621   2                 Cs1_12864=1;  Cs2_12864=0;
 622   2      show_cha_12864(0,32,ok[0]);  
 623   2              show_cha_12864(0,48,ok[1]); 
 624   2               Cs1_12864=0;  Cs2_12864=1;
 625   2           show_cha_12864(0,0,ok[10]);  
 626   2               show_cha_12864(0,16,ok[11]); 
 627   2                      PX1=1;
 628   2                        
 629   2                EX0=1;  //打开INT0中断请求
 630   2                      
 631   2              TF0=0;
 632   2              return; 
 633   2          } 
 634   1         end0:
 635   1        {
 636   2                      PX1=1;
 637   2                        
 638   2                EX0=1;  //打开INT0中断请求
 639   2                      
 640   2              TF0=0;
 641   2              return;  
 642   2          }
 643   1      
 644   1      
 645   1      }
 646          
 647          
 648          void RemIn(void) interrupt 2    using 0
 649          {
 650   1          unsigned char i,j,date      ,x1,x2;
 651   1              bit date1,date2;
 652   1          unsigned int temp;
 653   1               EX0=0;

⌨️ 快捷键说明

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