在按TS1激活之前10块电池总电压是40V,激活后测量只有26V,这是正常的吗?原理图在附件已上传。
huashi cai:
回复 Hugo Zhang:
问题解决了,谢谢
huashi cai:
回复 Hugo Zhang:
请问你们有无STM32与BQ76930通信的例程啊,我写的程序读出来的数据不正确啊,在组织程序方面的具体有哪些步骤?我的邮箱2982148529@qq.com,麻烦有例程给我发一下吧,电路是按官方手册上面画的。
huashi cai:
回复 Hugo Zhang:
你们的参考程序主函数就这么点东西,实现了什么功能?有点看得不是很懂,求解析一下下面这段程序的意思和实现功能,谢谢。
int main(void){int Result;
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
DISABLE_INT;
ClockInitialise();
I2CInitialise();
InitialisebqMaximo();
while(1){Result = UpdateVoltageFromBqMaximo();}
return Result;}
int UpdateVoltageFromBqMaximo(){int Result = 0, i = 0;unsigned char *pRawADCData = NULL;unsigned int iTemp = 0;unsigned long lTemp = 0;
Result = I2CReadBlockWithCRC(BQMAXIMO, \VC1_HI_BYTE, \&(Registers.VCell1.VCell1Byte.VC1_HI), \30);
pRawADCData = &Registers.VCell1.VCell1Byte.VC1_HI;for (i = 0; i < 15; i++){iTemp = (unsigned int)(*pRawADCData << 8) + *(pRawADCData + 1);lTemp = ((unsigned long)iTemp * iGain)/1000;lTemp += Registers.ADCOffset;CellVoltage[i] = lTemp;pRawADCData += 2;}
return Result;}
int InitialisebqMaximo(){int result = 0;
Registers.Protect1.Protect1Bit.SCD_DELAY = SCDDelay;Registers.Protect1.Protect1Bit.SCD_THRESH = SCDThresh;Registers.Protect2.Protect2Bit.OCD_DELAY = OCDDelay;Registers.Protect2.Protect2Bit.OCD_THRESH = OCDThresh;Registers.Protect3.Protect3Bit.OV_DELAY = OVDelay;Registers.Protect3.Protect3Bit.UV_DELAY = UVDelay;
result = GetADCGainOffset();
Gain = (365 + ((Registers.ADCGain1.ADCGain1Byte & 0x0C) << 1) + ((Registers.ADCGain2.ADCGain2Byte & 0xE0)>> 5)) / 1000.0;iGain = 365 + ((Registers.ADCGain1.ADCGain1Byte & 0x0C) << 1) + ((Registers.ADCGain2.ADCGain2Byte & 0xE0)>> 5);
Registers.OVTrip = (unsigned char)((((unsigned short)((OVPThreshold – Registers.ADCOffset)/Gain + 0.5) – OV_THRESH_BASE) >> 4) & 0xFF);Registers.UVTrip = (unsigned char)((((unsigned short)((UVPThreshold – Registers.ADCOffset)/Gain + 0.5) – UV_THRESH_BASE) >> 4) & 0xFF);
result = ConfigureBqMaximo();
return result;}