Post Go back to editing

AD7190 :unable to read load cell data

Hello,

     I have to read load cell data which is connecting with the ad7190 IC. I can successfully read all default register value.We have done following settings in code is as follows:-

1) Write in configuration register

-Chop Off

-REFSEL is 0(External reference applied between REFIN1(+) and REFIN1(−))

-Channel AIN1 and AIN2 select

-Burn OFF

-REFDET disable

-BUF disable

-Bipolar

-Gain 128

-wait for DRDY low

-add delay 

2) Internal Full scale calibration. Write in Mode register

-Internal Full scale calibration

-External crystal. The external crystal is connected from MCLK1 to MCLK2

-SINC4

-Parity Disable

-Single conversion disable

-Notch On

-Filter o/p data rate 100Hz

-wait for DRDY low

-add delay

3)Internal zero scale calibration.Write in Mode register

-Internal zero scale calibration

-External crystal. The external crystal is connected from MCLK1 to MCLK2

-SINC4

-Parity Disable

-Single conversion disable

-Notch On

-Filter o/p data rate 100Hz

-wait for DRDY low

-add delay

4) Write  in mode register.

-SIngle conversion

-External crystal. The external crystal is connected from MCLK1 to MCLK2

-SINC4

-Parity Disable

-Single conversion disable

-Notch On

-Filter o/p data rate 100Hz

-wait for DRDY low

-add delay

5) read data by writing 0x58 in register.

*** to read the data from ad7190:-

-CS low

-delay

-wait for data ready low

-read load cell data

-delay

-CS high

I have attache code for ref.

// read data from ad7190
/********************Read data from AD7190*********************/
         P1->OUT &=~BIT4;
         __delay_cycles(100);
         while(!((P1IN&BIT7)==0)){}           // Wait until data ready
         LoadCellData1=ReadData();               // Read load cell data
         __delay_cycles(200);
         P1->OUT |= BIT4;


void ADC_loadcell_Setup1_CH1()
{
    /* This setup is for data out rate of ADC is 341Hz,Chop mode filter enable
     * Internal full scale calibration for bipolar input,24 bit data mode,5V reference,channel 1
     * Internal zero scale calibration for bipolar input,24 bit data mode,5V reference,channel 1
     * Read continuous data for bipolar, 0 to 10 mV range
     */
    //write in configuration register
     WriteRegister(COM_WRITE_CONFIG_REG_CMD,3,CONFIG_CHOP_OFF | CONFIG_REFSEL_IN1P_IN1N | CONFIG_CH_AIN1P_AIN2N | CONFIG_BURNOUT_OFF | CONFIG_REFDET_OFF | CONFIG_BUF_DISABLE | CONFIG_BIPOLAR | CONFIG_GAIN_128);
     while(!((P1IN&BIT7)==0)){}  //wait for calibration complete
     __delay_cycles (200);

    // internal Full-scale calibration
     WriteRegister(COM_WRITE_MODE_REG_CMD,3,MODE_INTERNAL_FULL_CALIBRATION | MODE_EXT_CRYSTAL | MODE_SINC4 |MODE_PARITY_DS | MODE_SINGLE_CONV_DS | MODE_NOTCH_ON |FS_100_HZ);
     while(!((P1IN&BIT7)==0)){}  //wait for calibration complete
     __delay_cycles (200);

    // internal zero-scale calibration
     WriteRegister(COM_WRITE_MODE_REG_CMD,3,MODE_INTERNAL_ZERO_CALIBRATION | MODE_EXT_CRYSTAL | MODE_SINC4 |MODE_PARITY_DS | MODE_SINGLE_CONV_DS | MODE_NOTCH_ON |FS_100_HZ);
     while(!((P1IN&BIT7)==0)){}  //wait for calibration complete
     __delay_cycles (200);

    // continuous conversion mode register
     WriteRegister(COM_WRITE_MODE_REG_CMD,3,MODE_SINGLE | MODE_EXT_CRYSTAL | MODE_SINC4 | MODE_PARITY_DS | MODE_SINGLE_CONV_DS | MODE_NOTCH_ON | FS_100_HZ );
     while(!((P1IN&BIT7)==0)){}  //wait for calibration complete
     __delay_cycles (200);

     spi_tx(0x58); //read continuous data mode
}

//*********Software Reset for ADC*******************//
void ADC_Soft_Reset()
{
    //40 consecutive 1s to perform the reset
    spi_tx(0x01);
    spi_tx(0xFF);
    spi_tx(0xFF);
    spi_tx(0xFF);
    spi_tx(0xFF);
    spi_tx(0xFF);
    spi_tx(0xFF);

}


#ifndef AD7190_H_
#define AD7190_H_

/********************COMMUNICATION Register**************************/
//Read the data register continuously and place the data on DOUT
#define COMM_REG_CREAD                            0x5C

//Commands to write to specific registers
#define COM_WRITE_CONFIG_REG_CMD                  0x10
#define COM_WRITE_MODE_REG_CMD                    0x08
#define COM_WRITE_GPCON_RED_CMD                   0x28

