How to program an EEPROM

An EEPROM (Electronically Eraseable and Programmable ROM) is a ROM chip which can be erased and re-programmed a virtually unlimited number of times, without expensive or time-consuming erasing processes (as with a regular EPROM). In fact, an EEPROM can have single bytes within it changed on-the-fly, while a plain EPROM needs to be completely blanked out before it can be re-programmed. This makes EEPROM almost like RAM, and indeed, some people use EEPROMs in this way, although it is not really appropriate as a computer's basic RAM, simply because EEPROM is much slower than almost any type of RAM in use today; Using an EEPROM chip as your computer's RAM will require it to be unusually slow.

But an EEPROM works great for when you need bootstrap code for a small, home-made computer project. The EEPROM is actually surprisingly simple to program; In fact, I find EEPROMs among the easiest to understand chips of all that I use, barring simple one-function chips like the 7400 series. Thus far, I have worked mainly with the 2865 EEPROM, which I have found to do a pretty good job of almost everything I need it to do; My only complaint has been that sometimes it seems to have a bit of trouble storing a new value, as often the value gets corrupted when I try to write it into the chip. This may have something to do with my crude programming techniques: EEPROMs aren't really made to be programmed by hand, they're meant to be programmed in a dedicated chip burner, which is a multi-hundred-dollar device which many people can't justify for a simple hobby. And so, this page intends to tell you how to program your EEPROM by hand.

There are three special "Enable" pins on the EEPROM: CE (Chip Enable), OE (Output Enable), and WE (Write Enable). CE simply activates the chip (if CE is not enabled, the EEPROM will do nothing). OE makes the chip output a byte, and WE makes the chip program a byte into itself. When you are programming an EEPROM, you want to keep CE enabled the whole time, so tie CE low. (Because all three of these Enable signals are active-low; At least, they are on the 2865.) You also want to keep OE disabled the entire time, because you are not having the EEPROM output any bytes; Rather, you are programming bytes into it, so leave OE disabled: If it is active-low, tie it high to disable it. That leaves WE; Leave WE disabled for now.

The next thing you need to do is turn your EEPROM on. Connect its power pins to a power supply. (For the 2865 chip, that would be pins 14 and 28.)

The biggest step is to actually program the byte. First, configure the EEPROM's address and data buses to indicate the byte you would like to store, and the address you want to store it in. For example, to store the value 80 in the very first byte of the EEPROM (which is address 0), you'd tie all the address bus pins low (which means logical zero), so the address is set to 0. Then you'd set the data bus pins to the binary representation of 80, which is 01010000. Remember that bit numbers are read from right to left, not from left to right, so in this example, the first four data bus pins should be 0. (The second data bus pin should NOT be 1; Only the fifth and seventh will be 1.)

Once you have set up the address and data buses, the only thing left to do is cycle the WE pin to actually write the byte. Send WE low for a moment (assuming it is active-low), then put it high again. If the EEPROM is working properly, you have now stored your byte, and you can later examine it with OE. On the 2865 (and many other EEPROMs), there is a READY/BUSY pin, which is an output from the EEPROM which indicates when the chip has finished writing to itself and is ready to accept more input. If you are programming the chip using an automated machine, the speed of the EEPROM may be a factor, but when programming it by hand, this is not likely to matter much, since the EEPROM stores new values into itself in quite a bit less than one second, so I always ignore the READY/BUSY pin.

Back to the electronics section

Back to the main page