Microchip
直播中

张凯

7年用户 171经验值
私信 关注
[问答]

如何使用spi1_exchange8bit传输数据?

我正在处理PIC24FJ256GB210,试图在SPI接口上接口从设备。我的从设备有8位寄存器加法器,16位寄存器数据。我使用MPLAB代码配置器工具来生成SPI代码。请您帮助我,我应该选择通信宽度为16位还是8位?请举例说明如何使用Pix1Exchange 8BIT传输数据。在上面的场景中,我可以这样配置用于将16位数据写入8位寄存器:SPI1_Exchange8bit(register_addr);SPI1_Exchange8bit(register_data_MSB);SPI1_Exchange8bit(register_data_MSB);

以上来自于百度翻译


      以下为原文

    I am working on PIC24FJ256GB210, trying to interface a slave device on SPI interface.My slave has 8bit register addr, 16bit register data.
I am using MPLAB Code Configurator tool, to generate the SPI code. KIndly request you to help me, should i choose the Communication width as 16bit or 8bit ?

                Kindly provide an example how to use SPI1_Exchange8bit to transfer the data .

                         In the above scenario can i configure like this for WRITING 16bit data into 8bit register :
                                        SPI1_Exchange8bit(register_addr);
                                        SPI1_Exchange8bit(register_data_MSB);
                                        SPI1_Exchange8bit(register_data_MSB);

回帖(1)

薄坤坤

2019-7-8 08:50:24
在你的情况下,我会说你需要8位传输。如果你选择16位传输,那么每个交换机是16长。因为您只有一个8位的地址要先交换,这是限制因素。正如您所展示的,您总是可以使用多个交换来建立到实际的总交换大小。应该属于SPI或PIC24william hill官网 。苏珊

以上来自于百度翻译


      以下为原文

    In your case I would say you need 8-bit transfers.
If you select 16-bit transfers then every exchange is 16 its long. As you only have an 8-bit address to exchange first, that is the limiting factor.
As you have shown you can always use multiple exchanges to build up to the actual total exchange size.
I know that you mention the MPLABx configurator (and I don't think there is a forum for that) this quesiion really should belong in the SPI or PIC24 forums.
Susan
举报

更多回帖

发帖
×
20
完善资料,
赚取积分