|
Forum Index : Microcontroller and PC projects : Looking For - I2C Scanner - Picomite
| Author | Message | ||||
| pwillard Guru Joined: 07/06/2022 Location: United StatesPosts: 324 |
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 KingdomPosts: 2171 |
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 StatesPosts: 324 |
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 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. |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |