Voltage conversion in mm91z638

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Voltage conversion in mm91z638

1,613 Views
prathapa_reddy
Contributor I

We are using the VSENSE2 as the voltage sensing pin to measure the voltage.

I simply taken the sample source code and i programmmed my costom board.It is updating the voltage in milli voltages.I refered the code,in that we are dividing the register reading value in the voltage register by 2 by right shifting the value  by one.Please give me the reason for dividing the register value by 2.

Here i am attaching the code where we modify the result register value

if(VsenseGetValue(CH_VSENSE2,&VSensor[0])) {
#if (ISENSE_GND_REF==ISENSEL)
// ISENSEL is GND reference
//s16Vdrop = (s16)((-Battery.s32mAFilt)/G_SHUNT);
s16Vdrop = (s16)(Current_mA/G_SHUNT); // Calculated shunt drop voltage
//Battery.u16mV = (VSensor[0]>>1)-s16Vdrop; // Calculating the load voltage
Battery.u16mV = (VSensor[0]>>1)                      //Here i am not understanding the reason for dividing the register value
s32VolFiltered=s32VolFiltered+Battery.u16mV;
u16VolCnt++;
#endif

#if (ISENSE_GND_REF==ISENSEH)
// ISENSEH is GND reference
Battery.u16mV = VSensor[0]>>1; // scale to mV and no correction
#endif
}
 

0 Kudos
Reply
1 Reply

1,548 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Prathapreddy,

It is because 1 LSB corresponds to 0.5 mV for VSENSE2:

pastedImage_2.png

Best regards,

Tomas

PS: If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.

0 Kudos
Reply