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.
When I read the Conversion Register, the LSB is always returning a value of 0xFF
The MSB is correct
I have verified this on a storage oscilloscope, the data line from the ADS1015 stays high
unsigned int ADS_Read_Conversion(void)
{
unsigned int wData;
TWI_Start(); // Start
TWI_Out(ADS_ADDRESS_WRITE); // Issue Device address
TWI_Out(0x00); // Address register = 0, point to conversion register
TWI_Stop(); // Stop
// Guy - this is always returning a LSB of 0xFF
TWI_Start(); // Start
TWI_Out(ADS_ADDRESS_READ); // Issue Device address
wData = TWI_receive(); // Read data MSB
wData <<= 8; // Put in MSB
wData |= TWI_receive(); // Read data LSB
TWI_Stop(); // Stop
return(wData);
}
Guy,
Offhand, I don't know of anything could cause the lower byte to read out FF. I don't see anything in your code might be a problem. Does the ADS1015 ACK before the second byte?
To help debug this, can you show your I2C communications? I'd like to see the scope shot, along with the address, pointer register, and read of the conversion. I'd like to see the whole transaction with both SDA and SCL. Since this is a read of the conversion register, let me know what the input voltage and full-scale range is also. I just want to make sure the input isn't conveniently a voltage that would have a FF for a last byte reading.
Are you still able to read from the configuration registers without problems? If the device is having problems with it's data output register, the configuration register would be read wrong as well.
Joseph Wu
Thank you for your reply
Here is the capture for ADS_Read_Conversion()
ADS_ADDRESS_WRITE = 0x90
ADS_ADDRESS_READ = 0x91
unsigned int ADS_Read_Conversion(void)
{
unsigned int wData;
TWI_Start(); // Start
TWI_Out(ADS_ADDRESS_WRITE); // Issue Device address
TWI_Out(0x00); // Address register = 0, point to conversion register
TWI_Stop(); // Stop
// Guy - this is always returning a LSB of 0xFF
TWI_Start(); // Start
TWI_Out(ADS_ADDRESS_READ); // Issue Device address
wData = TWI_receive(); // Read data MSB
wData <<= 8; // Put in MSB
wData |= TWI_receive(); // Read data LSB
TWI_Stop(); // Stop
return(wData);
}
The bottom four bits of the LSB of the conversion register should always be zero, I have tried many input voltages (including 0V), and am always getting 0xFF in the LSB of the result. The MSB is correct.
If I read the Config Register, I also get the second (LS) byte as 0xFF. The MSB is fine (0xC5 in my case). I therefore seem to have a read problem on 16 bit values.