本帖最后由 仙人球W 于 2014-11-13 13:34 编辑
bear1 发表于 2014-11-13 09:49 
真假?请版主出来解释一下,以正视听。
问题找出来了 是给的程序问题 死在
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--;
}
}
当NumByteToRead==1 失能IIC 这样不会执行if(I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_RECEIVED)),以至于 NumByteToRead不会自减到0,程序死在while(NumByteToRead)里。
|