A Microcontroller is a small and low-cost computer built for the purpose of dealing with specific tasks, such as displaying information in a microwave LED or receiving information from a television’s remote control. Microcontrollers are mainly used in products that require a degree of control to be exerted by the user.
Microcontroller v/s microprocessor
Microprocessors are used to execute big and generic applications, while a microcontroller will only be used to execute a single task within one application. Some of the benefits of microcontrollers include the following:
Cost advantage: The biggest advantage of microcontrollers against larger microprocessors is that the design and hardware costs are much lesser and can be kept to a minimum. A microcontroller is cheap to replace, while microprocessors are ten times more expensive.
Lesser power usage: Microcontrollers are generally built using a technology known as Complementary Metal Oxide Semiconductor (CMOS). This technology is a competent fabrication system that uses less power and is more immune to power spikes than other techniques.
All-in-one: A microcontroller usually comprises of a CPU, ROM, RAM and I/O ports, built within it to execute a single and dedicated task. On the other hand, a microprocessor generally does not have a RAM, ROM or IO pins and generally uses its pins as a bus to interface to peripherals such as RAM, ROM, serial ports, digital and analog IO.
How does a Microcontroller work?
Microcontroller has an input device in order to get the input and an output device (such as LED or LCD Display) to exhibit the final process. Let us look into the illustration of how a microcontroller works in a Television.
The Television has a remote control as an Input device and the TV screen as the output device. The signal sent from the remote control is captured by the microcontroller. The microcontroller controls the channel selection, the amplifier system and picture tube adjustments such as hue, brightness, contrast etc.
General architecture of a microcontroller
The architecture of a microcontroller depends on the application it is built for. For example, some designs include usage of more than one RAM, ROM and I/O functionality integrated into the package.
The architecture of a typical microcontroller is complex and may include the following:
A CPU, ranging from simple 4-bit to complex 64-bit processers.
Peripherals such as timers, event counters and watchdog.
RAM (volatile memory) for data storage. The data is stored in the form of registers, and the general-purpose registers store information that interacts with the arithmetic logical unit (ALU).
ROM, EPROM, EEPROM or flash memory for program and operating parameter storage.
Serial input/output such as serial ports.
A clock generator for resonator, quartz timing crystal or RC circuit.
Data bus to carry information