READ NVRam

If you got this far .. hopefully you have fully constructed programmer board and now you can try out to read from the NVRam chip.

NVRam chips are battery backed up RAM ... so there are few things to be aware of when we READ the RAM chips .. (not to destroy the data within the chips).

Datasheet of the DS1250Y chip ..

Here is timing diagram for  a READ cycle ...

Note1: ~WE is HIGH during the READ cycle

How to Implement the READ on the Programmer board

Taking the information from above, some of the major points are:

Another point to consider with NVRam chips is the following info ...

As you can see there is at least 2mS time period for the ~CE and ~WE to be active (or inactive) .. so even within the READ program we can include this delay .. (to allow these lines to be stable before inserting or removing the chip from the board).

Here is one possible Arduino code to achieve above tasks. Hopefully I made enough comments within the code for you to understand it ... and if need be modify it for your own specific use. Note this code will only READ data from NVRam chips.

READ program on MEGA

/*NVRAM Reader program

  Modified original code for EEPROM Chip Reader by  Z80Dave

  http://z80dave.blogspot.com

  Note control signals are reversed here as original design used an inverter gate for output

  Mods by Michael Cvetanovski,4/2019.

*/

//Read only 32k of RAM  starting from 0000

#define memsize 32768

int LED   = 13;  // Status Indicator

// Adress and data array setups

int AP[16] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37};

int AD[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

int DP[8]  = {5, 6, 7, 8, 9, 10, 11, 12};

int DD[8]  = {0, 0, 0, 0, 0, 0, 0, 0};

//Control line setup

int CE  = 3;

int OE  = 4;

int WE  = 2;

int i;

int j;

int D;

long A;

void setup() {

  //Setup extra address lines A16, A17 and A18

  pinMode (38, OUTPUT);

  digitalWrite (38, LOW);

  pinMode (39, OUTPUT);

  digitalWrite (39, LOW);

  pinMode (40, OUTPUT);

  digitalWrite (40, LOW);

  // Setup Control Pins

  digitalWrite(CE, HIGH);

  digitalWrite(WE, HIGH);

  digitalWrite(OE, HIGH);

  //Note pinmode is set after pin assignment for OUTPUT

  //to reduce any glitches on control lines

  pinMode(CE, OUTPUT);

  pinMode(WE, OUTPUT);

  pinMode(OE, OUTPUT);

  // Disable Chip, and disable read and write.

  digitalWrite(CE, HIGH);

  digitalWrite(WE, HIGH);

  digitalWrite(OE, HIGH);

  //Setup coms @115200 baudrate

  Serial.begin(115200);

  Serial.println("Reading NVRAM ...");

  //Show activity on pin 13 LED that something is going on

  pinMode(LED,   OUTPUT);

  digitalWrite(LED, HIGH);

  // Setup Address Pins for OUTPUT

  for (i = 0; i < 16; i++) {

    pinMode(AP[i], OUTPUT);

  }

  // Setup Data Pins for INPUT

  for (i = 0; i < 8; i++) {

    pinMode(DP[i], INPUT);

  }

  //Delay 1 second

  delay(1000);

  //Adress output numbering as a 4 digit display

  //filling 4 digit place holder with '0' if numbers are smaller

  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;

        }

        // put out address on all 16 bits of datalines

        digitalWrite(AP[i], AD[i]);

      }

      //Put chip in READ mode

      digitalWrite(CE, LOW);     // Chip Enabled

      digitalWrite(OE, LOW);     // Read Enabled

      // Read Data Pins

      //store valua in D to be written on comm screen

      D = 0;

      for (i = 0; i < 8; i++) {

        DD[i] = digitalRead(DP[i]);

        D = D + bit(i) * DD[i];

      }

      //if data value less then 16 first digit is '0'

      if (D < 16) Serial.print("0");

      Serial.print(D, HEX);

      Serial.print(" ");

     

      //go to next address

      A++;

    }

    //When all addres lines examined

    //Disable OE and CE pins

    digitalWrite(OE, HIGH);    // Read Disabled

    digitalWrite(CE, HIGH);    // Chip Disabled

    Serial.println();

  }

}

void loop()

{

  //Blink LED for ever after display of all data is complete

  digitalWrite(LED, HIGH);   // set the LED on

  delay(1000);              // wait for a second

  digitalWrite(LED, LOW);    // set the LED off

  delay(1000);              // wait for a second

}

Following is some snapshots of running the program via the terminal program  ... and the output provided ..