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

📄 main.lst

📁 用C51单片机实现的MP3播放器的c代码程序。
💻 LST
字号:
C51 COMPILER V7.20   MAIN                                                                  05/08/2005 21:54:02 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN C:\main.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE main.c LARGE OPTIMIZE(1,SPEED) BROWSE DEBUG OBJECTEXTEND OBJECT(C:\main.obj
                    -)

line level    source

   1          #include <stdio.h>
   2          #include <string.h>
   3          #include "..\Inc\AT8xC51SND1.h"
   4          #include "..\Inc\GLOBAL.h"
   5          #include "..\Inc\CHIPSOURCE.h"
   6          #include "..\Inc\COMMON.h"
   7          #include "..\Inc\IDEIO.h"
   8          #include "..\Inc\FAT32.h"
   9          #include "..\Inc\MP3DECODER.h"
  10          #include "..\Inc\LCD.h"
  11          #include "mp3player.c"
  12          
  13          WORD test=0;
  14          
  15          xdata char filename1[100];
  16          
  17          void send_string(unsigned char *word)
  18          { TI=0;
  19   1        while(*word!=0)
  20   1         {SBUF=*word;
  21   2           while(TI=0);
*** WARNING C276 IN LINE 21 OF MAIN.C: constant in condition expression
  22   2               TI=0;
  23   2               word++;
  24   2         }
  25   1      }
  26          
  27          void main(void)
  28          {
  29   1              xdata WORD i,j=0;
  30   1              xdata BYTE key,status,f2,function=0;
  31   1      
  32   1              EA=1;
  33   1              
  34   1              //初始化
  35   1              //LCDInit();
  36   1              //LCDPrint(0,Title);
  37   1              InitPLL();
  38   1      
  39   1              InitUART();
  40   1              InitKEY();
  41   1      //      InitTimer0();
  42   1          send_string("UART and KEY OK");
  43   1              InitMP3Decoder();
  44   1              send_string("InitMP3Decoder OK");
  45   1              IDEInit();
  46   1          send_string("IDEInit OK");
  47   1      
  48   1              //printf("ok\n");
  49   1              //printf("%bd Drivers found!\n",IDE.TotalDevices);
  50   1              //printf("Device 0 LBA: %ld\n",IDEDevice[0].TotalSectors);
  51   1              //printf("Device 1 LBA: %ld\n",IDEDevice[1].TotalSectors);
  52   1      
  53   1              IDESetCurrentDevice(IDE_DEVICE_MASTER);
C51 COMPILER V7.20   MAIN                                                                  05/08/2005 21:54:02 PAGE 2   

  54   1      
  55   1              send_string("Ready\n");
  56   1              FAT32Init();
  57   1              i=FAT32MountPartition();
  58   1              send_string("Mount Hard Disk Partition Table...ok\n");
  59   1              i=FAT32MountVolumeID(0);
  60   1              //printf("\nMount Hard Disk Partition P%bd...ok\n",HDD.CurrentPartition);
  61   1              //printf("Total Size:\t%ld bytes\nFree Size:\t%ld bytes\n",FAT32DiskSize(),FAT32DiskFreeSize());
  62   1              //ShowDiskSize();
  63   1              filename1[0]=0;
  64   1              Play.CurrentPoint=1;
  65   1              while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
  66   1              //printf("\n%d\n",Play.CurrentPoint);
  67   1              function=1;
  68   1              while(1)
  69   1              {
  70   2                      key=GetKey();
  71   2                      //printf("key:%bd\n",key);
  72   2                      switch (key)
  73   2                      {
  74   3                              case KEY_LEFT           :
  75   3                                      FunctionProcess(function,0);
  76   3                                      send_string("KEY_LEFT processing");
  77   3                                      break;
  78   3                              case KEY_RIGHT  :
  79   3                                      FunctionProcess(function,1);
  80   3                                      send_string("KEY_right processing");
  81   3                                      break;
  82   3                              case KEY_UP     :
  83   3                                      function--;
  84   3                                      if (function>MAX_MENU) function=MAX_MENU-1;
  85   3                      send_string("KEY_up processing");
  86   3                                      //printf("%bd,%s\n",function,MenuList[function]);
  87   3                                      //LCDClearLine(0);
  88   3                                      //LCDPrint(0,MenuList[function]);
  89   3                                      break;
  90   3                              case KEY_DOWN   :
  91   3                                      function=(++function)%MAX_MENU;
  92   3                                      send_string("KEY_down processing");
  93   3                                      //printf("%bd,%s\n",function,MenuList[function]);
  94   3                                      //LCDClearLine(0);
  95   3                                      //LCDPrint(0,MenuList[function]);
  96   3                                      break;
  97   3                              case KEY_OK             :
  98   3                                      if (FAT32GetDirName(Play.CurrentPoint)==2)
  99   3                                      {
 100   4                                              strcpy((char *) filename1,(char *) LongFileName);
 101   4                                              //printf("%08lx->",FAT32.CurrentDirectory);
 102   4                                              FAT32ChangeDirectory(filename1);
 103   4                                              //printf("%08lx->\n",FAT32.CurrentDirectory);
 104   4                                              Play.CurrentPoint=1;
 105   4                                              while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
 106   4                                              LCDClearLine(1);
 107   4                                              status=FAT32GetDirName(Play.CurrentPoint);
 108   4                                              if (status==1)
 109   4                                              {
 110   5                                                      //printf("%bd FILE->",Play.CurrentPoint);
 111   5                                                      //LCDPrint(0x10,"--");
 112   5                                              }
 113   4                                              else if (status==2)
 114   4                                              {
 115   5                                                      //printf("DIR->");
C51 COMPILER V7.20   MAIN                                                                  05/08/2005 21:54:02 PAGE 3   

 116   5                                                      //LCDPrint(0x10,"->");
 117   5                                              }
 118   4                                              //printf("%s\n",LongFileName);
 119   4                                              //LCDPrint(0x11,LongFileName);
 120   4                                      }
 121   3                                      else
 122   3                                      {
 123   4                                              if (MP3.Playing)
 124   4                                              {
 125   5                                                      if (AUDCON1&0x40)
 126   5                                                              MP3DecoderControl(MP3_PAUSE,0);
 127   5                                                      else
 128   5                                                              MP3DecoderControl(MP3_PAUSE,1);
 129   5                                              }
 130   4                                              else                                    
 131   4                                              {
 132   5                                                      if ((status=FAT32GetDirName(Play.CurrentPoint))==0) {j=1;status=FAT32GetDirName(Play.CurrentPoint);}
 133   5                                                      strcpy((char *) filename1,(char *) LongFileName);
 134   5                                                      f2=FAT32OpenFile(filename1);
 135   5                                                      if (f2==FAT32_ERR_FILE_OPEN_ERROR) {send_string("fail to open file\n");}
 136   5                                                      else
 137   5                                                      {
 138   6                                                              //printf("open file:%s \t%ld \t%lx\n",FCB[f2].FileName,FCB[f2].Size,FCB[f2].FirstCluster);
 139   6              //                                              InitMP3Decoder();
 140   6                                                              LoadMP3Data(f2);
 141   6                                                      }
 142   5                                              }
 143   4                                      }
 144   3                                      break;
 145   3                              case KEY_CANCEL :
 146   3                                      if (MP3.Playing)
 147   3                                      {
 148   4                                              MP3.Playing=0;
 149   4                                              FAT32CloseFile(MP3.File);
 150   4                                              send_string("play over\n");
 151   4                                      }
 152   3                                      else
 153   3                                      {
 154   4                                              strcpy(filename1,"..         ");
 155   4                                              //printf("%08lx->",FAT32.CurrentDirectory);
 156   4                                              FAT32ChangeDirectory(filename1);
 157   4                                              //printf("%08lx->\n",FAT32.CurrentDirectory);
 158   4                                              Play.CurrentPoint=1;
 159   4                                              while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
 160   4                                              //LCDClearLine(1);
 161   4                                              status=FAT32GetDirName(Play.CurrentPoint);
 162   4                                              if (status==1)
 163   4                                              {
 164   5                                                      //printf("%bd FILE->",Play.CurrentPoint);
 165   5                                                      //LCDPrint(0x10,"--");
 166   5                                              }
 167   4                                              else if (status==2)
 168   4                                              {
 169   5                                                      send_string("DIR->");
 170   5                                                      //LCDPrint(0x10,"->");
 171   5                                              }
 172   4                                              //printf("%s\n",LongFileName);
 173   4                                              //LCDPrint(0x11,LongFileName);
 174   4                                      }
 175   3                                      break;
 176   3                      }
 177   2      }
C51 COMPILER V7.20   MAIN                                                                  05/08/2005 21:54:02 PAGE 4   

 178   1      }
 179          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2005    ----
   CONSTANT SIZE    =    462    ----
   XDATA SIZE       =   1577    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     19    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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