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

📄 eeprom.lst

📁 单片机键值测定程序
💻 LST
字号:
C51 COMPILER V7.50   EEPROM                                                                05/31/2008 10:36:54 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE EEPROM
OBJECT MODULE PLACED IN eeprom.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE eeprom.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          //-------------------------------------------------------------------------
   2          // 5.1 Channel Volume Control
   3          // COPYRIGHT (C) 2002, Enbia Technology Inc.
   4          // Target: 89c2051
   5          // AUTHOR: STEVEN LUO
   6          //
   7          // Revision History:
   8          // 2002/7/26 - Original Version
   9          //
  10          //-------------------------------------------------------------------------
  11          #include "define.h"
  12          #include "global.h"
  13          #include <regX52.H>
  14          #include <intrins.h>
  15          
  16          #define READ            0x01
  17          #define WRITE           0xfe
  18          #define EEPROM          0xa0
  19          //#define uint  unsigned int
  20          //#define uchar unsigned char
  21          
  22          char Addr,Val;
  23          //uchar Val,Addr;
  24          
  25          extern bit Write_I2C_Byte(uchar); 
  26          uchar Read_I2C_Byte(void); 
  27          extern void Send_I2C_Start(void);
  28          extern void Send_I2C_Stop(void);
  29          extern void SendAcknowledge(bit ack);
  30              uchar add=0;
  31          //-------------------------------------------------------------------------
  32          // Write_EEPROM
  33          //-------------------------------------------------------------------------
  34              void Write_EEPROM(uchar Addr, uchar Val){
  35   1      
  36   1              Send_I2C_Start();                       // Start I2C communication
  37   1      ddg:
  38   1              if (Write_I2C_Byte(add & WRITE))
  39   1      
  40   1          {add+=1;if(add==0xff)return;goto ddg;}
  41   1      
  42   1      /*
  43   1                      Send_I2C_Stop();        ttt=10;         // Second NACK -- send STOP condition and return CDB_ERROR
  44   1                      return;                                         // ErrorVal  
  45   1              }
  46   1      
  47   1              // Write the MAP Address Vale //
  48   1              if (Write_I2C_Byte(Addr))
  49   1      
  50   1         {
  51   1                      Send_I2C_Stop();ttt=11;                 // Second NACK -- send STOP condition and return CDB_ERROR
  52   1                      return;                                         // ErrorVal
  53   1              }
  54   1      
  55   1              // Write the Val Vale 
C51 COMPILER V7.50   EEPROM                                                                05/31/2008 10:36:54 PAGE 2   

  56   1              if (Write_I2C_Byte(Val))
  57   1              
  58   1              {
  59   1                      Send_I2C_Stop();ttt=12;                 // Second NACK -- send STOP condition and return CDB_ERROR
  60   1                      return;                                         // ErrorVal
  61   1          }*/
  62   1      
  63   1              Send_I2C_Stop();                                // Stop and return
  64   1      
  65   1              
  66   1      }
*** WARNING C280 IN LINE 34 OF EEPROM.C: 'Addr': unreferenced local variable
*** WARNING C280 IN LINE 34 OF EEPROM.C: 'Val': unreferenced local variable
  67          
  68          //-------------------------------------------------------------------------
  69          //   Read_EEPROM
  70          //-------------------------------------------------------------------------
  71          char Read_EEPROM(uchar Addr){
  72   1      char temp;
  73   1              
  74   1              Send_I2C_Start();                // Start I2C communication
  75   1      TVB4:
  76   1              if (Write_I2C_Byte(EEPROM & WRITE)) goto TVB4;
  77   1      /*      
  78   1              {
  79   1                      Send_I2C_Stop();                        // Second NACK -- send STOP condition and return CDB_ERROR
  80   1                      return 0xff;                            // ErrorVal
  81   1              }
  82   1      */  
  83   1              // Write the MAP Address Vale //
  84   1      TVB5:
  85   1              if (Write_I2C_Byte(Addr)) goto TVB5;
  86   1      /*      
  87   1              {
  88   1                      Send_I2C_Stop();                        // Second NACK -- send STOP condition and return CDB_ERROR
  89   1                      return 0xff;                            // ErrorVal
  90   1          }
  91   1      */
  92   1              Send_I2C_Stop();
  93   1      
  94   1              Send_I2C_Start();                // Start I2C communication
  95   1      TVB6:
  96   1              if (Write_I2C_Byte(EEPROM | READ)) goto TVB6;
  97   1      /*      
  98   1              {
  99   1                      Send_I2C_Stop();                        // Second NACK -- send STOP condition and return CDB_ERROR
 100   1                      return 0xff;                            // ErrorVal
 101   1              }
 102   1      */
 103   1              temp=Read_I2C_Byte();                   // Read the E2 Val Vale 
 104   1              SendAcknowledge(1);
 105   1              Send_I2C_Stop();                                // Stop and return
 106   1      
 107   1              return temp;
 108   1      } 
 109          
 110          
 111          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     77    ----
C51 COMPILER V7.50   EEPROM                                                                05/31/2008 10:36:54 PAGE 3   

   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      3       4
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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