I2C Slave with a PIC - Page 4


Closed Thread
Page 4 of 4 FirstFirst 1234
Results 121 to 130 of 130
  1. #121
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    If I have correctly understand, the maximum length from the capacitance point of view is around 8 meters, but what shall be the maximum distance for the single ended TTL?

    Leo
    Leo

  2. #122
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    I don't think there's any good single answer to that... it's dependent on so many different things it's hard to make a general statement.

    Personally, I start getting nervous as soon as a signal leaves a board!

  3. #123
    Join Date
    Sep 2009
    Posts
    737


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    SDA and SCL are not good combination in one pair. Because of cross talk.
    Much better is to combine GND and SDA on ona pair, GND and SCL on second pair. But capacitance play big roll. Probably CLK must be driven, not with pull up. SDA should have strong pull up.
    But do not connect multiple GND on both sides, as that will create long loop antenna, probably...
    I thing, but maybe i'm wrong, best chanse to get it to work is:
    1. Pair GND and signal on 2 pairs for SDA and SCL, connect that ground only on output port of module.
    2. Use third pair for power
    3. Ground unused pair master, as GND for signals.
    Generally not good idea to run TTL signals out of boards.
    If you design master and slave's why not to go with RS485, half duplex or duplex?

  4. #124
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    Personally, I start getting nervous as soon as a signal leaves a board!
    me too

    spi can get that sort of distance but you need a cs signal for each slave

    I wonder if you used a pair of those 3v-5v level shifters back to back if they could act like a repeater ?
    could be a cheap solution

    wireless may be an option
    rfm69 modules and the like can get 300k bps over that range and a master slave setup is no too difficult

  5. #125
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    It will work fine - as long as the PICs are the only I2C devices on the bus. The I2C specification was written to deal with low-power devices that have no more than 2 mA drive. As a result, all the pull ups (in parallel) could be no smaller than 2.5K. Since a PIC pin will sink more than 20mA, you can use much smaller pull ups. If there are only two PICs on the bus, I regularly use a 1K pull up at each end, with 10 ohms in series (one at each end) to reduce ringing. Since your CAT-5 will be twisted pairs, use one wire of each pair as GND (and the other as SDA or SCL). You should have no trouble at distance of at least 50'. But if you do get errors, you can slow the I2C bus down to lower data rates.

    Be aware, however that any other non-PIC devices on the bus will probably not be able to drive such small pullups properly.
    Charles Linquist

  6. #126
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    Your tips are pushing me towards the RS485.
    The only trouble and not've never used before.

    I am somewhat concerned about the protocol to use.

    You have to give me a hint where to look to select the protocol that I could use?

    Leo
    Leo

  7. #127
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    If you have used serial RS232, then the RS485 is just the same. Only drivers (chips) are different. And the signal is TTL level from your controller to the RS485 driver.

    The RS485 is not a protocol, rather a low level electric specs of the medium. It does not care about how the data will be sent.

    So you really have not many concerns on this. Almost Plug and play.

    Ioannis

  8. #128
    Join Date
    Feb 2007
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    In reality the RS232 is designed to connect generally ONLY two devices toghether.

    The RS485 have the capability to manage multiple slave and one master.

    In my project I have one master and I connect the USART to the RS485 chip and then in daisy chain all the other RS485 chip to the USART's slave. But that means every slave have his proper address, manage receiving, CRC chek etc etc and to do in the best way is needed a protocol.

    Googling I have found the SNAP protocol ( http://www.hth.com/snap/ ) that shall be good to be implemented in my solution and have the source code in PBP (old version).

    If I do not found a protocol more simple than SNAP, I will study and implement it.

    Leo
    Leo

  9. #129
    Join Date
    Aug 2016
    Posts
    1


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    I need Working I2C Slave code for PIC16LF1513 in C program with some instructions.


  10. #130
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: I2C Slave with a PIC

    Quote Originally Posted by Address View Post
    I need Working I2C Slave code for PIC16LF1513 in C program with some instructions.

    So why post on a BASIC forum -

Similar Threads

  1. Problem with PICto PIC I2C MASTER-SLAVE
    By juanen19 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2013, 02:58
  2. PIC as I2C Slave
    By Mainul in forum General
    Replies: 4
    Last Post: - 5th January 2013, 13:23
  3. I2C Slave, config Vref - + in pic with ADC
    By sebapostigo in forum PBP Wish List
    Replies: 4
    Last Post: - 5th March 2007, 03:21
  4. Pic as an i2c slave
    By Robert Soubie in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th January 2007, 21:11
  5. Use pic as slave in I2C
    By robert0 in forum General
    Replies: 2
    Last Post: - 3rd February 2006, 19:26

Members who have read this thread : 5

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