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

📄 main.lst

📁 用51单片机的io口模拟iic操作.不是采用中断的方式
💻 LST
字号:
C51 COMPILER V6.23a  MAIN                                                                  11/16/2005 20:39:02 PAGE 1   


C51 COMPILER V6.23a, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: D:\Program Files\KeilC51Full\C51\BIN\C51.EXE main.c ROM(SMALL) BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          
   2          #include<At89X51.h>
   3          #include <intrins.h>
   4          #include <stdio.h>
   5          #include <string.h>
   6          
   7          //sbit SDA = 0xB0^5;    //P3_5 connect the SDA footprint
   8          //sbit SCL = 0xB0^4;    //P3_4 connect the CLK footprint
   9          
  10          
  11          extern void WriteByte(char nData, const unsigned char nAdress);
  12          extern char ReadByte(const unsigned char nAddress);
  13          extern void ClearAll(void);
  14          
  15          /**************************** MAIN FUNC*****************************************/
  16          
  17          void Main()
  18          {
  19   1      
  20   1              unsigned short i = 0;
  21   1      
  22   1              char nReceive[32];
  23   1              char nStore[] = "ZZH is an excellent boy.\0";
  24   1              const unsigned char nAdress = 0x10;             //start adress when store data.(0 - 256)
  25   1      
  26   1      
  27   1              //random write each byte of the nStore[] into 24c02-----------------------------------
  28   1              for(i = 0; i <= sizeof(nStore) - 1; i++)        //will be failue if ignore 6ms
  29   1              {
  30   2                      WriteByte(nStore[i], nAdress + i);              
  31   2              }
  32   1              
  33   1      
  34   1      
  35   1              
  36   1              //read the data in 24c02----------------------------------------
  37   1              for(i = 0; i <= sizeof(nStore) - 1; i++)
  38   1              {
  39   2                      nReceive[i] = ReadByte(nAdress + i);
  40   2              }
  41   1      
  42   1      
  43   1              //validate the write-operation
  44   1              if(0 == strcmp(nReceive, nStore)) // should be equal
  45   1              {
  46   2                      P1 = 0; //YES!
  47   2              }
  48   1      
  49   1      
  50   1      
  51   1      
  52   1              //clear all data in 24c02----------------------------------------
  53   1              ClearAll();
  54   1              //validate the clear-operation
  55   1              P1 = ReadByte(123);
C51 COMPILER V6.23a  MAIN                                                                  11/16/2005 20:39:02 PAGE 2   

  56   1              
  57   1              
  58   1      
  59   1              while(1);
  60   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    125    ----
   CONSTANT SIZE    =     26    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      61
   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 + -