robtillaart:
Thanks for sharing!Can you post the final Arduino code too?
Can tell what EEPROM's you can write and how you connected them?
I used an Atmel AT28C64, but using a datasheet you should be able to modify the code to make it work with any other parallel EEPROM. The connections are pretty simple just check my code, one important detail: I added a pull-up resistor to WE because when the Arduino resets the i/O pins go to a high impedance state and the WE pin will pick up noise and you might end up using data loss (Not sure if this explanation is correct, but adding a pull up resistor somehow fixed the weird data corruption when resetting the arduino). For the rest it is just direcly connecting the pins of the EEPROM to the arduino pins(check my code)
Here's the full read and write code, but before you use it, download a datasheet and try it out yourself, you'll learn a lot and it'll give you a feeling of accomplishment.
/*
EEPROM Chip Reader
*/
#define memsize 8192
int STS = 13; // Status Indicator
int AP[13] = {24,26,30,32,36,38,42,44,48,50,47,51,53};
int AD[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
int DP[8] = {23,25,29,31,35,37,41,43};
int DD[8] = {0,0,0,0,0,0,0,0};
int CE = 6;
int OE = 4;
int WE = 2;
int i;
int j;
int D;
int A;
void setup()
{
Serial.begin(9600);
D=0;
for (i=0;i<8;i++)
{
DD[i] = 0;
}
// Setup Control Pins
pinMode(CE, OUTPUT);
pinMode(WE, OUTPUT);
pinMode(OE, OUTPUT);
// Disable Chip, and disable read and write.
digitalWrite(WE, HIGH);
digitalWrite(CE, LOW);
digitalWrite(OE, HIGH);
Serial.println("Reading EEPROM...");
pinMode(STS, OUTPUT);
digitalWrite(STS,HIGH);
// Setup Address Pins
for (i=0;i<16;i++)
{
pinMode(AP[i],OUTPUT);
}
// Setup Data Pins
for (i=0;i<8;i++)
{
pinMode(DP[i],INPUT);
}
delay(100);
for (A=0;A<memsize;) {
if (A<4096) Serial.print("0");
if (A<256) Serial.print("0");
if (A<16) Serial.print("0");
Serial.print(A,HEX);
Serial.print(" ");
for (j=0;j<16;j++) {
// Setup Address Pins
for (i=0;i<16;i++) {
if((A&bit(i))>0) {
AD[i]=HIGH;
} else {
AD[i]=LOW;
}
digitalWrite(AP[i],AD[i]);
}
delay(10);
digitalWrite(OE,LOW); // Read Enabled
delay(10);
// Read Data Pins
D=0;
for (i=0;i<8;i++) {
DD[i]=digitalRead(DP[i]);
D=D+bit(i)*DD[i];
}
if (D<16) Serial.print("0");
Serial.print(D,HEX);
Serial.print(" ");
A++;
}
Serial.println();
}
}
void loop() {
while (Serial.available()==0) delay(1);
Serial.print(Serial.read());
digitalWrite(STS, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(STS, LOW); // set the LED off
delay(500); // wait for a second
}
/*
EEPROM Programmer
*/
#define memsize 8192
int STS = 13; // Status Indicator
int AP[13] = {24,26,30,32,36,38,42,44,48,50,47,51,53};
int AD[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int DP[8] = {23,25,29,31,35,37,41,43};
int DD[8] = {0,0,0,0,0,0,0,0};
int CE = 6;
int OE = 4;
int WE = 2;
int i;
int A;
char D;
void setup() {
Serial.begin(9600);
Serial.println("Writing EEPROM...");
// Led that shows activity
pinMode(STS, OUTPUT);
// Setup Address Pins
for (i=0;i<16;i++)
{
pinMode(AP[i],OUTPUT);
}
// Setup Data Pins
for (i=0;i<8;i++)
{
pinMode(DP[i],OUTPUT);
}
// Setup Control Pins
pinMode(CE, OUTPUT);
pinMode(WE, OUTPUT);
pinMode(OE, OUTPUT);
// Setup Chip
digitalWrite(CE, LOW);
digitalWrite(WE, LOW);
digitalWrite(OE, HIGH);
// Loop that writes Byte per byte
for (A=0;A<memsize;A++)
{
while (Serial.available()==0) delay(1);
D = Serial.read();
Serial.print(D,HEX);
Serial.println("");
digitalWrite(STS,HIGH); //Signal that we're writing.
// Setup Address Pins
for (i=0;i<13;i++)
{
digitalWrite(AP[i], bitRead(A,i));
}
// Setup Control bus
digitalWrite(OE,LOW); // Reads Disabled
delay(1); // Give the EEPROM some time to catch up
digitalWrite(CE,HIGH); // Chip Enable
digitalWrite(WE,HIGH); // Write Enabled
// Setup Data Pins
for (i=0;i<8;i++)
{
digitalWrite(DP[i], bitRead(D,i));
}
// Write data (D)
digitalWrite(WE,LOW); // Write Disabled
digitalWrite(CE,LOW); // Chip Disabled
digitalWrite(OE,HIGH); // Reads Enabled
delay(1);
digitalWrite(STS,LOW); // Signal that we're waiting
}
// We got through the loop, signal that the write was successful
Serial.println("Done...");
}
void loop() {
// Small loop to show that data was written and device can be removed
digitalWrite(STS, HIGH);
delay(1000);
digitalWrite(STS, LOW);
delay(1000);
}
I'll probably make a post somewhere on this website explaining exactly what I did, but first I want to solder it and sadly I don't have time for that until Christmas.