您好,我想请教的问题就是:不知道怎么进行把目前串口输出的原始数据转换为正常的心电数据。我是通过心电发生器发射心电信号到ADS1293模块,进而到主控制模块,通过串口输出ECG数据。但是这个数据跟普通看到的心电数据不是一个类型,但是我不知道怎么进行转换。
希望有人可以及时回复我,非常感谢~!(附上有关我的3导联的部分代码)
void ADS1293_Init_3Lead(void)
{
TI_ADS1293_SPIWriteReg(0x01,0x11);//Connects channel 1¡¯s INP to IN2 and INN to IN1.
TI_ADS1293_SPIWriteReg(0x02,0x19);// Connect channel 2¡¯s INP to IN3 and INN to IN1.
//TI_ADS1293_SPIWriteReg(0x03,0x2E);// Connects channel 3¡¯s INP to IN5 and INN to IN6.
TI_ADS1293_SPIWriteReg(0x0A,0x07);// Enables the common-mode detector on input pins IN1, IN2 and IN3.
TI_ADS1293_SPIWriteReg(0x0C,0x04);//Connects the output of the RLD amplifier internally to pin IN4.
//Connects the first buffer of the Wilson reference to the IN1 pin, the second buffer to the IN2 pin, and the third buffer to the IN3 pin.
//TI_ADS1293_SPIWriteReg(0x0D,0x01);// TI_ADS1293_SPIWriteReg(0x0E,0x02);
//TI_ADS1293_SPIWriteReg(0x0F,0x03);
// TI_ADS1293_SPIWriteReg(0x10,0x01);//Connects the output of the Wilson reference internally to IN6.
TI_ADS1293_SPIWriteReg(0x12,0x04);// Uses external crystal and feeds the output of the internal oscillator module to the digital.
TI_ADS1293_SPIWriteReg(0x21,0x02);// Configures the R2 decimation rate as 5 for all channels.
TI_ADS1293_SPIWriteReg(0x22,0x02);//Configures the R3 decimation rate as 6 for channel 1.
TI_ADS1293_SPIWriteReg(0x23,0x02);//Configures the R3 decimation rate as 6 for channel 2.
TI_ADS1293_SPIWriteReg(0x24,0x02);//Configures the R3 decimation rate as 6 for channel 3.
TI_ADS1293_SPIWriteReg(0x27,0x08);//Configures the DRDYB source to ECG channel 1 (or fastest channel).
TI_ADS1293_SPIWriteReg(0x2F,0x30);// Enables channel 1 ECG and channel 2 ECG for loop read-back mode.
TI_ADS1293_SPIWriteReg(0x00,0x01);//Starts data conversion.
}
void ti_ads1293_stream_read(unsigned char *buff)
{
for(int i=0;i<10;i++)
{
buff[i] = ti_ads1293_read_reg(0x50);
for(int j=0;j<16;j++)
{
board_spi_cs_set(0);
delay_us(50);
board_spi_cs_set(1); delay_us(50);
}
}
for(int j=0;j<(8+8*10);j++)
{
board_spi_cs_set(0);
delay_us(50);
board_spi_cs_set(1); delay_us(50); }}
void ti_ads1293_read_ecg(unsigned int *ecg)
{
unsigned char buff[10] = {0};
if(ecg == NULL)
return;
for(int i=0;i<9;i++){
buff[i] = ti_ads1293_read_reg(0x37 + i);
}
ecg[0] = buff[0]*65536 + buff[1]*256 + buff[2];
ecg[1] = buff[3]*65536 + buff[4]*256 + buff[5];
ecg[2] = buff[6]*65536 + buff[7]*256 + buff[8];
}
user151383853:
前面是寄存器配置和初始化ADS1293模块,
ti_ads1293_read_ecg()
是通过串口输出ECG数据的。数据格式和解析可以参考手册的通信时序里的描述
user5943637:
回复 user151383853:
我可以再请教多一些关于数据格式跟解析的问题吗?我有看多很多次ADS1293芯片的数据手册,但是找不到我想要的形式?我有通过邮件申请添加您。谢谢您。