Overview to microcontrollers

A microcontroller is a microprocessor integrated with memory, input/output interfaces, timers and other peripherals into one chip.

         |       Data bus       Memory  |
         |           |                  |
Clock    |           |<--------->ROM    |
-------->|           |                  |
         |   CPU<--->|<--------->RAM    |
         |           |                  |
         |           |<------->EPROM or |
Control  |           |         EEPROM   |
lines    |           |                  |
-------->| Input/    | Input/Output     |
<--------| Output    | data registers   |
         | Control   |              ____|
         | and status|             |    |<--->
         | registers |             |    |<--->
         | ______    |             |    |<--->
         ||______|   |<----------->|    |<--->
         ||______|<->|             |    |<--->
         ||______|   |             |    |<--->
         ||______|   |             |    |<--->

Microcontrollers have different sizes of data bus: 4 bit, 8 bit, 16 bit, 32 bit. 8 bit is the most common.

Most microcontrolers are CMOS chips (Complementary Metal Oxide Semiconductor).

Architecture features:

Von-Neuman Architecture - program and data are in the same memory, instructions and data are fetched over the same data bus. Twp fetches are needed to execute an instruction (one to get the instruction, one to get (or put) the data).

Harvard Architecture - program and data are in separate memories, data bus and instruction bus are separate, can be operated at the same time.Next instruction is fetched while current instruction operates on data bus. This pre-fetching speeds up processing by a factor of two (except when branching).

CISC - Complex Instruction Set Computer - often have over 80 instructions in instruction set.

RISC - Reduced Instruction Set Computer - Fewer instructions, better performance, smaller chip, lower power consumption.

[made up name] SISC - Specific Instruction Set Computer - instruction set tailored to the special purpose of control.

Memory options

EEPROM - Electrically Erasable Programmable Read Only Memory

FLASH - a better version of EEPROM, especially for program memory

Battery backed-up static RAM - Fast, no limits on number of rewrites

OTP - One Time Programmable - An EPROM without a window for UV erasing

Software protection - chip is engineered so that the program in the chip can't be read. (But ROMed microcontrollers have backdoors (a test mode) so that the manufacturer can read the program to verify that the ROM was programmed properly. The test mode is kept very confidential.)

Some Hardware features

Brownout protection - chip automatically resets itself when voltage is back up after a brownout

Idle/Halt modes

Chip shuts down, conserving power, except for a few basic functions; on-board oscillator, watchdog logic, clock monitor, idle timer.

Chip wakes up when reset, interrupted or some other stimulus.

Serial ports - both asynchronous and synchronous

Onboard analog to digital conversion

Onboard digital to analog conversion

Pulse width modulators - often used for cheap analog to digital conversion


Take the place of polling - more efficient - can be triggered by rise, fall, or constant level of an external signal.

Maskable interrupts - interrupts can be enabled or disabled.

Vectored interrupts - Instead of the interrupt routine polling the possible causes of the interrupt and taking appropriate action, different kinds of interrupts jump to different sections of interrupt code to take immediate action. Some form of arbitration is needed when two interrupts occur at the same time.

Special microcontroller features

Watchdog timer - chip will reset itself after a certain period of time if the watchdog timer itself is not reset by the program - provides a way to recover from (some) endless loops and hardware problems.

Digital signal processors -

Clock Monitor - shuts chip down if clock is running too slowly

common terms, and links for info about common microcontrollers

Popular microcontrollers

common microcontrollers

8051 (Intel and other companies)

Most popular microcontroller in industry.
Modified Harvard architecture.
4K or 8K of on-chip program memory.
Can address up to 64K of external program memory and up to 64K of external data memory.
128 or 256 bytes of on-chip RAM, several special function registers. I/O has its own address space.
40 pins.
4 8-bit ports that can be used for either input or output.
Ports 0 and 2 can also be used to address external memory. The ALE (Address Latch Enable) can be used to control an external latch that combines outputs from ports 0 and 2 into a 16 bit address bus. Port 0 is still used for data transfer as well. Port 3 can be used for timing, control and interrupts.

Has lots of instructions for manipulating individual bits in RAM, registers, accumulators, etc. Complex tests and comparisons on single bits. The 8051 is thus a "Boolean processor".

Many variations of this microcontroller. One of the most popular (among hobbiests) is the 80C52BASIC ($19.95). This has a BASIC interpreter in its 8K ROM.

Other microcontrollers from Intel:

8048 - the first microcontroller ($0.49) Over 90 instructions in instruction set.

80C196 - a 16-bit microcontroller, has hardware multiply and divide, 6 addressing modes, up to 40 I/O pins, PWM generator, watchdog timer, A/D, serial communications channel.

80186, 80188 - controller versions of the 8086, 8088. Megabyte addressing space.

80386 EX

68HC11 (Freescale (formerly Motorola) and Toshiba)

8-bit data, 16-bit address. 48 pins. Von Neuman architecture. The MC68HC11A1P ($13.95) has A/D.

Other microcontrollers from Motorola:

MC68EC300 series is based on the 68020. These are "super-microcontrollers".

PIC (MicroChip)

A large family of RISC microcontrollers that have been around for 25 years. 33 or 35 instructions in the instruction set. Harvard architecture. The smallest are the PIC12C50X and PIC12C67X series.

PIC12C508-04P - $1.75. 8 pins. 512 x 12 EPROM (OTP), 25 bytes RAM. 5 I/O lines

PIC12C67 series: 1K or 2K x 14 EPROM (OTP), 128 bytes RAM, 6 I/O lines, 4 channels of 8-bit A/D. 8 pins.

MicroChip promotes the above for mechatronics applications.

PIC16F84 - Has flash program memory. 35 single word instructions. 1K x 14 Flash,. 68 bytes of RAM, 64 bytes of EEPROM data, 15 registers, eight-level deep hardware stack. three addressing modes, 13 I/O lines, 18 pins. Watchdog timer. $5.95.

Another PIC chip that should become popular is the PIC16F88X series. Up to 8K x 14 Flash, 368 bytes of RAM, 256 bytes of data EEPROM. 28, 40 or 44 pins. Up to 35 I/O lines, 14 channels of 10-bit A/D. $2. Programmable with just the 5 volts power supply. Internal Oscillator available.


Atmel makes several lines of microcontrollers.

Related microcontrollers:

Basic Stamp I and II (Parallax) - a PIC chip combined with a BASIC interpreter. BS1 has 256 bytes of EEPROM, 14 bytes RAM, 14 pins, has space for 80 instructions. $34 ($29 in 2008).
BS2 has 2048 bytes of EEPROM, 26 bytes of RAM, 24 pins, has space for 500 instructions. $49.