在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 */作者: adam1982 时间: 2007-7-26 16:09