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

📄 main.lst

📁 用51单片机实现IR解码
💻 LST
📖 第 1 页 / 共 3 页
字号:
 428   1              TH1 =0xff-0x1D+1;               SM1   =0;       //2400bps for 27        SMOD=0
 429   1      /*      TH1 =0xff-0x0E+1;                                       //4800bps for 27        SMOD=0  
 430   1              TH1 =0xff-0x07+1;                                       //9600bps for 27        SMOD=0 
 431   1              TH1 =0xff-0x0F+1;                                    //9600bps for 27   SMOD=1  
 432   1              TH1 =0xff-0x07+1;                                      //19200bps for 27        SMOD=1  
 433   1              TH1 =0xff-0x04+1;                                        //19200bps for 27      SMOD=0  
 434   1              TH1 =0xff-0x02+1;                                       //38400bps for 27       SMOD=0
 435   1              TH1 =0xff-0x01+1;                                       //57600bps for 27       SMOD=0
 436   1           
 437   1              TH1 =0xff-0x56+1;                                       //2400bps for 40.039*2M SMOD=0
 438   1              TH1 =0xff-0x2B+1;                                       //4800bps for 40.039*2M         SMOD=0  
 439   1              TH1 =0xff-0x15+1;                                       //9600bps for 40.039*2M         SMOD=0 
 440   1              TH1 =0xff-0x0A+1;                                       //19200bps for40.039*2M         SMOD=0  
 441   1              TH1 =0xff-0x05+1;                                       //38400bps for 40.039*2M        SMOD=0
 442   1              TH1 =0xff-0x04+1;                                       //57600bps for 40.039*2M        SMOD=0
 443   1             TH1 =0xff-0x02+1;                                        //115200bps for 40.039*2M       SMOD=0  
 444   1              */
 445   1              
 446   1      
 447   1      /***timer 2 for  timer***/
 448   1      
 449   1              T2CON=0x09;                     /*TF2   EXF2    RCLK    TCLK    EXEN2   TR2     C/T2    CR/RL2*/
 450   1                                                      /* use the timer2 as capture mode   and timer1 for baud rate*/
 451   1                                                /*TF2 timer2 overflow flag,not set*/
 452   1                                                      /*EXF2  T2 extern pin P1.1 negative edge flag*/
 453   1                                                        /*RCLK        TCLK =00 ,use timer1 overflow clock to RXD TXD*/
 454   1                                               /*set the EXEN2=1, allow the extern input T2EX(P11) */
 455   1                                                   /*set TR2=0,temp to mask the timer2 clock input*/
 456   1                                                   /*set C/T2=0,select the timer fuction for TIMER2 */
 457   1                                                  /*set CP/RT2=1, enable the timer capture */
 458   1                                                                                       
 459   1              TH2=0;  TL2=0;  /*reload the prescalor 19.6ms for X=40M , 37.5ms for X=22.118M*/  
 460   1      
 461   1              
 462   1      
 463   1      /****triggle the timer***/
 464   1              TR0=1;                          //start timer0
 465   1              TR1=1;              // start timer 1 for baud rate
 466   1              TR2=1;                 //start timer2 for IR decoder
 467   1      
 468   1      /****set the priority of interrupt***/
 469   1              PS = 0;              // set serial to low priority
 470   1              ES = 1;              // enable serial interrupt
 471   1              
 472   1              PT0=0;                          //set timer0 to low prioity
 473   1             PX1=0;                   // set the Externel 1 interrupt
 474   1            PT2       =1;                             //timer2 to high prioty
 475   1             PT1=0;
 476   1                
 477   1              ET0=1;                          //enable timer0 interrupt
 478   1              ET1=1;                          /*enable T1 interrupt*/
 479   1              ET2=1;                          /*enable T2 interrupt*/
 480   1              
 481   1              EX0=0;                          //disable the EXtern0 interrupt
 482   1              EX1=0;                         // disable the extern  interrupt1
 483   1      
 484   1      
 485   1              ET1=1;                          /*enable T1 interrupt*/
 486   1             ET0=1;
 487   1              
 488   1              
 489   1              
