由MCU控制BQ7694003,在初始化的时候,写入OV_TRIP=C8, UV_TRIP=B8; 在写入之后,立马读取,返回值正确。 但是过了一小段时间,再去读取OV_TRIP和UV_TRIP的时候,发现OV_TRIP已经被清零, UV_TRIP还是维持B8。 请问这可能是什么原因。
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.
由MCU控制BQ7694003,在初始化的时候,写入OV_TRIP=C8, UV_TRIP=B8; 在写入之后,立马读取,返回值正确。 但是过了一小段时间,再去读取OV_TRIP和UV_TRIP的时候,发现OV_TRIP已经被清零, UV_TRIP还是维持B8。 请问这可能是什么原因。
MCU的代码如下:
static int __config_cell_ovp(struct config_s* conf) {
PROTECT3_Type protect3;
int ov_trip = 0;
protect3.byte = __read_byte(PROTECT3);
ov_trip = ((((long)(conf->cell_ov_limit * 1000) - conf->adc_offset) * 1000 / conf->adc_gain) >> 4) & 0x00FF;
//printf("set OV_TRIP: %02X\r\n", ov_trip);
__write_byte(OV_TRIP, ov_trip);
//printf("get OV_TRIP: %02X\r\n", __read_byte(OV_TRIP));
protect3.OV_DELAY = 0;
for (int i = COUNTOF(OV_delay_setting) - 1; i > 0; i--) {
if (conf->cell_ov_delay_ms >= OV_delay_setting[i]) {
protect3.OV_DELAY = i;
break;
}
}
__write_byte(PROTECT3, protect3.byte);
// returns the actual current threshold value
return ((long)1 << 13 | ov_trip << 4) * conf->adc_gain / 1000 + conf->adc_offset;
}