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

📄 main.lst

📁 此程序为twell8806驱动程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
 237          #endif
 238          
 239          static  PDATA BYTE      commdbuf[MaxBuf], commdptr, bptr;
 240          static  PDATA BYTE  arg[MaxArg], argn;  
C51 COMPILER V7.50   MAIN                                                                  08/20/2007 10:23:30 PAGE 5   

 241          static  bit                     eol, cerror;            // bit eol, cerror;     
 242          static  bit                     indirect=0; // For indirect address access
 243          
 244          #endif  // SERIAL
 245          //================== Remocon ==================================================
 246          #ifdef REMO_RC5
 247          
 248          static  bit         RemoPhase1, RemoPhase2;
 249                          IDATA BYTE      RemoDataReady=0;
 250                          IDATA BYTE  RemoSystemCode, RemoDataCode;
 251          
 252          #elif defined REMO_NEC
              
              static  bit         RemoPhase=0;
              static  PDATA BYTE  RemoStep=0;
              static  PDATA BYTE  RemoHcnt, RemoLcnt;
                              BYTE     RemoData[4];
                          IDATA BYTE  RemoDataReady=0;
              static  IDATA BYTE  RemoNum, RemoBit;
              
                          IDATA BYTE  RemoDataCode=0xff;
              #endif
 263          //================= Etc. ======================================================
 264          #ifdef WIDE_SCREEN
 265                          PDATA BYTE  WideScreenMode;
 266          #endif
 267                          PDATA BYTE      DebugLevel;
 268          
 269                          bit   Flag4AutoPanelRegs = 0;
 270                          bit   I2CAutoIncFlagOn = 0;
 271          #ifdef SUPPORT_COMPONENT
 272                      PDATA BYTE  ComponentMode;
 273                          PDATA WORD  OLD_hpn;
 274          #endif
 275          extern  IDATA BYTE      PcMode;
 276          //extern  bit               OnChangingValue;
 277          extern  PDATA BYTE      TVInputSel;
 278          #ifdef SUPPORT_DEBUG
              extern  bit Debug_On;
              #endif
 281          
 282          #ifdef CHIP_MANUAL_TEST
              extern  PDATA   BYTE ManualFrequency;
              extern  bit             OnChipTest;
              #endif
 286          #ifdef NO_INITIALIZE
                              bit             NoInitAccess=0;
              #endif
 289          //#ifdef SUPPORT_CCD_VCHIP
 290          //extern        bit             VchipWindow_On;
 291          //#endif
 292          
 293          //static  bit         TestStop=0; // RYU TEST
 294          
 295                      bit   DisplayInputHold = 0;
 296          
 297          /*****************************************************************************/
 298          /*      Ext Int 1 Interrupt                                                  */
 299          /*****************************************************************************/
 300          //_interrupt(2) void ext1_int (void)
 301          INTERRUPT(2, ext1_int)
 302          {
C51 COMPILER V7.50   MAIN                                                                  08/20/2007 10:23:30 PAGE 6   

 303   1              EX1 = 0;
 304   1      }
 305          
 306          //****************************************************************************/
 307          //      Timer 0 Interrupt                                                  
 308          //                      If TL0 overflow,
 309          //                       .Invoke this interrupt
 310          //                       .TL0 <- TH0
 311          //                      TL0 is incremented every machine cycle
 312          //                      Every machine cycle is 12*Tosc(11.0592MHz)
 313          //
 314          //                      Every machine cycle = 1.085us
 315          //                      Interrupt interval = 208us ( 1.085*(256-64(TH0)) )
 316          //                      When tm001==48, it's 0.01sec.  48*208us
 317          //                                                      
 318          //****************************************************************************/
 319          DATA BYTE tm001;
 320          DATA BYTE keytic=0;
 321          DATA BYTE Key=0;
 322          bit KeyReady=0;
 323          
 324          #define _ReadKey()              ( ((~P4>>2)& 0x01) | (~P1 & 0xfc) )
 325          
 326          ////////////////////////////////
 327          
 328          INTERRUPT(1, timer0_int)
 329          {
 330   1      /*      
 331   1      tm001++;
 332   1              
 333   1              //---------- 0.01 sec timer ------------
 334   1              
 335   1              #ifdef CLOCK_11M
 336   1              if( tm001 > 48 ) 
 337   1               {                      // LJY001220 0.01sec
 338   1                              #elif defined CLOCK_22M
 339   1                              if( tm001 > 48*2 )
 340   1                               {              // LJY001220 0.01sec
 341   1                                      #endif
 342   1                              
 343   1                                              tm001 = 0;
 344   1                                              tic01++;
 345   1                                              
 346   1                                              if( tic01==100 ) 
 347   1                                              {                               // 1 sec
 348   1                                                      SystemClock++;
 349   1                                                      tic01 = 0;
 350   1                                              }
 351   1                                              if( tic_pc!=0xffff ) 
 352   1                                                      tic_pc++;
 353   1                              
 354   1                              
 355   1                                      if( _ReadKey() )
 356   1                                       {
 357   1                                                      if( keytic==3 ) 
 358   1                                                      {
 359   1                                                              Key = _ReadKey();
 360   1                                                              RepeatKey = 0;
 361   1                                                              KeyReady = 1;
 362   1                                                      }
 363   1                                                      else if( keytic==100 ) 
 364   1                                                      {
C51 COMPILER V7.50   MAIN                                                                  08/20/2007 10:23:30 PAGE 7   

 365   1                                                              Key = _ReadKey();
 366   1                                                              RepeatKey = 1;
 367   1                                                              KeyReady = 1;
 368   1                                                              keytic = 80;
 369   1                                                      }
 370   1                                                      keytic++;
 371   1                                      }
 372   1                                      else 
 373   1                                              keytic = 0;
 374   1                                      
 375   1                              }
 376   1           }
 377   1      */
 378   1      
 379   1      }
 380          //=============================================================================
 381          //                      Remocon
 382          //=============================================================================
 383          void EnableRemoconInt(void)
 384          {
 385   1              RemoDataReady = 0;
 386   1              IE = IE | 0x01; // Enable Remocon (Enable Ext int0)
 387   1      }
 388          
 389          void DisableRemoconInt(void)
 390          {
 391   1              IE = IE & 0xfe; // Disable Remocon (Disable Ext int0)
 392   1      }
 393          
 394          #ifdef REMO_RC5
 395          
 396          void InitForRemo(void)
 397          {
 398   1              WORD temp;
 399   1      
 400   1              #if defined CLOCK_11M
              
                      #ifdef TECHWELL_REMOCON // DONGYANG
                      temp = 0x10000 - 193;   // 209.62us = 1.085*193
                      #else
                      temp = 0x10000 - 204;   // 221.34us = 1.085*204
                      #endif
                      
                      #elif defined CLOCK_22M
 409   1      
 410   1              #ifdef TECHWELL_REMOCON // DONGYANG
 411   1              temp = 0x10000 - 193*2; // 209.62us = 1.085/2*193*2
 412   1              #else
                      temp = 0x10000 - 204*2; // 221.34us = 1.085/2*204*2
                      #endif
 415   1      
 416   1              #endif
 417   1      
 418   1              RCAP2H = TH2 = temp>>8;
 419   1              RCAP2L = TL2 = (BYTE)(temp & 0xff);
 420   1              TR2    = 1;
 421   1      
 422   1              tm01 = 4;
 423   1              RemoPhase1 = 1;
 424   1              RemoSystemCode= RemoDataCode=0;
 425   1      
 426   1              TR2    = 1;
C51 COMPILER V7.50   MAIN                                                                  08/20/2007 10:23:30 PAGE 8   

 427   1      
 428   1              tm01 = 4;
 429   1              RemoPhase1 = 1;
 430   1              RemoSystemCode= RemoDataCode=0;
 431   1      }
 432          
 433          #elif defined REMO_NEC
              
              void InitForRemo(void)
              {
                      WORD temp;
              
                      #if defined CLOCK_11M
                      temp = 0x10000 - 173;   // 187.71us = 1.085*173
                      #elif defined CLOCK_22M
                      temp = 0x10000 - 173*2;
                      #endif
              
                      RCAP2H = TH2 = temp>>8;
                      RCAP2L = TL2 = (BYTE)(temp & 0xff);
              
                      TR2 = 1;
              
                      tm01 = 0;
                      RemoStep  = 0;
                      RemoPhase = 0;
                      RemoHcnt  = 0;
                      RemoLcnt  = 0;
              }
              #endif
 457          
 458          void ClearRemoTimer(void)
 459          {
 460   1              TR2 = 0;
 461   1      }
 462          
 463          ///****************************************************************************
 464          ///*      Ext Int 0 Interrupt                                                
 465          ///****************************************************************************
 466          //_interrupt(0) void remocon_int (void)
 467          INTERRUPT(0, remocon_int)
 468          {
 469   1              DisableRemoconInt();
 470   1              InitForRemo();
 471   1      }
 472          
 473          //#endif                //SUPPORT_REMO
 474          
 475          
 476          //****************************************************************************/
 477          //      Timer 2 Interrupt                                                  
 478          //                      If TH2 and TL2 are overflowed,
 479          //                       .Invoke this interrupt
 480          //                       .TH2 <- RCAP2H

⌨️ 快捷键说明

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