I2C with 18F2685


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166

    Default

    MikeBZH, What values are you using for the pullup reststors on the SDA/SCL lines... I have found in the past that 4.7 k resistors are too large and slow the current flow for passive pullup when I use more than 4 devices on a bus... I would use 2.2 k resistors and try that.. It should cleanup the data signal a bit.. I'm not sure if the statement DEFINE I2C_HOLD 1 is required or not.. I have never used it in the past and I have used 100 khz. parts and 400 khz. parts with no issues.. Just make sure you use the statement DEFINE I2C_SLOW 1 if the part is only good for 100 khz. and you are running the processor at more than 4 mhz..

    Dave Purola,
    N8NTA

  2. #2
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82

    Default

    Hi,

    I fixed it, but the result is very strange.
    Resistors values or Defines have no influence but it seems that there is bug in the PBP documentation (or in the compiler, as you prefer).

    I found that the instruction :
    I2CWRITE DataPin, ClockPin, Control, [Address,] ...

    should be written
    I2CWRITE DataPin, ClockPin, [Address,] Control...

    In other words everything works if one pass first the Address and then the Control instead of what is written in the documentation. This is very clear with a dual trace scope on SDA and SCL.

    My compiler version is 2.50L

    MikeBZH / F8DFN

  3. #3
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82

    Default

    Moreover,

    The physical address has to be shifted left once (multiplied by 2) to cope with the I2C format. In my case the physical address is $2C : I have to pass $58 to I2CWRITE.

    MikeBZH / F8DFN

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

    Default

    Strange... I use PBP v2.50 I2C to talk to EEPROM 24LC64, DS1307 and MCP23008 and other devices on the same board and it all behaves as expected per the Manual...

  5. #5
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82

    Default

    Hi Melanie,

    Please note that I use PBPL. Maybe the behaviour of this version is different from the others. I have no more time to make some comparison tests but I will do them when I come back from vacation by the end of August.

    MikeBZH / F8DFN

  6. #6
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82

    Talking Same bug with I2CREAD

    Hi,

    Coming back after some time spent with other business...
    I have no more MAX517 in my circuit but the MCP23008 are still there and I need to use I2CWRITE and I2CREAD with them.
    The issue is still there. I confirm that with my PBPL v2.50, I need to invert the address and the control fields and to multiply the address by 2 to make I2CWRITE work. And from the experiments done this morning I know that I need to do the same thing for I2CREAD !

    Best regards

    MikeBZH / F8DFN
    Last edited by MikeBZH; - 11th January 2010 at 13:46.

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166

    Default

    MikeBZH, I hope you had a nice vacation in August... I have been currently using a pair of 24LC1025's to log data from my Solar Tracker which uses an 18F2620 running @ 40 Mhz. I have had no problem with them even in the below zero temperatures we have up here in Michigan...
    I do not compile with PBPL as I have used the internal flash to about 3/4"s of its capacity. It's nice to see you back...

    Dave Purola
    N8NTA

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. I2C slave
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2008, 04:46
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 14:55

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