Using 24LC65 eeprom


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    15

    Default Using 24LC65 eeprom

    I am trying to read and write to a 24LC65 eeprom.
    I have checked all the hardware and its fine.
    Something in my routine must be wrong.
    The first 12 memory locations do not contain what I wrote to them
    and only get 255 for the rest. Seems it is not writing properly.
    I have read through the data sheet form Microchip
    but I must have missed something.
    To be honest, its a bit too technical for me.

    Code:
    scl var PORTC.3
    sda var PORTC.4
    addr var byte
    y1 var byte
    x1 var byte
    start:
    addr = 0
    loop:
    
    lcdout $FE, 1, "Eeprom Data ", #addr, " ", #y1
    
    x1 = 255 - addr
    i2cwrite sda, scl, $A0, addr, [x1]
    pause 20
    i2cread sda, scl, $A0, addr, [y1]
    addr = addr +1
    pause 500
    if addr =100 then goto start
    
    goto loop
    Anybody want to leave me a clue as to where to go from here?

    Wilson

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Thumbs up

    Yes!

    Use the search-function in this forum.
    A lot of guys has already solved your problem !

    Inside the manual you find the behavoir of the I2CWRITE-command. It only sends 1 byte of adress if you give him a byte-sized variable. You must declare your adresscounter as a WORD !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Try WRITE control byte as %10100000 or $A0

    and

    Try READ control byte as %10100001 or $A1.


    ----------------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    Join Date
    Sep 2007
    Location
    Australia
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Thanks.
    Changed to addr variable from Byte to Word and its now okay.

    Wilson

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. How to define constants that specify eeprom addresses
    By DwayneR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th December 2009, 04:07
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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