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.

ADS1292RECG-FE: Code example interpretation

Part Number: ADS1292RECG-FE
Other Parts Discussed in Thread: ADS1292R, ADS1299, ADS1292

Hi team,

When looking at the ADS1292R sample code, I didn't understand one place. Can you interpret it?

After the original data of 9 bytes is read back in the example code, it is merged, and every 3 bytes are combined into a 24 bit data and stored in ads1x9x_ ECG_ Data_ BUF. ADS1x9x_ ECG_ Data_ BUF [1] stores ch1 data, ads1x9x_ ECG_ Data_ BUF [2] stores CH2 data.

The code is as follows: this code has no problem and can be understood.

for (ECG_Chan_num = 0; ECG_Chan_num < 3; ECG_Chan_num++)
{
ADS1x9x_ECG_Data_buf[ECG_Chan_num] = (signed long)SPI_Rx_buf[3*ECG_Chan_num];
ADS1x9x_ECG_Data_buf[ECG_Chan_num] = ADS1x9x_ECG_Data_buf[ECG_Chan_num] << 8;
ADS1x9x_ECG_Data_buf[ECG_Chan_num] |= SPI_Rx_buf[3*ECG_Chan_num+1];
ADS1x9x_ECG_Data_buf[ECG_Chan_num] = ADS1x9x_ECG_Data_buf[ECG_Chan_num] << 8;
ADS1x9x_ECG_Data_buf[ECG_Chan_num] |= SPI_Rx_buf[3*ECG_Chan_num+2];
}

However, it is processed later before filtering. The code is as follows:

ADS1x9x_ECG_Data_buf[1] = ADS1x9x_ECG_Data_buf[1];
ADS1x9x_ECG_Data_buf[2] = ADS1x9x_ECG_Data_buf[2] >> 4;

ADS1x9x_ECG_Data_buf[1] &= 0xFFFF;
ADS1x9x_ECG_Data_buf[2] &= 0xFFFF;

ECGRawData[0] = (short)ADS1x9x_ECG_Data_buf[1];
ECGRawData[1] = (short)ADS1x9x_ECG_Data_buf[2];

ECGRawData[0-1] is the original data that needs to be filtered. Why 24bit data becomes 16bit, the key is how to understand the code marked in red.

Later, two 16bit data are brought into the filter function. The code is as follows:

Resp_ProcessCurrSample(&ECGRawData[0],&ECGFilteredData[0]);
ECG_ProcessCurrSample(&ECGRawData[1],&ECGFilteredData[1]);

Sample code download link:

https://www.ti.com.cn/tool/cn/ADS1292RECG-FE

The folder is ADS1x9x_ECG_Recorder_FW

Specifically in the file ADS1x9x_ECG_Processing.c

The function name is ADS1x9x_Filtered_ECG

I hope you take the time to have a look this question.

Best Regards,

Amy Luo

  • Hi Amy,

    I am not familiar enough with the ADS1292R sample code to provide you with the exact detail. The current implementation uses 16-bit data for all ECG signal filtering and post-processing.

    Thanks

    -TC

  • Hi TC,

    The resolution of ADS1299 is 24bit, uses 16-bit data for all ECG signal filtering and post processing, the lower 8-bit of the measured data is omitted, which reduces the accuracy of the sampled data. Why do this? This is a customer's problem. I hope you can help me give the customer a reasonable explanation.

    Thanks,

    Amy

  • Hi Amy,

    The sample code is used as a reference and is not intended to be used for an end equipment product. The customer do not have to use only 16-bit of data for post signal processing. It is up to their system application requirements for their actual implementation. The ADS1292 will output a 24-bit resolution of raw data without any truncation. 

    Thanks

    -TC