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