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

📄 main.lst

📁 校园打铃系统
💻 LST
📖 第 1 页 / 共 3 页
字号:
 479   1      ADin=0;
 480   1      Din=0;
 481   1      ENB=1;
 482   1           mask=0x80;
 483   1           for(i = 0;i < 8;i++)
 484   1           {
C51 COMPILER V7.06   MAIN                                                                  06/08/2007 16:16:19 PAGE 9   

 485   2               CLK=0;
 486   2           if(Ctrl_Data & mask)
 487   2           {
 488   3           Din=1;
 489   3           }
 490   2           else
 491   2           {
 492   3           Din=0;
 493   3           }
 494   2           CLK=1;
 495   2           mask = mask >> 1;
 496   2           Din=0;
 497   2           }
 498   1      CLK=0;
 499   1      ENB=0;
 500   1           mask=0x80000000;
 501   1      ENB=1;
 502   1           for(i = 0;i < 32;i++)
 503   1           {
 504   2               CLK=0;
 505   2           if(Ref_Data & mask)
 506   2           {
 507   3           Din=1;
 508   3           }
 509   2           else
 510   2           {
 511   3           Din=0;
 512   3           }
 513   2           CLK=1;
 514   2           mask = mask >> 1;
 515   2           Din=0;
 516   2          }
 517   1      CLK=0;
 518   1      ENB=0;
 519   1           mask = 0x8000;
 520   1           for(i = 0;i < 16; i++)
 521   1           {
 522   2           CLK=0;
 523   2           if(Tx_Count & mask)
 524   2           {
 525   3           ADin=1;
 526   3           }
 527   2           else
 528   2           {
 529   3           ADin=0;
 530   3           }
 531   2           if(Rx_Count & mask)
 532   2           {
 533   3           Din=1;
 534   3           }
 535   2           else
 536   2           {
 537   3           Din=0;
 538   3           }
 539   2           CLK=1;
 540   2           mask = mask >> 1;
 541   2           ADin=0;
 542   2           Din=0;
 543   2           CLK=0;
 544   2           }
 545   1      ENB=1;
 546   1      ENB=0;
