I2C读E2PROM单字节数据程序

[复制链接]
298|0
 楼主| 爱德华复制手 发表于 2019-11-16 18:34 | 显示全部楼层 |阅读模式
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);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

376

主题

377

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部