EEPROM Burner
EEPROM burner, in other words EEPROM programmer.
A ROM is made for only reading so the name Read Only Memory, but to read the contents of the memory we must program it in advance.
Therefore PROM (Programmable ROM)came into existence, which can be programmed only once either by the manufacturer or the user, later to overcome the problem EPROM and EEPROM were developed which are Erasable PROMs and Electrically Erasable PROMs.
EEPROMs are mainly used in embedded field to store program memory of a Micro-Controller or for some other logic circuits.
One of the most common EEPROM is 28C16, 28C64 etc., here i'm using 28C64 which is 8K*8 bits or 8KB having
13 address pins to access all 8KB
8 data bits since memory is Byte addressable
CE - chip enable(active low)
OE - output enable(active low)
WE - write enable(active low)
For datasheet click here.
Getting to Know How EEPROM Works
From the datasheet of 28C64, to program a EEPROM, the address must be specified of the content before buffering the data on data pins by enabling chip(CE) and disabling output(OE).
Then after some delay the WE(write enable active low) must be pulled low, only then the content gets stored in the memory.
The timing diagrams are shown, the OE, CE, address pin timings are not as critical as WE timings.
WE must be pulled low for a time less than 1000ns.
What Are We Programming?
Here we are burning a lookup table for a 7 segment display into the EEPROM.
A 7segment display has obviously 7 pins(excluding the decimal point).
all we have to do is, for every address value from 0 to 255 we have to store the respective display value into the EEPROM.
eg. lets say you want to display "2" on 7segment display for address value 0x2.
"2" on 7segment display corresponds to "1101101" in binary when its pins are arranged in a b c d e f g manner where a is most significant and g is least significant.
therefore we have to store "1101101" at address 0x2.
similarly for other input address values its corresponding lookup value can be stored according to the programmers wish.
Arduino Code
Here i'm using a Arduino mega 2560, you can use any other micro controller as long as it has enough I/O pins.
As mentioned we need 8 data pins, 8 address pins(for 256 Bytes), WE so totally 17 digital pins.
I'll make another Instructable on EEPROM burner using multiplexing concept which reduces number of I/O pins significantly. anyways lets get into the code
1. declaring the pins
int a_pin[] = {22,24,26,28,30,32,34,36,38,40};
int d_pin[] = {5,6,7,8,9,10,11,12};
const byte WE = 3;
2. these are the decimal equivalent values for the 7segment binary bit values
int disp[10] = {126,48,109,121,51,91,31,112,127,115};
here 126d corresponds to "0", 48d is "1", 109d is "2" and so on..
3. a delay value
const int d = 100;
4. The void setup()
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
for(int i=0;i<13;i++) pinMode(a_pin[i], OUTPUT); //address pins
for(int i=0;i<10;i++) pinMode(d_pin[i], OUTPUT); //data pins
pinMode(WE, OUTPUT);
Serial.begin(9600); //starts the serial communication
5. going through all address values staring from 0x0, here i'm using "0x" reference for hexadecimal and "d" for decimal numbers.
for(int addr=0;addr<256;addr++){ //go till address 255
for(int addr_bit=7;addr_bit>-1;addr_bit--){
if(bitRead(addr, addr_bit) == 1) digitalWrite(a_pin[addr_bit], HIGH);
else digitalWrite(a_pin[addr_bit], LOW);
}
/*bitRead(value, nth_bit) is a built-in function which converts any kinda number to binary,it has two arguments, first argument is the value to be converted, second argument is the nth bit to be returned*/
6.after the address is out in address pins, its right time to buffer the data at data pins
for(int data_bit=7;data_bit>-1;data_bit--){
if(bitRead(disp[addr%10], data_bit) == 1) digitalWrite(d_pin[data_bit], HIGH);
else digitalWrite(d_pin[data_bit], LOW);
}
Serial.print(addr%10);
Serial.print(" ");
digitalWrite(WE, LOW);
delayMicroseconds(1); //pulse of 1000ns at WE (active low)
digitalWrite(WE, HIGH);
delay(d);
}
/*dont forget to enable the Chip and disable the Output while programming*/
get the code from Here.
Testing the Contents
once programming the contents, just make OE(active low) low so that EEPROM outputs stored contents and start giving address values starting from 0x0 to 0xFF and check the contents visually or any other way.
This can be done by just removing the data pins from arduino and let the arduino start sending address values, this should verify the contents you just programmed.
Some more stuff you can do other than just boring 7segment display!!
1. Multiplexing three 7segment with single EEPROM. download the code if you want from Here. and schematics from Here.
2. A crapy Music player using a basic ADCs, DACs, uC (coming soon in next upcoming instructables).
3. As a storage device to store sensor values in EEPROM.
4. As a code memory extension for a micro-controller.