I2CWRITE problem


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi Gusse,
    Your code does not loop, I am sitting here wondering if there is some latency in your hardware, causing your code to run ahead of the eeprom, so the code is finished before the eeprom has finished waking up . . . Maybe in Art's too . . BTW ART, I liked your talking clock, esp when it encounters an error
    Thanks for the comments , but I don't know what you mean by the code running ahead of the EEPROM.
    The code is posted above. Writing a bunch of zeros is not exactly what I want to
    achieve, but the code exhibits the problem I'm describing.

    I suppose at some point I'll run the same code on a breadboard and try adjusting things like clock speed, pull up resistor values, and see if that helps.
    PBP should compensate for clock speed though.

  2. #2
    Join Date
    Jan 2010
    Location
    morocco
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    HI art IM JUST TESTING IT ON AN OLD PIC F84A WITH 24C08 ITS WORKING WELL
    THIS MY CODE MODIFIED GUSSE CODE
    Code:
    PORTB = 0
    TRISB = 0
    X       VAR BYTE
    Y       VAR BYTE
    SCL     VAR PortB.0 
    SDA     VAR PortB.1   
    LED     VAR PortB.3
    
    I2CDeviceEEprom     VAR BYTE   
    I2CAddressEEprom    VAR WORD 
    I2CDeviceEEprom=$A0
    
    X=0    'OK if EEPROM content is 00h and X = 0, if X > 0 then fails
    MAIN:
    FOR I2CAddressEEprom = 0 TO 1024
        I2CWRITE SDA, SCL, I2CDeviceEEprom, I2CAddressEEprom,[ X ], Error			
        PAUSE 10
        I2CREAD SDA, SCL, I2CDeviceEEprom, I2CAddressEEprom,[ Y ], Error
        IF Y <> X THEN GOTO Error
        IF I2CAddressEEprom = 1024 AND X = Y THEN BLINK
    NEXT I2CAddressEEprom
    GOTO MAIN
    Blink:
    HIGH LED
    PAUSE 1000
    LOW LED
    PAUSE 1000
    GOTO Blink
    
    Error:
    HIGH LED
    PAUSE 200
    LOW LED
    PAUSE 200
    GOTO error
    
    END
    YOU HAVE TO MAKE SURE ABOUT EEPROM PULLUPS AND TRIS AND PORT SET THEM TO 0 OUTPUT
    JUST LOOK TO THIS CODE TO GET SOME IDEAS OR POST UR WHOLE CODE SO EVERYONES CAN HELP .
    REGARDS
    Last edited by MR2010; - 26th January 2010 at 08:00.

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Art View Post
    Thanks for the comments , but I don't know what you mean by the code running ahead of the EEPROM.
    The code is posted above. Writing a bunch of zeros is not exactly what I want to
    achieve, but the code exhibits the problem I'm describing.

    I suppose at some point I'll run the same code on a breadboard and try adjusting things like clock speed, pull up resistor values, and see if that helps.
    PBP should compensate for clock speed though.
    Hi Art,
    I was thinking, in Gusse's case, the pic might blather out a bunch of commands before his eprom was awake, since he is using an OFF PIC eprom, and maybe the eprom just missed it due to the difference in boot rates. I was thinking a short pause during initialization might allow eprom to catch up . . . as I said, I was just thinking.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. My I2CWRITE - timings and tricks
    By FinchPJ in forum Code Examples
    Replies: 5
    Last Post: - 3rd March 2008, 21:40
  2. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th June 2006, 20:03
  3. Problem with I2Cread and I2CWRITE function
    By Tony85 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th June 2006, 18:32
  4. Another I2CWRITE problem
    By ErnieM in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th May 2006, 21:57
  5. I2CRead / I2CWrite Problem?
    By koossa in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st October 2005, 18:26

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