top of page
  • Writer's pictureSubir Biswas

A beginner's guide to Microcontrollers | Tech-knowledge

Updated: Jan 3, 2021

It's a long time in this embedded field, I see beginners are jumping over to the microcontroller coding without knowing what it is exactly and how it works. In this article, I'll try to cover the basics of microcontroller and prepare a few more to provide a little bit of depth to other articles which helps the beginner to understand the working principle.

Introduction to Microcontrollers

A microcontroller is a single Integrated Circuit (IC) that is typically used for a specific application and designed to implement certain tasks. Sometimes this called an MCU. It has a CPU, RAM (Random Access Memory), special function registers, program ROM memory, data ROM memory, anywhere from one to several parallel I/O (Input/output) ports, and can have a host of on-chip peripherals including but not limited to Analog-to-Digital Converter (ADC), Digital-to-Analog Converter (DAC), Serial UART (Universal Asynchronous Receiver/Transmitter), one or several timers, comparators/on-chip voltage reference, capture/compare/PWM (Pulse Width Modulation) module, Master Synchronous Serial Port for SPI (Serial Peripheral Interface)/I2C (Inter-Integrated Circuit) communications, USB port, ethernet port, on-chip oscillators, along with a host of other peripherals.

Fig: Peripherals of Microcontroller (Source: Microchip)

Basic Uses of Microcontrollers

Products and devices that must be automatically controlled in certain situations, like appliances, power tools, automobile engine control systems, and computers are great examples, but microcontrollers reach much further than just these applications. Essentially, a microcontroller gathers input from different peripheral, processes this information with internal logic, and outputs a certain action based on the information and logic. Microcontrollers usually operate at lower speeds, around the 1 MHz to 100 MHz range, and need to be designed to consume less power.

Microcontrollers are everywhere, whether you’re driving your car, on your computer reading this (or smartphone/tablet), or making a cup of coffee on your coffee machine. With IoT rapidly increasing and data constantly being gathered, microcontrollers are a huge part of the modern world.


CPU stands for Central Processing Unit. It is basically the “brains” of the microcontroller. It is what fetches the instructions from the code memory and executes the instructions that it fetches. Its two main components are the Arithmetic Logic Unit (ALU), which performs arithmetic and logical operations, and the Control Unit (CU), which handles all of the processor’s instruction executions.

Memory Organisation

There are two types of memory available in the microcontroller devices. Sometimes this termed as on-chip ROM memory (Read Only Memory). It is like a microcontroller’s hard drive.

  • Program Memory

  • Data RAM

As Harvard architecture devices, the data and program memories use separate busses; this allows for concurrent access of the two memory spaces.

Considering the PIC18 microcontroller as an example, it has a 21-bit program counter, which is capable of addressing a 2-Mbyte program memory space. Accessing a location between the upper boundary of the physically implemented memory and the 2-Mbyte address will return all ‘0’s (a NOP instruction). On a given PIC microcontroller with say 32K of program space, the program space would occupy ROM addresses 0x0000 – 0x7FF7 (32760 or 32K).

RAM is a component that temporarily stores data and can be accessed quickly. It provides quick read-and-write access to the storage device. RAM improves total system performance because it allows the microcontroller to work with more information at the same time. Since RAM is temporary data, its content is always erased when the microcontroller is shut down. The data RAM on a microcontroller is organised into several “registers”, each with its own unique “address”. A RAM register on an 8-bit microcontroller can hold a total of 8 bits, or one byte of data. A typical RAM space specification may specify that it is 256 x 8. This means that there are a total of 256 registers in the RAM, and those registers can hold 8 bits each.

Check out the information about the peripherals in another article for the peripherals.

119 views0 comments

Related Posts

See All


Post: Blog2 Post
bottom of page