I2CWRITE "Label" option - what does it do?
I'm working on a piece of code I found in another thread about a DS3231 RTC.
Unfortunately, the used I2CWRITE command has an optional label to jump to.
I don't get what the label is there for.
The manual says If the optional Label is included, this label will be jumped to if an acknowledge is not received from the I2C device.
Okay, but, what does it mean?
Code:
.....
DS3231:
GetTime:
RtcI2cNack = 0
I2CRead RTC_SDA,RTC_SCL,$D0,RtcTimeReg,[RtcMin,RtcHour],I2CNACK
I2CNACK:
RtcI2cNack = 1
RETURN
.....
Re: I2CWRITE "Label" option - what does it do?
Exactly what is writen in manual :D
I2C Slave send 1 bit response after each byte received. If that bit is missing, then command will jump to label. If label is not present, it will just ignore it, and keep sending data...
Re: I2CWRITE "Label" option - what does it do?
If you want, you may include that label in case the I2C device fails to communicate. So you can give the user a message that something was wrong.
Ioannis
Re: I2CWRITE "Label" option - what does it do?
Quote:
I2C Slave send 1 bit response after each byte received.
I was missing this.
Thanks for the info guys :wink: