This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi user6251042,
welcome to our forum.
When applying an exact 0V input signal to an ADC, you rarely read a conversion code of exactly 0x0000. This is because of the inherent offset of any ADC.
However the code you are reading is much larger than the offset error specified in the ADS7951-Q1 datasheet. Means there is something off.
Could you share more details about the settings of the ADC and potentially a schematic to see if we can identify any problems there?
Regards,
Hi,thank you for your reply!
My MCU is Frescale MC9S12G128 and the Communication mode is SPI.CPOL=0,CPHA=0;
void ADS1(void)
{
ADS1_CS = 0;
SPI0_send(0x1980);
temp1 = SPI0_receive();
temp11=temp1>>12;
temp1 = temp1<<4;
temp1 = temp1>>4;
delay1us(20);
ADS1_CS = 1;
delay1us(20);
ADS1_CS = 0;
SPI0_send(0x1200);
temp2 = SPI0_receive();
temp12=temp2>>12;
temp2 = temp2<<4;
temp2 = temp2>>4; //采集电池总电压,单位mV
delay1us(20);
ADS1_CS = 1;
delay1us(20);
ADS1_CS = 0;
SPI0_send(0x1280);
temp3 = SPI0_receive();
temp13=temp3>>12;
temp3 = temp3<<4;
temp3 = temp3>>4;
ADS1_CH3 = (unsigned long int)(((unsigned long int)(temp3)*2500/4095)*255);
delay1us(20);
ADS1_CS = 1;
delay1us(20);
ADS1_CS = 0;
SPI0_send(0x1300);
temp4 = SPI0_receive();
temp14=temp4>>12;
temp4 = temp4<<4;
temp4 = temp4>>4;
ADS1_CH4 = (unsigned long int)(((unsigned long int)(temp4)*2500/4095)*255);
delay1us(20);
ADS1_CS = 1;
delay1us(20);}
Hi user6251042,
thanks a lot for providing those details. One of my colleagues who is an expert on this ADC will get back to you.
Regards,
Hello,
Apologies for the late reply due to holidays.
If I understand correctly, you are grounding the input but yet reading a higher reading than the measurement should be, is this correct?
From the schematic you shared, it seems fine. How are you providing the 0V input? Are you in fact grounding the input, or is the input source delivering 0V?
What is the input source? what is the sampling rate of the ADC? Would you measure the input at the ADC pin and compare to the ADC conversion result?
Thank you for the code, but would you please provide an oscilloscope of the digital communications between the micro and the ADC? this will help to confirm timing as well as make sure that what we expect the code to enact is in fact what the devices are seeing by visually comparing.
Please be sure to include 3 frames, as this device has a 2 frame delay.
From the code you provided, it looks like you are trying to measure channels 3,4,5, and 6 using manual mode.
Regards
Cynthia