I2C Read/Write problems


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JD123 View Post
    No. it doesn't. PBP handles the R/W bit for us. We still have to give it the correct address, formated to the device address byte. That's why you send %10100000 and the reciever "sees" %01010000 as the device address.
    Ok, I'm smelling what your cooking... I'm pickin' up what you're layin' down...
    (what happens if we overclock that same PIC to 50Ghz to get really fast I2C? )

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Wow... lots of help... I'm attempting to get the read to work, using $20 for the control byte. I'll see what I can do... eventually I want to be able to read and write registers using the LCD screen as sort of a 'menu' guide, and using my last to ports as button inputs.

    EDIT:

    Can anyone give me an idea as to why the clock is so far off? The book says 400KHz devices are accessible if the clock is above 8MHz (I'm using 20), but my clock is at 122Khz. The manufacturer of the board said this wasn't a problem so long as the PIC supported 'clock stretching'.

    If anyone is interested, what I'm trying to connect to is an 'Open Servo' board.
    Last edited by Dispersion123; - 3rd April 2008 at 06:20.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dispersion123 View Post
    Can anyone give me an idea as to why the clock is so far off? The book says 400KHz devices are accessible if the clock is above 8MHz (I'm using 20), but my clock is at 122Khz. The manufacturer of the board said this wasn't a problem so long as the PIC supported 'clock stretching'.
    See Post #2...
    400Khz is the MAXIMUM for most fast I2C devices. It's not neccessarily the speed that the PIC is communicating to said I2C device. I2CRead/I2CWrite are software, 'bit-banged' commands, not hardware.
    If you ran your PIC clock at 40Mhz vs. 20Mhz, the I2C clock may very well jump up to 244Khz.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by skimask View Post
    See Post #2...
    400Khz is the MAXIMUM for most fast I2C devices. It's not neccessarily the speed that the PIC is communicating to said I2C device. I2CRead/I2CWrite are software, 'bit-banged' commands, not hardware.
    If you ran your PIC clock at 40Mhz vs. 20Mhz, the I2C clock may very well jump up to 244Khz.

    Hi, Ski

    You forget the 24 FC series ... @ 1Mhz !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Ski
    You forget the 24 FC series ... @ 1Mhz !!!
    Alain
    Don't they call those 'HIGH' speed, a bit like USB? Slow, Fast, High?

  6. #6
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dispersion123 View Post
    Wow... lots of help... I'm attempting to get the read to work, using $20 for the control byte. I'll see what I can do...
    Here's the $24 million dollar question:

    Does the documents for the slave IC say send address $10 or does it say that its address is $10.

    So far as the clocking speed, there can be pulses that come close to 400k being send out, but that's just for a short period of time. The clocking speed will most likely vary in speed depending on what's being done. BTW, how are you reading the clocking speed? O-scope or frequency counter?
    Last edited by JD123; - 3rd April 2008 at 16:28.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  7. #7
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Mr.E., cute program you got there.

    See in the program where you enter "1010000" for the address? That's $50 for the address.

    Any who, I think everyone's got the idea, in agreement or not. I just took the O/P literally for the words he used and opened a can of do-do. Sorry.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by JD123 View Post
    Mr.E., cute program you got there.

    See in the program where you enter "1010000" for the address? That's $50 for the address.
    OK i see what you mean... $A0 is the ControlByte (Controlword or slave address depending of the document you have on hand... says datasheet) but yeah $50 for the address... this said, i don't remember to have any issue with any datasheet using what they said, whatever how they call it maybe why i didn't understood your point

    We still don't see the O/P datasheet or part#... weird eh?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Dispersion123, how's it coming, reading the 2 bytes?
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  10. #10
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Ok, I'm smelling what your cooking... I'm pickin' up what you're layin' down...
    (what happens if we overclock that same PIC to 50Ghz to get really fast I2C? )
    50Ghz? Don't know, but I think you can use the IC as a hot-plate to keep your coffee warm.
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

Similar Threads

  1. I2C Master/Slave 16F88/16F767 working code
    By DanPBP in forum Code Examples
    Replies: 2
    Last Post: - 23rd October 2012, 22:31
  2. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  3. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  4. I2C slave
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th March 2008, 03:46
  5. Please help with i2cslave i2c slave
    By cycle_girl in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st December 2005, 13: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