PDA

View Full Version : I2CWRITE "Label" option - what does it do?



flotulopex
- 20th September 2024, 14:04
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?


.....
DS3231:

GetTime:
RtcI2cNack = 0
I2CRead RTC_SDA,RTC_SCL,$D0,RtcTimeReg,[RtcMin,RtcHour],I2CNACK

I2CNACK:
RtcI2cNack = 1
RETURN
.....

pedja089
- 21st September 2024, 01:48
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...

Ioannis
- 23rd September 2024, 18:26
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

flotulopex
- 29th September 2024, 09:50
I2C Slave send 1 bit response after each byte received.

I was missing this.

Thanks for the info guys :wink: