AnsweredAssumed Answered

Problem with ad7795 internal calibration!

Question asked by Mosbat on Dec 15, 2017
Latest reply on Feb 5, 2018 by JellenieR

Hi there

I'm using ad7795 and i want to internally calibrate it in initial state.but after that i send zero-calibrate and full scale calibrate command nothing happens and when i read offset and fullscale registers my values are 0x8000 and 0x5941.i expect that values changes every time i init the a/d and i expect that i read 0x0000 instead of 0x8000.whats the problem???

here is my code

        //////////////////////////////////////reset step

        AD_CS_SET();
        DelayUS(1);
        RD_SSP(2); //read 2 bytes //reset
        RD_SSP(2);//read 2 bytes
        DelayUS(2000);
                    
                        

      ////////////////////////////////////////////////configuration step

        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_WRITE|AD7793_COMM_ADDR(AD7793_REG_CONF)));
        DelayUS(5);
        WR_SSP(AD7793_CONF_VBIAS(0)|AD7793_CONF_UNIPOLAR|AD7793_CONF_GAIN(0));
        WR_SSP(AD7793_CONF_REFSEL(0)|AD7793_CONF_BUF|AD7793_CONF_CHAN(i));
        DelayUS(1);    
      
        //////////////////////////////////////////////////internal zero calibration
        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_WRITE|AD7793_COMM_ADDR(AD7793_REG_MODE)));
        DelayUS(5);
        WR_SSP(AD7793_MODE_SEL(AD7793_MODE_CAL_INT_ZERO));
        WR_SSP(AD7793_MODE_CLKSRC(AD7793_CLK_INT)|AD7793_MODE_RATE(0xA));
        DelayUS(1);
        do{
        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_READ|AD7793_COMM_ADDR(AD7793_REG_STAT)));        
         DelayUS(5);
        tre=RD_SSP(1)&0x80;
        }while(tre);
        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_READ|AD7793_COMM_ADDR(AD7793_REG_OFFSET)));
        DelayUS(5);
        tre=RD_SSP(2);///  here always i read 0x8000 ----> i expect 0x0000 (unipolar mode)
        
        ///////////////////////////////////////////////////////////// internal full scale calibration
        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_WRITE|AD7793_COMM_ADDR(AD7793_REG_MODE)));
        DelayUS(5);
        WR_SSP(AD7793_MODE_SEL(AD7793_MODE_CAL_INT_FULL));
        WR_SSP(AD7793_MODE_CLKSRC(AD7793_CLK_INT)|AD7793_MODE_RATE(0xA));
        DelayUS(1);
        do{
        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_READ|AD7793_COMM_ADDR(AD7793_REG_STAT)));    
         DelayUS(5);

       tre=RD_SSP(1)&0x80;
        }while(tre);

 

        WR_SSP((AD7793_COMM_WEN|AD7793_COMM_READ|AD7793_COMM_ADDR(AD7793_REG_FULLSALE)));
        DelayUS(5);
        tre=RD_SSP(2);
 
        
      /////////////////////////////////////////////////////////// mode register setting      

       WR_SSP((AD7793_COMM_WEN|AD7793_COMM_WRITE|AD7793_COMM_ADDR(AD7793_REG_MODE)));
        DelayUS(5);
        WR_SSP(AD7793_MODE_SEL(AD7793_MODE_CONT));
        WR_SSP(AD7793_MODE_CLKSRC(AD7793_CLK_INT)|AD7793_MODE_RATE(0xA));
        DelayUS(1);
       

Outcomes