I2C scanner ?
in BASIC Stamp
BS2p has this I2CIN and I2COUT set of commands that might help to interface the I2C devices.
I wonder if anybody came up with a code that figures out the addresses of what's been connected to the bus.
Sort of like a "I2C scanner"
I wonder if anybody came up with a code that figures out the addresses of what's been connected to the bus.
Sort of like a "I2C scanner"

Comments
PUB WhoOnBus(ptrOnBusArr) | onbus, addr 'Fills an array with max 119 elements with addresses that get a response 'and writes how many is onbus to the 0th element onbus:= 1 REPEAT addr FROM %0000_1000 TO %0111_0111 'Scan the entire address space, exept for reserved spaces IF CallChip(addr << 1)== ACK 'If a chip acknowledges, LONG[ptrOnBusArr][onbus]:= addr 'put that address in the callers array LONG[ptrOnBusArr][0]:= onbus 'and update the total count of chips on the bus onbus++ IF onbus> 119 'until loop expires or maximum number of elements in the array is reached Stop QUIT Stop 'After each call send a stop signal to avoid confusionErlend
Erlend