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

📄 iic.lst

📁 STC51系列单片机通过vk3x系列芯片扩展串口的源码
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   IIC                                                                   06/14/2007 11:15:50 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE IIC
OBJECT MODULE PLACED IN iic.obj
COMPILER INVOKED BY: d:\Program Files\Keil\C51\BIN\C51.EXE code\iic.c BROWSE DEBUG OBJECTEXTEND PRINT(.\iic.lst) OBJECT(
                    -iic.obj)

stmt level    source

   1          #include "stc51reg.h"
   2          #include <intrins.h>
   3          
   4          
   5          extern void delay (unsigned int delaydata);
   6          //************************************************************
   7          void config()
   8          {
   9   1              WDT_CONTR = 0x00;       // Watchdog Timer Control Register
  10   1      
  11   1      }
  12          //初始化单片机,
  13          //***********************************************************
  14          //***********************************************************
  15          unsigned char send(unsigned char _data1,unsigned char _data2,unsigned char _data3)
  16          {       
  17   1          unsigned char i;
  18   1              clk=1; // start
  19   1              delay(1);
  20   1              sda=0;
  21   1                      delay(1);
  22   1              clk=0;
  23   1                      delay(1);
  24   1              i=0;
  25   1      
  26   1         if(_data1&0x80)
  27   1              {
  28   2                      sda=1;
  29   2              }
  30   1              else sda=0;
  31   1                      delay(1);
  32   1              clk=1;
  33   1                      delay(1);
  34   1              clk=0;
  35   1                      delay(1);
  36   1      
  37   1         if(_data1&0x40)
  38   1              {
  39   2                      sda=1;
  40   2              }
  41   1              else sda=0;
  42   1                      delay(1);
  43   1              clk=1;
  44   1                      delay(1);
  45   1      
  46   1              clk=0;
  47   1                      delay(1);
  48   1      
  49   1         if(_data1&0x20)
  50   1              {
  51   2                      sda=1;
  52   2              }
  53   1              else sda=0;
  54   1                      delay(1);
C51 COMPILER V7.06   IIC                                                                   06/14/2007 11:15:50 PAGE 2   

  55   1              clk=1;
  56   1                      delay(1);
  57   1      
  58   1              clk=0;
  59   1                      delay(1);
  60   1      
  61   1      
  62   1      
  63   1         if(_data1&0x10)
  64   1              {
  65   2                      sda=1;
  66   2              }
  67   1              else sda=0;
  68   1                      delay(1);
  69   1              clk=1;
  70   1                      delay(1);
  71   1      
  72   1              clk=0;
  73   1                      delay(1);
  74   1      
  75   1         if(_data1&0x08)
  76   1              {
  77   2                      sda=1;
  78   2              }
  79   1              else sda=0;
  80   1                      delay(1);
  81   1              clk=1;
  82   1                      delay(1);
  83   1      
  84   1              clk=0;
  85   1                      delay(1);
  86   1      
  87   1         if(_data1&0x04)
  88   1              {
  89   2                      sda=1;
  90   2              }
  91   1              else sda=0;
  92   1                      delay(1);
  93   1              clk=1;
  94   1                      delay(1);
  95   1      
  96   1              clk=0;
  97   1                      delay(1);
  98   1      
  99   1         if(_data1&0x02)
 100   1              {
 101   2                      sda=1;
 102   2              }
 103   1              else sda=0;
 104   1                      delay(1);
 105   1              clk=1;
 106   1                      delay(1);
 107   1      
 108   1          clk=0;
 109   1                      delay(1);
 110   1      
 111   1         if(_data1&0x01)
 112   1                      sda=1;
 113   1              else    
 114   1                sda=0;
 115   1                      delay(1);               
 116   1              clk=1;
C51 COMPILER V7.06   IIC                                                                   06/14/2007 11:15:50 PAGE 3   

 117   1                      delay(1);
 118   1              clk=0;
 119   1                      delay(1);
 120   1      
 121   1      
 122   1              clk=1; //ack
 123   1                      delay(1);
 124   1              clk=0;
 125   1                      delay(1);
 126   1      
 127   1      
 128   1         if(_data2&0x80)
 129   1              {
 130   2                      sda=1;
 131   2              }
 132   1              else sda=0;
 133   1                      delay(1);
 134   1              clk=1;
 135   1                      delay(1);
 136   1              clk=0;
 137   1                      delay(1);
 138   1      
 139   1      
 140   1         if(_data2&0x40)
 141   1              {
 142   2                      sda=1;
 143   2              }
 144   1              else sda=0;
 145   1                      delay(1);
 146   1              clk=1;
 147   1                      delay(1);
 148   1              clk=0;
 149   1                      delay(1);
 150   1      
 151   1      
 152   1         if(_data2&0x20)
 153   1              {
 154   2                      sda=1;
 155   2              }
 156   1              else sda=0;
 157   1                      delay(1);
 158   1              clk=1;
 159   1                      delay(1);
 160   1              clk=0;
 161   1                      delay(1);
 162   1      
 163   1      
 164   1         if(_data2&0x10)
 165   1              {
 166   2                      sda=1;
 167   2              }
 168   1              else sda=0;
 169   1                      delay(1);
 170   1              clk=1;
 171   1                      delay(1);
 172   1              clk=0;
 173   1                      delay(1);
 174   1      
 175   1         if(_data2&0x08)
 176   1              {
 177   2                      sda=1;
 178   2              }
C51 COMPILER V7.06   IIC                                                                   06/14/2007 11:15:50 PAGE 4   

 179   1              else sda=0;
 180   1                      delay(1);
 181   1              clk=1;
 182   1                      delay(1);
 183   1              clk=0;
 184   1                      delay(1);
 185   1      
 186   1         if(_data2&0x04)
 187   1              {
 188   2                      sda=1;
 189   2              }
 190   1              else sda=0;
 191   1                      delay(1);
 192   1              clk=1;
 193   1                      delay(1);
 194   1              clk=0;
 195   1                      delay(1);
 196   1      
 197   1         if(_data2&0x02)
 198   1              {
 199   2                      sda=1;
 200   2              }
 201   1              else sda=0;

⌨️ 快捷键说明

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