Main.LST
上传用户:jcsy2001
上传日期:2013-11-29
资源大小:201k
文件大小:7k
开发平台:

C/C++

  1. C51 COMPILER V8.02   MAIN                                                                  04/29/2007 12:48:53 PAGE 1   
  2. C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
  3. OBJECT MODULE PLACED IN Main.OBJ
  4. COMPILER INVOKED BY: D:KeilC51BINC51.EXE Main.c BROWSE DEBUG OBJECTEXTEND
  5. line level    source
  6.    1          #include "common.H"
  7.    2          #include "DEVICE.H"
  8.    3          #include "HAL.H"
  9.    4          #include "HPI.H"
  10.    5          #include "FAT.H"
  11.    6          #include "FAT32.H"
  12.    7          #include "HPI32.H"
  13.    8          
  14.    9          FLAGS bdata bFlags;
  15.   10          extern unsigned char xdata DBUF[BUFFER_LENGTH];
  16.   11          /////////////////////////////////////////////////
  17.   12          extern unsigned long xdata DirStartCluster,DirStartCluster32;
  18.   13          extern unsigned char xdata UARTBUF[UARTBUF_LENGTH];
  19.   14          extern Command_Def xdata Command;
  20.   15          extern SYS_INFO_BLOCK xdata DeviceInfo; 
  21.   16          extern FILE_INFO xdata ThisFile;
  22.   17          //////////////////////////////////////////
  23.   18          
  24.   19          
  25.   20          void Init_Port()
  26.   21          {
  27.   22   1              P0 = 0xFF;
  28.   23   1              P1 = 0xFF;
  29.   24   1              P2 = 0xFF;
  30.   25   1              P3 = 0xFF;
  31.   26   1      }
  32.   27          
  33.   28          /*Serial Port */
  34.   29          /*Mode            = 1  /8-bit UART
  35.   30            Serial Port Interrupt    = Disabled         */
  36.   31          /*Receive         = Enabled   */
  37.   32          /*Auto Addressing    = Disabled   */
  38.   33          void Init_COMM(void)
  39.   34          {
  40.   35   1              SCON = 0x53;
  41.   36   1              PCON = 0x80 | PCON;
  42.   37   1              T2CON=0x30;
  43.   38   1              RCAP2H=0xFF;            // 57600 @ 21.1184MHz: 24000000/(32*(65536-(RCAP2H,RCAP2L)))
  44.   39   1              RCAP2L=0xF4;
  45.   40   1              TI=0;
  46.   41   1              RI=0;
  47.   42   1              TR2=1;
  48.   43   1              ES = 1;
  49.   44   1      }
  50.   45          
  51.   46          void main(void)
  52.   47          {
  53.   48   1              unsigned char temp;
  54.   49   1              unsigned long xdata time_count;
  55.   50   1      
  56.   51   1              Init_Port();
  57.   52   1          Init_COMM(); 
  58.   53   1      
  59.   54   1              bFlags.bits.bUartInDone=0;      
  60.   55   1              DirStartCluster=0;
  61. C51 COMPILER V8.02   MAIN                                                                  04/29/2007 12:48:53 PAGE 2   
  62.   56   1              DirStartCluster32=0;
  63.   57   1      
  64.   58   1              for(temp=0;temp<64;temp++)
  65.   59   1                      DBUF[temp]=0;
  66.   60   1      
  67.   61   1              ENABLE_INTERRUPTS;
  68.   62   1              
  69.   63   1              while(TRUE)
  70.   64   1              {
  71.   65   2              time_count++;           
  72.   66   2                      if (time_count>1000)  // 过一段时间查询一下SD/MMC卡是否在线  www.mcusky.com
  73.   67   2                      {
  74.   68   3                              DISABLE_INTERRUPTS;
  75.   69   3                              time_count = 0;
  76.   70   3                              ENABLE_INTERRUPTS;
  77.   71   3              
  78.   72   3                              if(SdInit())                    //初始化SD卡
  79.   73   3                           {                          
  80.   74   4                            if(bFlags.bits.SLAVE_ONLINE == FALSE)
  81.   75   4                                {bFlags.bits.SLAVE_FOUND=TRUE;
  82.   76   5                                 bFlags.bits.SLAVE_ONLINE =TRUE;
  83.   77   5                                }
  84.   78   4                           }
  85.   79   3                      else 
  86.   80   3                              {       
  87.   81   4                               if(bFlags.bits.SLAVE_ONLINE ==TRUE)
  88.   82   4                                 {bFlags.bits.SLAVE_REMOVED=TRUE;
  89.   83   5                                  bFlags.bits.SLAVE_ONLINE =FALSE;
  90.   84   5                                 }
  91.   85   4                          }   
  92.   86   3                       }
  93.   87   2                      if(bFlags.bits.SLAVE_FOUND){
  94.   88   3                              DISABLE_INTERRUPTS;
  95.   89   3                              bFlags.bits.SLAVE_FOUND=FALSE;
  96.   90   3      
  97.   91   3                                      bFlags.bits.SLAVE_ENUMERATED = TRUE;    
  98.   92   3                                      DirStartCluster=0;
  99.   93   3                                      DirStartCluster32=0;
  100.   94   3                                      ThisFile.FatSectorPointer=0;
  101.   95   3                                      DeviceInfo.LastFreeCluster=0;
  102.   96   3                                      MCU_LED1=0;
  103.   97   3                                      bFlags.bits.bMassDevice=TRUE;
  104.   98   3                              ENABLE_INTERRUPTS;      
  105.   99   3                              }
  106.  100   2                      if(bFlags.bits.SLAVE_REMOVED)
  107.  101   2                 {
  108.  102   3                              DISABLE_INTERRUPTS;
  109.  103   3                              bFlags.bits.SLAVE_REMOVED=FALSE;
  110.  104   3                              bFlags.bits.SLAVE_ENUMERATED = FALSE;
  111.  105   3                              bFlags.bits.SLAVE_IS_ATTACHED = FALSE;
  112.  106   3                              MCU_LED1=1;MCU_LED2=1;
  113.  107   3                              ENABLE_INTERRUPTS;      
  114.  108   3                              }
  115.  109   2                      if(bFlags.bits.bUartInDone){
  116.  110   3                              DISABLE_INTERRUPTS;
  117.  111   3                              bFlags.bits.bUartInDone=0;
  118.  112   3      
  119.  113   3                              if(DeviceInfo.FAT)      //FAT32
  120.  114   3                                      UartHandler32();
  121.  115   3                              else
  122.  116   3                                      UartHandler();  //FAT16
  123.  117   3                              
  124. C51 COMPILER V8.02   MAIN                                                                  04/29/2007 12:48:53 PAGE 3   
  125.  118   3                              ENABLE_INTERRUPTS;      
  126.  119   3                              }
  127.  120   2                      if(bFlags.bits.bMassDevice)
  128.  121   2                        {
  129.  122   3                              DISABLE_INTERRUPTS;
  130.  123   3                              bFlags.bits.bMassDevice=FALSE;
  131.  124   3                              if(InitFileSystem())
  132.  125   3                                      {
  133.  126   4                                      bFlags.bits.SLAVE_IS_ATTACHED = TRUE;                           
  134.  127   4                                      MCU_LED2=0;     
  135.  128   4                                      }
  136.  129   3                              else
  137.  130   3                                      {                               
  138.  131   4                                      bFlags.bits.SLAVE_IS_ATTACHED = FALSE;                          
  139.  132   4                                      }               
  140.  133   3                                      ENABLE_INTERRUPTS;      
  141.  134   3                              }       
  142.  135   2                      
  143.  136   2              }
  144.  137   1              
  145.  138   1      }
  146. MODULE INFORMATION:   STATIC OVERLAYABLE
  147.    CODE SIZE        =    315    ----
  148.    CONSTANT SIZE    =   ----    ----
  149.    XDATA SIZE       =   ----       4
  150.    PDATA SIZE       =   ----    ----
  151.    DATA SIZE        =     10    ----
  152.    IDATA SIZE       =   ----    ----
  153.    BIT SIZE         =   ----    ----
  154. END OF MODULE INFORMATION.
  155. C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)