我直接将命令0x08发送到 BQ34110,然后通过 IIC 立即读取 BQ34110。 我得到的响应无效(0xff)。我在发送命令和读取响应之间增加了延迟,我得到另 一个无效响应(0x7f)。为什么我无法得到正确的响应?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
我建议您首先查看以下应用手册、并熟悉 bq34110的通信顺序。
我已经多次按照 slua790文件的顺序执行了操作。我得到了相同的结果。检查我的程序,帮助我找到错误,谢谢!
U16 tempwei;
U16 tempGwei;
U16 tempValue;
U16 Bq34110_cmd (u8 cmd)
{
IIC_Start();
IIC_Send_Byte (0xAA);
delay_us (10);
if (IIC_WAIT_Ack ())
{
返回0;
}
delay_us (10);
IIC_Send_Byte (cmd); //cmd 0x08
delay_us (10);
if (IIC_WAIT_Ack ())
{
返回0;
}
delay_us (10);
IIC_Start();
IIC_Send_Byte (0XAB);
delay_us (10);
if (IIC_WAIT_Ack ())
{
返回0;
}
delay_us (10);
tempGwei=IIC_READ_BYTE (0);
delay_us (10);
IIC_Ack();
delay_us (10);
tempDwei=IIC_READ_BYTE (0);
tempValue=(tempGwei<8)|tempDwei;
delay_us (10);
IIC_Stop();
返回 tempValue;
}