C51 COMPILER V8.02   MAIN                                                                  10/16/2006 17:42:28 PAGE 9   

 490   1      }
 491          
 492          
 493          void Init_all_Hardware(void)
 494          {
 495   1          
 496   1               Init_LCD_COtrollor();
 497   1            //first init the EEPROM
 498   1        /*   ReadXEEprom(temp_byte,EEPAddress_INIT_FLAG,1);
 499   1           if(*temp_byte!=0xAA)
 500   1          {
 501   1               WriteEEprom(EEPAddress_INIT_FLAG, 0xAA);
 502   1               Reset_EEProm();
 503   1              }
 504   1              */
 505   1              P3_4=0;
 506   1              Display_Temp_String("POWER ON");
 507   1                
 508   1      
 509   1      }
 510          
 511          
 512          void Save_all_Var_to_EEProm(void)
 513          {
 514   1      
 515   1      
 516   1      
 517   1      
 518   1      }
 519          
 520          
 521          void Reset_EEProm(void)
 522          {
 523   1      //save all var
 524   1      Save_all_Var_to_EEProm();
 525   1      
 526   1      }
 527          
 528          
 529          
 530          void Init_Run_VAR(void)
 531          {
 532   1      Need_Send_Single_Key=0;
 533   1      Flag_Get_Hold_Key=0;
 534   1      IR_Get_Start_Begin=0;
 535   1              Start_Parse_Key_Input=0;
 536   1              Key_Scan_Step=0;
 537   1               Enable_Get_Key=1;
 538   1               Need_Send_Click_key=0; 
 539   1               Get_Single_Key_Code=0;
 540   1              
 541   1       System_Flag_Being_Scrolling=0;          //flag to indicate that allow scrolling
 542   1       
 543   1       IR_Get_Start_Begin=0;
 544   1      System_Flag_RTC_Update=FALSE;   
 545   1      
 546   1        
 547   1      Start_Parse_Key_Input=0;
 548   1       Key_Scan_Step=0;
 549   1       Enable_Get_Key=0;
 550   1       Need_Send_Click_key=0;
 551   1      
C51 COMPILER V8.02   MAIN                                                                  10/16/2006 17:42:28 PAGE 10  

 552   1      IR_Key_Be_Hold_Key=0;                     //when we check the IR realse we will set the flag for send out 
             -a single key
 553   1      Get_Single_Key_Code=0;
 554   1      Enable_Hold_Key_Valid=0;
 555   1      System_Flag_Temp_DisplaY=0;
 556   1      
 557   1       Enable_Repeat_Bit=0;
 558   1      
 559   1       Timer_for_Refresh_LCD_Display=0;
 560   1       System_Confirm_Refresh_LCD_Counter=0;
 561   1       System_RTC_Hour=0;
 562   1       System_RTC_Minute=0;
 563   1       System_RTC_Second=0;
 564   1      
 565   1      }
 566          void Init_System()
 567          {       
 568   1      
 569   1      
 570   1              
 571   1      
 572   1      
 573   1      }
 574          void Mute_Key_Process()
 575          {
 576   1                       System_Flag_MuteState^=1;
 577   1                   if(System_Flag_MuteState)
 578   1                      {
 579   2                
 580   2                          LCD_Icon_Display_Control(SEG_MUTE, ON);
 581   2                      
 582   2      
 583   2                      }
 584   1               else
 585   1                      {
 586   2                      
 587   2                            LCD_Icon_Display_Control(SEG_MUTE, OFF);
 588   2                      
 589   2                      }
 590   1      
 591   1      }
 592          
 593          void Normal_Dispaly()
 594          {
 595   1      }
 596          
 597          
 598          void Delay_x5uS(U8  time )
 599          {
 600   1              
 601   1              while(time)
 602   1                      time--;
 603   1              
 604   1              
 605   1      }
 606          
 607          
 608          void Delay_xmS( U8  time)
 609          {
 610   1             U8 i;
 611   1               i=0;
 612   1            while(i<time)
C51 COMPILER V8.02   MAIN                                                                  10/16/2006 17:42:28 PAGE 11  

 613   1              {
 614   2                   
 615   2                      Delay_x5uS(190);
 616   2                     Delay_x5uS(190);
 617   2                      i++;
 618   2              }
 619   1              
 620   1      
 621   1      }
 622          
 623          
 624          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1077    ----
   CONSTANT SIZE    =    224    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      1       8
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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