A microcontroller (sometimes abbreviated µC, uC 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, toys 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. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems. Some microcontrollers may use four-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.

Contents
[hide]
 

    

  

1 History o 1.1 Volumes 2 Embedded design o 2.1 Interrupts o 2.2 Programs o 2.3 Other microcontroller features 3 Higher integration 4 Programming environments 5 Types of microcontrollers 6 Interrupt latency 7 Microcontroller embedded memory technology o 7.1 Data o 7.2 Firmware 8 See also 9 Notes 10 External links

History[edit]
This section requires expansion. (June 2008)

Cost has plummeted over time. and making it impossible to economically computerize appliances. with both memory types.) The same year. and expanded the division's budget over 25%. but the earlier EEPROM was more expensive and less durable.The first single-chip microprocessor was the 4-bit Intel 4004 released in 1971. raising total system cost. The result of their work was the TMS 1000. which could be made in lower-cost opaque plastic packages. but because there was no way to expose it to ultraviolet light. the Intel 8048. which went commercial in 1974. making them significantly more expensive than the OTP versions. Nowadays microcontrollers are cheap and readily available for hobbyists.[2] Intel developed a computer system on a chip optimized for control applications. with the Intel 8008 and other more capable microprocessors becoming available over the next several years.[2] It combined RAM and ROM on the same chip. with large online communities around certain processors. Atmel introduced the first microcontroller using Flash memory. One had an erasable EPROM program memory. This chip would find its way into over one billion PC keyboards. with commercial parts first shipping in 1977. processor and clock on one chip and was targeted at embedded systems. Luke J. with a transparent quartz window in the lid of the package to allow it to be erased by exposure to ultraviolet light. Volumes[edit] . both processors required external chips to implement a working system. for its transparency to ultraviolet—glass is largely opaque to UV—but the main cost differentiator was the ceramic package itself. the introduction of EEPROM memory allowed microcontrollers (beginning with the Microchip PIC16x84)[citation needed] to be electrically erased quickly without an expensive package as required for EPROM. For the erasable variants. At that time Intel's President. Valenter. In 1993. a special type of EEPROM.[citation needed] and some 32-bit microcontrollers around $1 for similar quantities. It combined read-only memory. (EEPROM technology had been available prior to this time. The PROM was actually exactly the same type of memory as the EPROM. However.[1] Partly in response to the existence of the single-chip TMS 1000. making it unsuitable for low-cost massproduced microcontrollers. instead of less expensive glass. stated that the microcontroller was one of the most successful in the company's history.[3] Other companies rapidly followed suit. MRAM could potentially be used in microcontrollers as it has infinite endurance and its incremental semiconductor wafer process cost is relatively low. allowing both rapid prototyping. In the future. sometimes this was signified with the designation OTP. read/write memory.25 in quantity (thousands) in 2009. with the cheapest 8-bit microcontrollers being available for under $0. standing for "one-time programmable". quartz was required. The erasable versions required ceramic packages with quartz windows. The Smithsonian Institution says TI engineers Gary Boone and Michael Cochran succeeded in creating the first microcontroller in 1971. Most microcontrollers at this time had two variants. and In System Programming. and other numerous applications. it could not be erased. The other was a PROM variant which was only programmable once.

2008. microwave ovens. or other recognizable I/O devices of a personal computer. LEDs.About 55% of all CPUs sold in the world are 8-bit microcontrollers and microprocessors. "The Most Widely Used Computer on a Chip: The TMS 1000". and sensors for data such as temperature. humidity. 4. According to Semico. appliances. They can also be found in many electrical devices such as washing machines. Retrieved 2009-12-23. 1. A PIC 18F8720 microcontroller in an 80-pin TQFP package. Stan (1983). memory and peripherals and can be used as an embedded system. Typical input and output devices include switches. disks. Semico has claimed the MCU market grew 36.com/content/momentum-carries-mcus2011 A typical home in a developed country is likely to have only four general-purpose microprocessors but around three dozen microcontrollers. over four billion 8-bit microcontrollers were sold in 2006. such as automobiles.[1] The majority of microcontrollers in use today are embedded in other machinery.semico.com 5. and may lack human interaction devices of any kind. 3. Computer History Museum Oral History. radio frequency devices. small or custom LCD displays. solenoids. and telephones. ^ Momentum Carries MCUs Into 2011 http://semico. with no operating system. and low software complexity. many have minimal requirements for memory and program length. and peripherals for computer systems. 2. light level etc. ^ http://www. ^ a b "Oral History Panel on the Development and Promotion of the Intel 8048 Microcontroller". p.[4] More recently. While some embedded systems are very sophisticated. State of the Art: A Photographic History of the Integrated Circuit (New Haven and New York: Ticknor & Fields). Embedded design[edit] A microcontroller can be considered a self-contained system with a processor. screen. Retrieved 2011-June28. ^ "Atmel’s Self-Programming Flash Microcontrollers" by Odd Jostein Svendsli 2003 4.5% in 2010 and 12% in 2011[5]. A typical mid-range automobile has as many as 30 or more microcontrollers. telephones. printers. Interrupts[edit] . ISBN 0-89919-195-9. Embedded systems usually have no keyboard. ^ Augarten. relays.

ready for reprogramming after a programming ("burn") and test cycle. peripherals and interfaces that are adapted to the requirements of the application. or "interrupt handler"). These "mask programmed" parts have the program laid down in the same way as the logic of the chip. For example. Other microcontroller features[edit] . Other versions may be available where the ROM is accessed as an external device rather than as internal memory. using parts programmed at the time of manufacture can be an economical option. 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. 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. or program memory may be field-alterable flash or erasable read-only memory. A customizable microcontroller incorporates a block of digital logic that can be personalized in order to provide additional processing capability. Where power consumption is important as in battery operated devices. the program memory may be permanent. The use of field-programmable devices on a microcontroller may allow field update of the firmware or permit late factory revisions to products that have been assembled but not yet shipped. however these are becoming increasingly rare due to the widespread availability of cheap microcontroller programmers. an interrupt system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR. Possible interrupt sources are device dependent. and data received on a communication link. EPROM versions are rare and have been replaced by EEPROM and flash. completing an analog to digital conversion. Where hundreds of thousands of identical devices are required. read-only memory that can only be programmed at the factory. Programmable memory also reduces the lead time required for deployment of a new product. Depending on the device. Originally these included EPROM versions that have a "window" on the top of the device through which program memory can be erased by ultraviolet light. memory. When certain events occur. since it would be costly to provide a system with external. The ISR will perform any processing required based on the source of the interrupt before returning to the original instruction sequence. and often include events such as an internal timer overflow. which are easier to use (can be erased electronically) and cheaper to manufacture. Since 1998. Programs[edit] Typically microcontroller programs must fit in the available on-chip program memory. though not necessarily fast) response to events in the embedded system they are controlling. at the same time. the AT91CAP from Atmel has a block of logic that can be customized during manufacture according to user requirements. Manufacturers have often produced special versions of their microcontrollers in order to help the hardware and software development of the target system. a logic level change on an input such as from a button being pressed.Microcontrollers must provide real time (predictable. expandable.

A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU to control power converters. it sends an interrupt to the processor indicating that it has finished counting. they are often used to read sensors or external signals. Configured to the output state. etc. 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. When GPIO pins are configured to an input state. In addition to the converters. This is useful for devices such as thermostats. many embedded microprocessors include a variety of timers as well. Since processors are built to interpret and process digital data. they are not able to do anything with the analog signals that may be sent to it by a device. 1s and 0s. Once it reaches zero. A PIT may either count down from some value to zero. etc. overflowing to zero. the heater on. resistive loads. 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. So the analog to digital converter is used to convert the incoming data into a form that the processor can recognize. Many embedded systems need to read sensors that produce analog signals. which periodically test the temperature around them to see if they need to turn the air conditioner on. 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).. i. This is the purpose of the analog-to-digital converter (ADC).e.Microcontrollers usually contain from several to dozens of general purpose input/output pins (GPIO). motors. One of the most common types of timers is the Programmable Interval Timer (PIT). or up to the capacity of the count register. EEPROM/EPROM/ROM-based CMOS microcontroller manufactured by Microchip Technology using a 1200 nanometre process. Higher integration[edit] Die of a PIC12C508 8-bit. GPIO pins are software configurable to either an input or an output state. . GPIO pins can drive external devices such as LEDs or motors. fully static. without using lots of CPU resources in tight timer loops.

