addressing 16K eeprom ??

Discussion in 'Embedded Systems and Microcontrollers' started by hadeedunhaad, May 14, 2011.

  1. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    I'm interfacing 8052 with 24c16 eeprom. Everything works in charm, suddenly a new problem popped up. I can't address the memory location after 0ffh (255 bytes), for that i need more than 8 bits address. And i tried the following code, in which the 16 bit address is written to the DPTR.
    But it doesn't seems to be working. All the subroutines in the below code works perfect.

    Can any one point me where exactly am i committing mistake ?


    Code ( (Unknown Language)):
    1.  
    2. read_data:
    3.                 acall I2C_start
    4.                 mov a,#0ah                 ; address of the I2C device
    5.                 acall send_data
    6.                 mov a,dph                   ; location address
    7.                 acall send_data
    8.                 mov a,dpl                    ; location address
    9.                 acall send_data
    10.               ; acall I2C_delay
    11.                 acall I2C_start
    12.                 mov a, #0a1h
    13.                 acall send_data
    14.                 acall  get_data
    15.                 acall I2C_stop
    16.                 ret
     
    Last edited: May 14, 2011
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The 24C16 uses the device pins 1, 2, and 3 to specify which of the 256 byte blocks you are addressing. There are eight 256 byte blocks within the part.

    hgmjr
     
  3. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    oh ! is it ? I just knew that A0, A1 & A2 are used as device addresses to support multiple devices on the same bus, and since At24c16 doesn't support this all these pins are grounded.

    yeah ! i found something now. How did i missed this para ? i found it in its datasheet.

    [​IMG]

    Thank you. I shall get back if i face any further troubles, let me check whether i can read all places well.
     
  4. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    but still Eight 256 byte will make only 2k. (8x256=2048). So how can we access the rest of the 14k ??:confused:
     
  5. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    from what the data sheet says below,

    [​IMG]

    128 x 16 = 2k ; so what i understood is that only 2K is possible to be addressed, and innorder to address the next 2k part, the combination of 1,2,3 of the eeprom need to be changed, and the total combinations possible are 8.
    Hence 2k x 8 = 16 k. That sounds ok. Am i correct ?

    if so my question repeats, how can i address the first 2k where i need more than a byte address which i tried (the code posted above) and found to be not working ?
     
  6. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The 24C16 is not a 16K by 8-bit device. The 16K refers to the total number of bits in the device. In other words, what you have is a device with a total of 16384/8 or 2048 bytes of memory. In a 2048 byte memory you have eight 256 byte banks. That means the 3 pins (B0, B1, & B2) on the device (in the case of the 24C16) permit you to address each of the eight 256 byte banks uniquely.

    hgmjr
     
  7. mehtadhaval

    New Member

    Sep 21, 2007
    9
    0
    1). AT24C16 contains a total of 2KByte memory
    2). For AT24C16, A0, A1 and A2 pins are "No Connect"
    3). To access addresses beyond 255, you will have to select Memory Page. For that, whn you are transmitting the 0101 sequence, after that, the 3 bits (known as P2, P1, P0) selects the Page. For example, if P0 = 0, P1 = 0, P2 = 0, then address 0x00 will access memory location 0x00. But, when P0 = 1, P1 = 0, P2 = 0, then address 0x00 will access memory location 0x100 (256).
     
  8. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    that was shocking , i never expected such a twist.
    In my project i need atleast 18,000 bytes for data storage, ie roughly speaking 18KBytes. In that case which chip would you recommend me to go with ? I need I2C device and low cost. Waiting for your advice.

    Thank you 'hgmjr' and 'mehtadhaval' for your very valuable and on time information.
     
  9. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    Take a look at the 24LC256 from Microchip. It has an I2C interface and is a 32K x 8 device. If all you need is 16Kbyte then go for the 24LC128.
     
  10. hadeedunhaad

    Thread Starter New Member

    Apr 22, 2011
    24
    0
    thank you, i'm on my way to by 74LS256.

    Great ! thank you all
     
  11. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    I trust you meant to type 24LC256 rather than 74LS256 as that part is a dual 4 bit latch!
     
Loading...