This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1118 Basic Usage

Other Parts Discussed in Thread: ADS1118

Hello All,

OK, I have been banging my head against the wall for awhile now and I am hoping someone can shed some light on why\where I am having some issues using the ADS1118.

I am using the design found in appnote SBAA189. I am able to read the internal temp sensor and I appear to get a correct value (24 deg C which is close to room temp) and when I don't have a thermocouple connected I read 0xFFFF (full scale) as I expect.  The problem is when I connect a thermocouple (K-Type) I always read back 0x0000 or 0x0001 even if I apply some heat to the thermocouple I always get the same result.

CPU is a Freescale MC9S08AW60 and I am using the SPI port built into the CPU.  Here is some bits & pieces of the source code:

void init_ADS1118(void)

{

unsigned char ConfigH;

unsigned char ConfigL;

ConfigH = 0x8B; //AIN0 & AIN1, .256V, Single Shot Mode

ConfigL = 0xF2; //860SPS, Temp Mode, Pull_UP disabled

//Change the polarity of the Clk signal for ADS1118

LCD_SPI_SetIdleClockPolarity(0);

//Make sure the LCD is NOT selected

LCD_SS_SetVal();

//Now select the ADS1118

TMP_SEL_ClrVal();

Cpu_Delay100US(2);

LCD_SPI_SendChar(ConfigH);

LCD_SPI_SendChar(ConfigL);

//Now De-select the ADS1118

TMP_SEL_SetVal();

//We are done now so change it back

LCD_SPI_SetIdleClockPolarity(1);

}

 

void Get_Internal_Temp(void)

{

unsigned char ConfigH;

unsigned char ConfigL;

unsigned char c;

int Temp_Val;

float Temp_Actual;

//As we read the CJ Temp we also write the config info

//for the next read

ConfigH = 0x8B; //AIN0 & AIN1, .256V, Single Mode

ConfigL = 0xE2; //860SPS, ADC Mode, Pull_UP Disabled

//Change the polarity of the Clk signal for ADS1118

LCD_SPI_SetIdleClockPolarity(0);

//Make sure the LCD is NOT selected

LCD_SS_SetVal();

//Init the rx Que

Q_Init(&SPI_RX_Que);

// Now select the ADS1118

TMP_SEL_ClrVal();

Cpu_Delay100US(2);

LCD_SPI_SendChar(ConfigH);

LCD_SPI_SendChar(ConfigL);

// Now De-select the ADS1118

TMP_SEL_SetVal();

//We are done now so change it back

LCD_SPI_SetIdleClockPolarity(1);

//now grab the TempData and store it

//MSB

c = Q_Remove(&SPI_RX_Que);

Temp_Val = c;

Temp_Val <<= 8;

//LSB

c = Q_Remove(&SPI_RX_Que);

Temp_Val |= c;

//now we shift it over 2 bits

Temp_Val >>=2;

Temp_Actual = (float)Temp_Val * .03125;

tParam.Valve_Temp.CJ_Temp = Temp_Actual;

}

void Get_vProbe_Voltage(void)

{

unsigned char ConfigH;
unsigned char ConfigL;

unsigned char c;

int Temp_Val;

 

//we are setting the next read to be the internal sensor

ConfigH = 0x8B; //AIN0 & AIN1, .256V, Single Mode

ConfigL = 0xF2; //860SPS, Temp Mode, Pull_UP Disabled

//Change the polarity of the Clk signal for ADS1118

LCD_SPI_SetIdleClockPolarity(0);

//Make sure the LCD is NOT selected

LCD_SS_SetVal();

Q_Init(&SPI_RX_Que);

// Select the ADS1118

TMP_SEL_ClrVal();

Cpu_Delay100US(2);

//The process of writing an NOP CMD will result in a read

LCD_SPI_SendChar(ConfigH);

LCD_SPI_SendChar(ConfigL);

 TMP_SEL_SetVal();

//We are done now so change it back

LCD_SPI_SetIdleClockPolarity(1);   

//now grab the TempData and store it

//MSB

 c = Q_Remove(&SPI_RX_Que);

Temp_Val = c;

Temp_Val <<= 8;

 

//LSB

c = Q_Remove(&SPI_RX_Que);

Temp_Val |= c;

tParam.Valve_Temp.TC_Voltage = Temp_Val;   

}

I run the calculation in a different function that I don't think is important for this issue since I am loading tParam.Valve_Temp.TC_Voltage with 0x0000 or ox0001 before I even get to the calculating.

My circuit is identical to the one in the appnote but I can provide a schematic if requested.

Any ideas or tips I should consider that could be causing me to have this problem? I have been working on this for a couple of weeks now and no real headway.

Thanks,

Dave

  • Hi David,

    As far as I can tell your code looks to be ok.  If you are always reading 0 (or very near 0) code when using the TC, I would look for a possible solder/connection error.  You also may want to verify your communications and calculations. 

    You say that you read 0xFFFF in the open case.  The ADS1118 results are binary two's complement, so you must make sure that you sign extend your integer result appropriately.  0xFFFF is one code below (negative) from 0 (-1).  (You might want to use a short int instead of int where sign is taken care of automatically.) Positive full-scale is 0x7FFF, and negative full-scale is 0x8000.  In the open case you should see 0x7FFF as AIN0 would be pulled to the supply and AIN1 is pulled to ground.

    To verify you communications you can use an oscilloscope.  If you send me some scope pictures of the communication I can help you in analyzing the communications.

    Best regards,

    Bob B

  • Hello Bob,

    I have checked solder a few times but I will check again. I figured with the correct internal temperature reading and the full scale reading solder should be OK.

    Oh and sorry, I meant full scale = 0x7FFF.

    What value should I expect a K-Type probe to read at room temperature? would 0x001be correct since I add it to the internal temp sensor reading anyways?

    I will work on capturing some data on the scope and post them later. 

    Thanks,

    Dave

  • Dave,

    The TC itself should be about 1mV at room temp.  0x1be is about 440 codes, and the LSB is about 7.8uV.  The result is about 3.4mV, which is a little high.  If you place your probe in ice water, and the voltage changes by approximately 1mV, then you are probably ok and just need to make sure the CJC is correct.

    Best regards,

    Bob B