C51 COMPILER V7.06   MAIN                                                                  06/08/2007 16:16:19 PAGE 10  

 547   1      }
 548          /***********************************************/
 549          void set_frequency()
 550          {LCD_init();
 551   1       LCD_write_string(0,0,frequency0[hh]);
 552   1       LCD_write_string(7,0,"<--");
 553   1       LCD_write_string(0,1,frequency0[hh+1]);
 554   1       while(scan_key()!=0x28)
 555   1      {
 556   2      while(!judge_hitkey());//有键按下转下步
 557   2      switch (scan_key())
 558   2      { case 0x48:if(hh==0)
 559   3                     hh=0;
 560   3                  else
 561   3                     hh--;
 562   3                 LCD_init();
 563   3                 LCD_write_string(0,0,frequency0[hh]);
 564   3                 LCD_write_string(7,0,frequency1[hh]);
 565   3                 LCD_write_string(13,0,"<--");
 566   3                 LCD_write_string(0,1,frequency0[hh+1]);
 567   3                 LCD_write_string(7,1,frequency1[hh+1]);
 568   3                 delay_nms(100);
 569   3                  break;
 570   3      
 571   3        case 0x88:if(hh==8)
 572   3                     hh=8;
 573   3                  else
 574   3                     hh++;
 575   3                 LCD_init();
 576   3                 LCD_write_string(0,0,frequency0[hh]);
 577   3                 LCD_write_string(7,0,frequency1[hh]);
 578   3                 LCD_write_string(13,0,"<--");
 579   3                 LCD_write_string(0,1,frequency0[hh+1]);
 580   3                 LCD_write_string(7,1,frequency1[hh+1]);
 581   3                         delay_nms(100);
 582   3                  break;
 583   3        case 0x18:MC145162_Reset(0x90,0x31904000,fry0[hh],fry1[hh]);
 584   3                  LCD_init();
 585   3                  LCD_write_string(5,0,"OK!");
 586   3                  delay_nms(100);
 587   3                  LCD_init();
 588   3                 LCD_write_string(0,0,frequency0[hh]);
 589   3                 LCD_write_string(7,0,frequency1[hh]);
 590   3                 LCD_write_string(13,0,"<--");
 591   3                 LCD_write_string(0,1,frequency0[hh+1]);
 592   3                 LCD_write_string(7,1,frequency1[hh+1]);
 593   3                   break;
 594   3        default:break;
 595   3      }
 596   2      }
 597   1      }
 598          /*************************over******************************************/
 599          
 600          /********************************************************************/
 601          void zhuye()
 602          { uchar tt=0;
 603   1        LCD_init();
 604   1        LCD_write_string(4,0,"Welcome!");
 605   1        delay_nms(150);
 606   1        LCD_write_string(0,0,"Set frequency<--");
 607   1        LCD_write_string(0,1,"data display");
 608   1      while(1)
C51 COMPILER V7.06   MAIN                                                                  06/08/2007 16:16:19 PAGE 11  

 609   1      {
 610   2      while(!judge_hitkey());//有键按下转下步
 611   2      switch(scan_key())
 612   2      { case 0x48:tt=0;
 613   3                  LCD_init();
 614   3                  LCD_write_string(0,0,"Set frequency<--");
 615   3                  LCD_write_string(0,1,"data display");
 616   3                  break;
 617   3      
 618   3        case 0x88:tt=1;
 619   3                  LCD_init();
 620   3                  LCD_write_string(0,0,"Set frequency");
 621   3                  LCD_write_string(0,1,"data display<--");
 622   3                  break;
 623   3        case 0x18:if(tt==0)
 624   3                  {delay_nms(52);
 625   4                  set_frequency();
 626   4                  }
 627   3                  else
 628   3                  {delay_nms(50);
 629   4                  data_display();
 630   4                  }
 631   3                  LCD_init();
 632   3                  LCD_write_string(0,0,"Set frequency<--");
 633   3                  LCD_write_string(0,1,"data display");
 634   3                  break;
 635   3      
 636   3      default:    break;
 637   3      }
 638   2      }
 639   1      
 640   1      }
 641          
 642          
 643          
 644          /*************************串口中断*********/
 645          uchar sp;
 646          bit k=0;
 647          uchar pty;
 648          void serial() interrupt 4
 649          {uchar  temp;
 650   1       uchar  temp1;
 651   1       temp=SBUF;
 652   1       while(!RI);
 653   1       RI=0;
 654   1       
 655   1       if(k==0)
 656   1       {temp1=temp>>4;
 657   2        switch(temp1)
 658   2        {case 0x0f:pty=0x00;break;
 659   3         case 0x05:pty=0x01;break;
 660   3         case 0x06:pty=0x02;break;
 661   3         case 0x0a:
 662   3                   if(temp&0x08)
 663   3                     {ad1_data[0]=temp;
 664   4                      pty=0x13;
 665   4                      }
 666   3                   else
 667   3                     {ad0_data[0]=temp;
 668   4                     pty=0x03;
 669   4                     }
 670   3                   break;
C51 COMPILER V7.06   MAIN                                                                  06/08/2007 16:16:19 PAGE 12  

 671   3         default: break;
 672   3         }
 673   2         }
 674   1      else
 675   1        switch(pty)
 676   1         {case 0x00:control_data=temp;
 677   2                   break;
 678   2          case 0x01:led_data=temp;
 679   2                   break;
 680   2          case 0x02:cd[sp]=temp;
 681   2                   sp++;
 682   2                   if(sp>31)
 683   2                     sp=0;
 684   2                   break;
 685   2      
 686   2          case 0x03:ad0_data[1]=temp;
 687   2                   break;
 688   2          case 0x13:ad1_data[1]=temp;
 689   2                   break;
 690   2          default: break;
 691   2         }
 692   1         k=~k;
 693   1         }
 694          
 695          /************************************************/
 696          void main()
 697          {SCON=0x40;//设置串行方式1,REN=0
 698   1       EA=1;
 699   1       ES=1;
 700   1       PCON=0x00;//波特率不增倍
 701   1       TMOD=0x20;//定时1工作2
 702   1       TL1=0x00;//波特率
 703   1       TH1=0x00;
 704   1       TR1=1;
 705   1       REN=1;
 706   1      zhuye();
 707   1      }
 708          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1768    ----
   CONSTANT SIZE    =    276    ----
   XDATA SIZE       =     40    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     91      29
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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