CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

i2c Scanner starts counting from 10 to the last point

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
camleot23



Joined: 16 Aug 2019
Posts: 52

View user's profile Send private message

i2c Scanner starts counting from 10 to the last point
PostPosted: Thu Aug 22, 2019 6:53 am     Reply with quote

Hello All,
I use I2C Scanner functions which I got from this forum. I have a real hardware, 1 LCD with I2C, 1 pic, 1 Arduino. Pic is master, Arduino is slave. I want to communicate with them via I2C protocol. When I connect them together at first it worked and i2c scanner gave me their addresses correctly which are 4E and 3C. Then, I plugged out the power (which is the same Arduino) after I plugged in the Arduino, I2C scanner started to count from 10 and increased by 2 every time. I didn't wait for the last point but I suppose it would count to the last point. I don't understand why this happened. When I try to load my program while the system was on and i2c scanner was giving me addresses, it again started from the beginning.
Do you have any idea why this happened?
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Thu Aug 22, 2019 7:15 am     Reply with quote

I2C scanner _should_ count from 0x10, and count in 2's.

Addresses below 0x10, are 'reserved' in I2C. Hence no point in scanning these
Also in 8bit I2C addressing, the 'even' addresses are the write addresses,
and the odd addresses are the read address for the same device. The
I2C scanner 'works' by testing for the acknowledge from a writable
device, so only tests the even addresses.
So I2C scanner is doing what it should. If it is not reporting the devices
it is because the devices are not working. Sounds as if something has
not woken up correctly in your switching on/off. This is always a thing
to be careful when doing.
camleot23



Joined: 16 Aug 2019
Posts: 52

View user's profile Send private message

PostPosted: Thu Aug 22, 2019 7:24 am     Reply with quote

Ttelmah you didn't get what I meant. I wanted to say, I2C scanner thinks there are devices because it is printing that values to serial port and then it says that much devices found (more than 2) . But I just have 2 slaves.I didn't ask why the code is counting from 10 to the last address, I asked my scanner finds devices on every addresses becuase it sends that addresses to serial port. Now could I explain very clearly?
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Thu Aug 22, 2019 7:29 am     Reply with quote

No I'm not. It is reporting devices because the bus is shorted low.
It is the 'low' on the bus that it sees to say a device has acknowledged.
Something is shorting the bus....
camleot23



Joined: 16 Aug 2019
Posts: 52

View user's profile Send private message

PostPosted: Thu Aug 22, 2019 7:34 am     Reply with quote

Hmm, I get it. Thank you Smile
asmallri



Joined: 12 Aug 2004
Posts: 1630
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

Re: i2c Scanner starts counting from 10 to the last point
PostPosted: Thu Aug 22, 2019 9:45 am     Reply with quote

camleot23 wrote:
Hello All,
I use I2C Scanner functions which I got from this forum. I have a real hardware, 1 LCD with I2C, 1 pic, 1 Arduino. Pic is master, Arduino is slave. I want to communicate with them via I2C protocol. When I connect them together at first it worked and i2c scanner gave me their addresses correctly which are 4E and 3C. Then, I plugged out the power (which is the same Arduino) after I plugged in the Arduino, I2C scanner started to count from 10 and increased by 2 every time. I didn't wait for the last point but I suppose it would count to the last point. I don't understand why this happened. When I try to load my program while the system was on and i2c scanner was giving me addresses, it again started from the beginning.
Do you have any idea why this happened?


Missing or open circuit pull-up resistors on the I2C bus or Arduino slave not set up correctly (has not initialized the I/O port for the I2C bus)?
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group