-3
\$\begingroup\$

I'm working in PIC24F I2C. I'm just writing and reading data on the eeeprom. I've cleared about the slave address (eg: 0xA0), writing mode address(0xA0 | 0x00) and reading mode address(0xA0 | 0x01), but there is another two are there low byte address and high byte address. I think without these low byte and high byte address i can't write and read the data. I don't know what address i've to assign for the low byte and high byte address? Actually, what is the purpose of these address?

Thanks...

\$\endgroup\$
4
\$\begingroup\$

The high and low byte address are the physical address of the data on the EEPROM chip (not the address of the chip itself which can be 7 or 10 bits and comes first). The high and low byte are combined to make the full address (see diagram below). For instance if the chip has 1024 bytes of storage, then the maximum address is high byte: 00000011 low byte: 11111111. To store a byte of data at location 1, you would use H: 00000000 L: 00000001. If the chip has 256 bytes or less, then there will only be the low byte needed.

Check out some EEPROM datasheets and I2C tutorials to get the hang of it all, here's the 24XX01 datasheet to get you started.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Hi @Oli Glaser thanks for the reply. Is that i have to mention the high and low byte address for read operation? \$\endgroup\$ – user6161 Sep 16 '15 at 15:40
  • \$\begingroup\$ Im just trying to write and read only one character in the eeprom. \$\endgroup\$ – user6161 Sep 16 '15 at 15:45
  • \$\begingroup\$ You MUST tell the EEPROM which of its many bytes you want to read or write by giving that byte's address in the Address High Byte and Address Low Byte bytes in the I2C message. \$\endgroup\$ – Peter Bennett Sep 16 '15 at 16:00
  • \$\begingroup\$ Yes, as Peter says you must provide an address for writing and reading. If it's only one character then the choice is arbitrary - pick from any of the address range (for simplicity I'd just pick location 1) Just think of the address as a "box number" where your byte is stored. \$\endgroup\$ – Oli Glaser Sep 16 '15 at 16:05
2
\$\begingroup\$

This is a guess, but I think you are confusing the EEPROM IIC address with addresses of locations within the EEPROM. You send the IIC address in the high 7 bits of the first byte of the IIC message. The meaning of subsequent bytes are then defined by the EEPROM. To read and write EEPROM bytes, you have to somehow tell the EEPROM which bytes you want to access. If the EEPROM contains more than 256 bytes, it will require at least two bytes to communicate this address. That's probably what the "high" and "low" address bytes are.

\$\endgroup\$
2
\$\begingroup\$

EEPROM you are using is addressed using 16 bit addressing, say 0x1234. and I2C at a time can send only 8 bits of data. So, You have to break that 16 bit address in two parts - "High" and "Low".

So address 0x1234, You will send as "0x12" (High) first and then "0x34" (Low).

0xA0 is address of EEPROM on I2C bus and 0x1234 is address of memory location in EEPROM.

Unless and until you provide address, You cannot read or write because EEPROM won't know from WHERE it has to read/write.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply. Is that eeprom has specific address of memory location? My eeprom is "BR24G256-3". \$\endgroup\$ – user6161 Sep 16 '15 at 15:33
  • 1
    \$\begingroup\$ @IMGP007 No.. It's your Choice... You can write from 0x0000 to 0x8000... That's because 256Kbits... You have to decide where you want to store which data \$\endgroup\$ – Swanand Sep 17 '15 at 6:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.