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