Other Parts Discussed in Thread: ADS1219
Hello,
I am having a problem as reading ADC value with ADS1119.
For I2C, the ACK response from ADS1119 is being received well. I can send CMD, write to config register 0x00 and also read back what I wrote.
However, the reading ADC value is constant all the time and quite different to what expected. (Expected :2.5V - Reading: 5V Full scale).
The ADC is configured as follow: input 2.5V AIN2-AGND, GAIN 1, 90SPS, Continuous conversion mode, External ref (5V).
I am not sure is there anything wrong here. Please let me know if there is any misunderstanding of the concept.
P/s: One more observation I made is when I try to read back 5 bytes, 3 first bytes contain value ( I expect only 2 following the ADS1119 datasheet).
I attached a screenshot of the communication when I try to read 5 bytes from the ADC.
Hope to hear from you soon. Thank you!
Here is the code I made to set up and read the ADC data:
// ADC set up // Reset device by common I2C 0x00 call Wire.beginTransmission(0x00); Wire.write(0x06); Serial.println(Wire.endTransmission()); delay(500); // Read the value from the register 0x00 - should return 0 as default Wire.beginTransmission(0x40); Wire.write(0x20); Serial.println(Wire.endTransmission()); Wire.requestFrom(0x40, 1); if (Wire.available() == 1) { int value = Wire.read(); Serial.println(value); } delay(100); // Write a value to the register 0x00 - 0xA7 - 1010 0111 : AIN2AGND, GAIN 1, 90SPS, Continuous conversion mode, External ref Wire.beginTransmission(0x40); Wire.write(0x40); Wire.write(0xA7); Serial.println(Wire.endTransmission()); delay(100); // Read the value from the register 0x00 - should return 0xA37= 0d167 Wire.beginTransmission(0x40); Wire.write(0x20); Serial.println(Wire.endTransmission()); Wire.requestFrom(0x40, 1); if (Wire.available() == 1) { int value = Wire.read(); Serial.println(value); } delay(100); // Start conversion Wire.beginTransmission(0x40); Wire.write(0x08); Serial.println(Wire.endTransmission()); delay(1000); // main loop //Reading data by cmd uint16_t value; Wire.beginTransmission(0x40); Wire.write(0x10); Wire.endTransmission(); Serial.print("Number of bytes requested :"); Serial.println(Wire.requestFrom(0x40, 2)); Serial.println(); value = (Wire.read() << 8 | Wire.read()); if (value > 0x7FFF) { value = 0x0; } float voltage = 5.0 * (float(value) / 32767) * 1; Serial.println(voltage); delay(1000);