i2cread pause required? SB/B
I'm doing a number of reads from an i2c clock, and it seems, on a hard reboot sometimes this read is getting cut short and operating as a write, scrambling things up. Below is the subroutine I made which is getting run 10 times in a row.
Notice the pause I added, which seemed to solve this. My questions is, is there a mimimum time I should be waiting inbetween subsiquent read and write operations? I seem to remember hearing something like this before? Anyone know the minimum, or at least someone else seen this? It only seems to a happen after a hard reboot and on the FIRST read.
sub rtc_read_byte
temp2 = __PARAM1
i2cstart RtcSda
temp = RtcId
temp.0 = 0
i2csend rtcsda, temp
i2csend rtcsda, temp2
i2cstart RtcSda
temp = RtcId
temp.0 = 1
i2csend rtcsda, temp
i2cRecv rtcsda, temp, Nak
i2cstop rtcsda
' I think this below pause fixed it.
pause 30
return temp
endsub
Notice the pause I added, which seemed to solve this. My questions is, is there a mimimum time I should be waiting inbetween subsiquent read and write operations? I seem to remember hearing something like this before? Anyone know the minimum, or at least someone else seen this? It only seems to a happen after a hard reboot and on the FIRST read.

Comments