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.

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

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.

Also read: Serial Interface

Share
John Mulindi

John Mulindi is an Industrial Instrumentation & Control Professional with a wide range of experience in electrical and electronics, process measurement, control systems and automation. He writes on technical as well as business related topics. In free time he spends time reading, taking adventure walks and watching football.

View Comments

Recent Posts

Optothyristors: Features & Operation

Silicon Controlled Rectifiers (SCRs), Triacs and other solid-state devices used for switching larger voltages and…

21 hours ago

Zener Diode and Emitter-Follower/Series Voltage Regulators

Almost all electronic devices and circuits need a dc source of power for their operation.…

2 days ago

PFDs vs. P&IDs

Process Flow Diagrams (PFDs) defines the major elements of the process schematically i.e. the interconnections…

3 days ago

Process Instrumentation Diagnostics & Communication Interfaces

There are various technologies that are available that help plant automation personnel to obtain diagnostic…

4 days ago

How a Bubbler Device is used for Level Measurement

An often utilized technique of indirectly measuring a liquid level is to measure the hydrostatic…

7 days ago

Megohmmeter: Function & Operation

The megohmmeter or megger is a portable deflection instrument widely used to check the insulation…

1 week ago