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.

BQ76930数据读取

Other Parts Discussed in Thread: BQ76930, BQSTUDIO

大家好,有个问题,一直很疑惑,请大家帮忙分析下,谢谢。问题如下:

读取BQ76930里面信息时,返回值为其实际地址,如读取第一串单体电压时,返回值为0xC0D,第二串时,返回0xE0F。温度,总压都是这样,这个是什么原因啊,代码如下:

int16 BqGetCellVoltage(uint8 cell)
{
    uint16 vCell;
    uint8 ubData[2] = {0,0},ubRes1 = ERROR,ubRes2 = ERROR;

  
    if((cell == 0)||(cell > NUMBER_OF_CELLS))
    {
        return 0;
    }
    else
    {  
        ubRes2 = IICReadData(IIC_FIR,BQMAXIMO,(VC1_LO_BYTE + ((cell - 1) << 1)),8, &ubData[1],IIC_DIR_READ); //0D
        ubRes1 = IICReadData(IIC_FIR,BQMAXIMO,(VC1_HI_BYTE + ((cell - 1) << 1)), 8,ubData,IIC_DIR_READ); //0C
        vCell =  ((uint16)(ubData[0]) << 8) |(uint16)(ubData[1]);

        if(ERROR == ubRes1 || ERROR == ubRes2)
        {
            //i2c error
            bqI2CError = 1;
            return 0;
        }
        else
        {
            bqI2CError = 0;
            return(BqCellVoltageConversion((vCell&0x3FFF),bqAdcGain,bqAdcOffset));//return value in mV
        }
    }
}