EEPROM & I2C Page Write


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136

    Default EEPROM & I2C Page Write

    I'm using EEPROM chips 24LC512 with 64k bytes of storage.
    I want to erase (set all data to zero) the chips as quickly as possible.
    According to the Microchip spec sheets, a page write can be done:

    Control_Byte, AddressHi_Byte, AddressLo_Byte, DataByte_0, .....DataByte_127

    i.e. the chip will accept 128 bytes of data in one go when using page write.
    How do I do this in PBP:

    Address VAR WORD
    Blank CON $0
    I2CWRITE DataPin,ClockPin,$A0,Address,[STR Blank\128]

    Is this OK? Is there a better way?

    The chips and code work OK in 'non-page write mode'
    Sorry if this has been covered before but I can't find it.

    Regards Bill Legge

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


    Did you find this post helpful? Yes | No

    Default

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

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    966


    Did you find this post helpful? Yes | No

    Default

    CAUTION:

    You should ensure that you write a PAGESIZE worth of data to the EEPROM on a PAGE BOUNDARY. Writing at an arbitrary address within a page may lead to unforseen consequences as the EEPROM wraps around the lower address bits within the same page and may overwrite other data that may be present at those addresses.

  4. #4
    Join Date
    Nov 2007
    Location
    South-West of Australia. A small town called Denmark. 'Where the forest meets the sea.'
    Posts
    136


    Did you find this post helpful? Yes | No

    Default I2C Page Write

    Sayzer

    Thanks for the code - it works fine.
    I was concerned about the amount of memory that a 128 byte array would occupy?

    Jerson

    Thanks for the note about page boundaries


    Bill legge

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. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. HARDWARE I2C SAMPLE CODE question
    By Michael Wakileh in forum Code Examples
    Replies: 2
    Last Post: - 16th June 2009, 21:07
  4. Replies: 5
    Last Post: - 29th May 2008, 18:03
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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