Post Go back to editing

# aducm355 Current Calculation

Hello Everyone,

I am trying the DC current example for measuring current. I am finding difficulty in understanding the current calculation part. Can anyone explain/elaborate current calculation part? Also, find the attached images for reference.

Current calculation code -

/* Calculate current in uA */
float AppAMPCalcCurrent(uint32_t ADCcode, float RtiaVal)
{
float fCurrent, fVoltage = 0.0;
fCurrent = fVoltage/RtiaVal;
return -fCurrent*1000000;
}

{
float kFactor = 1.835/1.82;
float fVolt = 0.0;
float tmp = 0;
tmp = (int32_t)code - 32768;
{
break;
tmp /= 1.5f;
break;
tmp /= 2.0f;
break;
tmp /= 4.0f;
break;
tmp /= 9.0f;
break;
default:break;
}
fVolt = tmp*VRef1p82/32768*kFactor;
return fVolt;
}

• Hi,

The voltage output at AIN4/LPTIA output is given to ADC.

Hence,

ADC code corresponding to VLPTIA_output  = code/PGAgain

ADC code corresponding to Vzero = 0x8000 = 32678/PGAgain

Therefore,

ADC code corresponding to (VLPTIA_output - Vzero) = (code - 32678)/PGAgain

At LPTIA,

VLPTIA_output - Vzero = Iin * RTIA

where Iin = input current

Therefore,

Iin = (VLPTIA_output - Vzero)/RTIA

= code2Volt((code - 32768)/PGAgain)/RTIA

kFactor is used because the device is factory calibrated for 1.835 Volts.

• Hello Akila,

Thanks for the reply. I have understood the code. I have some doubts regarding your reply.

1. As per datasheet - for code to voltage conversion formula ADCBIAS_CAP (1.11V) is added at the end

As per C codeADCBIAS_CAP (1.11V) is not added

2. return -fCurrent*1000000;

According to this statement, the negative value is passed to the main function. Is there any reason to pass this negative value?

• Hi,

In c code, Vzero is used instead of ADCBIAS_CAP.

-fCurrent*1000000 is done to tell the actual sense of current flow into/out of SE0.

• Do I have to add buffer op-amp at the reference electrode as they are not provided in the dev board?

• No need to add buffer.

All signals going to ADC goes through an ADC input buffer.