请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:AFE4960 你(们)好!
我有几个问题要请教您。
在双芯片串行模式下、在接收到 AFE4960发送的 FIFO_RDY 中断信号之后、MCU 开始通过 SPI 通信从 AFE4960的 FIFO 读取样本。
具体过程如下:
①Read 6D 地址寄存器的第0-7位来获得 FIFO 中的采样值数量。
②According 至样本数、通过在 while 循环中写入 FFh 来单独读取样本。
因此、FIFO 溢出。
void capture(void) { // Flag=0x01; volatile uint16_t numWordsToRead[2]={0,0}; txBuffPointer = 0; TX_BUFF[txBuffPointer++]=0; TX_BUFF[txBuffPointer++]=0; TX_BUFF[txBuffPointer++]=0; TX_BUFF[txBuffPointer++]=2;//心电数据 /*Read pointer difference from AFE1*/ SPI_READ_MODE=READ_AFE1; readSPI(0x6D,(uint8_t *)&afeRegData);//写入和读取指针之间的指针差异 AFE4960 6D copyRegDataInTxBuf1(3); numWordsToRead[0]=(afeRegData+1)&0xFF; // /*Read pointer difference from AFE2*/ SPI_READ_MODE=READ_AFE2; readSPI(0x6D,(uint8_t *)&afeRegData); copyRegDataInTxBuf1(4); numWordsToRead[1]=(afeRegData+1)&0xFF;//循环队列 SPI_READ_MODE=READ_AFE1; while(numWordsToRead[0]!=0) { readSPI(0xFF,(uint8_t *)&afeRegData);//从fifo中读取数据 copyRegDataInTxBuf1(5); numWordsToRead[0]--; } SPI_READ_MODE=READ_AFE2; while(numWordsToRead[1]!=0) { readSPI(0xFF,(uint8_t *)&afeRegData); copyRegDataInTxBuf1(6); numWordsToRead[1]--; } captureStatus=0x01; }
我们应该如何从 FIFO 获取样本?