关于ADS1298转换数据
老师好,在采集心电转换数据的时候出现了问题。我的目的是采集一个通道的数据通过430的串口发出。按照数据输出的组成共216bit,那么应该用27次接收缓存来接收吧。 我调用以下函数时设置len为27. 并把读到的数据发到dat数组中,按理说这样每次循环读取以后。dat【0】中应该为c0是吧,如果我要取通道1的数据发出,则应是dat[3]~dat[5]吧 但是我在程序调用前设置断点运行发查看d[0]却不是c0. 请问可能是什么原因。 这个连续读的子程序中是否需要设置延时,我理解只要加while判定语句就可以了。
主程序里函数调用为 ADS1298_SpiReadData_Continue( d,27);
uchar ADS1298_SpiReadData_Continue(uchar dat[],uchar len)
{
uchar i;
for(i=0;i<len;i++)
{
ADS1298_SpiSend_CMD_One(0); // 发送SPI时钟,DOUT=0
while(!(IFG2 & URXIFG1) ); //当buffer接收到一完整字节
dat[i] = U1RXBUF; }
while (!(IFG1 & UTXIFG0)); // TX缓存空闲?
U0TXBUF = dat[3];
while (!(IFG1 & UTXIFG0)); // TX缓存空闲?
U0TXBUF = dat[4];
while (!(IFG1 & UTXIFG0)); // TX缓存空闲?
U0TXBUF = dat[5];
}
return TRUE;
}
你好!
我把其他论坛的code贴出来给你参考一下!
ADS1298 and the MSP430F5438, some of our source code for the ADS1298. Note that this code will not compile, as it needs to be modified to work in your specific application. However, it should point you in the right direction to get your ADS1298 configured and running.
File summaries:
init_ADS1x9x.c, ADS1x9x_Device_Status.c, ADS1x9x_Functions.c, and ADS1x9x_SPI_Functions.c: These files provide functions for initializing and operating the ADS1298. These files should give you a good idea of the flow required to configure the device.
F5438_ADS1x9x_Device_Interface.c, F5438_Modular_EVM_IO_Functions.c: These files provide some of the application-specific functions that support the code in the ADS1x9x files. This is just an example of how we implemented it on our MSP430F5438 board, you will need to setup the pins, interrupts, etc. for your specific application.
ADS1x9x_Main_Shell.c: This is a shell for the main file of the project. It should give you an idea of how the functions provided in the above files are used to operate the device.
Jack Li 您好 我就是参考了您这个代码后写的程序。 ADS1298的寄存器可以读写了。 但是可否请您看一下我上面的问题和贴的那段代码是否有什么不对的。 非常感谢了
qi tang您好,我现在也在用ADS1298,我现在对寄存器写不进去,请问下您的spi时钟模式是怎么设置的?
qi tang,你这个读取方式不明白,我也用的430,能读出部分正确的东西,加我QQ:893872637.慢慢讨论。