Using an AT28C256 as non-volatile SRAM for a Z80

283 views Asked by At

I've been using an AT28C256 as EEPROM 'ROM' for a Z80 project quite successfully. As the AT28C256 can be programmed at 5V using the /WE pin, I was thinking about also using it as a form of non-volatile SRAM, rather than adding another chip.

Yes, the AT28C256 is only 32kB in size, so I'm not using the whole 16-bit address space on the Z80 - but I wanted to know if this is possible?

Could I just OR the /MREQ and /WR lines on the Z80 together for the /WE on the AT28C256? Or am I missing something?

I could then set my Stack Pointer (SP) to the 32k boundary, rather than the usual 0xFFFF.

1

There are 1 answers

0
the busybee On

You can use an EEPROM like a RAM, but only if you take its behavior into account.

You can simply connect:

  • Z80-/MREQ to EEPROM-/CE, but you will need to gate this
  • Z80-/WR to EEPROM-/WE
  • Z80-/RD to EEPROM-/OE

Things to consider, consult the data sheet for details:

  1. If you write a byte (or use the page write algorithm) the EEPROM will not output the stored values if you read it, until the self-timed write cycle has passed.

  2. The write cycle is about some milliseconds long.

  3. The EEPROM might fail after a few 10k write cycles (Thanks, Stefan Paul Noack).

You can't use it for the program that changes the chip's contents, because of point 1.

You can't use it for the stack or any other data that needs to be stored and retrieved quickly, because of point 2.

However, you can use it for the application's data. But you will need another memory for the program to run.

And if your program needs a stack or other variables to be written quickly, you will need an additional RAM. (Note: I remember a Z80 application that implemented a printer queue with just simple DRAM, using only the CPU's registers for the program's variables, and using the DRAM only for the data to buffer.)

To have multiple chip's as memory, you will need to gate the /CE-pins of these memories depending on their address range.