Using a Parallel EEPROM / RAMPosted: February 15, 2009
The first question that comes to your mind :
What is an EEPROM?
To cut it short , EEPROM is a memory device , similar to the memory stick in your cell phone or camera.
The Pin layout of an EEPROM is very similar for most Static RAMS. So once you know how to program an EEPROM , you also know how to program RAM.
So lets get started.
Before knowing how to use an EEPROM , you have to know how it organizes its data.
The EEPROM is divided into 8912 “houses” with eight rooms in each house. You are allowed to store either a 1 or 0 in each room.
When you wish to write some data to the EEPROM , you have to specify the address of the “house” where you want to store your data.
(Did you ask yourself why the number of “houses” is something as arbitary as 8912? Its because 2^13 is 8912. And there are 13 Address choose pins on the IC.)
Then , using 8 input pins , you have to give 8 values which will be stored in the eight “rooms” of selected “house”.
The procedure is very similar when you want to read the data back.
Again , you will have to select the address of the “house” and the 8 values in the eight rooms will appear through the output pins.
If add up the total number of pins : 8 for input +8 for output + 2 for power + 13 for address + 3 control pins
= 34 pins!!!
So to reduce pin count , Manufacturers have combined the Input and Output pins and made them into a single set of 8 I/O pins. This makes it a bit tougher to use the IC as both the functions have to be done by the same set of pins.
The Procedure :
EEPROMs have 3 control pins : CE (Chip Enable) , WE (Write Enable) , OE (Output Enable)
This truth table should make it pretty clear how the 3 pins work :
|0||1||1||Outputs are Tristated|
|1||0||0||Chip Disabled – Outputs are Tristated|
|1||0||1||Chip Disabled – Outputs are Tristated|
|1||1||0||Chip Disabled – Outputs are Tristated|
|1||1||1||Chip Disabled – Outputs are Tristated|
Here’s the explanation :
The Chip can Read/Write only when CE is low. If CE is held high , then the chip is disabled and the I/O pins are tristated.
When CE is LOW, OE is low and WE is held high , the data in the memory location chosen by the address pins , appears at the I/O pins.
On a new EEPROM which has never been programmed before , all the memory locations are programmed with 1′s by default. So , while reading from a new EEPROM , you will see only 1′s in every memory location.
To write , input the 8 bits that you wish to write at the I/O pins while holding OE high and WE low. Then raise WE to high and then back to low again. Then , the data that you have given on the I/O pins will be written on the rising edge of the pulse to the address that is present on the address pins at the rising edge.
The waveform will be like this :
So , if you have not understood from the above waveform , let me make it very clear.
This is the way to manually write to an EEPROM :
1) Hold OE and CE low and WE high – Read Mode – Whatever is in the location determined by the address pins will appear at the I/O pins.
2)Hold CE Low, OE high and WE high – I/O pins are tristated – disconnect the output leds (or whatever) from the I/O ports
3)Hold CE low , OE high and WE low – Write Mode – Give the data to be written at the I/O port and the address where you want it to be written at the address pins.
4)Hold Ce low ,OE high and WE High – I/O pins are tristated AND data is written – Disconnect the Switches or wires that you used to give data to the I/O port.
5) Hold CE and OE Low and WE high – Read Mode – You are back to step 1. Whatever is in the location determined by the address pins will appear at the I/O pins.
The procedure is same for RAMs as well. The only difference between EEPROMs and RAMs is that RAMs lose whatever has been written when the power is turned off , but EEPROMs dont.
There are many EEPROM and RAM ICs available. The EEPROM that i generally use is AT28C64B from Atmel. It is available at around 100 INR (~2$) here in bangalore. The cheapest RAM IC is 6264 which is available for 35 INR (0.7$)
The writing procedure that i have described above is rather crude. There are better ways of writing to the same EEPROM. But , this is best way if you are using the EEPROM by giving CE ,WE, OE signals by hand.