AnsweredAssumed Answered

AD7780

Question asked by r273 on Apr 5, 2016
Latest reply on Apr 7, 2016 by JellenieR

Started testing a new load cell and noticed that ADC results were odd:

 

Weight (kg)    AIN (mV)   ADC 24bits (hex)

2kg                    3.7mV               009752F0

4kg                         6.3mV          00FFEC90

4.1kg                    6.4mV            0082B118

 

Above 6.3mV the codes appear to drop (excitation voltage is 3.24V).

 

So looked at the status bits and, whereas was expecting / hoping for:

 

0100 1001 (gain is 128)

 

found

 

0100 1111

 

Which indicates there was some error in the reading of the data.

 

 

Anything wrong with this code fragment? (I've been using it for some time but never checked the status bits since behaviour was satisfactory. Previous load cells might not have reached the 6.3mV threshold... Am on the Evaluation board to eliminate other variables.)

 

unsigned long read_adc(void)

{

    if (DOUT_AD7780) // if it is high then not ready for reading

    {

        return 0;

    }   

    unsigned char i;

    unsigned long reading = 0;

    for (i = 0; i<32; i++)

    {

        SCLK_AD7780 = 0;

        reading <<= 1; // left shift unsigned long int

        __delay_us(1);

        if (DOUT_AD7780)

        {

            reading |= 1;

        }

        SCLK_AD7780 = 1;

        __delay_us(1);

    }

    return reading;

}

 

 

}

Outcomes