What is the difference between a microprocessor and a microcontroller? Starting out with electronics, I thought that they were the same thing. There is a difference however, and that difference is “peripherals”. A microprocessor handles only instructions (executing code) – it is the good old CPU which runs in your laptop or desktop computer. A microcontroller is a microprocessor + peripherals, all built into the same chip. With your laptop or desktop computer, the peripherals – such as the RAM, Hard Drive and Graphics Processor – are separate to the microprocessor (CPU). The trade off is between flexibility, size, economy and simplicity; having peripherals external to the processor provides greater flexibility in that you can for example easily choose different sizes and types of RAM, Hard Drive or GPU; but building everything into the same chip makes things smaller, more cost-effective, and simpler – especially when working with smaller embedded systems.

Microcontroller manufacturers typically offer a huge array of different microcontrollers with different sizes of memory and other peripheral options, and usually provide a parametric search tool to find a chip with the specific features you need. The manufacturer may only have a handful of microprocessor cores in use, but combining these with different peripheral options results in a huge array of chips. But which “peripherals” are we talking about anyway?

Memory


Most importantly, the microprocessor needs to be able to read from somewhere the instructions which it is to execute, and the usual place for this is the non-volatile ROM (Read-Only Memory). Non-volatile means that the memory doesn’t lose its contents when the power goes off. Typically FLASH memory is used, but in the old days there were even memories which had to be erased with a UV lamp in order to reprogram them!

The other important type of memory is RAM (Random Access Memory), which is typically much faster than the ROM but is volatile (loses its contents when the power goes off) – this is used by the microprocessor for storing “variables” (values which the program is working on and calculating whilst running).

Memory registers of a PIC16 during simulation. Data, Program and EPROM Memory contents on a running PIC simulation.

Communications


One of the earliest communication protocols was UART (Universal Asynchronous Receiver and Transmitter). We won’t go into the details of the various communication protocols in this article, but UART was one of the standard communication protocols built into desktop computers before USB (Universal Serial Bus) was invented. In Windows, UART ports are called COM Ports, and whilst no longer built into modern computers they are still widely used in the form of USB-UART converter chips (such as the ubiquitous FT232R).

SPI (Standard Peripheral Interface) and I2C (Inter-IC Communication) were the next two popular communication protocols to be developed, both facilitating the possibility of connecting many external chips to the same communication bus (wires).

SPI Analyzer on running simulation. SPI protocol analyser inspecting comms between AVR and TLC549 serial ADC.

Since then various other communication protocols have been developed as well; including USB, CAN and Ethernet.

? At this point it is worth mentioning that peripherals are typically separate pieces of circuitry which offload work from the microprocessor – the microprocessor simply asks a communication peripheral “please send this data” and the communication peripheral handles the nitty-gritty of it. It is usually possible to bit-bang communication protocols with the microprocessor itself, but having the peripherals handle this frees the microprocessor to focus on other things. Various peripherals can also be operating at the same time in parallel, which may not be possible for the microprocessor to handle on its own.

Timers and Counters


Timers can be used to keep track of time (a timer can be set to “tick” every 1ms for example), and counters can be used to count pulses on an external pin for example. Timers and counters can also be used for things such as PWM (Pulse-Width Modulation).

Analog to Digital Converters


ADCs are used to read an analog voltage and convert it into a digital number which the microprocessor can understand.

Graph and Oscilloscope of ADC signal. ADC Oversampling techniques for Stellaris MCU.

GPIO


General-Purpose Input/Output pins are used for simple “on”/”off” communication, such as reading a button or turning on an LED. GPIOs can be more complex than simply “on” and “off” however, with features such as pull-up and pull-down, and slew rate control (see our high-speed design article).

Watchdog Timer


The job of the watchdog is to try make sure that the CPU doesn’t get “stuck” in a bad code scenario. If the watchdog isn’t “tickled” periodically, then it will hit the reset button and start program execution from the beginning again. Whilst this should never be necessary in perfectly-coded programs, it provides an additional failsafe to try and prevent the program from “hanging” in case of a bug.

DMA


The Dynamic Memory Controller (on microcontrollers which have one) can transfer data between peripherals and memory (or memory and memory) without bothering the microprocessor (which, again, frees the microprocessor to do other things). Whereas a communication peripheral may only be able to receive and store one byte at a time before the microprocessor needs to process it (so that further received data can be received and not lost), DMA can be set up to buffer received communication into a larger area of memory, to be processed when the microprocessor is ready for it.

RTCC


The real-time calendar and clock does what it says on the box; and keeps track of the date and time.

Terminal displaying RTC data. Maxim DS1307 Real Time Clock in Action with Arduino AVR.

And many, many more...


The list of peripherals available on microcontrollers continues to expand as technology continues to develop, including such things as DAC (Digital to Analog Converters), VIC (Vectored Interrupt Controllers), CLC (Configurable Logic Cell) and angular timers. The list is continuously expanding as clever engineers find good use cases for on-boarding functionality and saving more space on the PCB layout.

External Peripherals


Whilst many peripherals are now integrated into microcontrollers, there are still many more external peripherals available – such as GPS, cellular connectivity, accelerometers, and so on. External peripherals typically communicate via one of the aforementioned communications protocols, such as SPI or I2C.

I2C Analyser running between microcontroller and peripheral device. I2C protocol analyser inspecting traffic between external serial EEPROM and the PIC microcontroller.

Simulation


Proteus has a great number of microcontrollers as well as external peripherals available for simulation; from the early 8086 which had almost no built-in peripherals, up to the latest ARM microcontrollers which are loaded with peripherals; as well as tools for analysing and debugging communication protocols such as UART / SPI and I2C. If you're interested in learning more about microcontrollers or want to drive particular peripherals find out more about our Proteus VSM software here.

Embedded Simulation

Learn more about our world leading embedded simulation, Proteus VSM. Simulate and debug your microcontroller firmware on the schematic alongside all the analog and digital peripherals connected to it.

Ask an Expert Icon Ask An Expert

Have a Question? Ask one of Labcenter's expert technical team directly.

More Like This

Find the right package for you

Product Wizard Try Proteus