首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

关于MC13192用SPI读取接收到数据程序中的问题?RAMDrvReadRx()

关于MC13192用SPI读取接收到数据程序中的问题?RAMDrvReadRx()

在MCU读取13192接收到的数据主要用到在drivers.c的RAMDrvReadRx()函数,我对这函数中一段代码不是很理解还请指导下代码如下)这代码中有四个Dummy write,目的应该是为了防止读取四个GARBAGE吧(MSB,LSB,LSB,LSB),我问题为什么要这样来假写数据到寄存器,为什么要四次DUMMYWRITE,为什么针对的是一个MSB.,三个LSB,(我的理解至少也应该是MSB,LSB,MSB,LSB两个字)?还请指导下,谢谢
SPIClearRecieveDataReg(); /*
* Clear receive data register.
* SPI entirely ready for read or write
*/
SPISendChar(u8TempValue); /*
* Dummy write. Receive register of SPI will
* contain MSB garbage for first read
//#define SPIWaitTransferDone() while (!(SPI1S_SPRF)); */
SPIWaitTransferDone(); /* For this bit to be set, SPTED MUST be set.*/
SPIClearRecieveDataReg(); /*
* Clear receive data register.
* SPI entirely ready for read or write
*/
SPISendChar(u8TempValue); /*
* Dummy write. Receive register of SPI will
* contain LSB garbage for first read
*/
SPIWaitTransferDone(); /* For this bit to be set, SPTED MUST be set.*/
SPIClearRecieveDataReg(); /*
* Clear receive data register.
* SPI entirely ready for read or write
*/
/* Byte codes */
SPISendChar(u8TempValue); /*
* [U]Dummy write[/U]. Receive register of SPI will
* contain LSB garbage for first read
*/
SPIWaitTransferDone(); /* For this bit to be set, SPTED MUST be set.*/
u8TempValue = SPIRead(); /* Read first code byte */
SPISendChar(u8TempValue); /*
* Dummy write. Receive register of SPI will
* contain LSB garbage for first read
*/
SPIWaitTransferDone(); /* For this bit to be set, SPTED MUST be set.*/
u8TempValue = SPIRead(); /* Read second code byte */
版主能指点下吗?
顶一下!!

我也对这东西有疑问!!
返回列表