Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How is EEPROM Addressing? (AT24C256)

Status
Not open for further replies.

fatehi

Newbie level 2
Joined
Oct 8, 2007
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,304
avr with at24c256

Hi all,

I'm using AT24C256 (Atmel's 256K EEPROM) but I can't understand its addressing.
The datasheet says:

Memory Organization:
The 128K/256K is internally organized as 256/512 pages of 64 bytes each.
Random word addressing requires a 14/15-bit data word address.

I'm using BASCOM-AVR to program an ATMega16; and my EEPROM_READ(pgNo,Addr) function body is as following:

Code:
   I2cstart                                         'generate start
   I2cwbyte EEPROMAddrW                 'slave adsress for writing
   I2cwbyte Pgno                               'PageNumber
   I2cwbyte Addr                               'Address
   I2cstart                                         'repeated start
   I2cwbyte EEPROMAddrR                 'slave address for reading
   I2crbyte memvalue , Nack             'read byte
   I2cstop                                         'generate stop
PgNo (as byte),Addr (as word),EEPROMAddrW (byte constant),EEPROMAddrR (byte constant) and memValue (as byte) are variables.
It works fine but PgNo can be numbers from 0 to 255 and Addr can be 0-65535.
I don't know PgNo and Addr valid ranges.

Another question: 512(pages)*64(bytes)=32KBytes not 256KBytes!

Thanks a lot
A.B.Fatehi
 

hassenman

Advanced Member level 4
Joined
Nov 29, 2004
Messages
117
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,298
Activity points
912
eeprom addressing

Hi fatehi,

The AT24C256 is a 256 KBits memory and not 256 Kbytes.

So 256 Kbits = 32 Kbytes = 512(pages)*64(bytes).

I can't answer your first question (i'm not familiar with BASCOM-AVR), but there is basically 2 difrent ways to adress such an EEPROM through a compiler.

Either you use a direct 15 bit adress, or you mention the PgNO and the adress within that page (the compiler will do the convertion for you).

It will also depend on whether you're dealing with Byte write mode or Page write mode.

Regards,
Hassen.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top