I2CREAD doesn't send stop bit


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Default I2CREAD doesn't send stop bit

    Hello!


    I'm facing problem with i2cread function.
    Seems that pic is not sending "STOP" code after "NOT ACK" code and reading continues.
    So, without proper stop bit its impossible to start new i2cread sequence(second doesn't work at all)
    Doesn't matter if its STR function or just one variable
    eeprom is 24c32
    i2c_dev is BYTE
    i2c_addr is word

    Here is the "read" code->



    serial_read:


    i2c_dev = $A0
    i2c_addr = 3
    I2CREAD porta.6, porta.7,i2c_dev,i2c_addr, [str line1\2]




    i2c_addr = 19
    I2CREAD porta.6, porta.7,i2c_dev,i2c_addr, [str line2\2]


    return


    Can anyone help?

    Thank you!

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    Your code looks ok with the exception of a PAUSE 10 between the two reads. Do you have the CLOCK and DATA pins pulled up?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    Thank you for fast reply!

    It's impossible to get to second read line because is no stop bit at first.
    Code works but doesn't stop.
    Example:
    if i'm reding from adress "X" and i want to read 1 field , because lack of stop bit reading continues until bit 5 from "X+6" address and no chance for second read line to work correct(pause between is irrelevant).
    All values that was read in the faulty process are correct.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    I must be missing something in the translation.
    How do you know it does not stop reading? Where is it reading to?

    Might be a good idea to post your code.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Oct 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    PicSimulator I2C eeprom have nice diagnostic where you can follow bit by bit transfer and whole reading sequence.
    I have Line1[10] and Line2[10] arrays that i'm displaying on 20x2 LCD.
    I think i will try with other EEPROM maybe 24c04.

    Thank you!

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    Never trust a SIM.
    And if I am not mistaken, PicSimulator is for the other PicBasic, not PicBasicPro..
    Exactly what are you using? Proton? PBP?
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Oct 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: I2CREAD doesn't send stop bit

    I'm using PBP.
    Thank You!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts