Hello, I am using this library but I have some problems with the sincronization of the data-rate coming from the ADS1220 and the reading-rete of my Arduino UNO.
Basically the Arduino loop is executed too fast in comparison than the data-rate and therefore I get a lot of samples that are 0.00 mV between one "real" sample and the other. See the attached picture:

It look like that the execution do not wait new data coming from the ADS1220.
Here is the code I'm using.
`//////////////////////////////////////////////////////////////////////////////////////////
//
// Demo code for the ADS1220 24-bit ADC breakout board
//
// Author: Ashwin Whitchurch
// Copyright (c) 2018 ProtoCentral
//
// This example gives differential voltage across the AN0 and AN1 pins in mVolts
//
// Arduino connections:
//
// |ADS1220 pin label| Pin Function |Arduino Connection|
// |-----------------|:--------------------:|-----------------:|
// | DRDY | Data ready Output pin| D6 |
// | MISO | Slave Out | D12 |
// | MOSI | Slave In | D11 |
// | SCLK | Serial Clock | D13 |
// | CS | Chip Select | D7 |
// | DVDD | Digital VDD | +5V |
// | DGND | Digital Gnd | Gnd |
// | AN0-AN3 | Analog Input | Analog Input |
// | AVDD | Analog VDD | - |
// | AGND | Analog Gnd | - |
//
// This software is licensed under the MIT License(http://opensource.org/licenses/MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For information on how to use, visit https://github.com/Protocentral/Protocentral_ADS1220
//
/////////////////////////////////////////////////////////////////////////////////////////
#include "Protocentral_ADS1220.h"
#include <SPI.h>
#define PGA 1 // Programmable Gain = 1
#define VREF 3.300 // Internal reference of 2.048V
#define VFSR VREF/PGA
#define FSR (((long int)1<<23)-1)
#define ADS1220_CS_PIN 7
#define ADS1220_DRDY_PIN 6
Protocentral_ADS1220 pc_ads1220;
int32_t adc_data;
void setup(){
Serial.begin(115200);
pc_ads1220.begin(ADS1220_CS_PIN,ADS1220_DRDY_PIN);
pc_ads1220.set_data_rate(DR_20SPS);
pc_ads1220.set_pga_gain(PGA_GAIN_1);
pc_ads1220.select_mux_channels(MUX_AIN0_AIN1); //Configure for differential measurement between AIN0 and AIN1
pc_ads1220.set_conv_mode_continuous();
pc_ads1220.writeRegister(0x02, 0xD0); // Register #2 (11 = analog supply reference,
// 01 = Simultaneous 50-Hz and 60-Hz rejection.
// 0 = Switch is always open (default)
// 000 = IDAC current setting Off (default)
pc_ads1220.Start_Conv(); //Start continuous conversion mode
}
void loop(){
while(true){
adc_data=pc_ads1220.Read_WaitForData();
float Vout = (float)((adc_data * VFSR * 1000)/FSR); //In mV
Serial.print("t = ");Serial.print(millis());Serial.print(" ms, V = ");Serial.print(Vout);Serial.println(" mV");
}
}`
Hello, I am using this library but I have some problems with the sincronization of the data-rate coming from the ADS1220 and the reading-rete of my Arduino UNO.
Basically the Arduino loop is executed too fast in comparison than the data-rate and therefore I get a lot of samples that are 0.00 mV between one "real" sample and the other. See the attached picture:
It look like that the execution do not wait new data coming from the ADS1220.
Here is the code I'm using.
`//////////////////////////////////////////////////////////////////////////////////////////
//
// Demo code for the ADS1220 24-bit ADC breakout board
//
// Author: Ashwin Whitchurch
// Copyright (c) 2018 ProtoCentral
//
// This example gives differential voltage across the AN0 and AN1 pins in mVolts
//
// Arduino connections:
//
// |ADS1220 pin label| Pin Function |Arduino Connection|
// |-----------------|:--------------------:|-----------------:|
// | DRDY | Data ready Output pin| D6 |
// | MISO | Slave Out | D12 |
// | MOSI | Slave In | D11 |
// | SCLK | Serial Clock | D13 |
// | CS | Chip Select | D7 |
// | DVDD | Digital VDD | +5V |
// | DGND | Digital Gnd | Gnd |
// | AN0-AN3 | Analog Input | Analog Input |
// | AVDD | Analog VDD | - |
// | AGND | Analog Gnd | - |
//
// This software is licensed under the MIT License(http://opensource.org/licenses/MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For information on how to use, visit https://github.com/Protocentral/Protocentral_ADS1220
//
/////////////////////////////////////////////////////////////////////////////////////////
#include "Protocentral_ADS1220.h"
#include <SPI.h>
#define PGA 1 // Programmable Gain = 1
#define VREF 3.300 // Internal reference of 2.048V
#define VFSR VREF/PGA
#define FSR (((long int)1<<23)-1)
#define ADS1220_CS_PIN 7
#define ADS1220_DRDY_PIN 6
Protocentral_ADS1220 pc_ads1220;
int32_t adc_data;
void setup(){
Serial.begin(115200);
}
void loop(){
while(true){
adc_data=pc_ads1220.Read_WaitForData();
float Vout = (float)((adc_data * VFSR * 1000)/FSR); //In mV
Serial.print("t = ");Serial.print(millis());Serial.print(" ms, V = ");Serial.print(Vout);Serial.println(" mV");
}
}`