each pin may interface to several internal peripherals.ranging from small and simple 4-bit processors to complex 32. some include digital-to-analog converters in-circuit programming and debugging support This integration drastically reduces the number of chips and the amount of wiring and circuit board space that would be needed to produce equivalent systems using separate chips.often an oscillator for a quartz timing crystal. motor control and Consumer Electronics Control (CEC) functions. the chip can be placed in a much smaller. Micro-controllers may not implement an external address or data bus as they integrate RAM and non-volatile memory on the same chip as the CPU. This allows a part to be used in a . Even if the cost of a CPU that has integrated peripherals is slightly more than the cost of a CPU and external peripherals. in addition to tending to decrease the defect rate for the finished assembly. Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip. having fewer chips typically allows a smaller and cheaper circuit board. cheaper package. on low pin count devices in particular. and watchdog clock generator . EPROM. Using fewer pins. A micro-controller is a single integrated circuit. Furthermore. Serial Peripheral Interface and Controller Area Network for system interconnect peripherals such as timers. but often results in decreased net cost of the embedded system as a whole. resonator or RC circuit many include analog-to-digital converters.Die of a STM32F100C4T6B ARM Cortex-M3 microcontroller with 16 kilobytes flash memory. PWM generators. and reduces the labor required to assemble and test the circuit board. EEPROM or Flash memory for program and operating parameter storage discrete input and output bits. commonly with the following features:           central processing unit . with the pin function selected by software. 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.or 64-bit processors volatile memory (RAM) for data storage ROM. Manufactured by STMicroelectronics. 24 MHz Central Processing Unit (CPU). event counters.

