External ADC Chip

I'm working on a project that will use J-type thermo-couples to take generally precise measurements, however I want to use an external analog to digital converter over the ones on the Arduino Mega2560. I'm using TI's ADS1118 chip, and while I get a digital signal out, the conversion to volts is completely inaccurate (and static).

These are the data sheets I'm using for the ADC. I've set up the circuit shown in Figure 3 of the Accurate Temperature data sheet for testing purposes (with a slight modification in that the 3.3V supply on the schematic has been replaced with 5V):

http://www.ti.com/lit/ds/symlink/ads1118.pdf (ADS1118 Data Sheet)
http://www.ti.com/lit/an/sbaa189/sbaa189.pdf (Accurate Temperature)

And this code I found from a project that had used an ADS1118:

#include <SPI.h>

void setup() {
  Serial.begin(9600);

  // Set up and start the SPI serial interface
  SPI.begin();
  SPI.setBitOrder(MSBFIRST); // Most significant bit first
  SPI.setClockDivider(SPI_CLOCK_DIV8); // Step down the arduino clock by 8
  SPI.setDataMode(SPI_MODE1); //Serial interface timing
}

void loop()
{ 
  Serial.println(readRaw());
  Serial.println (readVoltage(),8);
  delay(1000);
  
}

/* Allows the caller to read the raw value from the ADS1118 */
int readRaw(void) {
  int rawValue; // Raw value received back from the ADS1118
  byte MSB, LSB; //The most and least significant bits read from the ADS1118
  byte MSBConf=B10001011; // Most Significant Bit configuration register
  //11010001
  byte LSBConf=B11110010; // Least Significant Bit configuration register
  //10000010

  // Read the ADS1118's channel's A0 and A1 as temperature in single-shot mode
  MSB = SPI.transfer(MSBConf);
  LSB = SPI.transfer(LSBConf);
  //SPI.transfer(MSBConf);
  //SPI.transfer(LSBConf);

  // Build the raw value from the most and least significant bits
  rawValue = (MSB << 8) | LSB;

  return rawValue;
  
}

/* Allows the caller to read the raw voltage */
double readVoltage(void) {
  int rawValue; // Raw value received back from the ADS1118
  double volts; // Converted voltage from the raw value
  const double amp = 0.256000; // FS multiplier in register (check data sheet)

  // Get the raw value so that we can convert it to a voltage
  rawValue = readRaw();

  // Convert the raw value to the corresponding voltage (16 bits = 0 to 32767)
  volts = amp * ((double)rawValue / 32768);

  return volts;
 
}

And finally here is the serial debug, which appears to be a bunch of gobilty-gook:

(attached .png image)

IMO the code should set the trigger bit (SS), to start a single-shot conversion, then wait for conversion complete before reading the value. But if you receive meaningful RAW values, the code may be correct.

readRaw() is called twice, once for Serial output, and once more in readVoltage(), so that both values may not correspond. What if you apply the conversion formula to the displayed readRaw() value, instead of using readVoltage()?

#include <SPI.h>

void setup() {
 Serial.begin(9600);

 // Set up and start the SPI serial interface
 SPI.begin();
 SPI.setBitOrder(MSBFIRST); // Most significant bit first
 SPI.setClockDivider(SPI_CLOCK_DIV8); // Step down the arduino clock by 8
 SPI.setDataMode(SPI_MODE1); //Serial interface timing
}

void loop()
{ 
 int rawValue; // Raw value received back from the ADS1118
 byte MSB, LSB; //The most and least significant bits read from the ADS1118
 byte MSBConf=B10001011; // Most Significant Bit configuration register
 //11010001
 byte LSBConf=B11110010; // Least Significant Bit configuration register
 //10000010
 
 double volts; // Converted voltage from the raw value
 const double amp = 0.256000; // FS multiplier in register (check data sheet)

 // Read the ADS1118's channel's A0 and A1 as temperature in single-shot mode
 MSB = SPI.transfer(MSBConf);
 LSB = SPI.transfer(LSBConf);
 //SPI.transfer(MSBConf);
 //SPI.transfer(LSBConf);

 // Build the raw value from the most and least significant bits
 rawValue = (MSB << 8) | LSB;

 // Convert the raw value to the corresponding voltage (16 bits = 0 to 32767)
 volts = amp * ((double)rawValue / 32768);

 Serial.println (rawValue);
 Serial.println (volts, 8);
 delay(1000);
 
}

This is my revision of the code based off of your suggestion. Little hazy on how the config register works for this chip, but after moving the code around to a single function I still get the same result.

You still don't wait for the conversion to finish, after sending the trigger signal. But perhaps this will read the preceding conversion?

Do you now see different volts for different rawValue's?
BTW I only see an amplification factor, nothing about the supply voltage.

Also note the smilies in your code, please fix the missing code tag. Edit your post, select the code and click on </> to enclose the selected code into proper code tags.