AVR has an inbult EEPROM. Here we are trying to interface that EEPROM .We are using the EEPROM to write a data on the EEPROM and then read back the EEPROM and display the data in our LCD. The AVR AT Mega 16 has an EEPROM of 512 bytes and needs and addressing of 10 bits.
EEPROM stands for Electrically Erasable Programmable Read Only Memory. This is a non-volatile memory which means any data which will be written to the EEPROM will remain in the memory even when no power is supplied and it can be read at any time to retrieve the data.
The registers associated with EEPROM of the AVR are
EEAR : EEPROM Address Registers
The EEPROM module needs a 9 bit address to access the 512 Bytes of memory. So the address Register is divided into two registers the EEARH and EEARL for high and low bits.
Bits 15 to 9 are reserved
Bits 8 to 0 are R/W bits and are used to specify the location where the data is to be written or the data has to be read from.
The EEDR is the EEPROM data register and any kind of value can be written. This register value will be written to the EEPROM.
This is the EEPROM Control Register.
Bits 7 to 4 are reserved.
EERIE : The 3rd bit is EEPROM Ready Interrupt Enable. Writing EERIE to one enables the EEPROM Ready Interrupt if the I bit in SREG is set.Writing EERIE to zero disables the interrupt. The EEPROM Ready interrupt generates a constant interrupt when EEWE is cleared.
EEMWE: EEPROM Master Write Enable. This bit must be made 1 to write data to the EEPROM
EEWE: EEPROM Write Enable. To write data to the EEPROM this bit must be made 1 but only after EEMWE is made 1.
EERE: EEPROM read enable. This bit must be made 1 to read from the AVR.