第一章 bq769x初始化
void BQ76930_config(void)
{
WAKE_ALL_DEVICE(); //bq769x复位
BQ_1_2_config(); //配置
Get_offset();
OV_UV_1_2_PROTECT();
OCD_SCD_PROTECT(); //设置保护
IIC1_write_one_byte_CRC(SYS_STAT,0xFF);
}
第二章 电芯采集
void Get_Battery1(void)
{
unsigned int readbattbuf[2];
//unsigned int battery1val[2];
short batteryval1;
readbattbuf[1] = IIC1_read_one_byte(0x0c);
readbattbuf[0] = IIC1_read_one_byte(0x0d);
batteryval1= readbattbuf[1];
batteryval1= (batteryval1 << 8) |readbattbuf[0];
batteryval1=((batteryval1*GAIN)/1000)+ADC_offset;//单体电压计算公式,第1串
//get cell voltage
runData.bq76940.cell_voltage[0] = batteryval1;
}
第三章 电流采集
目前还未开源,可以私聊