Friday, June 15, 2018

AT28C16 EEPROM Programmer

Overview


The old AT28C16 EEPROM is a 2K EEPROM with 2 parallel buses:
  • One 8 bits data bus 
  • One 12 bits address bus
It is therefore easier to control without software than a modern EEPROM or FLASH chip that require one serial bus.


With a 8 bit counter plugged into the EEPROM address bus, we can select the first 256 addresses and output the programmed 256 values (each 8 bits) at the speed of the clock. 

The programmed EEPROM can also be used as a memory containing some assembly code to execute, in case you want to design your own 4 or 8 bit processor.

It is also an easy way to manage a 2 digit counter display using 2 7-segment displays, see videos by Ben Eater
Following the video I build a first programmer with an Arduino Nano and 2 shift registers to add an extra 8 GPIOs.


I would suggest to use an Arduino MEGA to control directly the 8 data bit bus and 12 address bit bus,
plus the Read/Write pin and Enable pin, for a total of 22 GPIOs needed.

Here is a second version with a dedicated board (schematic, board).



Code

Here is the main file using an Arduino Mega.


/*
 AT28C16 EEPROM Programmer 
 (C) Frederic Torres 2018

 based on `Build an Arduino EEPROM programmer`
 By Ben Eater
 https://www.youtube.com/watch?v=K88pgWhEb1M

 https://github.com/beneater/eeprom-programmer

*/
#include 
#include "EEPROM_Programmer.h"

#define APP_TITLE  "AT28C16 EEPROM Programmer Application"

#define ON_BOARD_LED 13
Led _onBoardLed(ON_BOARD_LED);
EEPROM_Programmer ep;

#define MAX_ADDR 16

void WriteEEPROM() {
 Board.Trace("About to Write EEPROM Sequence");
 delay(1000 * 1);
 Board.Trace("Writing EEPROM Sequence...");
 int baseValue = 1;

 for (int addr = 0; addr < MAX_ADDR; addr++) {

  ep.SetAddressBus8bits(addr);
  int val = addr;
  if (addr % 2 == 0) {
   val = 6;
  }
  else {
   val = 14;
  }
  
  ep.SetDataBusWriteData(val);
  Board.Trace(ep.GetStatus());
  Board.Trace("About to initiate the write op");
  delay(100);
  ep.InitiateWriteByteOperation();
  delay(100);
 }
 Board.Trace("Write EEPROM Sequence Done");
 Board.Trace("");
}

void ReadEEPROM() {
 Board.Trace("About to Read EEPROM Sequence");
 delay(1000 * 2);
 Board.Trace("Reading EEPROM Sequence...");
 int baseValue = 1;

 for (int addr = 0; addr < MAX_ADDR; addr++) {

  ep.SetAddressBus8bits(addr);  
  ep.GetDataBusReadData();
  Board.Trace(ep.GetStatus());
  delay(150);
 }
 Board.Trace("Read EEPROM Sequence Done");
 Board.Trace("");
}

void setup() {
 Board.SetPinMode(ON_BOARD_LED, OUTPUT);
 _onBoardLed.SetBlinkMode(250);

 Board.InitializeComputerCommunication(115200, APP_TITLE);
 Board.Trace("Initializing...");
 ep.Init();

 // WriteEEPROM();
 
}

void loop() {
 ReadEEPROM();
}




1 comment:

  1. Thank you very much for creating this blog and posting such useful information. We are a fully dedicated and focused chip programming company that offers reliable and genuine chips to our valued customers.

    Thanks,
    eeprom programmer, chip programmer

    ReplyDelete