I2C with any PIC?


Closed Thread
Results 1 to 13 of 13

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Many of us have done this but for professional reasons we are unable or unwilling to share the code. However, Robert Soubie detailed his adventures with I2CSlave using Melabs PICBasic, and posted all his code here...

    http://www.astrosurf.com/soubie/pic_as_an_i2c_slave.htm

    Well done Robert!

  2. #2
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie,
    i tried Roberts I2C Slave routine, but it is not clear how to access the Slave with I2CREAD / I2CWRITE with Melabs PBP from the Master.
    In the I2CREAD and I2CWRITE commands are also "address" parameters given, is this the same to be used as the parameter RXBuffer(0)?
    Does any one have an exmaple for me?
    Regards,
    Ralf

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


    Did you find this post helpful? Yes | No

    Default

    Other than telling you that Robert achieved the goal that many seek but few accomplish, and he documented everything on his website (I'm assuming it's all still there), I can't add any more, because I haven't actually tried his software myself.

  4. #4
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hello Melanie,
    yes there is a lot on the website, but there is not describd how to access it with I2CREAD / I2CWRITE. May be i am blind.... Maybe anyone else can help...?
    Regards,
    Ralf

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ralfmayr View Post
    Hello Melanie,
    yes there is a lot on the website, but there is not describd how to access it with I2CREAD / I2CWRITE. May be i am blind.... Maybe anyone else can help...?
    Regards,
    Ralf
    from the second page of his web site:
    http://www.astrosurf.com/soubie/fichiers/i2cInt.pbp
    http://www.astrosurf.com/soubie/fichiers/Proc_i2c.pbp
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    You would still use I2CREAD and I2CWRITE as per normal in the Master PIC. It's only the slave PIC that would use the new routines.

  7. #7
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hello Melanie,
    hello Joe,
    thanks for your answers.
    I have the code from Robert, i also implemented his code in my interrupt
    service of the slave (a 2431), all no problem, but:
    The problem i have is that i do not understand how it works. When writing or reading with my master (a 6722) to / from the slave, i alwasy get sensless values from the slave. The slave routine from Robert waits for 3 RXbuffer values (0 - 2), the first value of RXBuffer(0) indicates in i2c_proc.pbp the var-id, all other two bytes are the values. But when writing three values with I2CWRITE sda, scl, addr, [b1, b2, b3], the service routine gives back "0" for all two TX Values (defined in the i2c_proc.pbp there have been other values defined).
    In the pbp manual, there is also a value possible behind the address (before the "[", but using this value also for the RXBuffer(0) results also in senseless values.
    So i think the I2CREAD / I2CWRITE command i use in a wrong way, so i am looking for a master code example, which controls a slave to see the correct usage.
    Uff..... understood?
    BR
    Ralf

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 23:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 22:07
  3. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 20:33
  4. Use pic as slave in I2C
    By robert0 in forum General
    Replies: 2
    Last Post: - 3rd February 2006, 20:26
  5. Adding a pic in I2C network....
    By robert0 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2005, 13:07

Members who have read this thread : 0

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