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.

Code - https://github.com/analogdevicesinc/aducm355-examples/tree/master/examples/ApplicationExamples/M355_ECSns_SingleWE

Current calculation code - 

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

float AD5940_ADCCode2Volt(uint32_t code, uint32_t ADCPga, float VRef1p82)
{
float kFactor = 1.835/1.82;
float fVolt = 0.0;
float tmp = 0;
tmp = (int32_t)code - 32768;
switch(ADCPga)
{
case ADCPGA_1:
break;
case ADCPGA_1P5:
tmp /= 1.5f;
break;
case ADCPGA_2:
tmp /= 2.0f;
break;
case ADCPGA_4:
tmp /= 4.0f;
break;
case ADCPGA_9:
tmp /= 9.0f;
break;
default:break;
}
fVolt = tmp*VRef1p82/32768*kFactor;
return fVolt;
}

datasheet

block diagram