NVRam Programmer

Completed pcb version ...

Some people are put off the designs of micro boards using NVRam as they would require you to use Universal Programmers .

There is other options if you are familiar with say Arduino micro-controllers. The following video shows in a great detail of being able to use Arduino Nano and couple of shiftĀ  registers to read an write a smaller amount of bytes into EEPROMS ( or in our case NVRam). This would be a useful feature for writing small amount of code to test out any micro boards without any monitor programs.

Code for the video - by Ben Eater

#define SHIFT_CLK 3

#define SHIFT_LATCH 4

#define EEPROM_D0 5

#define EEPROM_D7 12

#define WRITE_EN 13

/*

* Output the address bits and outputEnable signal using shift registers.

*/

void setAddress(int address, bool outputEnable) {

shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, (address >> 8) | (outputEnable ? 0x00 : 0x80));

shiftOut(SHIFT_DATA, SHIFT_CLK, MSBFIRST, address);

digitalWrite(SHIFT_LATCH, LOW);

digitalWrite(SHIFT_LATCH, HIGH);

digitalWrite(SHIFT_LATCH, LOW);

}

/*

* Read a byte from the EEPROM at the specified address.

*/

byte readEEPROM(int address) {

for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {

pinMode(pin, INPUT);

}

setAddress(address, /*outputEnable*/ true);

byte data = 0;

for (int pin = EEPROM_D7; pin >= EEPROM_D0; pin -= 1) {

data = (data << 1) + digitalRead(pin);

}

return data;

}

/*

* Write a byte to the EEPROM at the specified address.

*/

void writeEEPROM(int address, byte data) {

setAddress(address, /*outputEnable*/ false);

for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {

pinMode(pin, OUTPUT);

}

for (int pin = EEPROM_D0; pin <= EEPROM_D7; pin += 1) {

digitalWrite(pin, data & 1);

data = data >> 1;

}

digitalWrite(WRITE_EN, LOW);

delayMicroseconds(1);

digitalWrite(WRITE_EN, HIGH);

delay(10);

}

/*

* Read the contents of the EEPROM and print them to the serial monitor.

*/

void printContents() {

for (int base = 0; base <= 255; base += 16) {

byte data[16];

for (int offset = 0; offset <= 15; offset += 1) {

data[offset] = readEEPROM(base + offset);

}

char buf[80];

sprintf(buf, "%03x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",

base, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7],

data[8], data[9], data[10], data[11], data[12], data[13], data[14], data[15]);

Serial.println(buf);

}

}

// 4-bit hex decoder for common anode 7-segment display

byte data[] = { 0x81, 0xcf, 0x92, 0x86, 0xcc, 0xa4, 0xa0, 0x8f, 0x80, 0x84, 0x88, 0xe0, 0xb1, 0xc2, 0xb0, 0xb8 };

// 4-bit hex decoder for common cathode 7-segment display

// byte data[] = { 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47 };

void setup() {

// put your setup code here, to run once:

pinMode(SHIFT_DATA, OUTPUT);

pinMode(SHIFT_CLK, OUTPUT);

pinMode(SHIFT_LATCH, OUTPUT);

digitalWrite(WRITE_EN, HIGH);

pinMode(WRITE_EN, OUTPUT);

Serial.begin(57600);

// Erase entire EEPROM

Serial.print("Erasing EEPROM");

for (int address = 0; address <= 2047; address += 1) {

writeEEPROM(address, 0xff);

if (address % 64 == 0) {

Serial.print(".");

}

}

Serial.println(" done");

// Program data bytes

Serial.print("Programming EEPROM");

for (int address = 0; address < sizeof(data); address += 1) {

writeEEPROM(address, data[address]);

if (address % 64 == 0) {

Serial.print(".");

}

}

Serial.println(" done");

// Read and print out the contents of the EERPROM

Serial.println("Reading EEPROM");

printContents();

}

void loop() {

// put your main code here, to run repeatedly:

}

#define SHIFT_DATA 2

You could add extra features to the example above by using load of hex data from a file(from a PC) ... to write into NVRam.

More information about this existing project here.

Here is pic of the above video setup schematic .. to use on NVRam chips just basically connect to similar address lines ... or if NVRam is larger memory size just add extra address lines up to A15. If chip is even larger ...then just ground higher address lines.

Also if code you want to write does not start at say 0000hex then .. you could write into any block of NVRam (up to 64K in sizeĀ  .. by enabling or disabling higher order address lines to where the code should start from. For example if we have a 128k chip and our code is to start from 10000 Hex ..then we just keep address A16 high... and treat the rest of address lines as normal. It is rare that you will write up to 64K of code for an old microprocessor type board.