SPI和I2C同时通讯使能

2020-02-09 09:23发布

请教大家个问题  就是我在做试验的过程中16f883外接2个片子 一个传感器 一个是DA转换的 传感器与883的通信是I2C的 DA是SPI的  而这2种通讯都是同样的寄存器控制  现在我要同时使能这2种方式 那我寄存器该如何设置呢 谢谢指教
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
11条回答
aliangnisno1
1楼-- · 2020-02-10 04:17
回复【6楼】stevenxia
-----------------------------------------------------------------------

个人认为:肯定是分时接收或发送了,不可能单片机同时I2C和SPI通信。
stevenxia
2楼-- · 2020-02-10 08:07
 精彩回答 2  元偷偷看……
qjs412
3楼-- · 2020-02-10 13:25
回复【6楼】stevenxia
-----------------------------------------------------------------------

"个人绝对还是会有冲突"

不太理解这句话!!

I2C使用硬件,SPI模拟,这样不行吗?
aliangnisno1
4楼-- · 2020-02-10 13:41
回复【8楼】stevenxia
-----------------------------------------------------------------------

都是微妙级的,简单的延时不就好了么。加一个if语句就好。
millwood0
5楼-- · 2020-02-10 14:58
"那我寄存器该如何设置呢 谢谢指教"

it depends on how you structure the transmission. not sure of your specific chip but some chips have shared pins (16f886 for example shares sdi and sda pins). In those cases, you cannot transmit data at the same time - aka interrupt driven approach doesn't work.

assuming that your pic acts as a master, and you transmit spi and i2c one at a time, you will then have to experiment a little: write up your spi routines and your i2c routines, make sure that they work independently and then join them together.

一周热门 更多>