打印

I2C读E2PROM单字节数据程序

[复制链接]
204|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

粉丝