Hi,
I am using the code LTC2497 - DC1012AB Linduino.INO File with their respective libraries (Single Ended Mode), and I have a couple of doubts:
1) Why is the adc_code return value so high? (adc_code -= 0x20000000;)
14:00:20.207 -> adc_code:182809344.0 voltage:0.6973623633
14:00:21.192 -> adc_code:180794112.0 voltage:0.6896748543
14:00:22.153 -> adc_code:179352320.0 voltage:0.6841748357
1) Why does the conversion formula divide the ADC result by 536870912.0, if it is 16 bits, shouldn't it be 65535?
float LTC24XX_diff_code_to_voltage(int32_t adc_code, float vref)
{
float voltage;
#ifndef SKIP_EZDRIVE_2X_ZERO_CHECK
if(adc_code == 0x00000000)
{
adc_code = 0x20000000;
}
#endif
adc_code -= 0x20000000; //! 1) Converts offset binary to binary
voltage=(float) adc_code;
voltage = voltage / 536870912.0; //! 2) This calculates the input as a fraction of the reference voltage (dimensionless)
voltage = voltage * vref; //! 3) Multiply fraction by Vref to get the actual voltage at the input (in volts)
return(voltage);
}
Note: my reference voltage is 2.048v
Regards,
added info
[edited by: ECProgrammer at 7:39 PM (GMT 0) on 28 Jun 2020]