1.3 Memory

  Memory devices are broadly classified into two categories: ROM (read-only memory) and RAM (random access memory).
You can only read stored data from ROM but cannot write to it.  Stored data is preserved intact, however, when the microprocessor is switched off.  Use ROM to store valuable data that needs to be protected from erasure in times of power failures, typically, programs.  Instructions are stored in ROM.  Each meaningful collection of instructions is a program.  Any microprocessor would be inoperable unless it comes up with "programs available for ready use" when switched on.  ROM fills this need.
  Data can be written to and read from RAM as desired.  Stored data would be lost, however, once the microprocessor is switched off.   Even when the microprocessor is switched on again, previous data is no longer left.  Hence, RAM is used as temporary data storage. Programs may also be placed in RAM, but will be lost once the microprocessor is switched off. To run programs in RAM, it is necessary to attach an external storage device, such as a floppy disk or hard disk drive, and transfer the programs to RAM from external storage to RAM when the microprocessor is switched on.
 


 
Mask ROM (Mask ROM)
  When a memory IC is manufactured in the factory, programs are written to it.  A mask is a plate of glass imprinted with patterns of wirings and transistors used in the IC manufacturing process.  Users have a semiconductor manufacture custom-build a mask to manufacture a memory IC. 
Advantages
- Suitable for volume production
- Low cost
Disadvantages
- Long lead-time from ordering to completion
- Not reprogrammable once built

EPROM (Erasable & Programmable ROM)
  Stored data can be erased by ultraviolet irradiation.  To this end, a special package with a glass window is used.  An EPROM writer is used to write to EPROM.  EPROM is erasable and programmable about 100 times.
Advantage
- Erasable and programmable and thus convenient for testing and debugging 
Disadvantage
- Expensive because of the use of a special package

OTPROM (One Time Programmable ROM)
  An EPROM chip housed in an inexpensive plastic package.  Stored data cannot be erased by ultraviolet irradiation because no glass window can be attached to the plastic package.  OPTROM can be written only once, but it comes by far cheaper than EPROM.  Programs are debugged in EPPROM and, when finalized, moved to OTPROM for volume production.
Advantage
- Cheaper than EPROM and suitable for small-batch production
Disadvantage
- Not erasable and programmable

EEPROM (Electrically Erasable & Programmable ROM)
  EEPROM can be electrically erased and programmable, and can be reprogrammed when mounted on a board as a finished product.  EEPROM is reprogrammable about tens of thousand times.
Advantages
- Onboard reprogrammable
- Ready for infinite times of reprogramming
Disadvantage
- Expensive

Flash memory (Flash Memory)
  A variation of flash memory, which is cheaper and larger-sized.
Advantage
- Cheaper and larger-sized than EEPROM
Disadvantages
- Unable to write address by address, unlike EEPROM
- Memory IC divided into blocks for erasure and reprogramming block by block

Static RAM (Static RAM)
  RAM with its storage circuit built of flip-flops.  Given a supply voltage, static RAM preserves stored data intact.  It dissipates least power when out of use.  Because six transistors are used to build its flip-flops, static RAM offers less storage capacity than does ROM.
Advantages
- Fast
- Low power consumption and suitable for battery backup
Disadvantages
- Expensive
- Small storage capacity

Dynamic RAM (Dynamic RAM)
  Simplified storage circuitry with only one capacitor and one transistor to provide each bit of memory, and hence larger-sized than static RAM.  Charges on the capacitors, however, drain with time, resulting ultimately in loss of stored data.  Before such loss, all stored data must be read out and refreshed.  Power alone does not allow dynamic RAM to retain stored data but requires refreshing for that purpose.
Advantage
- Cheap and large-sized
Disadvantage
- Refreshing required

  Table 1.1 summarizes features of key ROM and RAM devices.
 


Table 1.1  Kinds and features of memory devices
Kind Features
ROM Mask ROM Large-sized, cheap, volume production use, custom fabrication, not reprogrammable
EPROM Programmable and erasable by ultraviolet irradiation
Testing, debugging
OTPROM Low-volume production use, one-time programmable
EEPROM Electrically programmable, onboard reprogrammable
Flash memory Electrically erasable and programmable, cheaper and larger sized than EEPROM
RAM Static RAM Stored data preserved under voltage input alone, fast, battery backup use
Dynamic RAM Refreshing required to preserve data, large-sized, cheap