Skip to main content

Microcontrollers

Section 2.6 Memory

Memory is used to store binary data. Registers (introduced in SectionΒ 2.4) represent a particular type of memory. Memory can refer to volatile memory or non-volatile memory, depending on whether or not the contents of memory persist after power is removed from the microcontroller. The contents of volatile memory will be erased if power is removed, whereas non-volatile memory will be retained even after power is removed.
Modern computers (including desktops, laptops, tablets, and smart phones) have a nearly unlimited supply of memory of all types compared to microcontrollers. Microcontrollers typically have much more limited memory capacity. This means that it is necessary to be aware of size constraints while writing applications for microcontrollers.

Subsection 2.6.1 Volatile Memory

Volatile memory is used for temporary storage because data is unable to persist after power has been removed from the device. Random-access memory (RAM) is, for the most part, volatile memory. Random-access refers to the ability to obtain data from any arbitrary (or random) address in memory at any given time. RAM on a microcontroller is typically used to store information or data that is generated or accessed as a program is executed.

Aside

Types of RAM include static RAM (SRAM), dynamic RAM (DRAM), and registers. Static RAM (SRAM) is characterized by
DRAM is the type of volatile memory used in computers due to its small size and low cost. DRAM is characterized by

Subsection 2.6.2 Non-Volatile Memory

Non-volatile memory is used for more permanent storage because the data persists after power has been removed from the device. Over the years, non-volatile memory has taken on many different diverse forms: paper punch cards; wax cylinders and vinyl records; optical CD and DVD disks; magnetic disks, drives and tape; and semiconductor drives.
Read-only memory (ROM) refers to a type of non-volatile memory. The name ROM is slightly misleading in modern times due to the easy ability to write to it. Historically, ROM was not a type of memory that could be written to after being initially programmed. In modern times, writing to ROM typically requires a higher voltage or a strict timing requirement on the write pins than a read operation requires. This is to prevent data from being accidentally overwritten during otherwise normal operation.
Because non-volatile memory doesn’t require power to hold on to stored data, it is used to store firmware on computers and program instructions and constants on microcontrollers. Program memory contains the instructions used to tell the microcontroller (or microprocessor or computer) how to boot up, run programs, and access data. In a computer, the instructions that tell the computer how to boot up is typically known as firmware or a BIOS (basic I/O system), whereas instructions that tell the computer how to run programs are referred to as software.
Flash memory is a type of non-volatile memory commonly used in microcontrollers. It uses floating-gate transistors, one of which is shown in FigureΒ 2.6.1. CG stands for control gate, and is where control signals are asserted. FG stands for floating gate, and is where electrons are either injected or removed to store data. S stands for source, which is generally the low potential (or ground) connection of a transistor. D is the drain, which is generally the high potential connection of a transistor.
A rectangle is used to depict a slab of silicon. The top left corner is labeled S which is the transisitor source. The top right corner is labeled D which is the transistor drain. "Floating" above the silicon is a small rectangle labeled FG for floating gate. Above the floating gate, angled down to overlap horizontally with the source is another region labeled CG for control gate.
Figure 2.6.1. Diagram of a flash floating-gate cell.
The modes of operation of the flash floating-gate cell are detailed below.
  • Clear: High-voltage (>VCC) applied to CG, channel on, electrons travel from S to D and in the process they tunnel through oxide to FG.
  • Set: High-voltage (>VCC) applied to CG, electrons tunnel from FG to CG and are removed.
  • Read: VCC applied to CG, if FG has electrons, a channel will not form (read value = 0), if FG has no electrons, a channel will form (read value = 1) from S to D.
Flash ROM is a subset of EEPROM (electrically erasable programmable ROM). Today, there is little difference between EEPROM and flash memory.