Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:50 21 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Looking For - I2C Scanner - Picomite

Author Message
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 324
Posted: 02:43pm 29 Jun 2022
Copy link to clipboard 
Print this post

Is there a version of an I2C Scanner that works on Picomite?  Maybe "Search" has failed me?
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2171
Posted: 02:51pm 29 Jun 2022
Copy link to clipboard 
Print this post

try this

you might have to tweak it a bit to define the I2C pins etc as the pico has no defaults
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 324
Posted: 02:56pm 29 Jun 2022
Copy link to clipboard 
Print this post

Lifesaver!  


' i2cdetect like program

' Set Pins!
SetPin gp0, gp1, I2C

' Open first I2C
I2C open 100, 200


' Prep table
Print "     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F"

' loop col/row
For y=0 To 7
Print Hex$(y,2);": ";
For x=0 To 15
  addr = y*16+x               ' calc address
  I2C write addr, 0, 1, &H00  ' write zerp to that adress
  If MM.I2C=0 Then            ' check for errors
    Print Hex$(addr,2);" ";   ' found one!
 Else
   Print "-- ";               ' nothing here..
 EndIf
Next x
Print
Next y

I2C close  ' clean up


results in:


    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00: 00 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
01: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
02: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
03: -- -- -- -- -- -- -- 37 -- -- -- -- -- -- -- --
04: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
05: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
06: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
07: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


Which is great!  Thanks.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025