I2C应该是一个开放的集线器总线。实际上,大多数时候驱动SDA和SCL都是高电平和低电平,这是违反的。你忽略了每个写字节之后从设备返回的ACK脉冲。如果DS1307正在正确地接收数据,这将给你一个即时的指示。你必须使用PIC16F690,正如你现在知道的,它不包含一个I2C主外围设备。你需要一个“MSSP”外围设备,而不仅仅是一个“SSP”来获得它。当您应该将端口位设置为低,并操作TIS位以关闭输出驱动器。这是模拟开放集电极驱动器的正确方法。
以上来自于百度翻译
以下为原文
I2C is supposed to be an open collector bus.
You are violating that by actually driving SDA and SCL high and low most of the time.
You are ignoring the ACK pulse that the slave device is meant to send back after every write byte. That would give you an immediate indication if the DS1307 is receiving your data correctly.
Do you have to use a PIC16f690, which as you are now aware, does not contain an I2C Master peripheral.
You need an "MSSP" peripheral, not just an "SSP" to get that.
If you are going to bit-bang the interface, then you should be setting the port bits low, and manipulating the TRIS bits to turn the output driver off and on. That is the correct way to simulate an open collector driver.
I2C应该是一个开放的集线器总线。实际上,大多数时候驱动SDA和SCL都是高电平和低电平,这是违反的。你忽略了每个写字节之后从设备返回的ACK脉冲。如果DS1307正在正确地接收数据,这将给你一个即时的指示。你必须使用PIC16F690,正如你现在知道的,它不包含一个I2C主外围设备。你需要一个“MSSP”外围设备,而不仅仅是一个“SSP”来获得它。当您应该将端口位设置为低,并操作TIS位以关闭输出驱动器。这是模拟开放集电极驱动器的正确方法。
以上来自于百度翻译
以下为原文
I2C is supposed to be an open collector bus.
You are violating that by actually driving SDA and SCL high and low most of the time.
You are ignoring the ACK pulse that the slave device is meant to send back after every write byte. That would give you an immediate indication if the DS1307 is receiving your data correctly.
Do you have to use a PIC16f690, which as you are now aware, does not contain an I2C Master peripheral.
You need an "MSSP" peripheral, not just an "SSP" to get that.
If you are going to bit-bang the interface, then you should be setting the port bits low, and manipulating the TRIS bits to turn the output driver off and on. That is the correct way to simulate an open collector driver.
举报