BASIC on the early microcontrollers Intel 8052. such as SDCC for the 8051. Microcontroller vendors often make tools freely available to make it easier to adopt their hardware. The microcontroller vendors often trade operating frequencies and system design flexibility against time-to-market requirements from their customers and overall lower system cost. Manufacturers have to balance the need to minimize the chip size against additional functionality. Programming environments[edit] Microcontrollers were originally programmed only in assembly language.[2] For example. so floating point arithmetic is performed by software. which prevent using standard tools (such as code libraries or static analysis tools) even for code unrelated to hardware features.wider variety of applications than if pins had dedicated functions. or I/O functions integrated onto the package. Other designs are purpose built for control applications. For example. Microcontrollers typically do not have a math coprocessor. A micro-controller instruction set usually has many instructions intended for bit-wise operations to make control programs more compact. Compilers for general purpose languages will typically have some restrictions as well as enhancements to better support the unique characteristics of microcontrollers. Some microcontrollers have environments to aid developing certain types of applications. Many microcontrollers are so quirky that they effectively require their own non-standard dialects of C. Interpreters are often used to hide such low level quirks. or versions of general purpose languages such as the C programming language. Where a Harvard architecture is used. as well as allowing input signals to be generated. Microcontroller architectures vary widely. While on the one hand most simulators will be limited from being unable to simulate much other hardware in a system. The decision of which peripheral to integrate is often difficult. they can exercise conditions . Typically these interpreters support interactive programming. allowing accesses to take place concurrently. for example: 12-bit instructions used with 8-bit data registers. instruction words for the processor may be a different bit size than the length of internal memory and registers.[3] BASIC and FORTH on the Zilog Z8[4] as well as some modern devices. where a micro-controller could have a single instruction to provide that commonly required function. a general purpose processor might require several instructions to test a bit in a register and branch if the bit is set. Some microcontrollers use a Harvard architecture: separate memory buses for instructions and data. RAM. with one or more ROM. A simulator will show the internal processor state and also that of the outputs. These languages are either designed specially for the purpose. but various highlevel programming languages are now also in common use to target microcontrollers. Interpreter firmware is also available for some microcontrollers. Simulators are available for some microcontrollers. These allow a developer to analyze what the behavior of the microcontroller and their program should be if they were using the actual part. Micro-controllers have proved to be highly popular in embedded systems since their introduction in the 1970s. Some designs include general-purpose microprocessor cores.

