HI,
I want to exercise the SDADC on the MPC5746. I use the following configuration parameters :
SDADC_0.MCR.B.MODE = 1; /* Single ended input */
SDADC_0.MCR.B.VCOMSEL= 0; /* IMP+ = AN[0]; INP- = VREFN */
SDADC_0.MCR.B.HPFEN = 0; /* Disable HP filter */
SDADC_0.CSR.B.BIASEN = 0 /* Disable bias */
SDADC_0.MCR.B.PGAN = 0; /* 000: gain = 1 */
SDADC_0.MCR.B.PDR = 0; /* 0: OSR = 24; output data rate = sampleClk/(2*OSR) */
Since SDADC is 16 bit, and VREF is 5V, to convert from sample value to Voltage i use the equation:
Value-in-mV = (register_value * 5000 )/ 0xFFFF;
When i execute the program, the values I get half of the expected values. I probed the pins but find the actual values are correct, so I do not suspect any hardware issue.
Something in the SDADC configuration appears to be causing this divide by 2.
Appreciate any suggestions.
Hi,
SDADC has sign 16 bit resolution, the MSB bit is sign bit, so your equation must be: Value-in-mV = (register_value * 5000 )/ (2 ^ 15);