Programming Techniques
Micro Projects Home Page

Home

 Microprocessor Basics

Micro Basics

Something that seems to puzzle no end of folks is the way you program an EEPROM or EPROM. Not surprising when the information is difficult to find, one is inclined to think of it as a �black art�, which it most definitley is not. But aren�t all devices programmed differently? (some people observe). Unfortunately most are, which explains why a commercial programmer will need the part number and manufacturer entered before a device can be programmed. So how does this affect a home built programmer then? Well, there are several ways of going about this, maybe by making a very complex program for your own unit, using dozens of complicated routines that WILL never be used, or maybe limit yourself to ONE ROM chip by ONE manufacturer. Hmm.. Not too good this idea either.. So are there any other better options then? I say yes, and have applied my idea to my designs for many years without any problems, simply by making the programmer work with the widest and slowest possible parameters, which should suit almost ALL devices. OK, so the programming WILL be slow for a lot of chips, but how many experimenters will be using their programmer in a production environment where time is money? I�ve used my own in a work environment for lots of projects, and when there is a lot of code which takes a few minutes to program, I simply leave my desk and go and make a cup of tea whilst it does it�s job!

Site Projects

Site Projects

Construction Techniques

Construction

Programming concepts

Software

Projects

Projects

8085 page

8085 page

Fault Finding

Fault Finding

Data Sheets

Data Sheets

EEprom Programmer

Programmer

Video Information

VIDEO info

28C64
Question..
2764

EPROM OR EEPROM?

Ah! So does one build a programmer to program an EPROM or should it be an EEPROM - or maybe even both??

Err... I hear a few questions out there.. What�s the difference between the two of these? Well, the EPROM was the best thing since sliced bread (if you like sliced bread) since the OTP (one-time programmable memory device) as the �E� meant erasable for re-use or reprogramming with an updated code. All you need is a UV light and under the hour you have a blank device! Now the EEPROM is like the EPROM was to the OTPROM - namely it too can be re-programmed, but ELECTRICALLY rather than by UV, and one location at a time at that! You write your code, put it into your project, identify something that needs changing, turn off, put the EEPROM back in the programmer, change the ONE location, and put it back in the project etc. Wonderful! 

So what are the two like to program then? The answer is, remarkably similar. The only significant difference is that the EEPROM will almost certainly only need a single supply rail of +5V and that is that! Most EPROMS need a separate PROGRAMMING SUPPLY, which is more often than not either +21V or +12.5V.  Without this you cannot successfully program the device

SO HOW IS IT DONE THEN?

To keep things nice and simple I�m going to talk about the 27x64 ONLY. To program the 2708 / 16 / 32 / 128 / 256 / 512 variants, you simply need to alter my pin allocations. To begin with we will deal with the EPROM variant.

First and foremost you need to address the device with some form of counter to select the location you wish to program. In the case of an EPROM, these will generally be done all in the same programming session  as no location can be changed once it has been written - until that is, the device is subjected to UV light where ALL the locations will be erased simultaneously. Now whilst it is perfectly feasible to set up a bank of DIP switches to change the ADDRESSES, what a pain that would be

NO MAGIC WAND REQUIRED!

 - not to mention the opportunities for mistakes. No, we won�t go that way I think. Alternatives are the simple counter, or even a micro set to single step from 0000h onwards. Unless you are proposing to build an automated controller like the one on this site, one will also need to attach suitable displays to the address lines to show what location the address counter is addressing.

In addition to the addresses, you will need to arrange a method of setting the DATA BUS to the value you wish to program into the device.

Peripheral Circuitry

Peripheral circuitry

Central Heating and Z280's

Z280 and  Central Heating  Controllers

Concluding Ideas

Concluding ideas

Links

Links

Once again DIP switches could be used here but what a long-winded way of going about things - but it CAN be done this way if nothing else is available. Ideally for a manual programming unit, you need a set of HEX push buttons to automatically enter two consecutive digits on the bus. A quite elementary bit of logic to do this - I might be persuaded to put an example up on the site if enough are interested.

Right, that�s the addresses and data taken care of so what next? Enabling the chip! When accessing an EPROM to READ, one takes the chip enable LOW (pin 20) as well as the output enable (pin 22). VPP the programming VOLTAGE on pin 1 has to be held high to +5V as well as Pin 27, the programming LINE. Now the contents of the EPROM can be read. Nothing difficult here? OK so now on to the programming mode.

To PROGRAM a single location of an EPROM, you need to do the following:

a) Set up the address 

b) Set up the data needed on the data bus.

c) Enable the chip with /CE on pin 20 taken LOW

d) Take the OUTPUT enable HIGH.

e) Take the program voltage on pin 1 up to the programming voltage specified by the manufacturer - usually  +12.5 or +21V.

f) Finally toggle the /PGM pin on pin 27 LOW for approximately 50mS. All the EPROMS I�ve met up with seem to be happy with this setting.

And that�s it! Your location should be now programmed with the value on the Data Bus. All that needs doing now is to change the address to the next location, change the value on the Data Bus and toggle /PGM again. (all the other lines stay the same).

28C64

So now onto the EEPROM - a device that makes life so easy for the microprocessor project builder.

In many ways the EEPROM (electrically erasable read only memory) is more like a RAM to program than an EPROM. In keeping with my decision to talk of the 2764, I shall direct all my comments about the EEPROM to the 8K x 8 bit variant, namely the 28C64 device. All that is necessary to do to relate to other size variants is to re-allocate my pin definitions.

To READ from the EEPROM all you do is treat it like a RAM. Set up the correct address on the address bus, keep /WR on pin 27 high, take both /OE on pin 22 and /CE on pin 22 LOW. The byte from the memory will now appear on the Data Bus. 

To PROGRAM the EEPROM all you have to do is the following:

a) Set up the address

b) Set up the data needed on the data bus

c) Enable the chip with /CE on pin 20 taken LOW

d) Take the OUTPUT enable HIGH

e) Take the WRITE line on pin 27 LOW for the prescribed time.

f) Select the next address and set up the next byte of data to be written... and that�s it!

NOTE!! The write cycle of EEPROMS varies considerably, therefore I recommend that the complete WRITE CYCLE including time LOW plus the time high until the next pulse goes low, should be no shorter than 6mS. Some devices can take a much quicker cycle than this, but if you want to make sure your unit is �universal� then 6mS is probably the best value to choose.

 

One last point about programming EEPROMS in an �automated� programmer is to remember that the devices will only take about 100,000 programming cycles before they fail... Sounds a lot? But remember that if anything goes wrong with the programmer when your device is in-circuit then your expensive EEPROM may well be history. To avoid this, the site EEPROM programmer uses several hardware �interlocks� to try and stop the device being �accidentally� programmed over and over again if things go wrong!

So why ever use EPROMS instead of EEPROMS if the later are so good? Well, I guess the answer is down to cost in the end. At the moment of writing, EEPROMS are a lot more expensive than EPROMs, and there always seem to be EPROMS available in old equipment for pennies!

Happy Programming!

http://www.hampshire-shops.co.uk