i2c master/slave


Closed Thread
Results 1 to 5 of 5
  1. #1
    lab310's Avatar
    lab310 Guest

    Default i2c master/slave

    http://www.melabs.com/resources/samples/pbp/i2cmast.bas
    http://www.melabs.com/resources/samp...p/i2cslave.bas

    I found example for this on Melabs site, tried to establish communications between 2 PICS. Connected SDA-SDA and SCL-SCL, added pull-ups of 10k (10K is marginal - you should use lower values like 4K7 - Melanie), and used examples as Melabs posted in samples,but it doesn't work. I believe that problem is in slave which uses hardware MSSP module (master uses software I2Cread/write commands), but can't precisly determine what it is.
    So my question is this:
    1. Did anyone tried this Melabs example?
    2. Did anyone has succesfuly managed to implement pic as I2Cslave using MSSP?
    3. Does anyone know an easier method of exchanging data between 2 PIC's(problem is that slave PIC has interrupt routine on <200us). I think that SPI would be way to go, so if I can not make I2C to work, maybe this is a way to go.

  2. #2
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi!

    Maybe these links will help you.
    (Search with Google for more).

    Microchip Application Note AN734:
    Using the PICmicro SSP for Slave I2C Communication
    http://www.microchip.com/stellent/i...ppnote=en011798

    Picbasic Pro project for Slave I2C Communication:
    http://www.astrosurf.com/soubie/pic_as_an_i2c_slave.htm
    (See Microchip application note AN734 has errors).


    Luciano

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Can someone explain to me why people choose I2C for a PIC to PIC comm when a simple serial comm is so much simple???
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Synchronous Communications (like I2C) is faster and more robust than Asynchronous Communications which in addition to wasteful Start and Stop Bits also requires stable clocks at each processor for fast data transfer. If you're already laying down an IC2 Bus for other devices, it seems logical to extend it to encompass your processors as well, and then your processors can happilly rely on internal oscillators freeing PIC pins. Remember that PICs internal oscillators are only guaranteed to be factory calibrated to 4MHz +/- 1% and regardlesswhat people say, that just doesn't cut it for Async speeds above 1200 Baud with any degree of reliability and repeatability... whereas I2C is happily interchanging data at between ten and forty times that speed without any regard to clock stability.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    That make sense. Thanks Melanie!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 05:50
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13:55

Members who have read this thread : 1

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