Skip navigation
TechXchange
Digi-Key TechXchange Communities > General > Discussions
1190 Views 0 Replies Latest reply: Apr 28, 2014 10:47 AM by Riley RSS
Currently Being Moderated

Apr 28, 2014 10:47 AM

AD7731 Issue

Hey guys, I found this post on EEWeb and nobody seemed to be able to answer it.  I figured with the great help I've been getting in this forum, someone may be able to help this guy out:

 

http://www.eeweb.com/electronics-forum/ad7731-issue

 

Hello all,

 

 

I am pulling my hair out. I cannot get any communication from either of the 2 AD7731 ADCs I have. I am creating a new hardware rev of a water sanitation system. The OLD hardware was AD7731 and Atmel128. New hardware is AD7731 and PIC18f45k22.

 

I have ported the code from the atmel to the PIC. I am confident in the Code as I can talk to other SPI devices on the board just fine. As for the AD7731 I cannot get any response from the IC at all. No !RDY pin low, no ability to read the registers, etc. !RDY stays high at all times. I received the parts as Analog.com samples. The !RDY pin NEVER goes LOW. No matter how long I wait.

 

Here are snippets of my setup and communication code.

 

 

<code>// Initialize SPI

// MCU is running @32Mhz, divide  FOSC/64 to run SPI @ 500Khz.

//(Have tried, 2Mhz, 4Mhz, and 8Mhz)

  SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);

 

 

void Setup_AD7731(void){

    write_register(0x03, 0x13, 0x34);   //Initialize filter register.

 

// Self calibrate millivolt input  (Electrode Inputs)

/*----------------------------------------------------------------------------*/

// Calibrate Zero point

  write_register(0x02, 0x90, 0xF6); //Self calibrate mV input zero.

  while(AD7731_DR != LOW); //Wait for the ready pin to go low.

 

  // Set to Full Scale

  write_register(0x02, 0xB0, 0xF6); //Self calibrate mV input full scale.

  while(AD7731_DR != LOW); //Wait for the ready pin to go low.

}

}

 

 

void write_register(char reg, char msb, char lsb)

{

 

  SELECT_AD7731;         //Select the a/d converter.

  SPI1_Write(reg);            //Select the required a/d register.

  SPI1_Write(msb);          //Send msb byte.

  SPI1_Write(lsb);            //Send lsb byte.

  DISABLE_AD7731;       //De-select a/d converter.

 

}

 

 

</code>

 

 

This is a direct port from a working system. I am losing my mind here. Anyone see what I am doing wrong?

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 3 points