Trouble with I2C - Part 1


Results 1 to 5 of 5

Threaded View

  1. #3
    Join Date
    Nov 2008
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Hey Darryle, thanks for the response.

    Well ..... One of two things, I either don't completely understand your answer or I don't think that's what I'm seeing. Let me walk through it.

    >The I2C Control, is what the MAX calls Address

    Looked at that in more detail, Okay, I agree.

    If the I2C Value, is what Max calls Data then I agree by default that:

    >The I2C Address, is what the MAX calls Command

    So according to the PBP statement:

    I2Cwrite DataPin, ClockPin, Control, Address, Value

    The equivalent Max(imized) statement should be:

    I2Cwrite DataPin, ClockPin, Address, Command, Data

    Which is what you entered when you wrote:

    >Here's what it should look like without changing the variable names.

    And when I put it in that way ....... it ... ahhh .... works! ..... jeez.

    Okay, thanks, I had to walk myself through that. Also, it solved another problem I was seeing but won’t get into here.

    If I might add something else I'm seeing. If I write:

    I2cwrite PortA.6, PortA.2, Address, Command_NVreg, Data_M
    pauseus 100
    I2cwrite PortA.6, PortA.2, Address, Command_NVreg, Data_M
    pauseus 100
    I2cwrite PortA.6, PortA.2, Address, Command_NVreg, Data_M

    For simplicity write 80h to NVreg 21h on slave 29h three times.

    What I see is that the first write statement executed fine:


    However the second write was incorrect:


    And the third was correct:


    This continues on and on and on ....

    What apparently is happening is that the master isn't initiating a Stop sequence and the SCL line stays low .... apparently looking for the next Data Byte (?) ........ which it gets at the start of the next write, but we're trying to write the same thing again.

    Anyway, then a proper Stop sequence is initiated and we're back to normal for the next Write.

    Right around 1.2 mS where the Stop sequence should be SCL goes low before SDA goes high to initiate the Stop sequence.

    Best regards,
    Mark
    Last edited by munromh; - 17th November 2008 at 19:13.

Similar Threads

  1. Thermo 7 segments - little problem
    By fratello in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 27th July 2013, 07:31
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  3. 32 bit square root
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 6th May 2009, 03:37
  4. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 12:19
  5. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 14:23

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