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.

BQ76920: OV_THRESH_BASE question

Part Number: BQ76920

Hi Guys
We can see in "bq769x0_I2C_sample_code_with_CRC"
The calculation about OVTrip, There are OV_THRESH_BASE(0x2008) and UV_THRESH_BASE(0x1000.
But we can't see where the OV_THRESH_BASE and  + 0.5 will be used in the datasheet about OV_TRIP_FULL.

So I want to know which one rule we will follow, sample code or datasheet?


bqMaximo_Ctrl_G2553.h
#define OV_THRESH_BASE 0x2008
#define UV_THRESH_BASE 0x1000
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);

bq769x0 datasheet:
3. Calculate the full 14-bit ADC value needed to meet the desired OV and UV trip thresholds as follows:
(a) OV_TRIP_FULL = (OV – ADCOFFSET) ÷ ADCGAIN
(b) UV_TRIP_FULL = (UV – ADCOFFSET) ÷ ADCGAIN
4. Remove the upper 2 MSB and lower 4 LSB from the full 14-bit value, retaining only the remaining
middle 8 bits. This can be done by shifting the OV_TRIP_FULL and UV_TRIP_FULL binary values 4
bits to the right and removing the upper 2 MSB.

Thanks