//Commands to read from specific registers
#define COM_READ_CONFIG_REG_CMD                   0x50
#define COM_READ_STATUS_REG_CMD                   0x40
#define COM_READ_MODE_REG_CMD                     0x48
#define COM_READ_DATA_REG_CMD                     0x58
#define COM_READ_GPCON_REG_CMD                    0x68
#define COM_READ_ID_REG_CMD                       0x60
#define COM_READ_OFFSET_REG_CMD                   0x70
#define COM_READ_FULL_SCALE_REG_CMD               0x78


/********************Configuration Register**************************/
#define CONFIG_CHOP_ON                            0x800000
#define CONFIG_CHOP_OFF                           0x000000

#define CONFIG_REFSEL_IN1P_IN1N                   0x000000
#define CONFIG_REFSEL_IN2P_IN2N                   0x100000

#define CONFIG_CH_AIN1P_AIN2N                     0x000100
#define CONFIG_CH_AIN3P_AIN4N                     0x000200
#define CONFIG_CH_TEMP_SENSOR                     0x000400
#define CONFIG_CH_AIN2P_AIN2N                     0x000800
#define CONFIG_CH_AIN1P_AINCOM                    0x001000
#define CONFIG_CH_AIN2P_AINCOM                    0x002000
#define CONFIG_CH_AIN3P_AINCOM                    0x004000
#define CONFIG_CH_AIN4P_AINCOM                    0x008000

#define CONFIG_BURNOUT_ON                         0x000080
#define CONFIG_BURNOUT_OFF                        0x000000

#define CONFIG_REFDET_ON                          0x000040
#define CONFIG_REFDET_OFF                         0x000000

#define CONFIG_BUF_ENABLE                         0x000010
#define CONFIG_BUF_DISABLE                        0x000000

#define CONFIG_UNIPOLAR                           0x000008
#define CONFIG_BIPOLAR                            0x000000

#define CONFIG_GAIN_1                             0x000000          //±5 V  ADC I/P range
#define CONFIG_GAIN_8                             0x000003          //±625 mV
#define CONFIG_GAIN_16                            0x000004          //±312.5 mV
#define CONFIG_GAIN_32                            0x000005          //±156.2 mV
#define CONFIG_GAIN_64                            0x000006          //±78.125 mV
#define CONFIG_GAIN_128                           0x000007          //±39.06 mV

/*****************************MODE REGISTER**************************/
#define MODE_CONTINUOUS                           0x000000
#define MODE_SINGLE                               0x200000
#define MODE_IDLE                                 0x400000
#define MODE_POWERDOWN                            0x600000
#define MODE_INTERNAL_ZERO_CALIBRATION            0x800000
#define MODE_INTERNAL_FULL_CALIBRATION            0xA00000
#define MODE_SYSTEM_ZERO_CALIBRATION              0xC00000
#define MODE_SYSTEM_FULL_CALIBRATION              0xE00000

#define MODE_DAT_STA                              0x100000

#define MODE_EXT_CRYSTAL                          0x000000
#define MODE_EXT_CLOCK                            0x040000
#define MODE_INTERNAL                             0x080000
#define MODE_INTERNAL_MCLK2PIN                    0x0C0000

#define MODE_SINC3                                0x008000
#define MODE_SINC4                                0x000000

#define MODE_PARITY_EN                            0x002000
#define MODE_PARITY_DS                            0x000000

#define MODE_SINGLE_CONV_EN                       0x000800
#define MODE_SINGLE_CONV_DS                       0x000000

#define MODE_NOTCH_ON                             0x000400
#define MODE_NOTCH_OFF                            0x000000

#define FS_100_HZ                                 0x30
#define FS_1200_HZ                                0x04
#define FS_960_HZ                                 0x05
#define FS_2400_HZ                                0x02

/* Register settings commands for Configuration Register */
#define CONFIG_REG_CMD_MSB                        0x08
#define CONFIG_REG_CMD_MID                        0x02
/*May have to change Gain depending on input signal voltage
See Table 19 in AD7190 datasheet for more information*/
#define CONFIG_REG_CMD_LSB                        0x00//0x1F
/* Register settings commands for Mode Register */
#define MODE_REG_CMD_MSB                          0x08
#define MODE_REG_CMD_MID                          0x00
#define MODE_REG_CMD_LSB                          FS_100_HZ

#endif /* AD7190_H_ */



NO
[edited by: SP4 at 9:51 AM (GMT -5) on 21 Jan 2022]
Parents
  • Hi, 

    Thank you for your post but can we clarify which product are you referring? The title say AD7790 but the post it self uses AD7190 and I also see AD7730 in the code. Please let us know so we can help you better or we can re-direct you to the responsible engineer if needed. 

    Thanks,

    Jellenie

Reply
  • Hi, 

    Thank you for your post but can we clarify which product are you referring? The title say AD7790 but the post it self uses AD7190 and I also see AD7730 in the code. Please let us know so we can help you better or we can re-direct you to the responsible engineer if needed. 

    Thanks,

    Jellenie

Children
No Data