AnsweredAssumed Answered

AD7796,works only in a range of less than 100 uV ,broken or my error?

Question asked by Diegotrex on Apr 5, 2012
Latest reply on Apr 14, 2012 by Diegotrex

Hi from Milan,Italy.

Please can you help me or give me some hint?

I'm trying to aquire data from  load cell using AD7796 in unipolar mode.

I can communicate via SPI,i can read and write in any register,i can read temperature seeing it varying just blowing on the IC, but i can only see variation of data output varying VIN from 0 to about 500uV

Now i'm simulating the load cell with a resistive network .It was natural to me to connect te VIN+ to the positive side of the multiturn trimmer

,but reading better the datasheet at page 20 it says"For example, if AIN(−) is 2.5 V and the ADC is configured for unipolar mode, the input voltage range on the AIN(+) pin is 2.5 V to 2.02 V."

Is it an error or is expected that VIN>VREF?

I tried inverting inputs,but the output data is stuck to 0x0000

example.JPG

I load offset register stoppin the uC in debug mode,just before startin the offset calibration,pushing the botton shortening the inputs.

I do the calibration of fullscale register with 5mV between input ,for example.

 

Then Offset=0x8000 and Fullscale=0x4000 (typically 0x8003,0x4001).

Reading data in single mode gives 0xFFFF,at this point if i set the input voltage at 2.5 mV i expect something like 0x8000,but i have to go down  about 100uV to see a change,and the highest values less than 0xFFF that  i can see are about 0x77

 

I  modified the code in a way that i can modify and read offset and fullscale register just before acquistion,but the situation changes just about the fact that the data value is shifted and scaled,but still the dynamic looks enclosed in one hundred  uV.

 

 

 

Please tell me if there is something wrong from the start or if i should prepare to substitute the IC.

 

This is a snippet of the code:

 

void main (void)
{
 unsigned int ustestdata;
 unsigned char uctemp;
 unsigned char MSBo=0x80,LSBo=0x0,MSBfs=0x80,LSBfs=0x0; 


 Init_uC();

 seq32();//sync communication clocking at least 32 1's
  

 SetConfReg_AD7796(CONFIGREG_FIXEDBITS_M | BURNOUT_OFF | UNIPOLAR,AINPLUS_LESS_AINMINUS);  //TEMP_SENSOR);

 GetAllRegistersAD7796();

 //breakpoint: shorten inputs here
 SetModeReg_AD7796(SYS_ZEROSCALE_CAL_MODE,CLOCK_INT_ONLY | REJECTION_50HZ_ONLY);
 GetAllRegistersAD7796();
 //breakpoint:5 mV at inputs
 SetModeReg_AD7796(SYS_FULLSCALE_CAL_MODE,CLOCK_INT_ONLY | REJECTION_50HZ_ONLY);
 GetAllRegistersAD7796();
 //breakpoint: read offset snd full scale and load manually in MSBo,LSBo,MSBfs,LSBfs

  while(1)
 {
   //breakpoint: manually change MSBo,LSBo,MSBfs,LSBfs and set offset and fullscale registers
   //to see what happens
   SetModeReg_AD7796(IDLE_MODE,CLOCK_INT_ON_PIN | REJECTION_50HZ_ONLY);
   SetOffsetReg_AD7796(MSBo,LSBo);
   SetFullScaleReg_AD7796(MSBfs,LSBfs);
   GetAllRegistersAD7796();
   //
   CS_LO ;
   WriteSPI1(0x08);
   Delay(25);
   WriteSPI1(0x20);
   Delay(25);
   WriteSPI1(0x0A);
   Delay(25);
   
   WriteSPI1(0x58);


   SSP1CON1bits.SSPEN =0;//NB:pins SPI becomes I/O:test  RDY=0 => fine conv.
   
   while(PORTCbits.RC4) {}  //wait until RDY goes low
   //PORTBbits.RB3=1;//to sync oscilloscope
   SSP1CON1bits.SSPEN =1;// i pins I/O ridiventano SPI
   uctemp=ReadSPI();
   
   ustestdata = (((unsigned int)uctemp)<<8);
   Delay(25);
   uctemp=ReadSPI();
   
   ustestdata |=((unsigned int)uctemp);
    
   CS_HI;
   //PORTBbits.RB3=0;//to sync oscilloscope
   Delay(250);
   
 } 
}

Outcomes