I2CRead problem


Closed Thread
Results 1 to 10 of 10

Thread: I2CRead problem

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795

    Default I2CRead problem

    Very strange problem.

    Executing an I2CRead command does only I2CWrite as it is shown on the Logic capture.

    This is my test code for an 24C64 EEPROM

    Code:
    DEFINE I2C_SLOW 1
    b1  var byte
    b2  var byte
    addr VAR word
    cont CON %10100000
    data_pin  var porte.0
    clk_pin     var porte.1
    
    addr = 0
    ' Read data at address 0 into B1,B2
    I2CREAD data_pin,clk_pin,cont,addr,[b1,b2]
    stop
    Any ideas?

    Ioannis
    Attached Images Attached Images  

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380


    Did you find this post helpful? Yes | No

    Default Re: I2CRead problem

    can we see the whole transaction , an i2c read needs to do a write to set address and then a restart to read . you have not shown enough
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: I2CRead problem

    Thank you Richard. Will do that this evening.

    I tried byte read, word read, page read, Nothing works and all var's are just a zero.

    The chip is a 16F1939 but I am sure this does not matter. Logic analyzer shows I2C activity either way.

    Edit:

    OK, now that is weird. On a 45K22 works just fine. On 1939 not...

    Ioannis
    Last edited by Ioannis; - 18th October 2018 at 14:22.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: I2CRead problem

    I am very embarrassed...

    I forgot completely ANSELD and ANSELE when testing it...

    Ioannis

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,380


    Did you find this post helpful? Yes | No

    Default Re: I2CRead problem

    I forgot completely ANSELD

    Another good reason to migrate to xc8 , mcc gives all pin settings/names and function in one easy to use screen
    Attached Images Attached Images  
    Warning I'm not a teacher

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,795


    Did you find this post helpful? Yes | No

    Default Re: I2CRead problem

    It is not easy to me. I detest C lanquage. Despite my efforts so far, I did not managed to flip over.

    It looks very cryptic...

    Ioannis

Similar Threads

  1. Problem with I2Cread command for an 32 bits ADC
    By Pilou81 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th October 2011, 16:32
  2. Need help to get I2CRead woriking
    By w7ami in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th November 2007, 17:22
  3. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th June 2006, 21:03
  4. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2006, 19:32
  5. I2CRead / I2CWrite Problem?
    By koossa in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st October 2005, 19:26

Members who have read this thread : 1

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