PIC as I2C Slave


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2012
    Posts
    3

    Default PIC as I2C Slave

    Happy new year to everybody.

    This is my first post here. Whenever I had a problem, a little search in this forum presented me with very good solution posted by other members, who seemed to be experts in their respective fields.

    I am planning to connect several small PIC Microcontrollers on an I2C bus. One Microcontroller (May be 16F877A) will be master and scan all the slaves one by one for changes (button press or something like that). The slave will send one data byte only when Master request data on its particular address, will remain silent for rest of the scanning period. The search will be repeated after the last slave is scanned.

    I have designed several projects where the slave is an 24CXXX( EEPROM) or DS1307(RTC), which is not very difficult. They are working fine. But I am finding difficulty in thinking of a PIC as slave, assigning control and unique address bytes to each slave.

    I would highly appreciate any help (code examples etc.) from those experts in this forum.

    Mainul

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: PIC as I2C Slave

    Have you seen the articles here?
    http://www.picbasic.co.uk/forum/content.php?r=69
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: PIC as I2C Slave

    mackrackit

    Thanks a lot for such a prompt reply, I shall give it a try. I was certain to have something useful from here, that's why I love this forum so much.

    The 18F chips are still difficult for me to handle, but I shall play with 16F877A and 16F88 chips. Well, how many slaves can be handled at a time on a single I2C bus? 10, 100 or more?

    Mainul
    Last edited by Mainul; - 5th January 2013 at 11:32.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: PIC as I2C Slave

    Do not be afraid of the 18s, once you get past the setup they are not that much different than a 16. If you need help getting an 18F configured someone here will be able to help.

    As for how many I2C's on I bus I am not sure, I should know... (see avatar)
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2012
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: PIC as I2C Slave

    I was studying the datasheet of 16F88. The ‘SSP I2C Mode Operation’ section (10.3, page 94) says that SSP module can be configured for 7 bit or 10 bit addressing. So I guess in 7 bit addressing mode 128 unique addresses can be generated, similarly 1024 addresses in 10 bit mode. Is it really possible to connect 128 (or even 1024) 16F88 slaves in a single I2C bus? Seems to be very interesting!

    I have a plan to jump into 18F series soon, shall come back with lot more problems.

Similar Threads

  1. Interfacing with Arduino I2C LCD
    By norohs in forum Documentation
    Replies: 47
    Last Post: - 30th May 2017, 18:53
  2. Problem with PICto PIC I2C MASTER-SLAVE
    By juanen19 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2013, 02:58
  3. Replies: 17
    Last Post: - 15th March 2013, 23:11
  4. 16F1847 Usart and I2C
    By Seahound1 in forum Serial
    Replies: 6
    Last Post: - 18th December 2012, 20:41
  5. Strange I2C and serial behaviour.......
    By jimbostlawrence in forum General
    Replies: 4
    Last Post: - 30th October 2012, 01:02

Members who have read this thread : 3

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts