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