cpu.lst

来自「显示屏驱动源代码」· LST 代码 · 共 1,256 行 · 第 1/5 页

LST
1,256
字号
              // void InitTechwell(void) - Techwell Decoder initialize
              //------------------------------------------------------------------
              void    InitTechwell( void )
              {
                      #ifdef NO_INITIALIZE
                      if( ReadKey()==MENUKEY ) {// No Initialize
                              NoInitAccess =1;
                              Printf("\r\n No-initialize Test going on with MENU KEY pressed ..: %d\n", (WORD)P0_3);
C51 COMPILER V7.06   CPU                                                                   02/21/2008 14:00:25 PAGE 9   

                              return;
                      }
                      #endif
                      LCDPowerOFF();
                     InitCCFL(); // Hans
                     ConfigPanel(); // Hans
                     ConfigTCON(); // Hans   
                      Puts("\r\n\nDetect ");
              
                      switch( ReadTW88(0) ) {
                              case 0x21:      Puts("TW8816");         break;
                              case 0x49:      Puts("TW8817");         break;
                              default:        Printf("Nothing --0x%02x\r\n", (WORD)ReadDecoder(0)); 
                                      while(1) {
                                              #ifdef SERIAL
                                              if( RS_ready() ) break;
                                              #endif
                                              Printf("Check again --0x%02x\r\n", (WORD)ReadDecoder(0));
                                              delay(99);
                                              if( ReadTW88(0)==0 ) continue;
                                              if( ReadTW88(0)==0xff ) continue;
                                              break;
                                      }
                                      delay(99);
                                      delay(99);
                                      Printf("Last Check --0x%02x\r\n", (WORD)ReadDecoder(0));
                              break;
                      }
              
                      #ifdef ADD_ANALOGPANEL
                      if(IsAnalogOn())
                              Printf("%s \n", AddedAnalogPanelStr);
                      else
                      #endif  
                              Printf("%s \n", PanelInfoStr);
              
                      CheckSpecialMode();
                      DebugLevel = 0xff;
                      main_init();
              
              }
              //=============================================================================
              //                            Power LED ON / OFF                                                   
              //=============================================================================
              void PowerLED(BYTE flag)
              {
              #define GREEN_LED       P1_7
              #define RED_LED         P1_6
              
                      if( flag==ON ) {
                              RED_LED = 0;            // ON RED 
                              GREEN_LED = 0;          // ON GREEN
                              dPuts("\r\n(PowerLED)-ON");
                      }
                      else {
                              RED_LED = 0;            // ON RED
                              GREEN_LED = 1;          // OFF GREEN
                              dPuts("\r\n(PowerLED)-OFF");
                      }
              }
              #else
 548          //=============================================================================
