What is a Microcontroller ? 51059

Anywhere you would like to add intelligence you use a Microcontroller…

microcontroller (sometimes abbreviated µCuC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications.

Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools,robots and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes.

Some microcontrollers may use 4-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (single-digit milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption.

A micro-controller is a single integrated circuit, commonly with the following features:

  • central processing unit – ranging from small and simple 4-bit processors to complex 32- or 64-bit processors
  • volatile memory (RAM) for data storage
  • ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage
  • discrete input and output bits, allowing control or detection of the logic state of an individual package pin
  • serial input/output such as serial ports (UARTs)
  • other serial communications interfaces like I²C, Serial Peripheral Interface and Controller Area Network for system interconnect
  • peripherals such as timers, event counters, PWM generators, and watchdog
  • clock generator – often an oscillator for a quartz timing crystal, resonator or RC circuit
  • many include analog-to-digital converters, some include digital-to-analog converters
  • in-circuit programming and debugging support

Embedded Design:

A microcontroller can be considered a self-contained system with a processor, memory and peripherals and can be used as an embedded system.The majority of microcontrollers in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems.

While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays,solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.


Microcontrollers must provide real time (predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an interrupt system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or “interrupt handler”). The ISR will perform any processing required based on the source of the interrupt, before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as

  • an internal timer overflow,
  • completing an analog to digital conversion,
  • a logic level change on an input such as from a button being pressed,
  • and data received on a communication link.

Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event.


Typically microcontroller programs must fit in the available on-chip program memory, since it would be costly to provide a system with external, expandable, memory. Compilers and assemblers are used to convert high-level language and assembler language codes into a compact machine code for storage in the microcontroller’s memory. Depending on the device, the program memory may be permanent, read-only memory that can only be programmed at the factory, or program memory that may be field-alterable flash or erasable read-only memory.

Other Microcontroller Features:

Microcontrollers usually contain from several to dozens of general purpose input/output pins (GPIO). GPIO pins are software configurable to either an input or an output state. When GPIO pins are configured to an input state, they are often used to read sensors or external signals. Configured to the output state, GPIO pins can drive external devices such as LEDs or motors.

Many embedded systems need to read sensors that produce analog signals. This is the purpose of the analog-to-digital converter (ADC). Since processors are built to interpret and process digital data, i.e. 1s and 0s, they are not able to do anything with the analog signals that may be sent to it by a device. So the analog to digital converter is used to convert the incoming data into a form that the processor can recognize. A less common feature on some microcontrollers is a digital-to-analog converter (DAC) that allows the processor to output analog signals or voltage levels.

In addition to the converters, many embedded microprocessors include a variety of timers as well. One of the most common types of timers is the Programmable Interval Timer (PIT). A PIT may either count down from some value to zero, or up to the capacity of the count register, overflowing to zero. Once it reaches zero, it sends an interrupt to the processor indicating that it has finished counting. This is useful for devices such as thermostats, which periodically test the temperature around them to see if they need to turn the air conditioner on, the heater on, etc.

A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU to control power converters, resistive loads, motors, etc., without using lots of CPU resources in tight timer loops.

Universal Asynchronous Receiver/Transmitter (UART) block makes it possible to receive and transmit data over a serial line with very little load on the CPU. Dedicated on-chip hardware also often includes capabilities to communicate with other devices (chips) in digital formats such as I²C and Serial Peripheral Interface (SPI).

Microcontrollers Vs Computers

A microcontroller is a computer. All computers — whether we are talking about a personal desktop computer or a large mainframe computer or a microcontroller — have several things in common:

  • All computers have a CPU (central processing unit) that executes programs.
  • The computer has some RAM (random-access memory) where it can store “variables.”
  • And the computer has some input and output devices so it can talk to people. On your desktop machine, the keyboard and mouse are input devices and the monitor and printer are output devices. A hard disk is an I/O device — it handles both input and output.

The desktop computer you are using is a “general purpose computer” that can run any of thousands of programs. Microcontrollers are “special purpose computers.” Microcontrollers do one thing well. There are a number of other common characteristics that define microcontrollers. If a computer matches a majority of these characteristics, then you can call it a “microcontroller”:

  • Microcontrollers are “embedded” inside some other device (often a consumer product).
  • Another name for a microcontroller, therefore, is “embedded controller.”
  • Microcontrollers are dedicated to one task and run one specific program.
  • The program is stored in ROM(read-only memory) and generally does not change.
  • Microcontrollers are often low-power devices.
  • A desktop computer is almost always plugged into a wall socket and might consume 50 watts of electricity. A battery-operated microcontroller might consume 50 milliwatts.
  • A microcontroller has a dedicated input device and often (but not always) has a small LED or LCD display for output.
  • A microcontroller also takes input from the device it is controlling and controls the device by sending signals to different components in the device. (For Example : A microwave oven controller takes input from a keypad, displays output on an LCD display and controls a relay that turns the microwave generator on and off.)
  • A microcontroller is often small and low cost. The components are chosen to minimize size and to be as inexpensive as possible.
  • A microcontroller is often, but not always, ruggedized in some way. The microcontroller controlling a car’s engine, for example, has to work in temperature extremes that a normal computer generally cannot handle. A car’s microcontroller in Alaska has to work fine in -30 degree F (-34 C) weather, while the same microcontroller in Nevada might be operating at 120 degrees F (49 C). When you add the heat naturally generated by the engine, the temperature can go as high as 150 or 180 degrees F (65-80 C) in the engine compartment. On the other hand, a microcontroller embedded inside a VCR hasn’t been ruggedized at all.

Processor - The processor refers to the Central Processing Unit (CPU) of the microcontroller. It contains the Arithmetic Logic Unit (ALU), Control Unit, Instruction Decoder and some Special Registers (Stack Pointer, Status Register, Program Counter, etc.).

Volatile Memory - This is memory used by ht microcontroller for temporary data storage, system setup and peripherals configurations. Memory in this category includes SRAM and DRAM. AVR microcontrollers utilize SRAM.

Non-Volatile Memory - This is memory used by the microcontroller to store programs. Data can also be stored in this memory but the access time is much slower than that of RAM. Memory in this category includes ROM, PROM, EPROM, EEPROM and FLASH. The AVR microcontrollers utilize Flash for program storage, some AVR controllers contains a bit of EEPROM as well.

Timer Module - Most microcontrollers have at least one timer/counter peripheral. Timer/Counter modules are used to perform timing or counting operations in the controller. These include time stamping, measuring intervals, counting events, etc.

Interrupt Module - Interrupts enable the microcontroller to monitor certain events in the background while executing and application program and react to the event if necessary pausing the original program. This is all coordinated by the interrupt module.

Digital I/O Module - This module allows digital/logic communication with the microcontroller and the external world. Communication signals are that of TTL or CMOS logic.

Analog I/O Modules - These modules are use to input/output analog information from/to the external world. Analog modules include Analog Comparators and Analog-to-Digital Converters.

Serial Modules - These modules are used for serial communication with the external world. An example is the USART peripherial which utilizes the RS232 standard.

Microcontrollers Lesson – INTRODUCTION to Microcontrollers:

Table of Contents:

0:00 Introduction
0:38 What is it?
1:55 Where do you find them?
3:00 History
6:03 Microcontrollers vs Microprocessors
13:40 Basic Principles of Operation
15:29 Programming
18:23 Analog to Digital Converter
23:39 ADC Example- Digital Thermometer
29:34 Digital to Analog Converter
31:30 Microcontroller Applications
34:38 Packages
38:38 How to get started

Download Presentation - PowerPoint File


Youtube Video – http://www.youtube.com/watch?v=CmvUY4S0UbI






You may also like...