I2C Slave with a PIC


Closed Thread
Results 1 to 40 of 130

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Some Remarks:

    1. It is necessary to set the "DEFINE I2C_HOLD 1" in the master to get a
    better behaviour of the timing. I checkrd it with the logic analyzer and it is
    exactly like in the original "Phillips-Spec"

    2. In the section
    ...
    while STAT_BF = 1
    i = SSPBUF ' Dummy Read inserted => clears BF Flag
    wend
    ...
    it is necessary to inlude the dummy read to get it work on
    a 18F6722 and a 18LF14K22 (refer to MCHIP App Note 734, page 17)

    3. Address range ist tested from 00h to FFh, all work well.

    4. New address setting works (in the main loop) by only setting SSPADD
    register with new value without reseting the complete handler.

    Regards,
    Ralf

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    ralfmayr wrote on 17th Feb. 2009
    Hi Daniel,
    no, i stopped working on it, it is not possible to get it work... :-(

    I solved my problem using serin/serout.
    But it would be great when we exchange our know-how, so we can solve this together!

    -,Ralf
    I quoted your last year post, just to congratulate with you for the remarkable knowledge you have gained in a year. This will teach new comer that persevering on a subject always pay.

    Thank you for those additional I2C remarks that could be useful.

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Yep,
    last year i made my first experiments with i2cslave,
    but had no time to work on it for 8 months now as
    i was very busy with other things.
    Hope it will help others to come faster to their target.
    -,Ralf

  4. #4
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hello Al,
    another question:
    What are the three definitions:
    1. DEFINE I2C_SLOW 1
    2. DEFINE I2C_HOLD 1
    3. DEFINE I2C_SCLOUT 1
    do?
    1. => Used with LO > 8MHz and 100kHz devices
    2. => Time Delay during acknowledge?
    3. => Open Collector / Bipolar Clock on SCL? Dont Understand this!

    So: I use PCF8575C and MAX3611 (both 400kHz devices) but both only work
    correct when DEFINE I2C_HOLD 1 and DEFINE I2C_SCLOUT 1 is done.

    Can you 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 Al,
    another question:
    What are the three definitions:
    1. DEFINE I2C_SLOW 1
    2. DEFINE I2C_HOLD 1
    3. DEFINE I2C_SCLOUT 1
    do?
    1. => Used with LO > 8MHz and 100kHz devices
    2. => Time Delay during acknowledge?
    3. => Open Collector / Bipolar Clock on SCL? Dont Understand this!

    So: I use PCF8575C and MAX3611 (both 400kHz devices) but both only work
    correct when DEFINE I2C_HOLD 1 and DEFINE I2C_SCLOUT 1 is done.

    Can you help?

    Regards,
    Ralf
    Hi Ralf,
    I can answer part of #3:
    Open collector means the PIC has 2 states LOW where it takes the pin to ground and an open state where the pin is high impedance, so to get a high state it must have a pull up resistor to supply the power. I do not know what bipolar clock means, have not read up on this yet.
    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
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    1. => Used with LO > 8MHz and 100kHz devices
    Yes.

    2. => Time Delay during acknowledge?
    Not Exactly, data transfer can be paused by the receiving device by holding the clock line low, so the receiving device can control the data flow. To enable this function you need the DEFINE I2C_HOLD 1 declared.

    3. => Open Collector / Bipolar Clock on SCL? Dont Understand this!
    Joe already answer to this point with a clear explanation. Let me add that bipolar is a device capable to pullup the lines by itself without the need of external pullup resistors

    So: I use PCF8575C and MAX3611 (both 400kHz devices) but both only work
    correct when DEFINE I2C_HOLD 1 and DEFINE I2C_SCLOUT 1 is done.
    It is usefull to use DEFINE I2C_HOLD 1 as default since it will keep synchronized different devices connected on the I2C bus all with different internal clock.

    I don't know much about PCF8575C and MAX3611 but very likely they are bipolar devices.

    Al.
    All progress began with an idea

  7. #7
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Thank you both for the answers.
    Now i understand.
    So it seems always to be best to work with declaration 2 & 3 with
    400 khz devices. This is what i found out yesterday.
    Have nice eastern!
    Regards,
    Ralf

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, 03:58
  2. PIC as I2C Slave
    By Mainul in forum General
    Replies: 4
    Last Post: - 5th January 2013, 14:23
  3. I2C Slave, config Vref - + in pic with ADC
    By sebapostigo in forum PBP Wish List
    Replies: 4
    Last Post: - 5th March 2007, 04:21
  4. Pic as an i2c slave
    By Robert Soubie in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th January 2007, 22:11
  5. Use pic as slave in I2C
    By robert0 in forum General
    Replies: 2
    Last Post: - 3rd February 2006, 20:26

Members who have read this thread : 2

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