I2C detect?

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
HyperUniverse
Posts: 282
Joined: 17 Jun 2009 10:42

I2C detect?

#1 Post by HyperUniverse » 14 Sep 2023 09:35

Hi,

How can I detect at power up time, if an I2C device is connected or not in the system?

Thanks

Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

Re: I2C detect?

#2 Post by Thomas.Pahl@t-online.de » 14 Sep 2023 18:37

Perhaps there is a better way but my way is simple.

I have a project where i scan the whole 127 adresses with the soft i2c library on the pins of the hardware i2c. After the scan i initiate the hardware i2c.

check if there is an error writing to an adress

Code: Select all

 
 Soft_I2C_Start()
 error = Soft_I2C_Write((adress << 1) or 1)  'thats Basic write in C
 Soft_I2C_Stop()
 

Post Reply

Return to “mikroC PRO for PIC General”