以下为我的代码: I2C_GenerateSTART(I2C2, ENABLE); /* Test on I2C2 EV5 and clear it */ while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_MODE_SELECT)); /* Send I2C slave Address for write */ I2C_Send7bitAddress(I2C2, MOTOR_WRITE_ADDRESS7, I2C_Direction_Transmitter); /* Test on I2C2 EV6 and clear it */ 程序一直死在这里,等待不到ACK: while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)); I2C_SendData(I2C2,Cmd_Byte); while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_BYTE_TRANSMITTED)); I2C_GenerateSTOP(I2C2,ENABLE);
|