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

📄 mcu.lst

📁 车载SCALER模块源程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE MCU
OBJECT MODULE PLACED IN .\BIN\MCU.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SRC\MCU.C LARGE OPTIMIZE(9,SPEED) DEBUG OBJECTEXTEND PRINT(.\LST\MCU.lst) O
                    -BJECT(.\BIN\MCU.obj)

stmt level    source

   1          /*==========================================
   2          ==========================================*/
   3          #include "include.h"
   4          /*==========================================
   5          ==========================================*/
   6          extern WarmUp();
   7          void InitMCU(void)
   8          {
   9   1              Byte xdata *Addr;
  10   1              Byte i;
  11   1              Addr = 0xf000;
  12   1              for(i=0; i<0x23; i++){
  13   2                      *Addr = McuRegTab[i];
  14   2                      Addr++;
  15   2              }
  16   1      //      DrivePowOff();
  17   1              INTEXT_EN   = 0x02;
  18   1      // set timer 0
  19   1              SCON = 0x52;
  20   1              TMOD = 0x22;    //timer0 /timer1 8 bits auto reload
  21   1      //      TMOD = 0x21;    //timer0 16 bits/timer1 8 bits auto reload
  22   1              PCON = 0x80;
  23   1      // timer0 8 bits auto reload
  24   1              TL0 = -200;
  25   1              TH0 =-200;
  26   1      //      TL0 = 256-(CPU_CLK/1000*100/12000); //time base 100us
  27   1      //      TH0 = 256-(CPU_CLK/1000*100/12000);
  28   1      
  29   1      // timer0 16 bits
  30   1      //      TL0 = (65536-CPU_CLK/1200)%256; //time base 10ms
  31   1      //      TH0 = (65536-CPU_CLK/1200)/256;
  32   1      
  33   1      // For 12.000 MHz 
  34   1              TL1 = 256-(2*CPU_CLK/384/9600);
  35   1              TH1 = 256-(2*CPU_CLK/384/9600);
  36   1      // For 14.318 MHz 
  37   1              //TL1 = 256-(2*CPU_CLK/384/4800);
  38   1              //TH1 = 256-(2*CPU_CLK/384/4800);
  39   1              TR0 = 1;                //start timer0
  40   1              TR1 = 1;                //start timer1
  41   1      // set interrupt
  42   1              EX1 = 1;                //enable External interrupt1
  43   1              ET0 = 1;                //enable timer0 interrupt
  44   1              EA = 1;                 //enable all interrupt
  45   1              T0_INT_CNT = 0;
  46   1              T0_10ms_Cnt = 0;
  47   1              Sleep(50);      
  48   1      }
  49          /*==========================================
  50          ==========================================*/
  51          void Timer0(void) interrupt 1 using 2
  52          {
  53   1              if(++T0_INT_CNT >= 10){
  54   2                      T0_INT_CNT = 0;
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 2   

  55   2      //              if(Timer1 != 0)                 // 1ms
  56   2      //                      Timer1--;
  57   2                      if(++T0_1ms_Cnt >= 10){ // 10ms
  58   3                              CLRWDT = 0x55;
  59   3                              T0_1ms_Cnt = 0;
  60   3                              if(++T0_10ms_Cnt >= 100){//--1s
  61   4                                      T0_10ms_Cnt = 0;
  62   4                              }
  63   3                              if(OsdTimer > 0)
  64   3                                      OsdTimer--;
  65   3                              if(LocalTimer > 0)
  66   3                                      LocalTimer--;
  67   3                              if(PowerTimer > 0)
  68   3                                      PowerTimer--;
  69   3                              if(LedTimer > 0)
  70   3                                      LedTimer--;
  71   3                              if(RepeatTimer > 0)
  72   3                                      RepeatTimer--;
  73   3                              if(DDCTimer > 0)
  74   3                                      DDCTimer--;
  75   3                              if(SaveTimer > 0)
  76   3                                      SaveTimer--;
  77   3                              if(VideoTimer > 0)
  78   3                                      VideoTimer--;
  79   3                              if(BurnInTimer > 0)
  80   3                                      BurnInTimer--;
  81   3                              if(MuteTimer > 0)
  82   3                                      MuteTimer--;            
  83   3                      }
  84   2              }       
  85   1      }
  86          void Counter1(void) interrupt 3 using 3
  87          {
  88   1          ScrnCount = 0;
  89   1              INTEXT_FLG = 0x02;
  90   1              SCON = 0x52;
  91   1              TMOD = 0x22;    //timer0 /timer1 8 bits auto reload
  92   1      //      TMOD = 0x21;    //timer0 16 bits/timer1 8 bits auto reload
  93   1              PCON = 0x80;
  94   1      // timer0 8 bits auto reload
  95   1              TL0 = -200;
  96   1              TH0 =-200;
  97   1      //      TL0 = 256-(CPU_CLK/1000*100/12000); //time base 100us
  98   1      //      TH0 = 256-(CPU_CLK/1000*100/12000);
  99   1      
 100   1      // timer0 16 bits
 101   1      //      TL0 = (65536-CPU_CLK/1200)%256; //time base 10ms
 102   1      //      TH0 = (65536-CPU_CLK/1200)/256;
 103   1      
 104   1      // For 12.000 MHz 
 105   1              TL1 = 256-(2*CPU_CLK/384/9600);
 106   1              TH1 = 256-(2*CPU_CLK/384/9600);
 107   1      // For 14.318 MHz 
 108   1              //TL1 = 256-(2*CPU_CLK/384/4800);
 109   1              //TH1 = 256-(2*CPU_CLK/384/4800);
 110   1              TR0 = 1;                //start timer0
 111   1              TR1 = 1;                //start timer1
 112   1      // set interrupt
 113   1              EX1 = 0;                //enable External interrupt1
 114   1              ET0 = 1;                //enable timer0 interrupt
 115   1              EA = 1;                 //enable all interrupt
 116   1              T0_INT_CNT = 0;
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 3   

 117   1              T0_10ms_Cnt = 0;
 118   1      
 119   1      }
 120          //+++++++++++++++++++++++++++++++++++++++++++
 121          void KeyProsec()
 122          {
 123   1          unsigned char KeyBuf;
 124   1      //       LED_RedOn();
 125   1              KeyBuf = ScanKey();
 126   1              if(KeyBuf == 14)
 127   1                 {
 128   2                   KeyBuffer = KeyBuf;
 129   2                 }
 130   1              printf("KeyBuff=%d\r\n",KeyBuf);
 131   1              if(KeyBuf == 0x11)
 132   1                 {
 133   2                   Sleep(800);
 134   2                       KeyBuf = ScanKey();
 135   2      
 136   2                       if(KeyBuf == 11)
 137   2                          {
 138   3                                KeyBuf = 0x00;
 139   3                                if(PowStart == 0xff)
 140   3                                 {
 141   4                                   PowStart = 0x00;
 142   4                       PowNavOn();
 143   4                     }
 144   3                                 else 
 145   3                                  {
 146   4                                        PowStart = 0xff;
 147   4                                        PowNavOff();
 148   4                                      }
 149   3                              }
 150   2                 }
 151   1          if(KeyBuf == 12)
 152   1             {
 153   2                    LED_RedOn();
 154   2                   PreCount++;
 155   2               if(PreCount == 0x00)
 156   2                         {
 157   3                           SyncMode = 3;
 158   3          
 159   3                               Pow3Off();
 160   3                   Pow5Off();
 161   3                               Pow9Off();
 162   3              //               SetCount = 0;
 163   3                   FLG_Change_SyncMode = 1;
 164   3                         }
 165   2                      else if(PreCount == 0x01)
 166   2                         {
 167   3      //      
 168   3                                  Pow3On();
 169   3                      Pow5On();
 170   3                      Pow9On();
 171   3                   SyncMode = 0x00;
 172   3            
 173   3                               Sleep(200);  
 174   3                      //              SetCount = 0;
 175   3                                      ChangeMode = 1;
 176   3                      FLG_Change_SyncMode = 1;
 177   3                         }
 178   2              else if(PreCount == 0x02)
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 4   

 179   2                         {
 180   3                         //  PreCount =0x00;
 181   3                   SyncMode = 0x01;
 182   3           
 183   3                                 Pow3Off();
 184   3                     Pow5Off();
 185   3                     Pow9Off();
 186   3              
 187   3                     FLG_Change_SyncMode = 1;
 188   3                         }
 189   2                       else if(PreCount == 0x03)
 190   2                         {
 191   3                            SyncMode = 0x03;
 192   3                                PreCount = 0;
 193   3              
 194   3                                Pow3Off();
 195   3                    Pow5Off();
 196   3                    Pow9Off();
 197   3             
 198   3                      //
 199   3              //      FLG_Change_SyncMode = 1;
 200   3                         }
 201   2                 }
 202   1         if(KeyBuf == 13)
 203   1            {
 204   2                   CarDirecte +=1;
 205   2                       if(CarDirecte >=4)
 206   2                          {
 207   3                                CarDirecte = 2;
 208   3                              }
 209   2                   driver2();
 210   2              
 211   2                }
 212   1      }
 213          
 214          //************************************************************
 215          /*
 216          void driver1()
 217          {
 218            unsigned char temp;
 219           //    LED_GrnOn();
 220               if(CarDirecte == 2)
 221                 {
 222                        DrivePowOn();
 223                        while((ParTest(temp, 0x78)) >6) //0x6E
 224                              {
 225                                    temp = AdcCont();
 226                                    temp &=0x7f;
 227                                    printf("SCRET = %d\r\n",temp);
 228                                    ScreenDown();
 229                                    CLRWDT = 0x55;
 230                                    
 231                                  }   
 232                                  
 233                                  ScreenStop();
 234                    while(ReadCarStart() != 0)
 235                     {
 236                       CarBack();
 237                       CLRWDT = 0x55;
 238                       LED_GrnOn();
 239                     }
 240                     CarStop(); 
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 5   

 241                       while(ReadCarend() != 0)
 242                    {
 243                      CarFront();
 244                      CLRWDT = 0x55;
 245                      
 246                    }
 247                    CarStop();
 248                     
 249          //            ScreenUp();
 250                while((ParTest(temp,0x18))>6 || (temp == 0))  //0x2A  45
 251                   {
 252                     
 253                             temp = AdcCont();
 254                             temp &=0x7f;
 255                             ScreenUp();
 256                             CLRWDT = 0x55;
 257          //                 LED_GrnOn();
 258                    }       
 259          //                LED_GrnOff();  
 260                            ScrnCount = 0;
 261                          
 262                 ScreenStop();
 263                 CarDirecte=CarDirecte+1;
 264            //       if(CarDirecte == 3)
 265            //      LED_GrnOff();
 266                     temp = 0;
 267                 }
 268               else if(CarDirecte == 3)
 269                { 
 270                    
 271                  //    i = Read24C16(ep_Seven_Page);
 272                  ScreenDown();
 273                      while((ParTest(temp,0x78))>6)
 274                   {
 275                     ScreenDown();
 276                     temp = AdcCont();
 277                             temp &=0x7f;
 278                     CLRWDT = 0x55;
 279                    }    
 280                         ScreenStop();
 281          //              Write24C16(ep_Seven_Page,0x00);
 282                  ScrnCount = 0;
 283              
 284                      while((ReadCarStart())!=0)
 285                   {
 286                    CarBack();
 287                    CLRWDT = 0x55;
 288                           }
 289                  CarStop();
 290                  CarDirecte=CarDirecte-1;
 291                  temp = 0;
 292           //       if(CarDirecte == 2)
 293          //               LED_GrnOn(); 
 294                  DrivePowOff();
 295                     return;       
 296                 }
 297                     
 298            // }  
 299          }
 300          unsigned char AdcCont()
 301           {
 302           //  unsingned int cycl;
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 6   

 303             unsigned char  vel1;
 304             ADC_CON=STRT_ADC|EN_ADC0;//|EN_ADC3;
 305           //  Sleep(1);
 306             while(ADC3_REG&CMP_ADC ==0)
 307              {
 308                CLRWDT = 0x55;
 309                    
 310              }
 311              vel1=ADC0_REG;
 312              printf("ADC0_REG=%c\n",vel1);
 313              Sleep(10);
 314           //   while(vel1 !=46)  //(abs(vel1-vel2) >3 )
 315           //   {
 316            //    if(CMP_ADC==1)
 317            //     {
 318             //      ScreenDown();
 319             //            vel1=ADC0_REG;
 320             //      CLRWDT = 0x55;
 321          //               LED_GrnOff();
 322              //   }      
 323             // }
 324           //    CLRWDT = 0x55;
 325              ScrnCount= vel1;
 326          //      if((vel1 ==46) || (vel1==66) || (vel1==83) || (vel1==71) || (vel1==76) || (vel1==81) || (vel1==5)|| (ve
             -l1==10) || 
 327          //                  (vel1==15) || (vel1==20) || (vel1==25) || (vel1==30) || (vel1==35) || (vel1==40)) 
 328          //       Write24C16(ep_SevenPage,ScrnCount);
 329          //         Sleep(20);
 330                 
 331              return vel1;
 332          }*/
 333          void driver2(void)
 334          {  
 335   1         TCON = 0x44;
 336   1         TMOD = 0x60;
 337   1         TL1 = 0x243;
 338   1         TH1 = 0x243;
 339   1         EX1 = 1;
 340   1         INTEXT_EN = 0x02;
 341   1         ScrnCount = 1;
 342   1           if(CarDirecte == 2)
 343   1            {
 344   2                  while(ScrnCount == 1)
 345   2                     {
 346   3                   ScreenDown();
 347   3                 }            
 348   2            } 
 349   1           if(CarDirecte == 3)
 350   1                {  
 351   2                  while(ScrnCount  == 1)
 352   2                         {
 353   3                       ScreenUp();
 354   3                         }
 355   2                }
 356   1      }
 357          
 358          unsigned char ParTest(unsigned char k, unsigned m)
 359          {
 360   1          unsigned char valu;
 361   1          if(k < m)
 362   1            {
 363   2              valu= m-k;
C51 COMPILER V7.06   MCU                                                                   12/11/2007 11:24:25 PAGE 7   

 364   2            }
 365   1          else

⌨️ 快捷键说明

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