H8. AVR32 (32-bit). 32bit Aurix Tricore Bit microcontrollers[5] MIPS Microchip Technology PIC. and markets. Note that many vendors sell or have sold multiple architectures. 32bit TriCore and. LPC4000 (32-bit). Many others exist. 16-bit dsPIC33 / PIC24). some of which are used in very narrow range of applications or are more like applications processors than microcontrollers. RX 32-bit MCU. 32bit XMC4000 (ARM based Cortex M4F). LPC2000. PIC18. Interrupt latency[edit] In contrast to general-purpose computers. microcontrollers used in embedded systems often seek to optimize interrupt latency over instruction throughput. R8C 16-bit MCU Silicon Laboratories Pipelined 8-bit 8051 Microcontrollers and mixed-signal ARMbased 32-bit microcontrollers STMicroelectronics STM8 (8-bit). with numerous vendors. The microcontroller market is extremely fragmented. (8-bit PIC16. LPC700 (8-bit) Parallax Propeller PowerPC ISE Rabbit 2000 (8-bit) Renesas Electronics: RL78 16-bit MCU. and AT91SAM (32-bit) Cypress Semiconductor's M8C Core used in their PSoC (Programmable System-onChip) Freescale ColdFire (32-bit) and S08 (8-bit) Freescale 68HC11 (8-bit) Intel 8051 Infineon: 8bit XC800. . and making it be more predictable (to support real-time control). (32-bit PIC32) NXP Semiconductors LPC1000.that may otherwise be hard to reproduce at will in the physical implementation. LPC3000. V850 32-bit MCU. and can be the quickest way to debug and analyze problems. Types of microcontrollers[edit] See also: List of common microcontrollers As of 2008 there are several dozen microcontroller architectures and vendors including:                   ARM core processors (many vendors) o ARM Cortex-M cores are specifically targeted towards microcontroller applications Atmel AVR (8-bit). SuperH. ST10 (16-bit) and STM32 (32-bit) Texas Instruments TI MSP430 (16-bit) C2000 (32-bit) Toshiba TLCS-870 (8-bit/16-bit). Issues include both reducing the latency. technologies. LPC900. allow debugging of the firmware with a debugger. 16bit XE166. Recent microcontrollers are often integrated with on-chip debug circuitry that when accessed by an in-circuit emulator via JTAG.

When there are hard external constraints on system latency. The length of any critical section that needs to be interrupted. If there are more registers. Microcontroller embedded memory technology[edit] . When interrupts occur back-to-back. this saving and restoring process takes more time. increasing the latency. Entry to a critical section restricts concurrent data structure access. Accordingly. They must also be restored after that software is finished. This is easy to implement. this technique is used mostly in very constrained environments.When an electronic device causes an interrupt. Examples include supporting atomic access to bits or bytes within a word. When a data structure must be accessed by an interrupt handler. Accordingly. Another technique involves spending silicon gates on "shadow registers": One or more duplicate registers used only by the interrupt software. and ensure that longer instructions are continuable or restartable. o Processors may have hardware support for some critical sections. o One common technique just blocks all interrupts for the duration of the critical section. Other factors affecting interrupt latency include:     Cycles needed to complete current CPU activities. To minimize those costs. small write buffers. Lower end micro controllers tend to support fewer interrupt latency controls than higher end ones. Trigger rate. Ways to reduce such context/restore latency include having relatively few registers in their central processing units (undesirable because it slows down most non-interrupt processing substantially). Some micro controllers allow higher priority interrupts to interrupt lower priority ones. interrupt latency is increased by however long that interrupt is blocked. perhaps supporting a dedicated stack. which tend to not correspond well to the relevant system data structures. Reduced instruction set computing/RISC design principles ensure that most instructions take the same number of cycles. the intermediate results (registers) have to be saved before the software responsible for handling the interrupt can run. This is often based on interrupt priorities. helping avoid the need for most such continuation/restart logic. o A more complex technique just blocks the interrupts that may trigger access to that data structure. but sometimes critical sections get uncomfortably long. or other atomic access primitives like the Load-link/store-conditional/LDREX/STREX exclusive access primitives introduced in the ARMv6 architecture. the critical section must block that interrupt. Interrupt nesting. This allows software to manage latency by giving time-critical interrupts higher priority (and thus lower and more predictable latency) than lesscritical ones. developers often need tools to measure interrupt latencies and track down which critical sections cause slowdowns. microcontrollers tend to have short pipelines (often three instructions or less). micro controllers may avoid an extra context save/restore cycle by a form of tail call optimization. or at least having the hardware not save them all (this fails if the software then needs to compensate by saving the rest "manually").

[7] was the first microcontroller to use EEPROM to store firmware. Atmel introduced the first microcontroller using NOR Flash memory to store firmware. Later microcontrollers (such as the early versions of the Freescale 68HC11 and early PIC microcontrollers) had quartz windows that allowed ultraviolet light in to erase the EPROM. A few recent microcontrollers beginning in 2003 have "self-programmable" flash memory. Data[edit] From the earliest microcontrollers to today.[6] . six-transistor SRAM is almost always used as the read/write working memory. a non-volatile memory for storing firmware and a read-write memory for temporary data. introduced in 1993. MRAM could potentially replace it as it is 4 to 10 times denser which would make it more cost effective. with a few more transistors per bit used in the register file.[6] Firmware[edit] The earliest microcontrollers used mask ROM to store firmware. Almost all microcontrollers have at least two different kinds of memory. The Microchip PIC16C84. and even ones that do not have any (or not enough) are often connected to external serial EEPROM chip (such as the BASIC Stamp) or external serial flash memory chip. some microcontrollers also have internal EEPROM for data storage. In addition to the SRAM. In the same year.Since the emergence of microcontrollers. many different memory technologies have been used.