野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10349|回复: 2

I2C读E2PROM单字节数据程序

[复制链接]
发表于 2016-3-27 20:54:18 | 显示全部楼层 |阅读模式
I2C读E2PROM单字节数据程序部分中,为何没有将数据送到pBuffer指向的地址?而是在多字节读的时候才有 *pBuffer = I2C_ReceiveData(I2C1)??


while(NumByteToRead)  
  {
    if(NumByteToRead == 1)
    {
      /* Disable Acknowledgement */
      I2C_AcknowledgeConfig(I2C1, DISABLE);
      
      /* Send STOP Condition */
      I2C_GenerateSTOP(I2C1, ENABLE);

    }
    /* Test on EV7 and clear it */
    if(I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_RECEIVED))  
    {      
      /* Read a byte from the EEPROM */
      *pBuffer = I2C_ReceiveData(I2C1);
      /* Point to the next location where the byte read will be saved */
      pBuffer++;
      
      /* Decrement the read bytes counter */
      NumByteToRead--;        
    }   
  }
  /* Enable Acknowledgement to be ready for another reception */
  I2C_AcknowledgeConfig(I2C1, ENABLE);
}
回复

使用道具 举报

发表于 2016-3-28 08:31:40 | 显示全部楼层
你想问啥                 ?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-3-28 15:43:47 | 显示全部楼层
fire 发表于 2016-3-28 08:31
你想问啥                 ?

为何主机读AT24C02的数据时,没有接受数据,就Disable ACK
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-23 05:17 , Processed in 0.032850 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表