C51 COMPILER V7.06   CPU                                                                   02/21/2008 14:00:25 PAGE 10  

 549          //                            Initialize WINBOND CPU                                                   
 550          //=============================================================================
 551          void InitCPU(void)
 552          {
 553   1      
 554   1              CHPENR = 0x87;          // Enable AUX RAM in Winbond(W78E516B)
 555   1              CHPENR = 0x59;          //
 556   1              CHPCON = 0x10;          //
 557   1              CHPENR = 0x00;          // Write Disable
 558   1      
 559   1              /*----- Initialize interrupt -------------*/
 560   1      
 561   1              TH1 = 0xff;             //    SMOD = 0      SMOD =1                                             
 562   1                                                      // 0ffh :57600 bps                              
 563   1                                                      // 0fdh : 9600 bps      0fdh :19200 bps                         
 564   1                                                      // 0fah : 4800 bps                                                              
 565   1                                                      // 0f4h : 2400 bps                                                              
 566   1                                                      // 0e8h : 1200 bps                                                              
 567   1      
 568   1              SCON = 0x50;            // 0100 0000 mode 1 - 8 bit UART                                
 569   1                                                      // Enable serial reception                                              
 570   1              TMOD = 0x22;            // 0010 0010 timer 0 - 8 bit auto reload                
 571   1                                                      // timer 1 - baud rate generator                                
 572   1              TCON = 0x55;            // 0101 0001 timer 0,1 run                                              
 573   1                                                      // int 0,  edge triggered                                               
 574   1                                                      // int 1,  edge triggered                                               
 575   1                                                      // TF1 TR1 TF0 TR0      EI1 IT1 EI0 IT0                         
 576   1              TH0 = TL0 = 64;         // 64=4608 Hz at 11.0592MHz
 577   1      
 578   1              PCON = 0x80;            // 0000 0000 SMOD(double baud rate bit) = 1             
 579   1              IP       = 0x02;                // 0000 0000 interrupt priority                                 
 580   1                                                      // -  - PT2 PS PT1 PX1 PT0 PX0                           
 581   1      
 582   1              #ifdef SERIAL
 583   1              IE       = 0x92;                // 1001 0010 interrupt enable:Serial,TM0                
 584   1                                                      // EA - ET2 ES ET1 EX1 ET0 EX0                                  
 585   1      
 586   1              TI       = 1;                   // LJY000724 // For Starting Serial TX 
 587   1              ES   = 1;                       // LJY000724
 588   1              #else
                      IE   = 0x82;
                      #endif // SERIAL
 591   1      
 592   1              //------------ Timer 2 for Remocon --------------------------------
 593   1              T2CON  = 0x00;                          // Timer2 Clear
 594   1              TR2        = 0;
 595   1              ET2    = 1;
 596   1              //-----------------------------------------------------------------
 597   1              P4=0x0f;
 598   1      
 599   1      }
 600          
 601          #define _ReadKey()              ( ((~P4>>2)& 0x01) | (~P1 & 0xfc) )
 602          
 603          ////////////////////////////////
 604          
 605          //INTERRUPT(1, timer0_int)
 606          void timer0_int(void) interrupt 1 using 1                       // interrupt number1, bank register 2
 607          {
 608   1              tm001++;
 609   1              
 610   1              //---------- 0.01 sec timer ------------
C51 COMPILER V7.06   CPU                                                                   02/21/2008 14:00:25 PAGE 11  

 611   1              
 612   1              #ifdef CLOCK_11M
                      if( tm001 > 48 ) {                      // LJY001220 0.01sec
                      #elif defined CLOCK_22M
 615   1              if( tm001 > 48*2 ) {            // LJY001220 0.01sec
 616   2              #endif
 617   2      
 618   2                      tm001 = 0;
 619   2                      tic01++;
 620   2                      
 621   2                      if( tic01==100 ) {                              // 1 sec
 622   3                              SystemClock++;
 623   3                              tic01 = 0;
 624   3                      }
 625   2                      if( tic_pc!=0xffff ) 
 626   2                              tic_pc++;
 627   2      
 628   2              ///////////////////////////////////////////     
 629   2              if( _ReadKey() ) {
 630   3                      if( keytic==3 ) {
 631   4                              Key = _ReadKey();
 632   4                              RepeatKey = 0;
 633   4                              KeyReady = 1;
 634   4                      }
 635   3                      else if( keytic==100 ) {
 636   4                              Key = _ReadKey();
 637   4                              RepeatKey = 1;
 638   4                              KeyReady = 1;
 639   4                              keytic = 80;
 640   4                      }
 641   3                      keytic++;
 642   3              }
 643   2              else 
 644   2                      keytic = 0;
 645   2              ///////////////////////////////////////////     
 646   2      
 647   2                      // Hans
 648   2                      if (cDelayCounter > 0)
 649   2                              cDelayCounter--;
 650   2              }
 651   1      }
 652          //------------------------------------------------------------------
 653          // void InitVars(void) - variable initialize
 654          //------------------------------------------------------------------
 655          void    InitVars(void)
 656          {
 657   1              SystemClock=0;                  //00:00
 658   1              LastBlockedTime=0xffffffff;             //00:00 //ljy010904...CC_FIX_CLEAR_ON_TIME..oops! previous vchip clear error
             - 
 659   1              OffTime=0xffff;
 660   1              SleepTimer=0;
 661   1              SleepTime=0xffff;
 662   1      
 663   1              SEL_DVI=  1;            // disable Digital VGA
 664   1              // ResetKey();
 665   1      
 666   1              DebugLevel              = 0;
 667   1              RemoDataReady   = 0;
 668   1      
 669   1              P0_7 = 1;
 670   1              delay(100);
 671   1              PowerDown_XTAL(0);
C51 COMPILER V7.06   CPU                                                                   02/21/2008 14:00:25 PAGE 12  

 672   1              
 673   1              TW88HWReset = 1;        delay(1);
 674   1      }
 675          
 676          //------------------------------------------------------------------
 677          // void InitTechwell(void) - Techwell Decoder initialize
 678          //------------------------------------------------------------------
 679          void    InitTechwell( void )
 680          {
 681   1      
 682   1              #ifdef NO_INITIALIZE
 683   1              if( P0_3==0 ) {// No Initialize
 684   2                      NoInitAccess =1;
 685   2                      Printf("\r\n No-initialize Test going on with DIP SW4 ..: %d\n", (WORD)P0_3);
 686   2                      return;
 687   2              }
 688   1              #endif
 689   1      
 690   1              LCDPowerOFF();
 691   1             InitCCFL(); // Hans
 692   1             ConfigPanel(); // Hans
 693   1             ConfigTCON(); // Hans   
 694   1              Puts("\r\n\nDetect ");
 695   1              
 696   1              switch( ReadTW88(0) ) {
 697   2                      case 0x21:      Puts("TW8816");         break;
 698   2                      case 0x49:      Puts("TW8817");         break;
 699   2                      default:        Printf("Nothing --0x%02x\r\n", (WORD)ReadDecoder(0)); 
 700   2                              while(1) {
 701   3                                      #ifdef SERIAL
 702   3                                      if( RS_ready() ) break;
 703   3                                      #endif
 704   3      
 705   3                                      Printf("Check again --0x%02x\r\n", (WORD)ReadDecoder(0));
 706   3                                      delay(99);
 707   3                                      if( ReadTW88(0)==0 ) continue;
 708   3                                      if( ReadTW88(0)==0xff ) continue;
 709   3                                      break;
 710   3                              }
 711   2      
 712   2                              delay(99);
 713   2                              delay(99);
 714   2                              Printf("Last Check --0x%02x\r\n", (WORD)ReadDecoder(0));
 715   2                      break;
 716   2              }
 717   1      
 718   1              #ifdef ADD_ANALOGPANEL
                      if(IsAnalogOn())
                              Printf("%s \n", AddedAnalogPanelStr);
                      else

⌨️ 快捷键说明

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