Hi,
I am testing the ADS1220 for type B thermocouple measurement for a commercial product.
I purchased the EV1220 unit, but I found it easier to use the Arduino Mega for the testing. Eventually, in production, it will be a yet undefined processor.
The Type B has very low voltage (2 micro-volts to 13 mV).
I got it to work, but to be sure my settings are optimal, here it is:
I use gain=128,
The request is to sample every 100 mSec.
I set the sampling rate at 20 sps, filters On, and single shoot sampling.
I then start a measurement cycle each 100 mSec (by time interrupt) and read the data by next cycle.
(In addition, at each second (10 samples) I add the internal reference reading).
Question:
Is the above described setting and the following pseudo code correct / optimal?
Here is a pseudo code to my program:
//Defines:
#define VFSR VREF/ADS1220_PGA
#define FSR (((long int)1<<23)-1)
#define ADS1220_CS_PIN 53 //Using Arduino Mega SPI connector SS/CS pin
#define ADS1220_DRDY_PIN 50 //Using Arduino Mega SPI connector MISO pin
//settings:
volatile byte MSB;
volatile byte data;
volatile byte LSB;
volatile byte *SPI_RX_Buff_Ptr;
long bit32;
long bit24;
byte *config_reg;
float Vout;
//setup:
begin();
PGA_ON();
Single_shot_mode_ON();
set_data_rate(DR_20SPS);
set_pga_gain(PGA_GAIN_128);
FILTERS_ON();
//interrupt rutine:
ISR(TIMER1_COMPA_vect) //100mSec. interrupt service routine for data reading
{
TC_mV = read_ADS1220_mV(); //Read the Thermocouple voltage by SPI. First one will be ignored.
SPI_Start(); //Start a new ADS1220 convertion in single-shot.
}
//the program:
float read_ADS1220_mV()
{
SPI_RX_Buff_Ptr = Read_Data();
if (NewDataAvailable == true)
{
NewDataAvailable = false;
MSB = SPI_RX_Buff_Ptr[0];
data = SPI_RX_Buff_Ptr[1];
LSB = SPI_RX_Buff_Ptr[2];
bit24 = MSB;
bit24 = (bit24 << 8) | data;
bit24 = (bit24 << 8) | LSB;
bit24 = ( bit24 << 8 );
bit32 = ( bit24 >> 8 );
}
Vout = (float)((bit32 * VFSR * 1000) / FSR) + get_tc_ref_mv(); //In mV
return Vout ;
}