I'm currently trying to test some old NVSRAMs to make sure they work before I put them to use. Id like to test them independently and I'm thinking a arduino might do the trick. In theory, should a arduino mega be able to handle this?
PORTC = DQ0-DQ7
PORTA = A0-A7
#define E 2
#define G 3
#define W 4
void fillOne();
void setup() {
Serial.begin(9600);
pinMode(E, OUTPUT);
pinMode(G, OUTPUT);
pinMode(W, OUTPUT);
DDRA = B11111111; // sets port a to output
DDRC = B11111111; // set port c to output
digitalWrite(E, HIGH);
digitalWrite(G, HIGH);
digitalWrite(W, HIGH);
}
void loop() {
fillOne();
}
//Test One
void fillOne()
{
int fail = 0;
int address = 0;
PORTC = B11111111; // Sets Dataline to one
Serial.print("Test Start");
for (address = 0; address < 256; address++)
{
PORTA = address;
digitalWrite(W, LOW);
digitalWrite(E, LOW);
digitalWrite(W, HIGH);
}
//Read Back and check for One
// Sets Datalines to one
digitalWrite(W, HIGH);
digitalWrite(E, HIGH);
PORTC = 0x00;
DDRC = 0x00;
for(address = 0; address < 256; address++)
{
PORTA = address;
digitalWrite(G, LOW);
digitalWrite(E, LOW);
if(PORTC != B11111111)
fail ++;
digitalWrite(G, HIGH);
}
if(fail > 0)
{
Serial.print("FAIL");
Serial.print(fail);
while(1);
}
Serial.print("PASS");
while(1);
}
Update: I set it up to only use A0-A7 until I get it working, then will expand to other bits. I'm also only programming it with 1's so it's easier to debug for now. It's not quite working, I think it's the addressing.. I have Address set to a INT and it's going from 0 to 256.. If I send the int to a PORT, it should send out that number in binary, correct?