Embedded Systems

Basic Structure of a Microcontroller

A microcontroller is essentially a computer on a chip. It contains a processing unit, ROM, RAM, Serial communication ports, ADCs, etc. In other words, a microcontroller is a computer but without the monitor, keyboard and mouse. They are called microcontrollers because they are small (micro) and because they control machines, gadgets, etc.

With a microcontroller you can build an ‘’intelligent’’ machine. You start by writing a program on a host computer, download the program into the microcontroller via the USB, parallel or serial port of the PC; and then disconnect the programming cable and let the program run the machine.

Microcontrollers are used in a wide array of applications including telecommunication equipment, home appliances, airplanes, data loggers, in robots where the microcontroller acts as the robot’s brain, controlling and monitoring various inputs and output devices such as light sensors, stepper and servo motors, among other devices.  With a little bit of programming you can make the robot avoid objects, sweep the floor, generate various sounds to indicate a certain message e.g. low power. A microcontroller in a microwave oven monitors the control panel for user input, updates the graphical displays when necessary, and controls the timing & cooking functions, and store data as cooking time.

Basic Structure of a Microcontroller

Basic structure of a microcontroller
Basic Structure of a Microcontroller

A microcontroller usually contains:

  • CPU
  • RAM, ROM, EPROM, EEPROM or Flash (non-volatile software data)
  • I/O ports (digital I/O ports)
  • Timing circuitry/leads
  • Interrupt control
  • A serial port and adapter (e.g. UART, USART, SPI, I2C)
  • ADC/DAC

The CPU executes the software stored in ROM and controls all the microcontroller components.

RAM is used to store temporary data (settings & values) needed during program execution.

The ROM is used to store the program and any permanent data. A designer can have a program and data permanently stored in ROM by the chip manufacturer or the ROM can be in the form of EPROM or EEPROM which can be reprogrammed by the user. Software permanently stored in ROM is termed to as firmware.

Microcontrollers makers offer programming devices that can download compiled machine code from a PC directly to the EEPROM of the microcontroller, usually via the PC serial port and special-purpose pins on the microcontroller. These pins can be used for other purposes once the device is programmed. Also, EEPROM may also be available and used by the program to store settings and parameters generated or modified during execution. The data in EEPROM is non-volatile, which means the program can access the data when the microcontroller power is turned off and back on again.

The serial port adapter is used to provide serial communication between the microcontroller and a PC or between two microcontrollers. It is responsible for controlling the different rates of data flow common between devices. Serial port adapters found in microcontroller are the universal asynchronous receiver transmitter (UART), and universal synchronous/asynchronous receiver transmitter (USART).The serial port can be used to transmit data to and from external devices, provided these devices support the same serial communication protocol. These devices may include: external EEPROM memory ICs that might store a large block of data for the microcontroller and other microcontrollers that need to share data and coordinate control and host computer that may download a program into the microcontroller’s board EEPROM. Some microcontrollers include an interface for a universal serial bus (USB) on the chips.

The digital I/O ports allow binary data to be transferred to and from the microcontroller using external pins on the IC. These pins can be used to read the state of switches and on-off sensors, to interface to external A/D and D/A, to control digital displays, to control on-off actuators etc. The I/O ports can be also be used to transmit signals to and from other microcontrollers to coordinate various functions.

Related: Microprocessors

An interrupt system is used to interrupt a running program in order to process a special routine called routine service. This makes it possible for a microcontroller to respond to external data that requires immediate attention e.g. data conveyed by an external sensor indicating a shut down.

The A/D converter allows the microcontroller to convert an external analog voltage e.g. from a sensor to digital value that can be processed or stored by the CPU. The D/A converter allows the microcontroller to output an analog voltage to non-digital device e.g. amplifiers, analog actuators, analog displays etc.

Don’t miss out on key updates, join our newsletter  List

Also read: Serial Interface

Share
John Mulindi

John Mulindi is an Industrial Instrumentation and Control Professional with a wide range of experience in electrical and electronics, process measurement, control systems and automation. In free time he spends time reading, taking adventure walks and watching football.

View Comments

Recent Posts

What to Expect from PCB Assembly Services in China

The importance of printed circuit board (PCB) technology has escalated throughout the years with the…

1 day ago

Magneto-Optic Current Sensors for High Voltage, High Power Transmission Lines

One of the key challenges in measuring the electrical current in high voltage, high power…

3 days ago

How the Wiegand Effect is used in Sensing Instruments

The Concept behind Wiegand Effect Based Sensors   The Wiegand effect technology employs the unique…

6 days ago

Piezoelectric Accelerometer: Principle of Operation & Applications

An accelerometer is a sensor that is designed to measure acceleration or rate of change…

7 days ago

The USB-6009 Data Acquisition Card Features

The USB-6009 is a small external data acquisition and control device manufactured by National Instruments…

1 week ago

How X-Y Tables are used in Position Control Applications

X-Y tables are utilized as components in many systems where reprogrammable position control is desired.…

2 weeks ago