Writing / Reading EEPROM 24LC256 Problem


Closed Thread
Results 1 to 5 of 5
  1. #1
    schmoddel's Avatar
    schmoddel Guest

    Default Writing / Reading EEPROM 24LC256 Problem

    Hi Picers,
    does anyone have experience in handling
    an EEPROM 24LC256 via I2C.
    I try writing / reading this device
    with:

    Example for write:

    i2cwrite sda1, scl1, $a0, 10, [STR date\10] 'Writes at starting position 10 the array date(10)
    pause 10

    i2cwrite sda1, scl1, $a0, 50, [amp1_port] 'Writes one byte to position 50
    pause 10

    Example for read:

    i2cread sda1, scl1, $a0, 10, [STR date\10] 'Reads at starting position 10 the array date(10)
    pause 10

    i2cread sda1, scl1, $a0, 50, [amp1_port] 'Reads one byte from posiotion 50
    pause 10

    Can somebody help?

    Best Regards, Ralf

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Question Also need help with I2C

    I think I have the same problem here.
    18F452 @ 20 Mhz
    44LC515 512K EEPROM
    the read returns $10 on the first position I write to
    Have tried all the speed defines but no luck.
    My tests are at location 3200 dec.
    Maybe someone will give us a clue....

    My code is:
    I2CWRITE , PortC.4. PortC.3, %10100001, WW, [$4E]
    PAUSE 10
    ---------------------
    where WW is 3200 decimal defined as a word var.

    tcbcats

  3. #3
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    35


    Did you find this post helpful? Yes | No

    Cool Found my problem

    Forgot to set...
    DEFINE I2C_SCLOUT 1

    You need to do this if you have no pullup resistor on the external EEPROM clock line.

    tcbcats

  4. #4
    schmoddel's Avatar
    schmoddel Guest


    Did you find this post helpful? Yes | No

    Default Some useful hints

    Hi there,
    some important things:

    1. The address must be a variable of type word

    2. Using the PIC over 8MHz the DEFINE I2C_SLOW = 1 must be set

    3. The command byte when reading from i2cbus is automaticaly incremented by "1"

    My EEPROM won't run in the moment, but i will find the mistake....

    Ralf

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    As mentioned in another thread I'm in the middle of a migration from 16F87x to 18Fxx2 and changing the crystal from 12MHz to 20 MHz.

    My experience is:

    DEFINE I2C_SLOW 1
    DEFINE I2C_SCLOUT 1

    does not solve the problem
    in addition a pull-up is required at least on the data line.

    I have put pull-ups on both the clock and data line and now it works fine.

Similar Threads

  1. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  2. Writing & Reading to iButton EEPROM
    By crhomberg in forum Code Examples
    Replies: 2
    Last Post: - 6th October 2008, 19:40
  3. Writing, Reading from Internal PIC EEPROM
    By NO2K in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th October 2007, 00:35
  4. Problem on writing EEPROM in Winpic800 with picbasic pro
    By selimkara in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 4th May 2007, 16:33
  5. reading, writing, and displaying from eeprom
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th January 2006, 22:05

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