I have two issues with ADS1120.
First, I don't know what is a proper procedure to read two different MUX input using single-shot mode. I was thinking that sending new value of reg 00h is sufficient but it seems that all four register have to be set.
Second, is even more confusing. When "zero" is present on the selected input I'm receiving almost "full scale" value (i.e. 0xFFE8). Why is that? Please find below an Arduino code that I'm using for testing. U_MON value is present on ADS1220's Ch#1 and I_MON on Ch#2. Polling instead of interrupt is used, with lowest sampling rate 20SPS with additional 500ms delay between two consecutive conversions (U_MON first then I_MON).
Thanks in advance for any suggestion what I'm doing wrong.
#include "SPI.h" // necessary library const byte ADC_RESET = B00000110; const byte ADC_RDATA = B00010000; const byte ADC_START = B00001000; const byte READ_U_MON = B10010001; const byte READ_I_MON = B10100001; unsigned int dmsb; unsigned int dlsb; SPISettings ADS1120(SPI_CLOCK_DIV4, MSBFIRST, SPI_MODE1); void setup() { // Initialize serial communication Serial.begin(9600); // wait until the serial stream is not open while (!Serial); Serial.println("Serial com ready"); // Initialize ADS1120 pinMode(ADC1_SELECT, OUTPUT); // define CS pin as output pinMode(CONVEND1, INPUT); // define DRDY pin as input SPI.begin(); // wake up the SPI bus. SPI.beginTransaction(ADS1120); // Send RESET command digitalWrite(ADC1_SELECT, LOW); SPI.transfer(ADC_RESET); delayMicroseconds(100); // Guard time digitalWrite(ADC1_SELECT, HIGH); } void loop() { SPI.beginTransaction(ADS1120); // read U_MON digitalWrite(ADC1_SELECT, LOW); // select ADS1120 SPI.transfer(B01000011); // Write four bytes starting at configuration register 00h SPI.transfer(READ_U_MON); // Register 00h: Read U_MON SPI.transfer(B00000000); // Register 01h: 20SPS, 256KHz modulator clock, Single shot, disable temp sensor, Current sources off SPI.transfer(B01100000); // Register 02h: External Vref, 50Hz rejection, PSW off, IDAC off SPI.transfer(B00000000); // Register 03h: IDAC1 disabled, IDAC2 disabled, dedicated DRDY // Start conversion (single shot) SPI.transfer(ADC_START); while (digitalRead(CONVEND1)) // Wait for DRDY signal ; // Read conversion data SPI.transfer(ADC_RDATA); // Send RDATA command delayMicroseconds(50); // Guard time dmsb = SPI.transfer(0); // read MSB value dlsb = SPI.transfer(0); // read LSB value // Display received result Serial.print("u_mon="); Serial.print(dmsb, HEX); Serial.print(dlsb, HEX); // read I_MON SPI.transfer(B01000011); // Write four bytes starting at configuration register 00h SPI.transfer(READ_I_MON); // Register 00h: Read I_MON SPI.transfer(B00000000); // Register 01h: 20SPS, 256KHz modulator clock, Single shot, disable temp sensor, Current sources off SPI.transfer(B01100000); // Register 02h: External Vref, 50Hz rejection, PSW off, IDAC off SPI.transfer(B00000000); // Register 03h: IDAC1 disabled, IDAC2 disabled, dedicated DRDY // Start conversion (single shot) SPI.transfer(ADC_START); while (digitalRead(CONVEND1)) // Wait for DRDY signal ; // Read conversion data SPI.transfer(ADC_RDATA); // Send RDATA command delayMicroseconds(50); // Guard time dmsb = SPI.transfer(0); // read MSB value dlsb = SPI.transfer(0); // read LSB value digitalWrite(ADC1_SELECT, HIGH); // deselect ADS1120 SPI.endTransaction(); // Display received result Serial.print(" i_mon="); Serial.print(dmsb, HEX); Serial.println(dlsb, HEX); delay(500); // delay until next cycle }