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

📄 a93c46.lst

📁 使用STC12C5410AD单片机作为开发系统实现简易闹钟、秒表、打铃小系统程序。包含实时时钟芯片HT1380控制
💻 LST
字号:
C51 COMPILER V8.02   A93C46                                                                07/11/2008 16:59:10 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE A93C46
OBJECT MODULE PLACED IN a93C46.OBJ
COMPILER INVOKED BY: D:\Keil\C51\BIN\C51.EXE a93C46.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include "a93c46.h"
   3          
   4          // Write enable must precede all programming modes.
   5          void Ewen(void)
   6          {
   7   1               uchar temp,InData;
   8   1               CS=0; 
   9   1               SK=0;
  10   1               CS=1;
  11   1               InData=0x98; // 10011XXXX
  12   1               for(temp=9;temp!=0;temp--) { // 9
  13   2                        DI=InData&0x80;
  14   2                        SK=1; SK=0;
  15   2                        InData<<=1;
  16   2               }
  17   1               CS=0;
  18   1      }
  19          
  20          // Disables all programming instructions.
  21          void Ewds(void)
  22          {
  23   1               uchar temp,InData;
  24   1               CS=0;
  25   1               SK=0;
  26   1               CS=1;
  27   1               InData=0x80; // 10000XXXX
  28   1               for(temp=9;temp!=0;temp--) { // 9
  29   2                        DI=InData&0x80;
  30   2                        SK=1; SK=0;
  31   2                        InData<<=1;
  32   2               }
  33   1               CS=0;
  34   1      }
  35          
  36          // Reads data stored in memory, at specified address.
  37          uint Read(uchar address)
  38          {
  39   1               uchar temp;
  40   1               uint result;
  41   1               Ewen();
  42   1               SK=0; DI=1;    // 110 A5-A0
  43   1               CS=0; CS=1;
  44   1               SK=1; SK=0;    // 1
  45   1               address=address&0x3f|0x80;
  46   1               for(temp=8;temp!=0;temp--) { // 8
  47   2                        DI=address&0x80;
  48   2                        SK=1; SK=0;
  49   2                        address<<=1;
  50   2               }
  51   1               DO=1;
  52   1               for(temp=16;temp!=0;temp--) { // 16
  53   2                        SK=1;
  54   2                        result=(result<<1)|DO;
  55   2                        SK=0;
C51 COMPILER V8.02   A93C46                                                                07/11/2008 16:59:10 PAGE 2   

  56   2               }
  57   1               CS=0;
  58   1               Ewds();
  59   1               return(result);
  60   1      }
  61          
  62          // Writes memory location An - A0.
  63          void Write(uchar address,uint InData)
  64          {
  65   1               uchar temp;
  66   1               Ewen();
  67   1               SK=0; DI=1;    // 101 A5-A0
  68   1               CS=0; CS=1;
  69   1               SK=1; SK=0;    // 1
  70   1               address=address&0x3f|0x40;
  71   1              /* for(temp=8;temp!=0;temp--) { // 8
  72   1                        DI=address&0x80;
  73   1                        SK=1; SK=0;
  74   1                        address<<=1;
  75   1               }*/
  76   1               for(temp=16;temp!=0;temp--) { // 16
  77   2                        DI=InData&0x8000;
  78   2                        SK=1; SK=0;
  79   2                        InData<<=1;
  80   2               }
  81   1               CS=0; DO=1;
  82   1               CS=1; SK=1;
  83   1               while(DO==0) {   // busy test
  84   2                        SK=0; SK=1;
  85   2               }
  86   1               SK=0; CS=0;
  87   1               Ewds();
  88   1      }
  89          
  90          /*
  91          // Erase memory location An - A0.
  92          void Erase(uchar address) {
  93           uchar temp;
  94           Ewen();
  95           SK=0; DI=1; // 111 A5-A0
  96           CS=0; CS=1;
  97           SK=1; SK=0;   // 1
  98           address =0xc0;
  99           for(temp=8;temp!=0;temp--) { // 8
 100            DI=address&0x80;
 101            SK=1; SK=0;
 102            address<<=1;
 103           }
 104           CS=0; DO=1;
 105           CS=1; SK=1;
 106           while(DO==0) {
 107            SK=0; SK=1;
 108           }
 109           SK=0; CS=0;
 110           Ewds();
 111          }
 112          
 113          // Erases all memory locations. Valid only at VCC = 4.5V to 5.5V.
 114          void Eral(void) {
 115           uchar temp,InData;
 116           Ewen();
 117           CS=0;
C51 COMPILER V8.02   A93C46                                                                07/11/2008 16:59:10 PAGE 3   

 118           SK=0;
 119           CS=1;
 120           InData=0x90; // 10010XXXX
 121           for(temp=9;temp!=0;temp--) { // 9
 122            DI=InData&0x80;
 123            SK=1; SK=0;
 124            InData<<=1;
 125           }
 126           CS=0; DO=1;
 127           CS=1; SK=1;
 128           while(DO==0) {
 129            SK=0; SK=1;
 130           }
 131           SK=0; CS=0;
 132           Ewds();
 133          }
 134          
 135          // Writes all memory locations. Valid only at VCC = 4.5V to 5.5V.
 136          void Wral(uint InData) {
 137           uchar temp,address;
 138           Ewen();
 139           CS=0;
 140           SK=0;
 141           CS=1;
 142           address=0x88; // 10001XXXX
 143           for(temp=9;temp!=0;temp--) { // 9
 144            DI=address&0x80;
 145            SK=1; SK=0;
 146            address<<=1;
 147           }
 148           for(temp=16;temp!=0;temp--) { // 16
 149            DI=InData&0x8000;
 150            SK=1; SK=0;
 151            InData<<=1;
 152           }
 153           CS=0; DO=1;
 154           CS=1; SK=1;
 155           while(DO==0) {
 156            SK=0; SK=1;
 157           }
 158           SK=0; CS=0;
 159           Ewds();
 160          }
 161          
 162          */
 163          
 164          uchar ReadChar(uchar address)
 165          {
 166   1               uchar temp=address>>1;
 167   1               if(address&0x01) return((uchar)(Read(temp)>>8));
 168   1               else return((uchar)(Read(temp)));
 169   1      }
 170          
 171          void WriteChar(uchar address,uchar InData)
 172          {
 173   1               uchar temp=address>>1;
 174   1               if(address&0x01) Write(temp,(uint)(Read(temp)&0x00ff|(InData<<8)));
 175   1               else Write(temp,(uint)(Read(temp)&0xff00|InData));
 176   1      }
 177          
 178          void ReadString(uchar data *RamAddress,uchar RomAddress,uchar Number)
 179          {
C51 COMPILER V8.02   A93C46                                                                07/11/2008 16:59:10 PAGE 4   

 180   1               while(Number!=0) {
 181   2                        *RamAddress=ReadChar(RomAddress);
 182   2                        RamAddress++;
 183   2                        RomAddress++;
 184   2                        Number--;
 185   2               }
 186   1      }
 187          
 188          void WriteString(uchar data *RamAddress,uchar RomAddress,uchar Number)
 189          {
 190   1               uint temp;
 191   1               if(Number==0) return;
 192   1               if(RomAddress&0x01) {
 193   2                        WriteChar(RomAddress,*RamAddress);
 194   2                        RamAddress++;
 195   2                        RomAddress++;
 196   2                        Number--;
 197   2               }
 198   1               if(Number==0) return;
 199   1               while(Number>>1) {
 200   2                        temp=*RamAddress;
 201   2                        RamAddress++;
 202   2                        temp=temp|(*RamAddress)<<8;
 203   2                        RamAddress++;
 204   2                        Write(RomAddress>>1,temp);
 205   2                        RomAddress++;
 206   2                        RomAddress++;
 207   2                        Number--;
 208   2                        Number--;
 209   2               }
 210   1               if(Number) WriteChar(RomAddress,*RamAddress);
 211   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    358    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       5
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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